From 64df902cf71a8ee258fb85f6be26248f399aa01f Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 27 Jan 2013 01:05:15 -0600 Subject: Rename a number of libraries and executables to avoid conflicts with KDE4 --- CMakeLists.txt | 8 +- MAINTAINERS | 4 +- Mainpage.dox | 2 +- Makefile.am.in | 4 +- NewsLog.txt | 2 +- README | 4 +- README.Kolab | 2 +- akregator/src/CMakeLists.txt | 2 +- akregator/src/akregator_part.cpp | 8 +- akregator/src/akregator_view.cpp | 6 +- akregator/src/akregatorconfig.kcfgc | 2 +- akregator/src/articlefilter.cpp | 2 +- akregator/src/articleviewer.cpp | 4 +- akregator/src/configdialog.h | 2 +- akregator/src/librss/image.cpp | 2 +- akregator/src/librss/loader.cpp | 2 +- akregator/src/librss/loader.h | 2 +- akregator/src/mainwindow.cpp | 4 +- akregator/src/mainwindow.h | 2 +- akregator/src/mk4storage/CMakeLists.txt | 2 +- akregator/src/pageviewer.cpp | 2 +- akregator/src/viewer.cpp | 2 +- certmanager/certificatewizardimpl.cpp | 4 +- certmanager/certmanager.cpp | 6 +- certmanager/conf/appearanceconfigwidget.cpp | 2 +- certmanager/conf/configuredialog.cpp | 2 +- certmanager/conf/dirservconfigpage.cpp | 2 +- certmanager/kwatchgnupg/kwatchgnupgconfig.cpp | 2 +- certmanager/kwatchgnupg/kwatchgnupgmainwin.cpp | 4 +- certmanager/lib/CMakeLists.txt | 2 +- .../lib/backends/chiasmus/chiasmusbackend.cpp | 2 +- certmanager/lib/cryptplugfactory.cpp | 2 +- certmanager/lib/cryptplugwrapper.cpp | 2 +- certmanager/lib/kleo/CMakeLists.txt | 2 +- certmanager/lib/kleo/Makefile.am | 2 +- certmanager/lib/kleo/cryptobackendfactory.cpp | 2 +- certmanager/lib/kleo/dn.cpp | 2 +- certmanager/lib/kleo/kconfigbasedkeyfilter.cpp | 251 -- certmanager/lib/kleo/kconfigbasedkeyfilter.h | 104 - certmanager/lib/kleo/keyfiltermanager.cpp | 4 +- certmanager/lib/kleo/tdeconfigbasedkeyfilter.cpp | 251 ++ certmanager/lib/kleo/tdeconfigbasedkeyfilter.h | 104 + .../lib/ui/dnattributeorderconfigwidget.cpp | 2 +- certmanager/lib/ui/keyselectiondialog.cpp | 2 +- certmanager/lib/ui/messagebox.cpp | 2 +- certmanager/storedtransferjob.h | 2 +- config.h.cmake | 2 +- dependency-graph.dot | 6 +- kaddressbook/addresseditwidget.cpp | 2 +- kaddressbook/addresseeconfig.h | 2 +- kaddressbook/addresseeeditorwidget.cpp | 2 +- kaddressbook/common/filter.cpp | 2 +- kaddressbook/common/filter.h | 2 +- kaddressbook/common/kabprefs.cpp | 2 +- kaddressbook/common/kabprefs_base.kcfgc | 2 +- kaddressbook/common/locationmap.cpp | 2 +- kaddressbook/emaileditwidget.cpp | 2 +- kaddressbook/extensionmanager.cpp | 2 +- kaddressbook/features/distributionlistwidget.cpp | 2 +- kaddressbook/imagewidget.cpp | 4 +- kaddressbook/imeditwidget.cpp | 2 +- kaddressbook/interfaces/configurewidget.h | 2 +- kaddressbook/kaddressbookview.cpp | 2 +- kaddressbook/kcmconfigs/addresseewidget.cpp | 2 +- kaddressbook/kcmconfigs/kabconfigwidget.cpp | 2 +- kaddressbook/kcmconfigs/ldapoptionswidget.cpp | 2 +- kaddressbook/keywidget.cpp | 4 +- kaddressbook/ldapsearchdialog.cpp | 2 +- kaddressbook/nameeditdialog.cpp | 2 +- kaddressbook/phoneeditwidget.cpp | 2 +- kaddressbook/printing/detailledstyle.cpp | 2 +- kaddressbook/soundwidget.cpp | 2 +- kaddressbook/thumbnailcreator/Makefile.am | 2 +- kaddressbook/thumbnailcreator/ldifvcardcreator.cpp | 2 +- kaddressbook/thumbnailcreator/ldifvcardcreator.h | 2 +- kaddressbook/viewconfigurefilterpage.cpp | 2 +- kaddressbook/viewconfigurewidget.cpp | 2 +- kaddressbook/viewmanager.cpp | 2 +- kaddressbook/views/configurecardviewdialog.cpp | 2 +- kaddressbook/views/configuretableviewdialog.cpp | 2 +- kaddressbook/views/contactlistview.cpp | 2 +- kaddressbook/views/kaddressbookcardview.cpp | 2 +- kaddressbook/views/kaddressbookiconview.cpp | 2 +- kaddressbook/views/kaddressbooktableview.cpp | 2 +- kaddressbook/xxport/csv_xxport.cpp | 4 +- kaddressbook/xxport/csvimportdialog.cpp | 2 +- kaddressbook/xxport/eudora_xxport.cpp | 4 +- kaddressbook/xxport/kde2_xxport.cpp | 8 +- kaddressbook/xxport/ldif_xxport.cpp | 4 +- kaddressbook/xxport/opera_xxport.cpp | 4 +- kaddressbook/xxport/pab_xxport.cpp | 4 +- kaddressbook/xxport/vcard_xxport.cpp | 4 +- kalarm/CMakeLists.txt | 2 +- kalarm/Makefile.am | 4 +- kalarm/alarmcalendar.cpp | 8 +- kalarm/birthdaydlg.cpp | 2 +- kalarm/daemon.cpp | 2 +- kalarm/editdlg.cpp | 10 +- kalarm/functions.cpp | 4 +- kalarm/kalarmapp.cpp | 4 +- kalarm/kalarmd/adcalendar.cpp | 4 +- kalarm/kalarmd/adconfigdata.cpp | 2 +- kalarm/kalarmd/alarmdaemon.cpp | 4 +- kalarm/kamail.cpp | 4 +- kalarm/lib/messagebox.cpp | 2 +- kalarm/mainwindow.cpp | 2 +- kalarm/messagewin.cpp | 4 +- kalarm/pickfileradio.cpp | 182 -- kalarm/pickfileradio.h | 121 - kalarm/pictdefileradio.cpp | 182 ++ kalarm/pictdefileradio.h | 121 + kalarm/preferences.cpp | 2 +- kalarm/sounddlg.cpp | 2 +- kalarm/soundpicker.cpp | 2 +- kalarm/traywindow.cpp | 2 +- kandy/src/kandy.cpp | 6 +- kandy/src/kandyprefs.kcfgc | 2 +- kandy/src/kandyview.cpp | 2 +- kandy/src/mobilegui.cpp | 2 +- kandy/src/mobilemain.cpp | 2 +- karm/karm_part.cpp | 2 +- karm/karmstorage.cpp | 2 +- karm/mainwindow.cpp | 2 +- karm/preferences.cpp | 2 +- karm/taskview.cpp | 4 +- kfile-plugins/CMakeLists.txt | 13 - kfile-plugins/Makefile.am | 6 - kfile-plugins/RETURNED_ITEMS | 12 - kfile-plugins/ics/CMakeLists.txt | 40 - kfile-plugins/ics/Makefile.am | 24 - kfile-plugins/ics/kfile_ics.cpp | 96 - kfile-plugins/ics/kfile_ics.desktop | 56 - kfile-plugins/ics/kfile_ics.h | 37 - kfile-plugins/palm-databases/Makefile.am | 22 - kfile-plugins/palm-databases/kfile_palm.cpp | 121 - kfile-plugins/palm-databases/kfile_palm.desktop | 59 - kfile-plugins/palm-databases/kfile_palm.h | 41 - kfile-plugins/rfc822/Makefile.am | 22 - kfile-plugins/rfc822/RETURNED_ITEMS | 14 - kfile-plugins/rfc822/kfile_rfc822.cpp | 161 -- kfile-plugins/rfc822/kfile_rfc822.desktop | 62 - kfile-plugins/rfc822/kfile_rfc822.h | 38 - kfile-plugins/vcf/CMakeLists.txt | 35 - kfile-plugins/vcf/Makefile.am | 22 - kfile-plugins/vcf/kfile_vcf.cpp | 103 - kfile-plugins/vcf/kfile_vcf.desktop | 65 - kfile-plugins/vcf/kfile_vcf.h | 38 - kioslaves/CMakeLists.txt | 21 - kioslaves/ConfigureChecks.cmake | 22 - kioslaves/Mainpage.dox | 9 - kioslaves/Makefile.am | 11 - kioslaves/configure.in.bot | 6 - kioslaves/configure.in.in | 27 - kioslaves/imap4/CMakeLists.txt | 44 - kioslaves/imap4/Makefile.am | 26 - kioslaves/imap4/PATCHING | 7 - kioslaves/imap4/README | 48 - kioslaves/imap4/configure.in.in | 1 - kioslaves/imap4/imap4.cc | 2734 -------------------- kioslaves/imap4/imap4.h | 205 -- kioslaves/imap4/imap4.protocol | 29 - kioslaves/imap4/imapcommand.cc | 408 --- kioslaves/imap4/imapcommand.h | 394 --- kioslaves/imap4/imapinfo.cc | 236 -- kioslaves/imap4/imapinfo.h | 232 -- kioslaves/imap4/imaplist.cc | 135 - kioslaves/imap4/imaplist.h | 137 - kioslaves/imap4/imapparser.cc | 2094 --------------- kioslaves/imap4/imapparser.h | 504 ---- kioslaves/imap4/imaps.protocol | 30 - kioslaves/imap4/mailaddress.cc | 323 --- kioslaves/imap4/mailaddress.h | 81 - kioslaves/imap4/mailheader.cc | 203 -- kioslaves/imap4/mailheader.h | 190 -- kioslaves/imap4/mimehdrline.cc | 521 ---- kioslaves/imap4/mimehdrline.h | 67 - kioslaves/imap4/mimeheader.cc | 745 ------ kioslaves/imap4/mimeheader.h | 337 --- kioslaves/imap4/mimeio.cc | 188 -- kioslaves/imap4/mimeio.h | 79 - kioslaves/imap4/rfcdecoder.cc | 668 ----- kioslaves/imap4/rfcdecoder.h | 89 - kioslaves/imap4/selectinfo.h | 202 -- kioslaves/mbox/AUTHORS | 1 - kioslaves/mbox/CMakeLists.txt | 36 - kioslaves/mbox/Makefile.am | 30 - kioslaves/mbox/README | 7 - kioslaves/mbox/mbox.cc | 168 -- kioslaves/mbox/mbox.h | 81 - kioslaves/mbox/mbox.protocol | 14 - kioslaves/mbox/mboxfile.cc | 45 - kioslaves/mbox/mboxfile.h | 68 - kioslaves/mbox/readmbox.cc | 204 -- kioslaves/mbox/readmbox.h | 132 - kioslaves/mbox/stat.cc | 115 - kioslaves/mbox/stat.h | 82 - kioslaves/mbox/urlinfo.cc | 133 - kioslaves/mbox/urlinfo.h | 82 - kioslaves/opengroupware/Makefile.am | 17 - kioslaves/opengroupware/opengroupware.cpp | 250 -- kioslaves/opengroupware/opengroupware.h | 57 - kioslaves/opengroupware/opengroupware.protocol | 7 - kioslaves/opengroupware/opengroupwares.protocol | 7 - kioslaves/opengroupware/webdavhandler.cpp | 81 - kioslaves/opengroupware/webdavhandler.h | 44 - kioslaves/sieve/CMakeLists.txt | 35 - kioslaves/sieve/Makefile.am | 15 - kioslaves/sieve/configure.in.in | 18 - kioslaves/sieve/draft-daboo-sieve-include.txt | 1 - kioslaves/sieve/draft-daboo-sieve-spamtest.txt | 1 - kioslaves/sieve/draft-degener-sieve-body-00.txt | 1 - kioslaves/sieve/draft-degener-sieve-copy.txt | 1 - kioslaves/sieve/draft-degener-sieve-editheader.txt | 1 - .../sieve/draft-degener-sieve-multiscript.txt | 1 - kioslaves/sieve/draft-homme-sieve-variables.txt | 1 - kioslaves/sieve/draft-martin-managesieve-04.txt | 1 - kioslaves/sieve/draft-martin-sieve-notify-01.txt | 1 - kioslaves/sieve/draft-melnikov-sieve-imapflags.txt | 1 - kioslaves/sieve/draft-murchison-sieve-regex-06.txt | 1 - .../sieve/draft-murchison-sieve-subaddress-05.txt | 1 - .../sieve/draft-showalter-sieve-vacation-04.txt | 1 - kioslaves/sieve/rfc3028.txt | 1 - kioslaves/sieve/rfc3431.txt | 1 - kioslaves/sieve/sieve.cpp | 1343 ---------- kioslaves/sieve/sieve.h | 133 - kioslaves/sieve/sieve.protocol | 53 - kitchensync/src/configguievo2.cpp | 2 +- kitchensync/src/configguisunbird.cpp | 2 +- kmail/ChangeLog | 2 +- kmail/Makefile.am | 2 +- kmail/accountdialog.cpp | 4 +- kmail/accountmanager.cpp | 2 +- kmail/accountwizard.cpp | 2 +- kmail/acljobs.cpp | 2 +- kmail/acljobs.h | 2 +- kmail/actionscheduler.cpp | 2 +- kmail/annotationjobs.cpp | 2 +- kmail/annotationjobs.h | 2 +- kmail/antispamconfig.cpp | 2 +- kmail/antispamwizard.h | 2 +- kmail/archivefolderdialog.cpp | 2 +- kmail/cachedimapjob.cpp | 4 +- kmail/cachedimapjob.h | 4 +- kmail/configure.in.in | 2 +- kmail/configuredialog.cpp | 2 +- kmail/csshelper.cpp | 2 +- kmail/editorwatcher.cpp | 2 +- kmail/favoritefolderview.cpp | 2 +- kmail/filterimporterexporter.cpp | 4 +- kmail/filterlogdlg.cpp | 2 +- kmail/folderdiaquotatab_p.cpp | 2 +- kmail/folderjob.cpp | 2 +- kmail/folderstorage.cpp | 2 +- kmail/foldertreebase.cpp | 2 +- kmail/headeritem.cpp | 2 +- kmail/headerstrategy.cpp | 2 +- kmail/htmlstatusbar.cpp | 2 +- kmail/identitydialog.cpp | 4 +- kmail/imapaccountbase.cpp | 8 +- kmail/imapaccountbase.h | 4 +- kmail/imapjob.cpp | 2 +- kmail/imapjob.h | 4 +- kmail/kmaccount.cpp | 2 +- kmail/kmacctcachedimap.cpp | 8 +- kmail/kmacctimap.cpp | 4 +- kmail/kmacctlocal.cpp | 2 +- kmail/kmacctmaildir.cpp | 2 +- kmail/kmail.upd | 4 +- kmail/kmailicalifaceimpl.cpp | 2 +- kmail/kmcommands.cpp | 8 +- kmail/kmcommands.h | 2 +- kmail/kmcomposewin.cpp | 8 +- kmail/kmcomposewin.h | 2 +- kmail/kmedit.cpp | 2 +- kmail/kmfawidgets.cpp | 2 +- kmail/kmfilter.cpp | 2 +- kmail/kmfilteraction.cpp | 2 +- kmail/kmfilterdlg.cpp | 2 +- kmail/kmfiltermgr.cpp | 2 +- kmail/kmfolder.cpp | 2 +- kmail/kmfoldercachedimap.cpp | 6 +- kmail/kmfolderdia.cpp | 2 +- kmail/kmfolderimap.cpp | 4 +- kmail/kmfolderimap.h | 4 +- kmail/kmfoldermaildir.cpp | 2 +- kmail/kmfoldermaildir.h | 2 +- kmail/kmfoldermbox.cpp | 2 +- kmail/kmfoldermgr.cpp | 2 +- kmail/kmfoldersearch.cpp | 2 +- kmail/kmfoldertree.cpp | 2 +- kmail/kmheaders.cpp | 2 +- kmail/kmkernel.cpp | 6 +- kmail/kmkernel.h | 2 +- kmail/kmlineeditspell.cpp | 2 +- kmail/kmmainwidget.cpp | 2 +- kmail/kmmainwin.cpp | 2 +- kmail/kmmessage.cpp | 2 +- kmail/kmmimeparttree.cpp | 2 +- kmail/kmmimeparttree.h | 2 +- kmail/kmmsgpart.h | 2 +- kmail/kmmsgpartdlg.h | 2 +- kmail/kmpopfiltercnfrmdlg.cpp | 2 +- kmail/kmreaderwin.cpp | 4 +- kmail/kmsearchpattern.cpp | 2 +- kmail/kmsender.cpp | 6 +- kmail/kmsender_p.h | 2 +- kmail/kmservertest.cpp | 8 +- kmail/kmtransport.cpp | 2 +- kmail/listjob.cpp | 6 +- kmail/mailinglist-magic.cpp | 2 +- kmail/networkaccount.cpp | 4 +- kmail/objecttreeparser.cpp | 2 +- kmail/partNode.h | 2 +- kmail/popaccount.cpp | 6 +- kmail/quotajobs.cpp | 2 +- kmail/quotajobs.h | 2 +- kmail/renamejob.cpp | 6 +- kmail/searchjob.cpp | 8 +- kmail/searchwindow.cpp | 2 +- kmail/sieveconfig.cpp | 2 +- kmail/sievejob.cpp | 4 +- kmail/sievejob.h | 2 +- kmail/snippetwidget.cpp | 2 +- kmail/transportmanager.cpp | 2 +- kmail/util.h | 2 +- kmail/xfaceconfigurator.cpp | 4 +- kmailcvt/CMakeLists.txt | 2 +- kmailcvt/filter_evolution.cxx | 2 +- kmailcvt/filter_evolution_v2.cxx | 4 +- kmailcvt/filter_kmail_maildir.cxx | 4 +- kmailcvt/filter_lnotes.cxx | 4 +- kmailcvt/filter_lnotes.hxx | 2 +- kmailcvt/filter_mailapp.cxx | 2 +- kmailcvt/filter_mbox.cxx | 2 +- kmailcvt/filter_oe.cxx | 2 +- kmailcvt/filter_opera.cxx | 4 +- kmailcvt/filter_outlook.cxx | 2 +- kmailcvt/filter_plain.cxx | 2 +- kmailcvt/filter_pmail.cxx | 4 +- kmailcvt/filter_sylpheed.cxx | 4 +- kmailcvt/filter_thebat.cxx | 4 +- kmailcvt/filter_thunderbird.cxx | 4 +- kmobile/DESIGN | 6 +- kmobile/Makefile.am | 2 +- kmobile/TODO | 4 +- kmobile/devices/gnokii/gnokii_mobile.cpp | 4 +- kmobile/devices/skeleton/skeleton.cpp | 2 +- kmobile/kioslave/Makefile.am | 18 - kmobile/kioslave/cellphone.protocol | 18 - kmobile/kioslave/kio_mobile.cpp | 636 ----- kmobile/kioslave/kio_mobile.h | 70 - kmobile/kioslave/mimetypes/Makefile.am | 4 - .../kioslave/mimetypes/mobile_addressbook.desktop | 60 - kmobile/kioslave/mimetypes/mobile_calendar.desktop | 60 - kmobile/kioslave/mimetypes/mobile_device.desktop | 64 - kmobile/kioslave/mimetypes/mobile_notes.desktop | 58 - kmobile/kioslave/mobile.protocol | 18 - kmobile/kioslave/organizer.protocol | 18 - kmobile/kioslave/pda.protocol | 18 - kmobile/kioslave/phonecamera.protocol | 18 - kmobile/kmobile.cpp | 6 +- kmobile/kmobileclient.cpp | 4 +- kmobile/kmobiledevice.cpp | 4 +- kmobile/kmobiledevice.h | 8 +- kmobile/kmobileiface.h | 2 +- kmobile/kmobileitem.cpp | 2 +- kmobile/kmobileview.cpp | 10 +- kmobile/kmobileview.h | 2 +- kmobile/tdeioslave/Makefile.am | 18 + kmobile/tdeioslave/cellphone.protocol | 18 + kmobile/tdeioslave/kio_mobile.cpp | 636 +++++ kmobile/tdeioslave/kio_mobile.h | 70 + kmobile/tdeioslave/mimetypes/Makefile.am | 4 + .../mimetypes/mobile_addressbook.desktop | 60 + .../tdeioslave/mimetypes/mobile_calendar.desktop | 60 + kmobile/tdeioslave/mimetypes/mobile_device.desktop | 64 + kmobile/tdeioslave/mimetypes/mobile_notes.desktop | 58 + kmobile/tdeioslave/mobile.protocol | 18 + kmobile/tdeioslave/organizer.protocol | 18 + kmobile/tdeioslave/pda.protocol | 18 + kmobile/tdeioslave/phonecamera.protocol | 18 + knode/articlewidget.cpp | 2 +- knode/knapplication.cpp | 2 +- knode/knarticlewindow.cpp | 2 +- knode/kncomposer.cpp | 2 +- knode/knconfig.h | 2 +- knode/knconfigwidgets.cpp | 2 +- knode/knconvert.cpp | 2 +- knode/knewsservice.protocol | 2 +- knode/knglobals.cpp | 2 +- knode/knglobals.h | 2 +- knode/knjobdata.cpp | 2 +- knode/knmainwidget.cpp | 2 +- knode/knnetaccess.cpp | 4 +- knode/knserverinfo.cpp | 2 +- knode/utilities.cpp | 4 +- knotes/TODO | 2 +- knotes/knote.cpp | 4 +- knotes/knote.h | 2 +- knotes/knoteconfigdlg.cpp | 2 +- knotes/knoteconfigdlg.h | 2 +- knotes/knoteslegacy.cpp | 2 +- kode/kodemain.cpp | 18 +- kode/kwsdl/converter.cpp | 2 +- kode/kwsdl/kung/binaryinputfield.cpp | 4 +- kode/kwsdl/kung/transport.h | 2 +- kode/kwsdl/schema/fileprovider.cpp | 2 +- kode/kwsdl/tests/google/transport.h | 2 +- kode/kxml_compiler/creator.cpp | 2 +- kode/kxml_compiler/creator.h | 2 +- kode/kxml_compiler/kxml_compiler.cpp | 2 +- kode/kxml_compiler/parser.cpp | 2 +- kode/kxml_compiler/parser.h | 2 +- konsolekalendar/konsolekalendarvariables.cpp | 2 +- konsolekalendar/main.cpp | 2 +- konsolekalendar/stdcalendar.cpp | 2 +- kontact/plugins/kmail/kcmkmailsummary.cpp | 2 +- kontact/plugins/kmail/summarywidget.cpp | 2 +- kontact/plugins/korganizer/kcmkorgsummary.cpp | 2 +- kontact/plugins/newsticker/kcmkontactknt.cpp | 2 +- kontact/plugins/newsticker/summarywidget.cpp | 2 +- kontact/plugins/specialdates/kcmsdsummary.cpp | 2 +- kontact/plugins/summary/kcmkontactsummary.cpp | 2 +- kontact/plugins/summary/summaryview_part.cpp | 2 +- kontact/src/kontactconfig.desktop | 2 +- kontact/src/mainwindow.cpp | 4 +- kontact/src/prefs.kcfgc | 2 +- kontact/src/profiledialog.cpp | 2 +- kontact/src/profilemanager.cpp | 4 +- korganizer/Makefile.am | 2 +- korganizer/actionmanager.cpp | 8 +- korganizer/archivedialog.cpp | 2 +- korganizer/calendarview.cpp | 6 +- korganizer/calendarview.h | 2 +- korganizer/docprefs.cpp | 2 +- korganizer/eventarchiver.cpp | 2 +- korganizer/exportwebdialog.cpp | 8 +- korganizer/freebusymanager.cpp | 10 +- korganizer/koagendaview.cpp | 2 +- korganizer/koapp.cpp | 2 +- korganizer/kocore.cpp | 2 +- korganizer/koeditorattachments.cpp | 6 +- korganizer/koeditorgeneral.cpp | 2 +- korganizer/koeditorgeneralevent.cpp | 2 +- korganizer/koeditorgeneraltodo.cpp | 2 +- korganizer/koeventviewer.h | 2 +- korganizer/koglobals.cpp | 2 +- korganizer/kogroupware.h | 2 +- korganizer/koincidenceeditor.cpp | 2 +- korganizer/komonthview.cpp | 2 +- korganizer/koprefs.cpp | 2 +- korganizer/koprefs_base.kcfgc | 2 +- korganizer/korgac/alarmdialog.cpp | 2 +- korganizer/korgac/alarmdockwindow.cpp | 2 +- korganizer/korgac/testalarmdlg.cpp | 2 +- korganizer/korganizer.cpp | 4 +- korganizer/korganizer_part.cpp | 2 +- korganizer/koviewmanager.cpp | 2 +- korganizer/plugins/datenums/configdialog.cpp | 2 +- korganizer/plugins/datenums/datenums.cpp | 2 +- korganizer/plugins/exchange/exchange.cpp | 2 +- korganizer/plugins/exchange/exchangeconfig.cpp | 2 +- korganizer/plugins/hebrew/configdialog.cpp | 2 +- korganizer/plugins/hebrew/hebrew.cpp | 2 +- .../plugins/printing/journal/journalprint.cpp | 2 +- korganizer/plugins/printing/list/listprint.cpp | 2 +- .../plugins/printing/whatsnext/whatsnextprint.cpp | 2 +- korganizer/plugins/printing/year/yearprint.cpp | 2 +- korganizer/plugins/projectview/koprojectview.cpp | 2 +- korganizer/plugins/projectview/projectview.cpp | 2 +- korganizer/plugins/timespanview/kotimespanview.cpp | 4 +- korganizer/plugins/timespanview/timespanview.cpp | 2 +- korganizer/previewdialog.cpp | 4 +- korganizer/printing/CMakeLists.txt | 2 +- korganizer/printing/Makefile.am | 2 +- korganizer/printing/calprintdefaultplugins.cpp | 4 +- korganizer/printing/calprintpluginbase.cpp | 2 +- korganizer/printing/calprintweekconfig_base.ui | 300 --- korganizer/printing/calprintweetdeconfig_base.ui | 300 +++ korganizer/resourceview.cpp | 2 +- korganizer/stdcalendar.cpp | 2 +- korganizer/urihandler.cpp | 4 +- korn/CMakeLists.txt | 4 +- korn/Makefile.am | 2 +- korn/accountmanager.cpp | 2 +- korn/boxcontainer.cpp | 2 +- korn/boxcontaineritem.cpp | 2 +- korn/dcop_proto.cpp | 2 +- korn/dcopdrop.cpp | 2 +- korn/dockeditem.cpp | 2 +- korn/imap_proto.h | 2 +- korn/kconf_update/CMakeLists.txt | 38 - korn/kconf_update/Makefile.am | 12 - korn/kconf_update/korn-3-4-config_change.cpp | 261 -- korn/kconf_update/korn-3-4-config_change.upd | 3 - korn/kconf_update/korn-3-5-metadata-update.pl | 43 - korn/kconf_update/korn-3-5-ssl-update.pl | 39 - korn/kconf_update/korn-3-5-update.upd | 10 - korn/keditlistboxman.cpp | 2 +- korn/kio.cpp | 6 +- korn/kio_count.cpp | 10 +- korn/kio_count.h | 2 +- korn/kio_delete.cpp | 6 +- korn/kio_proto.cpp | 2 +- korn/kio_proto.h | 2 +- korn/kio_read.cpp | 6 +- korn/kio_single_subject.cpp | 8 +- korn/kio_subjects.cpp | 4 +- korn/kmail_proto.cpp | 2 +- korn/kornaccountcfgimpl.cpp | 2 +- korn/kornboxcfgimpl.cpp | 4 +- korn/korncfgimpl.cpp | 2 +- korn/kornshell.cpp | 2 +- korn/maildrop.cpp | 2 +- korn/password.cpp | 2 +- korn/polldrop.cpp | 2 +- korn/systemtray.cpp | 2 +- korn/tdeconf_update/CMakeLists.txt | 38 + korn/tdeconf_update/Makefile.am | 12 + korn/tdeconf_update/korn-3-4-config_change.cpp | 261 ++ korn/tdeconf_update/korn-3-4-config_change.upd | 3 + korn/tdeconf_update/korn-3-5-metadata-update.pl | 43 + korn/tdeconf_update/korn-3-5-ssl-update.pl | 39 + korn/tdeconf_update/korn-3-5-update.upd | 10 + ktnef/gui/attachpropertydialog.cpp | 2 +- ktnef/gui/ktnefmain.cpp | 2 +- ktnef/lib/CMakeLists.txt | 2 +- libemailfunctions/networkstatus.cpp | 2 +- libkcal/attachmenthandler.cpp | 4 +- libkcal/convertqtopia.cpp | 2 +- libkcal/freebusyurlstore.cpp | 2 +- libkcal/htmlexportsettings.kcfgc | 2 +- libkcal/resourcecached.h | 2 +- libkcal/resourcecalendar.cpp | 2 +- libkcal/resourcecalendar.h | 2 +- libkcal/resourcelocaldir.cpp | 2 +- libkcal/tests/runtestcase.pl | 4 +- libkcal/tests/testresource.cpp | 4 +- libkpgp/Makefile.am | 2 +- libkpgp/kpgp.cpp | 4 +- libkpgp/kpgpui.cpp | 4 +- libkpimexchange/configure.in.in | 2 +- libkpimexchange/core/exchangeaccount.cpp | 10 +- libkpimexchange/core/exchangeaccount.h | 2 +- libkpimexchange/core/exchangeclient.cpp | 4 +- libkpimexchange/core/exchangedelete.cpp | 16 +- libkpimexchange/core/exchangedelete.h | 2 +- libkpimexchange/core/exchangedownload.cpp | 14 +- libkpimexchange/core/exchangedownload.h | 2 +- libkpimexchange/core/exchangemonitor.cpp | 12 +- libkpimexchange/core/exchangemonitor.h | 2 +- libkpimexchange/core/exchangeprogress.cpp | 2 +- libkpimexchange/core/exchangeupload.cpp | 12 +- libkpimexchange/core/exchangeupload.h | 2 +- libkpimidentities/identity.cpp | 4 +- libkpimidentities/identitymanager.cpp | 4 +- libtdepim/CMakeLists.txt | 4 +- libtdepim/Makefile.am | 4 +- libtdepim/addresseeview.cpp | 4 +- libtdepim/cfgc/README | 2 +- libtdepim/cfgc/autoexample.cpp | 2 +- libtdepim/cfgc/example.cpp | 2 +- libtdepim/cfgc/exampleprefs_base.kcfgc | 2 +- libtdepim/completionordereditor.h | 2 +- libtdepim/csshelper.cpp | 2 +- libtdepim/groupwarejob.cpp | 2 +- libtdepim/groupwarejob.h | 2 +- libtdepim/kaccount.cpp | 2 +- libtdepim/kcmdesignerfields.cpp | 4 +- libtdepim/kconfigpropagator.cpp | 289 --- libtdepim/kconfigpropagator.h | 165 -- libtdepim/kconfigwizard.cpp | 197 -- libtdepim/kconfigwizard.h | 110 - libtdepim/kfileio.cpp | 390 --- libtdepim/kfileio.h | 105 - libtdepim/kfoldertree.cpp | 2 +- libtdepim/kimportdialog.cpp | 2 +- libtdepim/komposer/core/core.cpp | 2 +- libtdepim/komposer/core/komposerconfig.desktop | 2 +- libtdepim/komposer/core/settings.kcfgc | 2 +- .../komposer/plugins/default/defaulteditor.cpp | 2 +- libtdepim/kpimprefs.cpp | 2 +- libtdepim/kpimprefs.h | 2 +- libtdepim/kprefsdialog.cpp | 2 +- libtdepim/kprefsdialog.h | 4 +- libtdepim/kresourceprefs.h | 2 +- libtdepim/ldapclient.cpp | 2 +- libtdepim/ldapclient.h | 4 +- libtdepim/ldapsearchdialog.cpp | 2 +- libtdepim/recentaddresses.cpp | 2 +- libtdepim/tdeconfigpropagator.cpp | 289 +++ libtdepim/tdeconfigpropagator.h | 165 ++ libtdepim/tdeconfigwizard.cpp | 197 ++ libtdepim/tdeconfigwizard.h | 110 + libtdepim/tdefileio.cpp | 390 +++ libtdepim/tdefileio.h | 105 + libtdepim/tdepartsdesignerplugin/CMakeLists.txt | 2 +- libtdepim/tests/myconfig.kcfgc | 2 +- libtdepim/tests/testdistrlist.cpp | 4 +- libtdepim/tests/testwizard.cpp | 2 +- plugins/kmail/bodypartformatter/text_calendar.cpp | 6 +- plugins/kmail/bodypartformatter/text_vcard.cpp | 4 +- tdefile-plugins/CMakeLists.txt | 13 + tdefile-plugins/Makefile.am | 6 + tdefile-plugins/RETURNED_ITEMS | 12 + tdefile-plugins/ics/CMakeLists.txt | 40 + tdefile-plugins/ics/Makefile.am | 24 + tdefile-plugins/ics/tdefile_ics.cpp | 96 + tdefile-plugins/ics/tdefile_ics.desktop | 56 + tdefile-plugins/ics/tdefile_ics.h | 37 + tdefile-plugins/palm-databases/Makefile.am | 22 + tdefile-plugins/palm-databases/tdefile_palm.cpp | 121 + .../palm-databases/tdefile_palm.desktop | 59 + tdefile-plugins/palm-databases/tdefile_palm.h | 41 + tdefile-plugins/rfc822/Makefile.am | 22 + tdefile-plugins/rfc822/RETURNED_ITEMS | 14 + tdefile-plugins/rfc822/tdefile_rfc822.cpp | 161 ++ tdefile-plugins/rfc822/tdefile_rfc822.desktop | 62 + tdefile-plugins/rfc822/tdefile_rfc822.h | 38 + tdefile-plugins/vcf/CMakeLists.txt | 35 + tdefile-plugins/vcf/Makefile.am | 22 + tdefile-plugins/vcf/tdefile_vcf.cpp | 103 + tdefile-plugins/vcf/tdefile_vcf.desktop | 65 + tdefile-plugins/vcf/tdefile_vcf.h | 38 + tdeioslaves/CMakeLists.txt | 21 + tdeioslaves/ConfigureChecks.cmake | 22 + tdeioslaves/Mainpage.dox | 9 + tdeioslaves/Makefile.am | 11 + tdeioslaves/configure.in.bot | 6 + tdeioslaves/configure.in.in | 27 + tdeioslaves/imap4/CMakeLists.txt | 44 + tdeioslaves/imap4/Makefile.am | 26 + tdeioslaves/imap4/PATCHING | 7 + tdeioslaves/imap4/README | 48 + tdeioslaves/imap4/configure.in.in | 1 + tdeioslaves/imap4/imap4.cc | 2734 ++++++++++++++++++++ tdeioslaves/imap4/imap4.h | 205 ++ tdeioslaves/imap4/imap4.protocol | 29 + tdeioslaves/imap4/imapcommand.cc | 408 +++ tdeioslaves/imap4/imapcommand.h | 394 +++ tdeioslaves/imap4/imapinfo.cc | 236 ++ tdeioslaves/imap4/imapinfo.h | 232 ++ tdeioslaves/imap4/imaplist.cc | 135 + tdeioslaves/imap4/imaplist.h | 137 + tdeioslaves/imap4/imapparser.cc | 2094 +++++++++++++++ tdeioslaves/imap4/imapparser.h | 504 ++++ tdeioslaves/imap4/imaps.protocol | 30 + tdeioslaves/imap4/mailaddress.cc | 323 +++ tdeioslaves/imap4/mailaddress.h | 81 + tdeioslaves/imap4/mailheader.cc | 203 ++ tdeioslaves/imap4/mailheader.h | 190 ++ tdeioslaves/imap4/mimehdrline.cc | 521 ++++ tdeioslaves/imap4/mimehdrline.h | 67 + tdeioslaves/imap4/mimeheader.cc | 745 ++++++ tdeioslaves/imap4/mimeheader.h | 337 +++ tdeioslaves/imap4/mimeio.cc | 188 ++ tdeioslaves/imap4/mimeio.h | 79 + tdeioslaves/imap4/rfcdecoder.cc | 668 +++++ tdeioslaves/imap4/rfcdecoder.h | 89 + tdeioslaves/imap4/selectinfo.h | 202 ++ tdeioslaves/mbox/AUTHORS | 1 + tdeioslaves/mbox/CMakeLists.txt | 36 + tdeioslaves/mbox/Makefile.am | 30 + tdeioslaves/mbox/README | 7 + tdeioslaves/mbox/mbox.cc | 168 ++ tdeioslaves/mbox/mbox.h | 81 + tdeioslaves/mbox/mbox.protocol | 14 + tdeioslaves/mbox/mboxfile.cc | 45 + tdeioslaves/mbox/mboxfile.h | 68 + tdeioslaves/mbox/readmbox.cc | 204 ++ tdeioslaves/mbox/readmbox.h | 132 + tdeioslaves/mbox/stat.cc | 115 + tdeioslaves/mbox/stat.h | 82 + tdeioslaves/mbox/urlinfo.cc | 133 + tdeioslaves/mbox/urlinfo.h | 82 + tdeioslaves/opengroupware/Makefile.am | 17 + tdeioslaves/opengroupware/opengroupware.cpp | 250 ++ tdeioslaves/opengroupware/opengroupware.h | 57 + tdeioslaves/opengroupware/opengroupware.protocol | 7 + tdeioslaves/opengroupware/opengroupwares.protocol | 7 + tdeioslaves/opengroupware/webdavhandler.cpp | 81 + tdeioslaves/opengroupware/webdavhandler.h | 44 + tdeioslaves/sieve/CMakeLists.txt | 35 + tdeioslaves/sieve/Makefile.am | 15 + tdeioslaves/sieve/configure.in.in | 18 + tdeioslaves/sieve/draft-daboo-sieve-include.txt | 1 + tdeioslaves/sieve/draft-daboo-sieve-spamtest.txt | 1 + tdeioslaves/sieve/draft-degener-sieve-body-00.txt | 1 + tdeioslaves/sieve/draft-degener-sieve-copy.txt | 1 + .../sieve/draft-degener-sieve-editheader.txt | 1 + .../sieve/draft-degener-sieve-multiscript.txt | 1 + tdeioslaves/sieve/draft-homme-sieve-variables.txt | 1 + tdeioslaves/sieve/draft-martin-managesieve-04.txt | 1 + tdeioslaves/sieve/draft-martin-sieve-notify-01.txt | 1 + .../sieve/draft-melnikov-sieve-imapflags.txt | 1 + .../sieve/draft-murchison-sieve-regex-06.txt | 1 + .../sieve/draft-murchison-sieve-subaddress-05.txt | 1 + .../sieve/draft-showalter-sieve-vacation-04.txt | 1 + tdeioslaves/sieve/rfc3028.txt | 1 + tdeioslaves/sieve/rfc3431.txt | 1 + tdeioslaves/sieve/sieve.cpp | 1343 ++++++++++ tdeioslaves/sieve/sieve.h | 133 + tdeioslaves/sieve/sieve.protocol | 53 + tderesources/birthdays/resourcekabc.cpp | 2 +- tderesources/birthdays/resourcekabc.h | 2 +- tderesources/blogging/API_Blog.h | 2 +- tderesources/blogging/xmlrpcjob.cpp | 4 +- tderesources/blogging/xmlrpcjob.h | 4 +- tderesources/caldav/prefsskel.kcfgc | 2 +- tderesources/caldav/resource.h | 2 +- tderesources/carddav/prefsskel.kcfgc | 2 +- tderesources/carddav/resource.h | 2 +- tderesources/egroupware/kabc_egroupwareprefs.kcfgc | 2 +- tderesources/egroupware/kabc_resourcexmlrpc.cpp | 2 +- tderesources/egroupware/kcal_egroupwareprefs.kcfgc | 2 +- tderesources/egroupware/kcal_resourcexmlrpc.h | 2 +- .../egroupware/knotes_egroupwareprefs.kcfgc | 2 +- tderesources/egroupware/knotes_resourcexmlrpc.h | 2 +- tderesources/egroupware/xmlrpciface.cpp | 2 +- .../featureplan/kcal_resourcefeatureplan.h | 2 +- tderesources/featureplan/prefs.kcfgc | 2 +- .../groupdav/groupdavaddressbookadaptor.cpp | 2 +- tderesources/groupdav/groupdavglobals.cpp | 4 +- tderesources/groupware/kabc_resourcegroupware.cpp | 2 +- tderesources/groupware/kabc_resourcegroupware.h | 2 +- .../groupware/kcal_groupwareprefsbase.kcfgc | 2 +- tderesources/groupware/kcal_resourcegroupware.h | 6 +- .../groupware/kcal_resourcegroupwareconfig.h | 2 +- tderesources/groupwise/CMakeLists.txt | 2 +- tderesources/groupwise/Makefile.am | 2 +- tderesources/groupwise/kabc_resourcegroupwise.cpp | 2 +- tderesources/groupwise/kabc_resourcegroupwise.h | 2 +- .../groupwise/kcal_groupwiseprefsbase.kcfgc | 2 +- tderesources/groupwise/kcal_resourcegroupwise.h | 4 +- tderesources/groupwise/kioslave/CMakeLists.txt | 39 - tderesources/groupwise/kioslave/Makefile.am | 19 - tderesources/groupwise/kioslave/groupwise.cpp | 426 --- tderesources/groupwise/kioslave/groupwise.h | 54 - tderesources/groupwise/kioslave/groupwise.protocol | 7 - .../groupwise/kioslave/groupwises.protocol | 7 - tderesources/groupwise/soap/groupwiseserver.cpp | 6 +- tderesources/groupwise/soap/groupwiseserver.h | 4 +- tderesources/groupwise/soap/ksslsocket.cpp | 6 +- tderesources/groupwise/soap/ksslsocket.h | 2 +- tderesources/groupwise/soap/soapdebug.cpp | 2 +- tderesources/groupwise/tdeioslave/CMakeLists.txt | 39 + tderesources/groupwise/tdeioslave/Makefile.am | 19 + tderesources/groupwise/tdeioslave/groupwise.cpp | 426 +++ tderesources/groupwise/tdeioslave/groupwise.h | 54 + .../groupwise/tdeioslave/groupwise.protocol | 7 + .../groupwise/tdeioslave/groupwises.protocol | 7 + tderesources/kolab/CMakeLists.txt | 4 +- tderesources/kolab/Makefile.am | 2 +- tderesources/kolab/kabc/contact.cpp | 2 +- tderesources/kolab/kabc/resourcekolab.cpp | 8 +- tderesources/kolab/kcal/incidence.cpp | 2 +- tderesources/kolab/kcal/resourcekolab.cpp | 8 +- tderesources/lib/addressbookadaptor.cpp | 2 +- tderesources/lib/calendaradaptor.cpp | 2 +- tderesources/lib/davaddressbookadaptor.cpp | 4 +- tderesources/lib/davcalendaradaptor.cpp | 2 +- tderesources/lib/folderlister.cpp | 4 +- tderesources/lib/groupwaredataadaptor.cpp | 2 +- tderesources/lib/groupwaredownloadjob.cpp | 2 +- tderesources/lib/groupwareresourcejob.h | 2 +- tderesources/lib/groupwareuploadjob.cpp | 2 +- tderesources/lib/groupwareuploadjob.h | 2 +- tderesources/lib/kcal_cachesettingsdlg.h | 2 +- tderesources/lib/kcal_resourcegroupwarebase.cpp | 2 +- tderesources/lib/kcal_resourcegroupwarebase.h | 2 +- .../lib/kcal_resourcegroupwarebaseconfig.h | 2 +- .../newexchange/exchangeaddressbookadaptor.cpp | 2 +- .../newexchange/exchangecalendaradaptor.cpp | 2 +- tderesources/newexchange/exchangeglobals.cpp | 4 +- tderesources/remote/resourceremote.cpp | 2 +- tderesources/remote/resourceremote.h | 2 +- tderesources/scalix/CMakeLists.txt | 2 +- tderesources/scalix/Makefile.am | 2 +- tderesources/scalix/kabc/resourcescalix.cpp | 8 +- tderesources/scalix/kcal/resourcescalix.cpp | 8 +- tderesources/scalix/kioslave/CMakeLists.txt | 37 - tderesources/scalix/kioslave/Makefile.am | 17 - tderesources/scalix/kioslave/scalix.cpp | 225 -- tderesources/scalix/kioslave/scalix.h | 52 - tderesources/scalix/kioslave/scalix.protocol | 8 - tderesources/scalix/kioslave/scalixs.protocol | 8 - tderesources/scalix/scalixadmin/jobs.cpp | 2 +- tderesources/scalix/scalixadmin/jobs.h | 2 +- tderesources/scalix/scalixadmin/passwordpage.cpp | 2 +- tderesources/scalix/scalixadmin/settings.cpp | 4 +- tderesources/scalix/scalixadmin/settings.h | 4 +- tderesources/scalix/tdeioslave/CMakeLists.txt | 37 + tderesources/scalix/tdeioslave/Makefile.am | 17 + tderesources/scalix/tdeioslave/scalix.cpp | 225 ++ tderesources/scalix/tdeioslave/scalix.h | 52 + tderesources/scalix/tdeioslave/scalix.protocol | 8 + tderesources/scalix/tdeioslave/scalixs.protocol | 8 + tderesources/slox/kabcresourceslox.cpp | 4 +- tderesources/slox/kabcsloxprefs.kcfgc | 2 +- tderesources/slox/kcalresourceslox.cpp | 4 +- tderesources/slox/kcalresourceslox.h | 2 +- tderesources/slox/kcalsloxprefs.kcfgc | 2 +- tderesources/slox/sloxaccounts.cpp | 6 +- tderesources/slox/sloxfoldermanager.cpp | 4 +- tderesources/slox/webdavhandler.cpp | 2 +- tderesources/tvanytime/kcal_resourcetvanytime.h | 4 +- .../tvanytime/kcal_resourcetvanytimeconfig.cpp | 2 +- .../tvanytime/kcal_tvanytimeprefsbase.kcfgc | 2 +- wizards/egroupwareconfig.kcfgc | 2 +- wizards/egroupwarewizard.h | 2 +- wizards/exchangewizard.h | 2 +- wizards/groupwiseconfig.kcfgc | 2 +- wizards/groupwisewizard.h | 2 +- wizards/kmailchanges.h | 4 +- wizards/kolabconfig.kcfgc | 2 +- wizards/kolabkmailchanges.cpp | 2 +- wizards/kolabkmailchanges.h | 2 +- wizards/kolabwizard.h | 2 +- wizards/scalixconfig.kcfgc | 2 +- wizards/scalixkmailchanges.cpp | 2 +- wizards/scalixkmailchanges.h | 2 +- wizards/scalixwizard.h | 2 +- wizards/servertype.h | 2 +- wizards/sloxconfig.kcfgc | 2 +- wizards/sloxwizard.h | 2 +- 825 files changed, 20775 insertions(+), 20775 deletions(-) delete mode 100644 certmanager/lib/kleo/kconfigbasedkeyfilter.cpp delete mode 100644 certmanager/lib/kleo/kconfigbasedkeyfilter.h create mode 100644 certmanager/lib/kleo/tdeconfigbasedkeyfilter.cpp create mode 100644 certmanager/lib/kleo/tdeconfigbasedkeyfilter.h delete mode 100644 kalarm/pickfileradio.cpp delete mode 100644 kalarm/pickfileradio.h create mode 100644 kalarm/pictdefileradio.cpp create mode 100644 kalarm/pictdefileradio.h delete mode 100644 kfile-plugins/CMakeLists.txt delete mode 100644 kfile-plugins/Makefile.am delete mode 100644 kfile-plugins/RETURNED_ITEMS delete mode 100644 kfile-plugins/ics/CMakeLists.txt delete mode 100644 kfile-plugins/ics/Makefile.am delete mode 100644 kfile-plugins/ics/kfile_ics.cpp delete mode 100644 kfile-plugins/ics/kfile_ics.desktop delete mode 100644 kfile-plugins/ics/kfile_ics.h delete mode 100644 kfile-plugins/palm-databases/Makefile.am delete mode 100644 kfile-plugins/palm-databases/kfile_palm.cpp delete mode 100644 kfile-plugins/palm-databases/kfile_palm.desktop delete mode 100644 kfile-plugins/palm-databases/kfile_palm.h delete mode 100644 kfile-plugins/rfc822/Makefile.am delete mode 100644 kfile-plugins/rfc822/RETURNED_ITEMS delete mode 100644 kfile-plugins/rfc822/kfile_rfc822.cpp delete mode 100644 kfile-plugins/rfc822/kfile_rfc822.desktop delete mode 100644 kfile-plugins/rfc822/kfile_rfc822.h delete mode 100644 kfile-plugins/vcf/CMakeLists.txt delete mode 100644 kfile-plugins/vcf/Makefile.am delete mode 100644 kfile-plugins/vcf/kfile_vcf.cpp delete mode 100644 kfile-plugins/vcf/kfile_vcf.desktop delete mode 100644 kfile-plugins/vcf/kfile_vcf.h delete mode 100644 kioslaves/CMakeLists.txt delete mode 100644 kioslaves/ConfigureChecks.cmake delete mode 100644 kioslaves/Mainpage.dox delete mode 100644 kioslaves/Makefile.am delete mode 100644 kioslaves/configure.in.bot delete mode 100644 kioslaves/configure.in.in delete mode 100644 kioslaves/imap4/CMakeLists.txt delete mode 100644 kioslaves/imap4/Makefile.am delete mode 100644 kioslaves/imap4/PATCHING delete mode 100644 kioslaves/imap4/README delete mode 100644 kioslaves/imap4/configure.in.in delete mode 100644 kioslaves/imap4/imap4.cc delete mode 100644 kioslaves/imap4/imap4.h delete mode 100644 kioslaves/imap4/imap4.protocol delete mode 100644 kioslaves/imap4/imapcommand.cc delete mode 100644 kioslaves/imap4/imapcommand.h delete mode 100644 kioslaves/imap4/imapinfo.cc delete mode 100644 kioslaves/imap4/imapinfo.h delete mode 100644 kioslaves/imap4/imaplist.cc delete mode 100644 kioslaves/imap4/imaplist.h delete mode 100644 kioslaves/imap4/imapparser.cc delete mode 100644 kioslaves/imap4/imapparser.h delete mode 100644 kioslaves/imap4/imaps.protocol delete mode 100644 kioslaves/imap4/mailaddress.cc delete mode 100644 kioslaves/imap4/mailaddress.h delete mode 100644 kioslaves/imap4/mailheader.cc delete mode 100644 kioslaves/imap4/mailheader.h delete mode 100644 kioslaves/imap4/mimehdrline.cc delete mode 100644 kioslaves/imap4/mimehdrline.h delete mode 100644 kioslaves/imap4/mimeheader.cc delete mode 100644 kioslaves/imap4/mimeheader.h delete mode 100644 kioslaves/imap4/mimeio.cc delete mode 100644 kioslaves/imap4/mimeio.h delete mode 100644 kioslaves/imap4/rfcdecoder.cc delete mode 100644 kioslaves/imap4/rfcdecoder.h delete mode 100644 kioslaves/imap4/selectinfo.h delete mode 100644 kioslaves/mbox/AUTHORS delete mode 100644 kioslaves/mbox/CMakeLists.txt delete mode 100644 kioslaves/mbox/Makefile.am delete mode 100644 kioslaves/mbox/README delete mode 100644 kioslaves/mbox/mbox.cc delete mode 100644 kioslaves/mbox/mbox.h delete mode 100644 kioslaves/mbox/mbox.protocol delete mode 100644 kioslaves/mbox/mboxfile.cc delete mode 100644 kioslaves/mbox/mboxfile.h delete mode 100644 kioslaves/mbox/readmbox.cc delete mode 100644 kioslaves/mbox/readmbox.h delete mode 100644 kioslaves/mbox/stat.cc delete mode 100644 kioslaves/mbox/stat.h delete mode 100644 kioslaves/mbox/urlinfo.cc delete mode 100644 kioslaves/mbox/urlinfo.h delete mode 100644 kioslaves/opengroupware/Makefile.am delete mode 100644 kioslaves/opengroupware/opengroupware.cpp delete mode 100644 kioslaves/opengroupware/opengroupware.h delete mode 100644 kioslaves/opengroupware/opengroupware.protocol delete mode 100644 kioslaves/opengroupware/opengroupwares.protocol delete mode 100644 kioslaves/opengroupware/webdavhandler.cpp delete mode 100644 kioslaves/opengroupware/webdavhandler.h delete mode 100644 kioslaves/sieve/CMakeLists.txt delete mode 100644 kioslaves/sieve/Makefile.am delete mode 100644 kioslaves/sieve/configure.in.in delete mode 100644 kioslaves/sieve/draft-daboo-sieve-include.txt delete mode 100644 kioslaves/sieve/draft-daboo-sieve-spamtest.txt delete mode 100644 kioslaves/sieve/draft-degener-sieve-body-00.txt delete mode 100644 kioslaves/sieve/draft-degener-sieve-copy.txt delete mode 100644 kioslaves/sieve/draft-degener-sieve-editheader.txt delete mode 100644 kioslaves/sieve/draft-degener-sieve-multiscript.txt delete mode 100644 kioslaves/sieve/draft-homme-sieve-variables.txt delete mode 100644 kioslaves/sieve/draft-martin-managesieve-04.txt delete mode 100644 kioslaves/sieve/draft-martin-sieve-notify-01.txt delete mode 100644 kioslaves/sieve/draft-melnikov-sieve-imapflags.txt delete mode 100644 kioslaves/sieve/draft-murchison-sieve-regex-06.txt delete mode 100644 kioslaves/sieve/draft-murchison-sieve-subaddress-05.txt delete mode 100644 kioslaves/sieve/draft-showalter-sieve-vacation-04.txt delete mode 100644 kioslaves/sieve/rfc3028.txt delete mode 100644 kioslaves/sieve/rfc3431.txt delete mode 100644 kioslaves/sieve/sieve.cpp delete mode 100644 kioslaves/sieve/sieve.h delete mode 100644 kioslaves/sieve/sieve.protocol delete mode 100644 kmobile/kioslave/Makefile.am delete mode 100644 kmobile/kioslave/cellphone.protocol delete mode 100644 kmobile/kioslave/kio_mobile.cpp delete mode 100644 kmobile/kioslave/kio_mobile.h delete mode 100644 kmobile/kioslave/mimetypes/Makefile.am delete mode 100644 kmobile/kioslave/mimetypes/mobile_addressbook.desktop delete mode 100644 kmobile/kioslave/mimetypes/mobile_calendar.desktop delete mode 100644 kmobile/kioslave/mimetypes/mobile_device.desktop delete mode 100644 kmobile/kioslave/mimetypes/mobile_notes.desktop delete mode 100644 kmobile/kioslave/mobile.protocol delete mode 100644 kmobile/kioslave/organizer.protocol delete mode 100644 kmobile/kioslave/pda.protocol delete mode 100644 kmobile/kioslave/phonecamera.protocol create mode 100644 kmobile/tdeioslave/Makefile.am create mode 100644 kmobile/tdeioslave/cellphone.protocol create mode 100644 kmobile/tdeioslave/kio_mobile.cpp create mode 100644 kmobile/tdeioslave/kio_mobile.h create mode 100644 kmobile/tdeioslave/mimetypes/Makefile.am create mode 100644 kmobile/tdeioslave/mimetypes/mobile_addressbook.desktop create mode 100644 kmobile/tdeioslave/mimetypes/mobile_calendar.desktop create mode 100644 kmobile/tdeioslave/mimetypes/mobile_device.desktop create mode 100644 kmobile/tdeioslave/mimetypes/mobile_notes.desktop create mode 100644 kmobile/tdeioslave/mobile.protocol create mode 100644 kmobile/tdeioslave/organizer.protocol create mode 100644 kmobile/tdeioslave/pda.protocol create mode 100644 kmobile/tdeioslave/phonecamera.protocol delete mode 100644 korganizer/printing/calprintweekconfig_base.ui create mode 100644 korganizer/printing/calprintweetdeconfig_base.ui delete mode 100644 korn/kconf_update/CMakeLists.txt delete mode 100644 korn/kconf_update/Makefile.am delete mode 100644 korn/kconf_update/korn-3-4-config_change.cpp delete mode 100644 korn/kconf_update/korn-3-4-config_change.upd delete mode 100644 korn/kconf_update/korn-3-5-metadata-update.pl delete mode 100644 korn/kconf_update/korn-3-5-ssl-update.pl delete mode 100644 korn/kconf_update/korn-3-5-update.upd create mode 100644 korn/tdeconf_update/CMakeLists.txt create mode 100644 korn/tdeconf_update/Makefile.am create mode 100644 korn/tdeconf_update/korn-3-4-config_change.cpp create mode 100644 korn/tdeconf_update/korn-3-4-config_change.upd create mode 100644 korn/tdeconf_update/korn-3-5-metadata-update.pl create mode 100644 korn/tdeconf_update/korn-3-5-ssl-update.pl create mode 100644 korn/tdeconf_update/korn-3-5-update.upd delete mode 100644 libtdepim/kconfigpropagator.cpp delete mode 100644 libtdepim/kconfigpropagator.h delete mode 100644 libtdepim/kconfigwizard.cpp delete mode 100644 libtdepim/kconfigwizard.h delete mode 100644 libtdepim/kfileio.cpp delete mode 100644 libtdepim/kfileio.h create mode 100644 libtdepim/tdeconfigpropagator.cpp create mode 100644 libtdepim/tdeconfigpropagator.h create mode 100644 libtdepim/tdeconfigwizard.cpp create mode 100644 libtdepim/tdeconfigwizard.h create mode 100644 libtdepim/tdefileio.cpp create mode 100644 libtdepim/tdefileio.h create mode 100644 tdefile-plugins/CMakeLists.txt create mode 100644 tdefile-plugins/Makefile.am create mode 100644 tdefile-plugins/RETURNED_ITEMS create mode 100644 tdefile-plugins/ics/CMakeLists.txt create mode 100644 tdefile-plugins/ics/Makefile.am create mode 100644 tdefile-plugins/ics/tdefile_ics.cpp create mode 100644 tdefile-plugins/ics/tdefile_ics.desktop create mode 100644 tdefile-plugins/ics/tdefile_ics.h create mode 100644 tdefile-plugins/palm-databases/Makefile.am create mode 100644 tdefile-plugins/palm-databases/tdefile_palm.cpp create mode 100644 tdefile-plugins/palm-databases/tdefile_palm.desktop create mode 100644 tdefile-plugins/palm-databases/tdefile_palm.h create mode 100644 tdefile-plugins/rfc822/Makefile.am create mode 100644 tdefile-plugins/rfc822/RETURNED_ITEMS create mode 100644 tdefile-plugins/rfc822/tdefile_rfc822.cpp create mode 100644 tdefile-plugins/rfc822/tdefile_rfc822.desktop create mode 100644 tdefile-plugins/rfc822/tdefile_rfc822.h create mode 100644 tdefile-plugins/vcf/CMakeLists.txt create mode 100644 tdefile-plugins/vcf/Makefile.am create mode 100644 tdefile-plugins/vcf/tdefile_vcf.cpp create mode 100644 tdefile-plugins/vcf/tdefile_vcf.desktop create mode 100644 tdefile-plugins/vcf/tdefile_vcf.h create mode 100644 tdeioslaves/CMakeLists.txt create mode 100644 tdeioslaves/ConfigureChecks.cmake create mode 100644 tdeioslaves/Mainpage.dox create mode 100644 tdeioslaves/Makefile.am create mode 100644 tdeioslaves/configure.in.bot create mode 100644 tdeioslaves/configure.in.in create mode 100644 tdeioslaves/imap4/CMakeLists.txt create mode 100644 tdeioslaves/imap4/Makefile.am create mode 100644 tdeioslaves/imap4/PATCHING create mode 100644 tdeioslaves/imap4/README create mode 100644 tdeioslaves/imap4/configure.in.in create mode 100644 tdeioslaves/imap4/imap4.cc create mode 100644 tdeioslaves/imap4/imap4.h create mode 100644 tdeioslaves/imap4/imap4.protocol create mode 100644 tdeioslaves/imap4/imapcommand.cc create mode 100644 tdeioslaves/imap4/imapcommand.h create mode 100644 tdeioslaves/imap4/imapinfo.cc create mode 100644 tdeioslaves/imap4/imapinfo.h create mode 100644 tdeioslaves/imap4/imaplist.cc create mode 100644 tdeioslaves/imap4/imaplist.h create mode 100644 tdeioslaves/imap4/imapparser.cc create mode 100644 tdeioslaves/imap4/imapparser.h create mode 100644 tdeioslaves/imap4/imaps.protocol create mode 100644 tdeioslaves/imap4/mailaddress.cc create mode 100644 tdeioslaves/imap4/mailaddress.h create mode 100644 tdeioslaves/imap4/mailheader.cc create mode 100644 tdeioslaves/imap4/mailheader.h create mode 100644 tdeioslaves/imap4/mimehdrline.cc create mode 100644 tdeioslaves/imap4/mimehdrline.h create mode 100644 tdeioslaves/imap4/mimeheader.cc create mode 100644 tdeioslaves/imap4/mimeheader.h create mode 100644 tdeioslaves/imap4/mimeio.cc create mode 100644 tdeioslaves/imap4/mimeio.h create mode 100644 tdeioslaves/imap4/rfcdecoder.cc create mode 100644 tdeioslaves/imap4/rfcdecoder.h create mode 100644 tdeioslaves/imap4/selectinfo.h create mode 100644 tdeioslaves/mbox/AUTHORS create mode 100644 tdeioslaves/mbox/CMakeLists.txt create mode 100644 tdeioslaves/mbox/Makefile.am create mode 100644 tdeioslaves/mbox/README create mode 100644 tdeioslaves/mbox/mbox.cc create mode 100644 tdeioslaves/mbox/mbox.h create mode 100644 tdeioslaves/mbox/mbox.protocol create mode 100644 tdeioslaves/mbox/mboxfile.cc create mode 100644 tdeioslaves/mbox/mboxfile.h create mode 100644 tdeioslaves/mbox/readmbox.cc create mode 100644 tdeioslaves/mbox/readmbox.h create mode 100644 tdeioslaves/mbox/stat.cc create mode 100644 tdeioslaves/mbox/stat.h create mode 100644 tdeioslaves/mbox/urlinfo.cc create mode 100644 tdeioslaves/mbox/urlinfo.h create mode 100644 tdeioslaves/opengroupware/Makefile.am create mode 100644 tdeioslaves/opengroupware/opengroupware.cpp create mode 100644 tdeioslaves/opengroupware/opengroupware.h create mode 100644 tdeioslaves/opengroupware/opengroupware.protocol create mode 100644 tdeioslaves/opengroupware/opengroupwares.protocol create mode 100644 tdeioslaves/opengroupware/webdavhandler.cpp create mode 100644 tdeioslaves/opengroupware/webdavhandler.h create mode 100644 tdeioslaves/sieve/CMakeLists.txt create mode 100644 tdeioslaves/sieve/Makefile.am create mode 100644 tdeioslaves/sieve/configure.in.in create mode 100644 tdeioslaves/sieve/draft-daboo-sieve-include.txt create mode 100644 tdeioslaves/sieve/draft-daboo-sieve-spamtest.txt create mode 100644 tdeioslaves/sieve/draft-degener-sieve-body-00.txt create mode 100644 tdeioslaves/sieve/draft-degener-sieve-copy.txt create mode 100644 tdeioslaves/sieve/draft-degener-sieve-editheader.txt create mode 100644 tdeioslaves/sieve/draft-degener-sieve-multiscript.txt create mode 100644 tdeioslaves/sieve/draft-homme-sieve-variables.txt create mode 100644 tdeioslaves/sieve/draft-martin-managesieve-04.txt create mode 100644 tdeioslaves/sieve/draft-martin-sieve-notify-01.txt create mode 100644 tdeioslaves/sieve/draft-melnikov-sieve-imapflags.txt create mode 100644 tdeioslaves/sieve/draft-murchison-sieve-regex-06.txt create mode 100644 tdeioslaves/sieve/draft-murchison-sieve-subaddress-05.txt create mode 100644 tdeioslaves/sieve/draft-showalter-sieve-vacation-04.txt create mode 100644 tdeioslaves/sieve/rfc3028.txt create mode 100644 tdeioslaves/sieve/rfc3431.txt create mode 100644 tdeioslaves/sieve/sieve.cpp create mode 100644 tdeioslaves/sieve/sieve.h create mode 100644 tdeioslaves/sieve/sieve.protocol delete mode 100644 tderesources/groupwise/kioslave/CMakeLists.txt delete mode 100644 tderesources/groupwise/kioslave/Makefile.am delete mode 100644 tderesources/groupwise/kioslave/groupwise.cpp delete mode 100644 tderesources/groupwise/kioslave/groupwise.h delete mode 100644 tderesources/groupwise/kioslave/groupwise.protocol delete mode 100644 tderesources/groupwise/kioslave/groupwises.protocol create mode 100644 tderesources/groupwise/tdeioslave/CMakeLists.txt create mode 100644 tderesources/groupwise/tdeioslave/Makefile.am create mode 100644 tderesources/groupwise/tdeioslave/groupwise.cpp create mode 100644 tderesources/groupwise/tdeioslave/groupwise.h create mode 100644 tderesources/groupwise/tdeioslave/groupwise.protocol create mode 100644 tderesources/groupwise/tdeioslave/groupwises.protocol delete mode 100644 tderesources/scalix/kioslave/CMakeLists.txt delete mode 100644 tderesources/scalix/kioslave/Makefile.am delete mode 100644 tderesources/scalix/kioslave/scalix.cpp delete mode 100644 tderesources/scalix/kioslave/scalix.h delete mode 100644 tderesources/scalix/kioslave/scalix.protocol delete mode 100644 tderesources/scalix/kioslave/scalixs.protocol create mode 100644 tderesources/scalix/tdeioslave/CMakeLists.txt create mode 100644 tderesources/scalix/tdeioslave/Makefile.am create mode 100644 tderesources/scalix/tdeioslave/scalix.cpp create mode 100644 tderesources/scalix/tdeioslave/scalix.h create mode 100644 tderesources/scalix/tdeioslave/scalix.protocol create mode 100644 tderesources/scalix/tdeioslave/scalixs.protocol diff --git a/CMakeLists.txt b/CMakeLists.txt index 259b7320..5a6e8d87 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,7 +97,7 @@ option( BUILD_LIBKPGP "Build libkpgp" ${BUILD_ALL} ) option( BUILD_MIMELIB "Build mimelib" ${BUILD_ALL} ) option( BUILD_LIBKSIEVE "Build libksieve" ${BUILD_ALL} ) option( BUILD_LIBKPIMEXCHANGE "Build libkpimexchange" ${BUILD_ALL} ) -option( BUILD_KIOSLAVES "Build kioslaves" ${BUILD_ALL} ) +option( BUILD_KIOSLAVES "Build tdeioslaves" ${BUILD_ALL} ) option( BUILD_KMAIL "Build kmail" ${BUILD_ALL} ) option( BUILD_AKREGATOR "Build akregator" ${BUILD_ALL} ) option( BUILD_KALARM "Build kalarm" ${BUILD_ALL} ) @@ -115,7 +115,7 @@ option( BUILD_KABC "Build kabc" ${BUILD_ALL} ) option( BUILD_KONSOLEKALENDAR "Build konsolekalendar" ${BUILD_ALL} ) option( BUILD_KMAILCVT "Build kmailcvt" ${BUILD_ALL} ) option( BUILD_KARM "Build karm" ${BUILD_ALL} ) -option( BUILD_KFILE_PLUGINS "Build kfile-plugins" ${BUILD_ALL} ) +option( BUILD_KFILE_PLUGINS "Build tdefile-plugins" ${BUILD_ALL} ) option( BUILD_KANDY "Build kandy" ${BUILD_ALL} ) option( BUILD_KNODE "Build knode" ${BUILD_ALL} ) option( BUILD_KMOBILE "Build kmobile" ${BUILD_ALL} ) @@ -168,7 +168,7 @@ tde_conditional_add_subdirectory( BUILD_LIBKPGP libkpgp ) tde_conditional_add_subdirectory( BUILD_MIMELIB mimelib ) tde_conditional_add_subdirectory( BUILD_LIBKSIEVE libksieve ) tde_conditional_add_subdirectory( BUILD_LIBKPIMEXCHANGE libkpimexchange ) -tde_conditional_add_subdirectory( BUILD_KIOSLAVES kioslaves ) +tde_conditional_add_subdirectory( BUILD_KIOSLAVES tdeioslaves ) tde_conditional_add_subdirectory( BUILD_KMAIL kmail ) tde_conditional_add_subdirectory( BUILD_AKREGATOR akregator ) tde_conditional_add_subdirectory( BUILD_KALARM kalarm ) @@ -187,7 +187,7 @@ tde_conditional_add_subdirectory( BUILD_KABC kabc ) tde_conditional_add_subdirectory( BUILD_KONSOLEKALENDAR konsolekalendar ) tde_conditional_add_subdirectory( BUILD_KMAILCVT kmailcvt ) tde_conditional_add_subdirectory( BUILD_KARM karm ) -tde_conditional_add_subdirectory( BUILD_KFILE_PLUGINS kfile-plugins ) +tde_conditional_add_subdirectory( BUILD_KFILE_PLUGINS tdefile-plugins ) tde_conditional_add_subdirectory( BUILD_KANDY kandy ) tde_conditional_add_subdirectory( BUILD_KNODE knode ) tde_conditional_add_subdirectory( BUILD_KMOBILE kmobile ) diff --git a/MAINTAINERS b/MAINTAINERS index a4ee9665..3a2dc538 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -7,9 +7,9 @@ kandy Cornelius Schumacher karm Mark Bucciarelli kdgantt Kalle Dalheimer Lutz Rogowski -kfile-plugins ? +tdefile-plugins ? kgantt ? Jochen Hanff -kioslaves ? Marc Mutz +tdeioslaves ? Marc Mutz kitchensync Cornelius Schumacher Holger Freyther kmail Ingo Kloecker diff --git a/Mainpage.dox b/Mainpage.dox index eaf9f1f2..f3311b22 100644 --- a/Mainpage.dox +++ b/Mainpage.dox @@ -29,7 +29,7 @@ * - karm * (classes)\n * A time tracker. - * - kfile-plugins + * - tdefile-plugins * * - kgantt * (classes)\n diff --git a/Makefile.am.in b/Makefile.am.in index dd70a20c..77bd7367 100644 --- a/Makefile.am.in +++ b/Makefile.am.in @@ -11,7 +11,7 @@ COMPILE_AFTER_libkmime = libemailfunctions COMPILE_AFTER_libemailfunctions = libkcal libkpimidentities kmail korganizer COMPILE_AFTER_libkholidays = korganizer kontact -COMPILE_AFTER_libkcal = kalarm kitchensync konsolekalendar korganizer libkpimexchange libtdepim karm knotes tderesources kfile-plugins +COMPILE_AFTER_libkcal = kalarm kitchensync konsolekalendar korganizer libkpimexchange libtdepim karm knotes tderesources tdefile-plugins COMPILE_AFTER_mimelib = korn kmail COMPILE_AFTER_libtdenetwork = kmail knode COMPILE_AFTER_libksieve = kmail @@ -28,7 +28,7 @@ COMPILE_BEFORE_knode= libtdepim libkpgp libkmime COMPILE_BEFORE_karm = libtdepim tderesources COMPILE_BEFORE_plugins = kmail libtdepim libkcal COMPILE_BEFORE_kontact = kaddressbook knotes korganizer akregator karm -COMPILE_BEFORE_kioslaves = libkmime libtdepim +COMPILE_BEFORE_tdeioslaves = libkmime libtdepim COMPILE_BEFORE_libkpimexchange = libtdepim COMPILE_BEFORE_kalarm = libtdepim libkmime COMPILE_BEFORE_tderesources = libkpimexchange knotes kaddressbook kode diff --git a/NewsLog.txt b/NewsLog.txt index cc5cdc4c..9b36e32f 100644 --- a/NewsLog.txt +++ b/NewsLog.txt @@ -1475,7 +1475,7 @@ Problems addressed ------------------- * Prevent crash after changing the layout and replying then. (778728) -* kolab/issue2442 kolab/issue2442 (kioslave crashs after closing kontact, if the vacation reminder is activated. (779694) +* kolab/issue2442 kolab/issue2442 (tdeioslave crashs after closing kontact, if the vacation reminder is activated. (779694) * "Enterprise headers" makes impossible to select text in first paragraph of body. [ kde-bug#151150 ] (779994) * kolab/issue1700 kleopatra crashes after ldap search. (780211) * kolab/issue2168 Email attachment overlay view, header style "enterprise" : Should be made foldable (780250) diff --git a/README b/README index 9139a476..2837f0b9 100644 --- a/README +++ b/README @@ -32,7 +32,7 @@ What it is * kontact: Integrated PIM application * karm: Time tracker. * kitchensync: Synchronization framework, still under heavy development. -* kfile-plugins: vCard KFIleItem plugin. +* tdefile-plugins: vCard KFIleItem plugin. * knotes: yellow notes application * konsolecalendar: Command line tool for accessing calendar files. * korn: mail checker @@ -53,7 +53,7 @@ There is also quite an amount of infrastructure in this package: plugin of KOrganizer * kdgantt: alternative lib for Gantt diagrams, used by the free/busy view of KOrganizer (yes, we should decide for one of the Gantt libs) -* kioslaves/sieve: Sieve kioslave +* tdeioslaves/sieve: Sieve tdeioslave * ktnef: handling of tnef data The following subdirectories have been moved to kdenonbeta/tdepim: diff --git a/README.Kolab b/README.Kolab index 8253c447..85181185 100644 --- a/README.Kolab +++ b/README.Kolab @@ -76,7 +76,7 @@ General Notes: ============== Autocompletion: Works in both KMail and KOrganizer. The order of resources used for completion is as follows: - 1. All available addressbook resources as seen in "kcmshell tderesources", section "kabc" + 1. All available addressbook resources as seen in "tdecmshell tderesources", section "kabc" 2. LDAP Nothing special, AFAIK diff --git a/akregator/src/CMakeLists.txt b/akregator/src/CMakeLists.txt index 621880eb..b1bb367d 100644 --- a/akregator/src/CMakeLists.txt +++ b/akregator/src/CMakeLists.txt @@ -83,7 +83,7 @@ tde_add_library( akregatorprivate SHARED AUTOMOC tagset.cpp trayicon.cpp treenode.cpp treenodevisitor.cpp utils.cpp VERSION 0.0.0 - LINK rsslocal-static kio-shared + LINK rsslocal-static tdeio-shared DESTINATION ${LIB_INSTALL_DIR} ) diff --git a/akregator/src/akregator_part.cpp b/akregator/src/akregator_part.cpp index 3ea4e798..3ff787ea 100644 --- a/akregator/src/akregator_part.cpp +++ b/akregator/src/akregator_part.cpp @@ -28,9 +28,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include #include @@ -44,7 +44,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/akregator/src/akregator_view.cpp b/akregator/src/akregator_view.cpp index 3066760a..d9f39710 100644 --- a/akregator/src/akregator_view.cpp +++ b/akregator/src/akregator_view.cpp @@ -62,11 +62,11 @@ #include #include #include -#include +#include #include #include -#include -#include +#include +#include #include #include #include diff --git a/akregator/src/akregatorconfig.kcfgc b/akregator/src/akregatorconfig.kcfgc index 5602bc56..66183471 100644 --- a/akregator/src/akregatorconfig.kcfgc +++ b/akregator/src/akregatorconfig.kcfgc @@ -1,4 +1,4 @@ -# Code generation options for kconfig_compiler +# Code generation options for tdeconfig_compiler File=akregator.kcfg ClassName=Settings NameSpace=Akregator diff --git a/akregator/src/articlefilter.cpp b/akregator/src/articlefilter.cpp index 27ecd64e..1bb5646a 100644 --- a/akregator/src/articlefilter.cpp +++ b/akregator/src/articlefilter.cpp @@ -29,7 +29,7 @@ #include "shared.h" #include -#include +#include #include #include diff --git a/akregator/src/articleviewer.cpp b/akregator/src/articleviewer.cpp index dfd48ffe..68af3860 100644 --- a/akregator/src/articleviewer.cpp +++ b/akregator/src/articleviewer.cpp @@ -38,8 +38,8 @@ #include #include #include -#include -#include +#include +#include #include "aboutdata.h" #include "akregator_run.h" diff --git a/akregator/src/configdialog.h b/akregator/src/configdialog.h index db2161cb..3fd7c8f2 100644 --- a/akregator/src/configdialog.h +++ b/akregator/src/configdialog.h @@ -25,7 +25,7 @@ #ifndef AKREGATOR_CONFIGDIALOG_H #define AKREGATOR_CONFIGDIALOG_H -#include +#include namespace Akregator { diff --git a/akregator/src/librss/image.cpp b/akregator/src/librss/image.cpp index 4dff9822..383d76b9 100644 --- a/akregator/src/librss/image.cpp +++ b/akregator/src/librss/image.cpp @@ -11,7 +11,7 @@ #include "image.h" #include "tools_p.h" -#include +#include #include #include diff --git a/akregator/src/librss/loader.cpp b/akregator/src/librss/loader.cpp index 12036ec9..ea0134e6 100644 --- a/akregator/src/librss/loader.cpp +++ b/akregator/src/librss/loader.cpp @@ -12,7 +12,7 @@ #include "document.h" #include "feeddetector.h" -#include +#include #include #include #include diff --git a/akregator/src/librss/loader.h b/akregator/src/librss/loader.h index a0c9f29d..0d5ec596 100644 --- a/akregator/src/librss/loader.h +++ b/akregator/src/librss/loader.h @@ -114,7 +114,7 @@ namespace RSS /** * @return The error code for the last process of retrieving data. * The returned numbers correspond directly to the error codes - * as + * as * defined by KIO. */ virtual int errorCode() const; diff --git a/akregator/src/mainwindow.cpp b/akregator/src/mainwindow.cpp index f6e5ec18..293d60ad 100644 --- a/akregator/src/mainwindow.cpp +++ b/akregator/src/mainwindow.cpp @@ -32,10 +32,10 @@ #include #include -#include +#include #include #include -#include +#include #include #include #include diff --git a/akregator/src/mainwindow.h b/akregator/src/mainwindow.h index bb3ca733..6f0374b6 100644 --- a/akregator/src/mainwindow.h +++ b/akregator/src/mainwindow.h @@ -33,7 +33,7 @@ #include #include #include -#include +#include class KActionCollection; class KToggleAction; diff --git a/akregator/src/mk4storage/CMakeLists.txt b/akregator/src/mk4storage/CMakeLists.txt index 99ff7a2a..c229d6ec 100644 --- a/akregator/src/mk4storage/CMakeLists.txt +++ b/akregator/src/mk4storage/CMakeLists.txt @@ -39,6 +39,6 @@ tde_add_kpart( libakregator_mk4storage_plugin AUTOMOC storagefactorymk4impl.cpp LINK rsslocal-static metakitlocal-static - akregatorprivate-shared kio-shared + akregatorprivate-shared tdeio-shared DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/akregator/src/pageviewer.cpp b/akregator/src/pageviewer.cpp index d80cccfb..19523722 100644 --- a/akregator/src/pageviewer.cpp +++ b/akregator/src/pageviewer.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/akregator/src/viewer.cpp b/akregator/src/viewer.cpp index 299cedd1..74f2ca2a 100644 --- a/akregator/src/viewer.cpp +++ b/akregator/src/viewer.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include #include diff --git a/certmanager/certificatewizardimpl.cpp b/certmanager/certificatewizardimpl.cpp index 364c5cd0..f153674b 100644 --- a/certmanager/certificatewizardimpl.cpp +++ b/certmanager/certificatewizardimpl.cpp @@ -60,8 +60,8 @@ #include #include #include -#include -#include +#include +#include // TQt #include diff --git a/certmanager/certmanager.cpp b/certmanager/certmanager.cpp index 7c86e8b2..9c1fe389 100644 --- a/certmanager/certmanager.cpp +++ b/certmanager/certmanager.cpp @@ -71,7 +71,7 @@ #include // KDE -#include +#include #include #include #include @@ -85,8 +85,8 @@ #include #include #include -#include -#include +#include +#include #include // TQt diff --git a/certmanager/conf/appearanceconfigwidget.cpp b/certmanager/conf/appearanceconfigwidget.cpp index 96c0bfff..3c2c7c04 100644 --- a/certmanager/conf/appearanceconfigwidget.cpp +++ b/certmanager/conf/appearanceconfigwidget.cpp @@ -41,7 +41,7 @@ #include #include -#include +#include #include #include #include diff --git a/certmanager/conf/configuredialog.cpp b/certmanager/conf/configuredialog.cpp index fde9df9d..83879de8 100644 --- a/certmanager/conf/configuredialog.cpp +++ b/certmanager/conf/configuredialog.cpp @@ -35,7 +35,7 @@ #include #include -#include +#include #include ConfigureDialog::ConfigureDialog( TQWidget *parent, const char *name, bool modal ) diff --git a/certmanager/conf/dirservconfigpage.cpp b/certmanager/conf/dirservconfigpage.cpp index 40ab0998..769b9532 100644 --- a/certmanager/conf/dirservconfigpage.cpp +++ b/certmanager/conf/dirservconfigpage.cpp @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include diff --git a/certmanager/kwatchgnupg/kwatchgnupgconfig.cpp b/certmanager/kwatchgnupg/kwatchgnupgconfig.cpp index 200175b2..1cb31ef4 100644 --- a/certmanager/kwatchgnupg/kwatchgnupgconfig.cpp +++ b/certmanager/kwatchgnupg/kwatchgnupgconfig.cpp @@ -34,7 +34,7 @@ #include #include -#include +#include #include #include diff --git a/certmanager/kwatchgnupg/kwatchgnupgmainwin.cpp b/certmanager/kwatchgnupg/kwatchgnupgmainwin.cpp index 9bcd0b39..6dbca982 100644 --- a/certmanager/kwatchgnupg/kwatchgnupgmainwin.cpp +++ b/certmanager/kwatchgnupg/kwatchgnupgmainwin.cpp @@ -44,8 +44,8 @@ #include #include #include -#include -#include +#include +#include #include #include diff --git a/certmanager/lib/CMakeLists.txt b/certmanager/lib/CMakeLists.txt index 79c729f3..74dc46ea 100644 --- a/certmanager/lib/CMakeLists.txt +++ b/certmanager/lib/CMakeLists.txt @@ -47,6 +47,6 @@ tde_add_library( kleopatra SHARED AUTOMOC LINK kleopatra_backend_qgpgme-static kleopatra_backend_chiasmus-static - qgpgme-shared kio-shared + qgpgme-shared tdeio-shared DESTINATION ${LIB_INSTALL_DIR} ) diff --git a/certmanager/lib/backends/chiasmus/chiasmusbackend.cpp b/certmanager/lib/backends/chiasmus/chiasmusbackend.cpp index da875e30..53ad316d 100644 --- a/certmanager/lib/backends/chiasmus/chiasmusbackend.cpp +++ b/certmanager/lib/backends/chiasmus/chiasmusbackend.cpp @@ -43,7 +43,7 @@ #include "kleo/cryptoconfig.h" #include -#include +#include #include #include diff --git a/certmanager/lib/cryptplugfactory.cpp b/certmanager/lib/cryptplugfactory.cpp index a5015a54..50db2ab7 100644 --- a/certmanager/lib/cryptplugfactory.cpp +++ b/certmanager/lib/cryptplugfactory.cpp @@ -37,7 +37,7 @@ #include "cryptplugfactory.h" #include "cryptplugwrapperlist.h" -#include +#include #include #include #include diff --git a/certmanager/lib/cryptplugwrapper.cpp b/certmanager/lib/cryptplugwrapper.cpp index f997e930..eb2ccafe 100644 --- a/certmanager/lib/cryptplugwrapper.cpp +++ b/certmanager/lib/cryptplugwrapper.cpp @@ -64,7 +64,7 @@ #include #include #include -#include +#include // other #include diff --git a/certmanager/lib/kleo/CMakeLists.txt b/certmanager/lib/kleo/CMakeLists.txt index 63d238e7..aab4ce21 100644 --- a/certmanager/lib/kleo/CMakeLists.txt +++ b/certmanager/lib/kleo/CMakeLists.txt @@ -43,6 +43,6 @@ tde_add_library( kleopatra_core STATIC_PIC AUTOMOC SOURCES cryptobackend.cpp cryptobackendfactory.cpp enum.cpp dn.cpp job.cpp multideletejob.cpp - hierarchicalkeylistjob.cpp kconfigbasedkeyfilter.cpp + hierarchicalkeylistjob.cpp tdeconfigbasedkeyfilter.cpp keyfiltermanager.cpp ) diff --git a/certmanager/lib/kleo/Makefile.am b/certmanager/lib/kleo/Makefile.am index ad9054d1..b81d43bf 100644 --- a/certmanager/lib/kleo/Makefile.am +++ b/certmanager/lib/kleo/Makefile.am @@ -14,7 +14,7 @@ libkleopatra_core_la_SOURCES = \ multideletejob.cpp \ hierarchicalkeylistjob.cpp \ \ - kconfigbasedkeyfilter.cpp \ + tdeconfigbasedkeyfilter.cpp \ keyfiltermanager.cpp kleodir = $(includedir)/kleo diff --git a/certmanager/lib/kleo/cryptobackendfactory.cpp b/certmanager/lib/kleo/cryptobackendfactory.cpp index f67343ca..0397e168 100644 --- a/certmanager/lib/kleo/cryptobackendfactory.cpp +++ b/certmanager/lib/kleo/cryptobackendfactory.cpp @@ -46,7 +46,7 @@ #include #include -#include +#include #include #include #include diff --git a/certmanager/lib/kleo/dn.cpp b/certmanager/lib/kleo/dn.cpp index 3249cc73..847127ea 100644 --- a/certmanager/lib/kleo/dn.cpp +++ b/certmanager/lib/kleo/dn.cpp @@ -40,7 +40,7 @@ #include "ui/dnattributeorderconfigwidget.h" #include -#include +#include #include #include diff --git a/certmanager/lib/kleo/kconfigbasedkeyfilter.cpp b/certmanager/lib/kleo/kconfigbasedkeyfilter.cpp deleted file mode 100644 index 4ed6ab37..00000000 --- a/certmanager/lib/kleo/kconfigbasedkeyfilter.cpp +++ /dev/null @@ -1,251 +0,0 @@ -/* - kconfigbasedkeyfilter.cpp - - This file is part of libkleopatra, the KDE keymanagement library - Copyright (c) 2004 Klarälvdalens Datakonsult AB - - Libkleopatra is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - Libkleopatra is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the TQt library by Trolltech AS, Norway (or with modified versions - of TQt that use the same license as TQt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - TQt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "kconfigbasedkeyfilter.h" - -#include -#include - -static const struct { - const char * name; - GpgME::Key::OwnerTrust trust; - GpgME::UserID::Validity validity; -} ownerTrustAndValidityMap[] = { - { "unknown", GpgME::Key::Unknown, GpgME::UserID::Unknown }, - { "undefined", GpgME::Key::Undefined, GpgME::UserID::Undefined }, - { "never", GpgME::Key::Never, GpgME::UserID::Never }, - { "marginal", GpgME::Key::Marginal, GpgME::UserID::Marginal }, - { "full", GpgME::Key::Full, GpgME::UserID::Full }, - { "ultimate", GpgME::Key::Ultimate, GpgME::UserID::Ultimate }, -}; - -static GpgME::Key::OwnerTrust map2OwnerTrust( const TQString & s ) { - for ( unsigned int i = 0 ; i < sizeof ownerTrustAndValidityMap / sizeof *ownerTrustAndValidityMap ; ++i ) - if ( s.lower() == ownerTrustAndValidityMap[i].name ) - return ownerTrustAndValidityMap[i].trust; - return ownerTrustAndValidityMap[0].trust; -} - -static GpgME::UserID::Validity map2Validity( const TQString & s ) { - for ( unsigned int i = 0 ; i < sizeof ownerTrustAndValidityMap / sizeof *ownerTrustAndValidityMap ; ++i ) - if ( s.lower() == ownerTrustAndValidityMap[i].name ) - return ownerTrustAndValidityMap[i].validity; - return ownerTrustAndValidityMap[0].validity; -} - - -Kleo::TDEConfigBasedKeyFilter::TDEConfigBasedKeyFilter( const TDEConfigBase & config ) - : KeyFilter(), - mSpecificity( 0 ), - mItalic( false ), - mBold( false ), - mStrikeOut( false ), - mUseFullFont( false ), - mRevoked( DoesNotMatter ), - mExpired( DoesNotMatter ), - mDisabled( DoesNotMatter ), - mRoot( DoesNotMatter ), - mCanEncrypt( DoesNotMatter ), - mCanSign( DoesNotMatter ), - mCanCertify( DoesNotMatter ), - mCanAuthenticate( DoesNotMatter ), - mHasSecret( DoesNotMatter ), - mIsOpenPGP( DoesNotMatter ), - mWasValidated( DoesNotMatter ), - mOwnerTrust( LevelDoesNotMatter ), - mOwnerTrustReferenceLevel( GpgME::Key::Unknown ), - mValidity( LevelDoesNotMatter ), - mValidityReferenceLevel( GpgME::UserID::Unknown ) -{ - mFgColor = config.readColorEntry( "foreground-color" ); - mBgColor = config.readColorEntry( "background-color" ); - mName = config.readEntry( "name", i18n("") ); - mIcon = config.readEntry( "icon" ); - if ( config.hasKey( "font" ) ) { - mUseFullFont = true; - mFont = config.readFontEntry( "font" ); - } else { - mItalic = config.readBoolEntry( "font-italic", false ); - mBold = config.readBoolEntry( "font-bold", false ); - } - mStrikeOut = config.readBoolEntry( "font-strikeout", false ); -#ifdef SET -#undef SET -#endif -#define SET(member,key) \ - if ( config.hasKey( key ) ) { \ - member = config.readBoolEntry( key ) ? Set : NotSet ; \ - ++mSpecificity; \ - } - SET( mRevoked, "is-revoked" ); - SET( mExpired, "is-expired" ); - SET( mDisabled, "is-disabled" ); - SET( mRoot, "is-root-certificate" ); - SET( mCanEncrypt, "can-encrypt" ); - SET( mCanSign, "can-sign" ); - SET( mCanCertify, "can-certify" ); - SET( mCanAuthenticate, "can-authenticate" ); - SET( mHasSecret, "has-secret-key" ); - SET( mIsOpenPGP, "is-openpgp-key" ); - SET( mWasValidated, "was-validated" ); -#undef SET - static const struct { - const char * prefix; - LevelState state; - } prefixMap[] = { - { "is-", Is }, - { "is-not-", IsNot }, - { "is-at-least-", IsAtLeast }, - { "is-at-most-", IsAtMost }, - }; - for ( unsigned int i = 0 ; i < sizeof prefixMap / sizeof *prefixMap ; ++i ) { - const TQString key = TQString( prefixMap[i].prefix ) + "ownertrust"; - if ( config.hasKey( key ) ) { - mOwnerTrust = prefixMap[i].state; - mOwnerTrustReferenceLevel = map2OwnerTrust( config.readEntry( key ) ); - ++mSpecificity; - break; - } - } - for ( unsigned int i = 0 ; i < sizeof prefixMap / sizeof *prefixMap ; ++i ) { - const TQString key = TQString( prefixMap[i].prefix ) + "validity"; - if ( config.hasKey( key ) ) { - mValidity = prefixMap[i].state; - mValidityReferenceLevel = map2Validity( config.readEntry( key ) ); - ++mSpecificity; - break; - } - } -} - -Kleo::TDEConfigBasedKeyFilter::~TDEConfigBasedKeyFilter() { - -} - -bool Kleo::TDEConfigBasedKeyFilter::matches( const GpgME::Key & key ) const { -#ifdef MATCH -#undef MATCH -#endif -#define MATCH(member,method) \ - if ( member != DoesNotMatter && key.method() != bool( member == Set ) ) \ - return false -#define IS_MATCH(what) MATCH( m##what, is##what ) -#define CAN_MATCH(what) MATCH( mCan##what, can##what ) - IS_MATCH( Revoked ); - IS_MATCH( Expired ); - IS_MATCH( Disabled ); - IS_MATCH( Root ); - CAN_MATCH( Encrypt ); - CAN_MATCH( Sign ); - CAN_MATCH( Certify ); - CAN_MATCH( Authenticate ); - MATCH( mHasSecret, isSecret ); -#undef MATCH - if ( mIsOpenPGP != DoesNotMatter && - bool( key.protocol() == GpgME::Context::OpenPGP ) != bool( mIsOpenPGP == Set ) ) - return false; - if ( mWasValidated != DoesNotMatter && - bool( key.keyListMode() & GpgME::Context::Validate ) != bool( mWasValidated == Set ) ) - return false; - switch ( mOwnerTrust ) { - default: - case LevelDoesNotMatter: - break; - case Is: - if ( key.ownerTrust() != mOwnerTrustReferenceLevel ) - return false; - break; - case IsNot: - if ( key.ownerTrust() == mOwnerTrustReferenceLevel ) - return false; - break; - case IsAtLeast: - if ( (int)key.ownerTrust() < (int)mOwnerTrustReferenceLevel ) - return false; - break; - case IsAtMost: - if ( (int)key.ownerTrust() > (int)mOwnerTrustReferenceLevel ) - return false; - break; - } - const GpgME::UserID uid = key.userID(0); - switch ( mValidity ) { - default: - case LevelDoesNotMatter: - break; - case Is: - if ( uid.validity() != mValidityReferenceLevel ) - return false; - break; - case IsNot: - if ( uid.validity() == mValidityReferenceLevel ) - return false; - break; - case IsAtLeast: - if ( (int)uid.validity() < (int)mValidityReferenceLevel ) - return false; - break; - case IsAtMost: - if ( (int)uid.validity() > (int)mValidityReferenceLevel ) - return false; - break; - } - return true; -} - -static inline TQFont resizedFont( TQFont font, int pointSize, bool strike ) { - font.setPointSize( pointSize ); - if ( strike ) - font.setStrikeOut( true ); - return font; -} - -static inline TQFont adapt( TQFont font, bool it, bool b, bool strike ) { - if ( it ) - font.setItalic( true ); - if ( b ) - font.setBold( true ); - if ( strike ) - font.setStrikeOut( true ); - return font; -} - -TQFont Kleo::TDEConfigBasedKeyFilter::font( const TQFont & f ) const { - if ( mUseFullFont ) - return resizedFont( mFont, f.pointSize(), mStrikeOut ); - else - return adapt( f, mItalic, mBold, mStrikeOut ); -} diff --git a/certmanager/lib/kleo/kconfigbasedkeyfilter.h b/certmanager/lib/kleo/kconfigbasedkeyfilter.h deleted file mode 100644 index 487b3791..00000000 --- a/certmanager/lib/kleo/kconfigbasedkeyfilter.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - kconfigbasedkeyfilter.h - - This file is part of libkleopatra, the KDE keymanagement library - Copyright (c) 2004 Klarälvdalens Datakonsult AB - - Libkleopatra is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - Libkleopatra is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the TQt library by Trolltech AS, Norway (or with modified versions - of TQt that use the same license as TQt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - TQt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#ifndef __KLEO_KCONFIGBASEDKEYFILTER_H__ -#define __KLEO_KCONFIGBASEDKEYFILTER_H__ - -#include "keyfilter.h" - -#include -#include -#include - -#include - -class TDEConfigBase; - -namespace Kleo { - - class TDEConfigBasedKeyFilter : public KeyFilter { - public: - explicit TDEConfigBasedKeyFilter( const TDEConfigBase & config ); - ~TDEConfigBasedKeyFilter(); - bool matches( const GpgME::Key & key ) const; - - unsigned int specificity() const { return mSpecificity; } - - TQColor fgColor() const { return mFgColor; } - TQColor bgColor() const { return mBgColor; } - TQFont font( const TQFont & ) const; - TQString name() const { return mName; } - TQString icon() const { return mIcon; } - - private: - TQColor mFgColor, mBgColor; - TQString mName; - TQString mIcon; - unsigned int mSpecificity; - bool mItalic; - bool mBold; - bool mStrikeOut; - bool mUseFullFont; - TQFont mFont; - - enum TriState { - DoesNotMatter = 0, - Set = 1, - NotSet = 2 - }; - TriState mRevoked; - TriState mExpired; - TriState mDisabled; - TriState mRoot; - TriState mCanEncrypt; - TriState mCanSign; - TriState mCanCertify; - TriState mCanAuthenticate; - TriState mHasSecret; - TriState mIsOpenPGP; - TriState mWasValidated; - enum LevelState { - LevelDoesNotMatter = 0, - Is = 1, - IsNot = 2, - IsAtLeast = 3, - IsAtMost = 4 - }; - LevelState mOwnerTrust; - GpgME::Key::OwnerTrust mOwnerTrustReferenceLevel; - LevelState mValidity; - GpgME::UserID::Validity mValidityReferenceLevel; - }; - -} - -#endif // __KLEO_KCONFIGBASEDKEYFILTER_H__ diff --git a/certmanager/lib/kleo/keyfiltermanager.cpp b/certmanager/lib/kleo/keyfiltermanager.cpp index 1276f9fd..1aa2b170 100644 --- a/certmanager/lib/kleo/keyfiltermanager.cpp +++ b/certmanager/lib/kleo/keyfiltermanager.cpp @@ -35,11 +35,11 @@ #endif #include "keyfiltermanager.h" -#include "kconfigbasedkeyfilter.h" +#include "tdeconfigbasedkeyfilter.h" #include "cryptobackendfactory.h" -#include +#include #include #include diff --git a/certmanager/lib/kleo/tdeconfigbasedkeyfilter.cpp b/certmanager/lib/kleo/tdeconfigbasedkeyfilter.cpp new file mode 100644 index 00000000..05c6d04d --- /dev/null +++ b/certmanager/lib/kleo/tdeconfigbasedkeyfilter.cpp @@ -0,0 +1,251 @@ +/* + tdeconfigbasedkeyfilter.cpp + + This file is part of libkleopatra, the KDE keymanagement library + Copyright (c) 2004 Klarälvdalens Datakonsult AB + + Libkleopatra is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + Libkleopatra is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the TQt library by Trolltech AS, Norway (or with modified versions + of TQt that use the same license as TQt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + TQt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "tdeconfigbasedkeyfilter.h" + +#include +#include + +static const struct { + const char * name; + GpgME::Key::OwnerTrust trust; + GpgME::UserID::Validity validity; +} ownerTrustAndValidityMap[] = { + { "unknown", GpgME::Key::Unknown, GpgME::UserID::Unknown }, + { "undefined", GpgME::Key::Undefined, GpgME::UserID::Undefined }, + { "never", GpgME::Key::Never, GpgME::UserID::Never }, + { "marginal", GpgME::Key::Marginal, GpgME::UserID::Marginal }, + { "full", GpgME::Key::Full, GpgME::UserID::Full }, + { "ultimate", GpgME::Key::Ultimate, GpgME::UserID::Ultimate }, +}; + +static GpgME::Key::OwnerTrust map2OwnerTrust( const TQString & s ) { + for ( unsigned int i = 0 ; i < sizeof ownerTrustAndValidityMap / sizeof *ownerTrustAndValidityMap ; ++i ) + if ( s.lower() == ownerTrustAndValidityMap[i].name ) + return ownerTrustAndValidityMap[i].trust; + return ownerTrustAndValidityMap[0].trust; +} + +static GpgME::UserID::Validity map2Validity( const TQString & s ) { + for ( unsigned int i = 0 ; i < sizeof ownerTrustAndValidityMap / sizeof *ownerTrustAndValidityMap ; ++i ) + if ( s.lower() == ownerTrustAndValidityMap[i].name ) + return ownerTrustAndValidityMap[i].validity; + return ownerTrustAndValidityMap[0].validity; +} + + +Kleo::TDEConfigBasedKeyFilter::TDEConfigBasedKeyFilter( const TDEConfigBase & config ) + : KeyFilter(), + mSpecificity( 0 ), + mItalic( false ), + mBold( false ), + mStrikeOut( false ), + mUseFullFont( false ), + mRevoked( DoesNotMatter ), + mExpired( DoesNotMatter ), + mDisabled( DoesNotMatter ), + mRoot( DoesNotMatter ), + mCanEncrypt( DoesNotMatter ), + mCanSign( DoesNotMatter ), + mCanCertify( DoesNotMatter ), + mCanAuthenticate( DoesNotMatter ), + mHasSecret( DoesNotMatter ), + mIsOpenPGP( DoesNotMatter ), + mWasValidated( DoesNotMatter ), + mOwnerTrust( LevelDoesNotMatter ), + mOwnerTrustReferenceLevel( GpgME::Key::Unknown ), + mValidity( LevelDoesNotMatter ), + mValidityReferenceLevel( GpgME::UserID::Unknown ) +{ + mFgColor = config.readColorEntry( "foreground-color" ); + mBgColor = config.readColorEntry( "background-color" ); + mName = config.readEntry( "name", i18n("") ); + mIcon = config.readEntry( "icon" ); + if ( config.hasKey( "font" ) ) { + mUseFullFont = true; + mFont = config.readFontEntry( "font" ); + } else { + mItalic = config.readBoolEntry( "font-italic", false ); + mBold = config.readBoolEntry( "font-bold", false ); + } + mStrikeOut = config.readBoolEntry( "font-strikeout", false ); +#ifdef SET +#undef SET +#endif +#define SET(member,key) \ + if ( config.hasKey( key ) ) { \ + member = config.readBoolEntry( key ) ? Set : NotSet ; \ + ++mSpecificity; \ + } + SET( mRevoked, "is-revoked" ); + SET( mExpired, "is-expired" ); + SET( mDisabled, "is-disabled" ); + SET( mRoot, "is-root-certificate" ); + SET( mCanEncrypt, "can-encrypt" ); + SET( mCanSign, "can-sign" ); + SET( mCanCertify, "can-certify" ); + SET( mCanAuthenticate, "can-authenticate" ); + SET( mHasSecret, "has-secret-key" ); + SET( mIsOpenPGP, "is-openpgp-key" ); + SET( mWasValidated, "was-validated" ); +#undef SET + static const struct { + const char * prefix; + LevelState state; + } prefixMap[] = { + { "is-", Is }, + { "is-not-", IsNot }, + { "is-at-least-", IsAtLeast }, + { "is-at-most-", IsAtMost }, + }; + for ( unsigned int i = 0 ; i < sizeof prefixMap / sizeof *prefixMap ; ++i ) { + const TQString key = TQString( prefixMap[i].prefix ) + "ownertrust"; + if ( config.hasKey( key ) ) { + mOwnerTrust = prefixMap[i].state; + mOwnerTrustReferenceLevel = map2OwnerTrust( config.readEntry( key ) ); + ++mSpecificity; + break; + } + } + for ( unsigned int i = 0 ; i < sizeof prefixMap / sizeof *prefixMap ; ++i ) { + const TQString key = TQString( prefixMap[i].prefix ) + "validity"; + if ( config.hasKey( key ) ) { + mValidity = prefixMap[i].state; + mValidityReferenceLevel = map2Validity( config.readEntry( key ) ); + ++mSpecificity; + break; + } + } +} + +Kleo::TDEConfigBasedKeyFilter::~TDEConfigBasedKeyFilter() { + +} + +bool Kleo::TDEConfigBasedKeyFilter::matches( const GpgME::Key & key ) const { +#ifdef MATCH +#undef MATCH +#endif +#define MATCH(member,method) \ + if ( member != DoesNotMatter && key.method() != bool( member == Set ) ) \ + return false +#define IS_MATCH(what) MATCH( m##what, is##what ) +#define CAN_MATCH(what) MATCH( mCan##what, can##what ) + IS_MATCH( Revoked ); + IS_MATCH( Expired ); + IS_MATCH( Disabled ); + IS_MATCH( Root ); + CAN_MATCH( Encrypt ); + CAN_MATCH( Sign ); + CAN_MATCH( Certify ); + CAN_MATCH( Authenticate ); + MATCH( mHasSecret, isSecret ); +#undef MATCH + if ( mIsOpenPGP != DoesNotMatter && + bool( key.protocol() == GpgME::Context::OpenPGP ) != bool( mIsOpenPGP == Set ) ) + return false; + if ( mWasValidated != DoesNotMatter && + bool( key.keyListMode() & GpgME::Context::Validate ) != bool( mWasValidated == Set ) ) + return false; + switch ( mOwnerTrust ) { + default: + case LevelDoesNotMatter: + break; + case Is: + if ( key.ownerTrust() != mOwnerTrustReferenceLevel ) + return false; + break; + case IsNot: + if ( key.ownerTrust() == mOwnerTrustReferenceLevel ) + return false; + break; + case IsAtLeast: + if ( (int)key.ownerTrust() < (int)mOwnerTrustReferenceLevel ) + return false; + break; + case IsAtMost: + if ( (int)key.ownerTrust() > (int)mOwnerTrustReferenceLevel ) + return false; + break; + } + const GpgME::UserID uid = key.userID(0); + switch ( mValidity ) { + default: + case LevelDoesNotMatter: + break; + case Is: + if ( uid.validity() != mValidityReferenceLevel ) + return false; + break; + case IsNot: + if ( uid.validity() == mValidityReferenceLevel ) + return false; + break; + case IsAtLeast: + if ( (int)uid.validity() < (int)mValidityReferenceLevel ) + return false; + break; + case IsAtMost: + if ( (int)uid.validity() > (int)mValidityReferenceLevel ) + return false; + break; + } + return true; +} + +static inline TQFont resizedFont( TQFont font, int pointSize, bool strike ) { + font.setPointSize( pointSize ); + if ( strike ) + font.setStrikeOut( true ); + return font; +} + +static inline TQFont adapt( TQFont font, bool it, bool b, bool strike ) { + if ( it ) + font.setItalic( true ); + if ( b ) + font.setBold( true ); + if ( strike ) + font.setStrikeOut( true ); + return font; +} + +TQFont Kleo::TDEConfigBasedKeyFilter::font( const TQFont & f ) const { + if ( mUseFullFont ) + return resizedFont( mFont, f.pointSize(), mStrikeOut ); + else + return adapt( f, mItalic, mBold, mStrikeOut ); +} diff --git a/certmanager/lib/kleo/tdeconfigbasedkeyfilter.h b/certmanager/lib/kleo/tdeconfigbasedkeyfilter.h new file mode 100644 index 00000000..3d65e7a2 --- /dev/null +++ b/certmanager/lib/kleo/tdeconfigbasedkeyfilter.h @@ -0,0 +1,104 @@ +/* + tdeconfigbasedkeyfilter.h + + This file is part of libkleopatra, the KDE keymanagement library + Copyright (c) 2004 Klarälvdalens Datakonsult AB + + Libkleopatra is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + Libkleopatra is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the TQt library by Trolltech AS, Norway (or with modified versions + of TQt that use the same license as TQt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + TQt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#ifndef __KLEO_KCONFIGBASEDKEYFILTER_H__ +#define __KLEO_KCONFIGBASEDKEYFILTER_H__ + +#include "keyfilter.h" + +#include +#include +#include + +#include + +class TDEConfigBase; + +namespace Kleo { + + class TDEConfigBasedKeyFilter : public KeyFilter { + public: + explicit TDEConfigBasedKeyFilter( const TDEConfigBase & config ); + ~TDEConfigBasedKeyFilter(); + bool matches( const GpgME::Key & key ) const; + + unsigned int specificity() const { return mSpecificity; } + + TQColor fgColor() const { return mFgColor; } + TQColor bgColor() const { return mBgColor; } + TQFont font( const TQFont & ) const; + TQString name() const { return mName; } + TQString icon() const { return mIcon; } + + private: + TQColor mFgColor, mBgColor; + TQString mName; + TQString mIcon; + unsigned int mSpecificity; + bool mItalic; + bool mBold; + bool mStrikeOut; + bool mUseFullFont; + TQFont mFont; + + enum TriState { + DoesNotMatter = 0, + Set = 1, + NotSet = 2 + }; + TriState mRevoked; + TriState mExpired; + TriState mDisabled; + TriState mRoot; + TriState mCanEncrypt; + TriState mCanSign; + TriState mCanCertify; + TriState mCanAuthenticate; + TriState mHasSecret; + TriState mIsOpenPGP; + TriState mWasValidated; + enum LevelState { + LevelDoesNotMatter = 0, + Is = 1, + IsNot = 2, + IsAtLeast = 3, + IsAtMost = 4 + }; + LevelState mOwnerTrust; + GpgME::Key::OwnerTrust mOwnerTrustReferenceLevel; + LevelState mValidity; + GpgME::UserID::Validity mValidityReferenceLevel; + }; + +} + +#endif // __KLEO_KCONFIGBASEDKEYFILTER_H__ diff --git a/certmanager/lib/ui/dnattributeorderconfigwidget.cpp b/certmanager/lib/ui/dnattributeorderconfigwidget.cpp index 4cfcfb20..67f1929e 100644 --- a/certmanager/lib/ui/dnattributeorderconfigwidget.cpp +++ b/certmanager/lib/ui/dnattributeorderconfigwidget.cpp @@ -42,7 +42,7 @@ #include #include #include -#include +#include #include #include diff --git a/certmanager/lib/ui/keyselectiondialog.cpp b/certmanager/lib/ui/keyselectiondialog.cpp index adb25749..b785137d 100644 --- a/certmanager/lib/ui/keyselectiondialog.cpp +++ b/certmanager/lib/ui/keyselectiondialog.cpp @@ -58,7 +58,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/certmanager/lib/ui/messagebox.cpp b/certmanager/lib/ui/messagebox.cpp index 96b710c3..571ceccd 100644 --- a/certmanager/lib/ui/messagebox.cpp +++ b/certmanager/lib/ui/messagebox.cpp @@ -41,7 +41,7 @@ #include #include -#include +#include #include #include #include diff --git a/certmanager/storedtransferjob.h b/certmanager/storedtransferjob.h index 7fab7706..276d5db4 100644 --- a/certmanager/storedtransferjob.h +++ b/certmanager/storedtransferjob.h @@ -20,7 +20,7 @@ #ifndef STOREDTRANSFERJOB_H #define STOREDTRANSFERJOB_H -#include +#include // To be moved to KIO? namespace TDEIOext { diff --git a/config.h.cmake b/config.h.cmake index 89b739ae..9a020efb 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -21,7 +21,7 @@ #cmakedefine MAX_CMD_LENGTH @MAX_CMD_LENGTH@ #cmakedefine HAVE_C99_INITIALIZERS 1 -// kioslaves +// tdeioslaves #cmakedefine HAVE_LIBSASL2 1 // kmail diff --git a/dependency-graph.dot b/dependency-graph.dot index 5cd9d0cf..9e9953d4 100644 --- a/dependency-graph.dot +++ b/dependency-graph.dot @@ -25,7 +25,7 @@ digraph "inter-dependency graph for tdepim" { "libemailfunctions" -> "libkpimidentities"; "libkcal" -> "kalarm"; "libkcal" -> "karm"; - "libkcal" -> "kfile-plugins"; + "libkcal" -> "tdefile-plugins"; "libkcal" -> "kitchensync"; "libkcal" -> "knotes"; "libkcal" -> "konsolekalendar"; @@ -44,7 +44,7 @@ digraph "inter-dependency graph for tdepim" { "libtdepim" -> "kalarm"; "libtdepim" -> "kandy"; "libtdepim" -> "karm"; - "libtdepim" -> "kioslaves"; + "libtdepim" -> "tdeioslaves"; "libtdepim" -> "kitchensync"; "libtdepim" -> "kmail"; "libtdepim" -> "knode"; @@ -57,7 +57,7 @@ digraph "inter-dependency graph for tdepim" { "libkholidays" -> "kontact"; "libkholidays" -> "korganizer"; "libkmime" -> "kalarm"; - "libkmime" -> "kioslaves"; + "libkmime" -> "tdeioslaves"; "libkmime" -> "kmail"; "libkmime" -> "knode"; "libkpgp" -> "certmanager"; diff --git a/kaddressbook/addresseditwidget.cpp b/kaddressbook/addresseditwidget.cpp index 4e4b6e61..5d17f4ef 100644 --- a/kaddressbook/addresseditwidget.cpp +++ b/kaddressbook/addresseditwidget.cpp @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kaddressbook/addresseeconfig.h b/kaddressbook/addresseeconfig.h index a0dcd45a..c267dce1 100644 --- a/kaddressbook/addresseeconfig.h +++ b/kaddressbook/addresseeconfig.h @@ -25,7 +25,7 @@ #define ADDRESSEECONFIG_H #include -#include +#include using namespace KABC; diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp index e4cd5a3a..c1173b37 100644 --- a/kaddressbook/addresseeeditorwidget.cpp +++ b/kaddressbook/addresseeeditorwidget.cpp @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kaddressbook/common/filter.cpp b/kaddressbook/common/filter.cpp index 1872ecea..e312fbcd 100644 --- a/kaddressbook/common/filter.cpp +++ b/kaddressbook/common/filter.cpp @@ -21,7 +21,7 @@ without including the source code for TQt in the source distribution. */ -#include +#include #include #include "kabprefs.h" diff --git a/kaddressbook/common/filter.h b/kaddressbook/common/filter.h index e8518b8e..68df1036 100644 --- a/kaddressbook/common/filter.h +++ b/kaddressbook/common/filter.h @@ -29,7 +29,7 @@ #include #include -#include +#include /** Filter for AddressBook related objects (Addressees) diff --git a/kaddressbook/common/kabprefs.cpp b/kaddressbook/common/kabprefs.cpp index 8a45fc14..1f9e2410 100644 --- a/kaddressbook/common/kabprefs.cpp +++ b/kaddressbook/common/kabprefs.cpp @@ -21,7 +21,7 @@ without including the source code for TQt in the source distribution. */ -#include +#include #include #include diff --git a/kaddressbook/common/kabprefs_base.kcfgc b/kaddressbook/common/kabprefs_base.kcfgc index 75e0d84d..bc54ae65 100644 --- a/kaddressbook/common/kabprefs_base.kcfgc +++ b/kaddressbook/common/kabprefs_base.kcfgc @@ -1,4 +1,4 @@ -# Code generation options for kconfig_compiler +# Code generation options for tdeconfig_compiler File=kaddressbook.kcfg ClassName=KABPrefsBase Singleton=false diff --git a/kaddressbook/common/locationmap.cpp b/kaddressbook/common/locationmap.cpp index e1f23e66..11fd2c11 100644 --- a/kaddressbook/common/locationmap.cpp +++ b/kaddressbook/common/locationmap.cpp @@ -22,7 +22,7 @@ */ #include -#include +#include #include #include #include diff --git a/kaddressbook/emaileditwidget.cpp b/kaddressbook/emaileditwidget.cpp index 3d94d3b7..a04a88a9 100644 --- a/kaddressbook/emaileditwidget.cpp +++ b/kaddressbook/emaileditwidget.cpp @@ -32,7 +32,7 @@ #include #include -#include +#include #include #include #include diff --git a/kaddressbook/extensionmanager.cpp b/kaddressbook/extensionmanager.cpp index aa17b625..dea1170e 100644 --- a/kaddressbook/extensionmanager.cpp +++ b/kaddressbook/extensionmanager.cpp @@ -22,7 +22,7 @@ */ #include -#include +#include #include #include #include diff --git a/kaddressbook/features/distributionlistwidget.cpp b/kaddressbook/features/distributionlistwidget.cpp index c49deee6..f48b5e96 100644 --- a/kaddressbook/features/distributionlistwidget.cpp +++ b/kaddressbook/features/distributionlistwidget.cpp @@ -31,7 +31,7 @@ #include #include -#include +#include #include #include #include diff --git a/kaddressbook/imagewidget.cpp b/kaddressbook/imagewidget.cpp index 1d64fde3..9ba87d46 100644 --- a/kaddressbook/imagewidget.cpp +++ b/kaddressbook/imagewidget.cpp @@ -24,11 +24,11 @@ #include #include #include -#include +#include #include #include #include -#include +#include #include #include #include diff --git a/kaddressbook/imeditwidget.cpp b/kaddressbook/imeditwidget.cpp index 2f40f5de..9f727120 100644 --- a/kaddressbook/imeditwidget.cpp +++ b/kaddressbook/imeditwidget.cpp @@ -31,7 +31,7 @@ #include #include -#include +#include #include #include #include diff --git a/kaddressbook/interfaces/configurewidget.h b/kaddressbook/interfaces/configurewidget.h index d1d23c8c..e8df353d 100644 --- a/kaddressbook/interfaces/configurewidget.h +++ b/kaddressbook/interfaces/configurewidget.h @@ -26,7 +26,7 @@ #include -#include +#include #include namespace KABC { diff --git a/kaddressbook/kaddressbookview.cpp b/kaddressbook/kaddressbookview.cpp index 15ea63ba..98668618 100644 --- a/kaddressbook/kaddressbookview.cpp +++ b/kaddressbook/kaddressbookview.cpp @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include #include diff --git a/kaddressbook/kcmconfigs/addresseewidget.cpp b/kaddressbook/kcmconfigs/addresseewidget.cpp index 6bbc45be..ce58d272 100644 --- a/kaddressbook/kcmconfigs/addresseewidget.cpp +++ b/kaddressbook/kcmconfigs/addresseewidget.cpp @@ -32,7 +32,7 @@ #include #include -#include +#include #include #include #include diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.cpp b/kaddressbook/kcmconfigs/kabconfigwidget.cpp index 18cb1a90..d63247a4 100644 --- a/kaddressbook/kcmconfigs/kabconfigwidget.cpp +++ b/kaddressbook/kcmconfigs/kabconfigwidget.cpp @@ -32,7 +32,7 @@ #include #include -#include +#include #include #include #include diff --git a/kaddressbook/kcmconfigs/ldapoptionswidget.cpp b/kaddressbook/kcmconfigs/ldapoptionswidget.cpp index 0f33eca6..12ff1104 100644 --- a/kaddressbook/kcmconfigs/ldapoptionswidget.cpp +++ b/kaddressbook/kcmconfigs/ldapoptionswidget.cpp @@ -31,7 +31,7 @@ #include #include -#include +#include #include #include diff --git a/kaddressbook/keywidget.cpp b/kaddressbook/keywidget.cpp index b3fd9af2..8f0ca7bc 100644 --- a/kaddressbook/keywidget.cpp +++ b/kaddressbook/keywidget.cpp @@ -29,8 +29,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/kaddressbook/ldapsearchdialog.cpp b/kaddressbook/ldapsearchdialog.cpp index 6537bebe..b9bdd1f6 100644 --- a/kaddressbook/ldapsearchdialog.cpp +++ b/kaddressbook/ldapsearchdialog.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kaddressbook/nameeditdialog.cpp b/kaddressbook/nameeditdialog.cpp index 8f70f0f8..1bba99ff 100644 --- a/kaddressbook/nameeditdialog.cpp +++ b/kaddressbook/nameeditdialog.cpp @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kaddressbook/phoneeditwidget.cpp b/kaddressbook/phoneeditwidget.cpp index ff787e12..6d3ef0b9 100644 --- a/kaddressbook/phoneeditwidget.cpp +++ b/kaddressbook/phoneeditwidget.cpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kaddressbook/printing/detailledstyle.cpp b/kaddressbook/printing/detailledstyle.cpp index a8062651..949c1783 100644 --- a/kaddressbook/printing/detailledstyle.cpp +++ b/kaddressbook/printing/detailledstyle.cpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kaddressbook/soundwidget.cpp b/kaddressbook/soundwidget.cpp index f4558258..f7beaf20 100644 --- a/kaddressbook/soundwidget.cpp +++ b/kaddressbook/soundwidget.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kaddressbook/thumbnailcreator/Makefile.am b/kaddressbook/thumbnailcreator/Makefile.am index d0d4c789..2f8ba9c8 100644 --- a/kaddressbook/thumbnailcreator/Makefile.am +++ b/kaddressbook/thumbnailcreator/Makefile.am @@ -1,4 +1,4 @@ -# kioslave to generate thumbnails for vCard and LDIF-Files in Konqueror +# tdeioslave to generate thumbnails for vCard and LDIF-Files in Konqueror INCLUDES = $(all_includes) kde_module_LTLIBRARIES = ldifvcardthumbnail.la diff --git a/kaddressbook/thumbnailcreator/ldifvcardcreator.cpp b/kaddressbook/thumbnailcreator/ldifvcardcreator.cpp index 7460ad80..4627ebd5 100644 --- a/kaddressbook/thumbnailcreator/ldifvcardcreator.cpp +++ b/kaddressbook/thumbnailcreator/ldifvcardcreator.cpp @@ -20,7 +20,7 @@ /* * - ldifvcardthumbnail - * - * kioslave which generates tumbnails for vCard and LDIF files. + * tdeioslave which generates tumbnails for vCard and LDIF files. * The thumbnails are used e.g. by Konqueror or in the file selection * dialog. * diff --git a/kaddressbook/thumbnailcreator/ldifvcardcreator.h b/kaddressbook/thumbnailcreator/ldifvcardcreator.h index 2de6c7b4..04f78831 100644 --- a/kaddressbook/thumbnailcreator/ldifvcardcreator.h +++ b/kaddressbook/thumbnailcreator/ldifvcardcreator.h @@ -22,7 +22,7 @@ #define VCARD_LDIFCREATOR_H #include -#include +#include #include // for KABC_VCARD_ENCODING_FIX define class KPixmapSplitter; diff --git a/kaddressbook/viewconfigurefilterpage.cpp b/kaddressbook/viewconfigurefilterpage.cpp index 9602f2d3..3dd0d7d6 100644 --- a/kaddressbook/viewconfigurefilterpage.cpp +++ b/kaddressbook/viewconfigurefilterpage.cpp @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include #include diff --git a/kaddressbook/viewconfigurewidget.cpp b/kaddressbook/viewconfigurewidget.cpp index 415430d9..f2153f82 100644 --- a/kaddressbook/viewconfigurewidget.cpp +++ b/kaddressbook/viewconfigurewidget.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include #include diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp index edafa411..bfb02760 100644 --- a/kaddressbook/viewmanager.cpp +++ b/kaddressbook/viewmanager.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kaddressbook/views/configurecardviewdialog.cpp b/kaddressbook/views/configurecardviewdialog.cpp index 347bd423..b1e6233e 100644 --- a/kaddressbook/views/configurecardviewdialog.cpp +++ b/kaddressbook/views/configurecardviewdialog.cpp @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include diff --git a/kaddressbook/views/configuretableviewdialog.cpp b/kaddressbook/views/configuretableviewdialog.cpp index 987feb17..2551be98 100644 --- a/kaddressbook/views/configuretableviewdialog.cpp +++ b/kaddressbook/views/configuretableviewdialog.cpp @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include "configuretableviewdialog.h" diff --git a/kaddressbook/views/contactlistview.cpp b/kaddressbook/views/contactlistview.cpp index c4552232..25c66ac4 100644 --- a/kaddressbook/views/contactlistview.cpp +++ b/kaddressbook/views/contactlistview.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kaddressbook/views/kaddressbookcardview.cpp b/kaddressbook/views/kaddressbookcardview.cpp index 30e1ca67..f69ce0c1 100644 --- a/kaddressbook/views/kaddressbookcardview.cpp +++ b/kaddressbook/views/kaddressbookcardview.cpp @@ -30,7 +30,7 @@ #include #include -#include +#include #include #include diff --git a/kaddressbook/views/kaddressbookiconview.cpp b/kaddressbook/views/kaddressbookiconview.cpp index adf3de0e..60bae788 100644 --- a/kaddressbook/views/kaddressbookiconview.cpp +++ b/kaddressbook/views/kaddressbookiconview.cpp @@ -28,7 +28,7 @@ #include #include -#include +#include #include #include #include diff --git a/kaddressbook/views/kaddressbooktableview.cpp b/kaddressbook/views/kaddressbooktableview.cpp index d951655b..4c39c13b 100644 --- a/kaddressbook/views/kaddressbooktableview.cpp +++ b/kaddressbook/views/kaddressbooktableview.cpp @@ -38,7 +38,7 @@ #include #include -#include +#include #include #include #include diff --git a/kaddressbook/xxport/csv_xxport.cpp b/kaddressbook/xxport/csv_xxport.cpp index f3d47bfc..673a0ec7 100644 --- a/kaddressbook/xxport/csv_xxport.cpp +++ b/kaddressbook/xxport/csv_xxport.cpp @@ -23,8 +23,8 @@ #include -#include -#include +#include +#include #include #include #include diff --git a/kaddressbook/xxport/csvimportdialog.cpp b/kaddressbook/xxport/csvimportdialog.cpp index 40c209dc..4a363e76 100644 --- a/kaddressbook/xxport/csvimportdialog.cpp +++ b/kaddressbook/xxport/csvimportdialog.cpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kaddressbook/xxport/eudora_xxport.cpp b/kaddressbook/xxport/eudora_xxport.cpp index 402665ab..c443cce3 100644 --- a/kaddressbook/xxport/eudora_xxport.cpp +++ b/kaddressbook/xxport/eudora_xxport.cpp @@ -23,8 +23,8 @@ #include -#include -#include +#include +#include #include #include #include diff --git a/kaddressbook/xxport/kde2_xxport.cpp b/kaddressbook/xxport/kde2_xxport.cpp index f5abefde..6d8fd80e 100644 --- a/kaddressbook/xxport/kde2_xxport.cpp +++ b/kaddressbook/xxport/kde2_xxport.cpp @@ -24,8 +24,8 @@ #include #include -#include -#include +#include +#include #include #include #include @@ -62,10 +62,10 @@ KABC::AddresseeList KDE2XXPort::importContacts( const TQString& ) const TDEProcess proc; if ( result == KMessageBox::Yes ) { - proc << "kab2kabc"; + proc << "tdeab2tdeabc"; proc << "--override"; } else if ( result == KMessageBox::No ) - proc << "kab2kabc"; + proc << "tdeab2tdeabc"; else { kdDebug(5720) << "KAddressBook::importKDE2(): Unknow return value." << endl; return KABC::AddresseeList(); diff --git a/kaddressbook/xxport/ldif_xxport.cpp b/kaddressbook/xxport/ldif_xxport.cpp index f0c13e61..67c3684d 100644 --- a/kaddressbook/xxport/ldif_xxport.cpp +++ b/kaddressbook/xxport/ldif_xxport.cpp @@ -35,8 +35,8 @@ #include -#include -#include +#include +#include #include #include #include diff --git a/kaddressbook/xxport/opera_xxport.cpp b/kaddressbook/xxport/opera_xxport.cpp index 800f11fa..f1547481 100644 --- a/kaddressbook/xxport/opera_xxport.cpp +++ b/kaddressbook/xxport/opera_xxport.cpp @@ -25,8 +25,8 @@ #include #include -#include -#include +#include +#include #include #include #include diff --git a/kaddressbook/xxport/pab_xxport.cpp b/kaddressbook/xxport/pab_xxport.cpp index 911e92de..c4db37a9 100644 --- a/kaddressbook/xxport/pab_xxport.cpp +++ b/kaddressbook/xxport/pab_xxport.cpp @@ -25,8 +25,8 @@ #include #include -#include -#include +#include +#include #include #include #include diff --git a/kaddressbook/xxport/vcard_xxport.cpp b/kaddressbook/xxport/vcard_xxport.cpp index 34a6809f..8e219fca 100644 --- a/kaddressbook/xxport/vcard_xxport.cpp +++ b/kaddressbook/xxport/vcard_xxport.cpp @@ -30,8 +30,8 @@ #include #include -#include -#include +#include +#include #include #include #include diff --git a/kalarm/CMakeLists.txt b/kalarm/CMakeLists.txt index b93cc671..cd7295a4 100644 --- a/kalarm/CMakeLists.txt +++ b/kalarm/CMakeLists.txt @@ -59,7 +59,7 @@ install( FILES uninstall.desktop DESTINATION ${APPS_INSTALL_DIR}/Applications RE tde_add_executable( kalarm AUTOMOC SOURCES birthdaydlg.cpp main.cpp alarmevent.cpp editdlg.cpp - emailidcombo.cpp find.cpp pickfileradio.cpp + emailidcombo.cpp find.cpp pictdefileradio.cpp calendarcompat.cpp eventlistviewbase.cpp alarmlistview.cpp kamail.cpp timeselector.cpp fontcolourbutton.cpp alarmtimewidget.cpp fontcolour.cpp soundpicker.cpp diff --git a/kalarm/Makefile.am b/kalarm/Makefile.am index a8e0e8bd..defbcce7 100644 --- a/kalarm/Makefile.am +++ b/kalarm/Makefile.am @@ -20,7 +20,7 @@ kalarm_SOURCES = birthdaydlg.cpp main.cpp alarmevent.cpp editdlg.cpp \ eventlistviewbase.cpp alarmlistview.cpp kamail.cpp timeselector.cpp \ templatelistview.cpp templatepickdlg.cpp templatedlg.cpp \ templatemenuaction.cpp latecancel.cpp repetition.cpp alarmtext.cpp \ - emailidcombo.cpp find.cpp pickfileradio.cpp calendarcompat.cpp + emailidcombo.cpp find.cpp pictdefileradio.cpp calendarcompat.cpp kalarm_LDFLAGS = $(all_libraries) $(KDE_RPATH) -L$(top_builddir)/libtdenetwork/qgpgme if include_ARTS ARTSLIB = -lartskde @@ -37,7 +37,7 @@ noinst_HEADERS = alarmcalendar.h alarmevent.h alarmlistview.h alarmtext.h \ editdlg.h editdlgprivate.h emailidcombo.h eventlistviewbase.h find.h \ fontcolour.h fontcolourbutton.h functions.h kalarm.h kalarmapp.h \ kamail.h karecurrence.h latecancel.h mainwindow.h mainwindowbase.h \ - messagewin.h pickfileradio.h prefdlg.h preferences.h recurrenceedit.h \ + messagewin.h pictdefileradio.h prefdlg.h preferences.h recurrenceedit.h \ recurrenceeditprivate.h reminder.h repetition.h sounddlg.h \ soundpicker.h specialactions.h startdaytimer.h templatedlg.h \ templatelistview.h templatemenuaction.h templatepickdlg.h timeselector.h \ diff --git a/kalarm/alarmcalendar.cpp b/kalarm/alarmcalendar.cpp index 1e64b046..26d2eb70 100644 --- a/kalarm/alarmcalendar.cpp +++ b/kalarm/alarmcalendar.cpp @@ -31,12 +31,12 @@ #include #include #include -#include +#include #include -#include -#include +#include +#include #include -#include +#include #include #include diff --git a/kalarm/birthdaydlg.cpp b/kalarm/birthdaydlg.cpp index 0727507f..76b040da 100644 --- a/kalarm/birthdaydlg.cpp +++ b/kalarm/birthdaydlg.cpp @@ -29,7 +29,7 @@ #include #include -#include +#include #include #include #include diff --git a/kalarm/daemon.cpp b/kalarm/daemon.cpp index 707865f8..1c37f974 100644 --- a/kalarm/daemon.cpp +++ b/kalarm/daemon.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include #include diff --git a/kalarm/editdlg.cpp b/kalarm/editdlg.cpp index 62c445ad..daf4406d 100644 --- a/kalarm/editdlg.cpp +++ b/kalarm/editdlg.cpp @@ -39,11 +39,11 @@ #include #include -#include -#include +#include +#include #include -#include -#include +#include +#include #include #include #include @@ -71,7 +71,7 @@ #include "latecancel.h" #include "lineedit.h" #include "mainwindow.h" -#include "pickfileradio.h" +#include "pictdefileradio.h" #include "preferences.h" #include "radiobutton.h" #include "recurrenceedit.h" diff --git a/kalarm/functions.cpp b/kalarm/functions.cpp index 4723c342..e637f22f 100644 --- a/kalarm/functions.cpp +++ b/kalarm/functions.cpp @@ -38,14 +38,14 @@ #include #include -#include +#include #include #include #include #include #include #include -#include +#include #include #include #include diff --git a/kalarm/kalarmapp.cpp b/kalarm/kalarmapp.cpp index 29f498fc..5fa0d495 100644 --- a/kalarm/kalarmapp.cpp +++ b/kalarm/kalarmapp.cpp @@ -32,12 +32,12 @@ #include #include #include -#include +#include #include #include #include #include -#include +#include #include #include #include diff --git a/kalarm/kalarmd/adcalendar.cpp b/kalarm/kalarmd/adcalendar.cpp index db2e4e3d..e499f481 100644 --- a/kalarm/kalarmd/adcalendar.cpp +++ b/kalarm/kalarmd/adcalendar.cpp @@ -24,8 +24,8 @@ #include #include -#include -#include +#include +#include #include #include "adcalendar.moc" diff --git a/kalarm/kalarmd/adconfigdata.cpp b/kalarm/kalarmd/adconfigdata.cpp index 0253e320..3f728bdb 100644 --- a/kalarm/kalarmd/adconfigdata.cpp +++ b/kalarm/kalarmd/adconfigdata.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include diff --git a/kalarm/kalarmd/alarmdaemon.cpp b/kalarm/kalarmd/alarmdaemon.cpp index 75bb4d2d..4b2ff902 100644 --- a/kalarm/kalarmd/alarmdaemon.cpp +++ b/kalarm/kalarmd/alarmdaemon.cpp @@ -31,9 +31,9 @@ #include #include #include -#include +#include #include -#include +#include #include #include diff --git a/kalarm/kamail.cpp b/kalarm/kamail.cpp index e0c50d3c..cc9c0248 100644 --- a/kalarm/kamail.cpp +++ b/kalarm/kamail.cpp @@ -37,8 +37,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/kalarm/lib/messagebox.cpp b/kalarm/lib/messagebox.cpp index 721ee5ea..4e78ef08 100644 --- a/kalarm/lib/messagebox.cpp +++ b/kalarm/lib/messagebox.cpp @@ -19,7 +19,7 @@ */ #include "kalarm.h" -#include +#include #include "messagebox.h" diff --git a/kalarm/mainwindow.cpp b/kalarm/mainwindow.cpp index 765678c6..08706246 100644 --- a/kalarm/mainwindow.cpp +++ b/kalarm/mainwindow.cpp @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kalarm/messagewin.cpp b/kalarm/messagewin.cpp index 0315b8f4..7c17edd0 100644 --- a/kalarm/messagewin.cpp +++ b/kalarm/messagewin.cpp @@ -39,7 +39,7 @@ #include #include #include -#include +#include #include #include #include @@ -49,7 +49,7 @@ #include #include #include -#include +#include #include #include #ifdef WITHOUT_ARTS diff --git a/kalarm/pickfileradio.cpp b/kalarm/pickfileradio.cpp deleted file mode 100644 index 15b56d94..00000000 --- a/kalarm/pickfileradio.cpp +++ /dev/null @@ -1,182 +0,0 @@ -/* - * pickfileradio.cpp - radio button with an associated file picker - * Program: kalarm - * Copyright (C) 2005 by David Jarvie - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "kalarm.h" - -#include -#include -#include - -#include - -#include "lineedit.h" -#include "pickfileradio.moc" - - -PickFileRadio::PickFileRadio(TQPushButton* button, LineEdit* edit, const TQString& text, TQButtonGroup* parent, const char* name) - : RadioButton(text, parent, name), - mGroup(parent), - mEdit(edit), - mButton(button), - mLastId(-1), // set to an invalid value - mRevertId(false) -{ - Q_ASSERT(parent); - Q_ASSERT(button); - mButton->setEnabled(false); - connect(mButton, TQT_SIGNAL(clicked()), TQT_SLOT(slotPickFile())); - if (mEdit) - mEdit->setEnabled(false); - connect(mGroup, TQT_SIGNAL(buttonSet(int)), TQT_SLOT(slotSelectionChanged(int))); -} - -PickFileRadio::PickFileRadio(const TQString& text, TQButtonGroup* parent, const char* name) - : RadioButton(text, parent, name), - mGroup(parent), - mEdit(0), - mButton(0), - mLastId(-1), // set to an invalid value - mRevertId(false) -{ - Q_ASSERT(parent); -} - -void PickFileRadio::init(TQPushButton* button, LineEdit* edit) -{ - Q_ASSERT(button); - mEdit = edit; - mButton = button; - mButton->setEnabled(false); - connect(mButton, TQT_SIGNAL(clicked()), TQT_SLOT(slotPickFile())); - if (mEdit) - mEdit->setEnabled(false); - connect(mGroup, TQT_SIGNAL(buttonSet(int)), TQT_SLOT(slotSelectionChanged(int))); - setReadOnly(RadioButton::isReadOnly()); -} - -void PickFileRadio::setReadOnly(bool ro) -{ - RadioButton::setReadOnly(ro); - if (mButton) - { - if (mEdit) - mEdit->setReadOnly(ro); - if (ro) - mButton->hide(); - else - mButton->show(); - } -} - -void PickFileRadio::setFile(const TQString& file) -{ - mFile = file; -} - -TQString PickFileRadio::file() const -{ - return mEdit ? mEdit->text() : mFile; -} - -/****************************************************************************** -* Set the radio button enabled or disabled. -* Adjusts the enabled/disabled state of other controls appropriately. -*/ -void PickFileRadio::setEnabled(bool enable) -{ - Q_ASSERT(mButton); - RadioButton::setEnabled(enable); - enable = enable && mGroup->selected() == this; - if (enable) - { - if (!pickFileIfNone()) - enable = false; // revert to previously selected type - } - mButton->setEnabled(enable); - if (mEdit) - mEdit->setEnabled(enable); -} - -/****************************************************************************** -* Called when the selected radio button changes. -*/ -void PickFileRadio::slotSelectionChanged(int id) -{ - if (id == mLastId || mRevertId) - return; - int radioId = mGroup->id(this); - if (mLastId == radioId) - { - mButton->setEnabled(false); - if (mEdit) - mEdit->setEnabled(false); - } - else if (id == radioId) - { - if (!pickFileIfNone()) - return; // revert to previously selected type - mButton->setEnabled(true); - if (mEdit) - mEdit->setEnabled(true); - } - mLastId = id; -} - -/****************************************************************************** -* Prompt for a file name if there is none currently entered. -*/ -bool PickFileRadio::pickFileIfNone() -{ - if (mEdit) - mFile = mEdit->text(); - if (!mFile.isEmpty()) - return true; - slotPickFile(); - return !mFile.isEmpty(); -} - -/****************************************************************************** -* Called when the file picker button is clicked. -*/ -void PickFileRadio::slotPickFile() -{ - mFile = pickFile(); - if (mEdit) - mEdit->setText(mFile); - if (mFile.isEmpty()) - { - // No file is selected, so revert to the previous radio button selection. - // But wait a moment before setting the radio button, or it won't work. - mRevertId = true; // prevent picker dialogue popping up twice - TQTimer::singleShot(0, this, TQT_SLOT(setLastId())); - } -} - -/****************************************************************************** -* Select the previously selected radio button in the group. -*/ -void PickFileRadio::setLastId() -{ - if (mLastId == -1) - setOn(false); // we don't know the previous selection, so just turn this button off - else - mGroup->setButton(mLastId); - mRevertId = false; -} diff --git a/kalarm/pickfileradio.h b/kalarm/pickfileradio.h deleted file mode 100644 index f30ca7f6..00000000 --- a/kalarm/pickfileradio.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * pickfileradio.h - radio button with an associated file picker - * Program: kalarm - * Copyright (C) 2005 by David Jarvie - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef PICKFILERADIO_H -#define PICKFILERADIO_H - -/** @file pickfileradio.h - radio button with an associated file picker */ - -#include "radiobutton.h" - -class TQPushButton; -class LineEdit; - -/** - * @short Radio button with associated file picker controls. - * - * The PickFileRadio class is a radio button with an associated button to choose - * a file, and an optional file name edit box. Its purpose is to ensure that while - * the radio button is selected, the chosen file name is never blank. - * - * To achieve this, whenever the button is newly selected and the - * file name is currently blank, the file picker dialogue is displayed to choose a - * file. If the dialogue exits without a file being chosen, the radio button selection - * is reverted to the previously selected button in the parent button group. - * - * The class handles the activation of the file picker dialogue (via a virtual method - * which must be supplied by deriving a class from this one). It also handles all - * enabling and disabling of the browse button and edit box when the enable state of - * the radio button is changed, and when the radio button selection changes. - * - * @author David Jarvie - */ -class PickFileRadio : public RadioButton -{ - Q_OBJECT - - public: - /** Constructor. - * @param button Push button to invoke the file picker dialogue. - * @param edit File name edit widget, or null if there is none. - * @param text Radio button's text. - * @param parent Button group which is to be the parent object for the radio button. - * @param name The name of this widget. - */ - PickFileRadio(TQPushButton* button, LineEdit* edit, const TQString& text, TQButtonGroup* parent, const char* name = 0); - /** Constructor. - * The init() method must be called before the widget can be used. - * @param text Radio button's text. - * @param parent Button group which is to be the parent object for the radio button. - * @param name The name of this widget. - */ - PickFileRadio(const TQString& text, TQButtonGroup* parent, const char* name = 0); - /** Initialises the widget. - * @param button Push button to invoke the file picker dialogue. - * @param edit File name edit widget, or null if there is none. - */ - void init(TQPushButton* button, LineEdit* edit = 0); - /** Sets whether the radio button and associated widgets are read-only for the user. - * If read-only, their states cannot be changed by the user. - * @param readOnly True to set the widgets read-only, false to set them read-write. - */ - virtual void setReadOnly(bool readOnly); - /** Chooses a file, for example by displaying a file selection dialogue. - * This method is called when the push button is clicked - the client - * should not activate a file selection dialogue directly. - * @return Selected file name, or TQString() if no selection made. - */ - virtual TQString pickFile() = 0; - /** Notifies the widget of the currently selected file name. - * This should only be used when no file name edit box is used. - * It should be called to initialise the widget's data, and also any time the file - * name is changed without using the push button. - */ - void setFile(const TQString& file); - /** Returns the currently selected file name. */ - TQString file() const; - /** Returns the associated file name edit widget, or null if none. */ - LineEdit* fileEdit() const { return mEdit; } - /** Returns the associated file browse push button. */ - TQPushButton* pushButton() const { return mButton; } - - public slots: - /** Enables or disables the radio button, and adjusts the enabled state of the - * associated browse button and file name edit box. - */ - virtual void setEnabled(bool); - - private slots: - void slotSelectionChanged(int id); - void slotPickFile(); - void setLastId(); - - private: - bool pickFileIfNone(); - - TQButtonGroup* mGroup; // button group which radio button is in - LineEdit* mEdit; // file name edit box, or null if none - TQPushButton* mButton; // push button to pick a file - TQString mFile; // saved file name (if mEdit is null) - int mLastId; // previous radio button selected - bool mRevertId; // true to revert to the previous radio button selection -}; - -#endif // PICKFILERADIO_H diff --git a/kalarm/pictdefileradio.cpp b/kalarm/pictdefileradio.cpp new file mode 100644 index 00000000..80911c29 --- /dev/null +++ b/kalarm/pictdefileradio.cpp @@ -0,0 +1,182 @@ +/* + * pictdefileradio.cpp - radio button with an associated file picker + * Program: kalarm + * Copyright (C) 2005 by David Jarvie + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "kalarm.h" + +#include +#include +#include + +#include + +#include "lineedit.h" +#include "pictdefileradio.moc" + + +PickFileRadio::PickFileRadio(TQPushButton* button, LineEdit* edit, const TQString& text, TQButtonGroup* parent, const char* name) + : RadioButton(text, parent, name), + mGroup(parent), + mEdit(edit), + mButton(button), + mLastId(-1), // set to an invalid value + mRevertId(false) +{ + Q_ASSERT(parent); + Q_ASSERT(button); + mButton->setEnabled(false); + connect(mButton, TQT_SIGNAL(clicked()), TQT_SLOT(slotPickFile())); + if (mEdit) + mEdit->setEnabled(false); + connect(mGroup, TQT_SIGNAL(buttonSet(int)), TQT_SLOT(slotSelectionChanged(int))); +} + +PickFileRadio::PickFileRadio(const TQString& text, TQButtonGroup* parent, const char* name) + : RadioButton(text, parent, name), + mGroup(parent), + mEdit(0), + mButton(0), + mLastId(-1), // set to an invalid value + mRevertId(false) +{ + Q_ASSERT(parent); +} + +void PickFileRadio::init(TQPushButton* button, LineEdit* edit) +{ + Q_ASSERT(button); + mEdit = edit; + mButton = button; + mButton->setEnabled(false); + connect(mButton, TQT_SIGNAL(clicked()), TQT_SLOT(slotPickFile())); + if (mEdit) + mEdit->setEnabled(false); + connect(mGroup, TQT_SIGNAL(buttonSet(int)), TQT_SLOT(slotSelectionChanged(int))); + setReadOnly(RadioButton::isReadOnly()); +} + +void PickFileRadio::setReadOnly(bool ro) +{ + RadioButton::setReadOnly(ro); + if (mButton) + { + if (mEdit) + mEdit->setReadOnly(ro); + if (ro) + mButton->hide(); + else + mButton->show(); + } +} + +void PickFileRadio::setFile(const TQString& file) +{ + mFile = file; +} + +TQString PickFileRadio::file() const +{ + return mEdit ? mEdit->text() : mFile; +} + +/****************************************************************************** +* Set the radio button enabled or disabled. +* Adjusts the enabled/disabled state of other controls appropriately. +*/ +void PickFileRadio::setEnabled(bool enable) +{ + Q_ASSERT(mButton); + RadioButton::setEnabled(enable); + enable = enable && mGroup->selected() == this; + if (enable) + { + if (!pickFileIfNone()) + enable = false; // revert to previously selected type + } + mButton->setEnabled(enable); + if (mEdit) + mEdit->setEnabled(enable); +} + +/****************************************************************************** +* Called when the selected radio button changes. +*/ +void PickFileRadio::slotSelectionChanged(int id) +{ + if (id == mLastId || mRevertId) + return; + int radioId = mGroup->id(this); + if (mLastId == radioId) + { + mButton->setEnabled(false); + if (mEdit) + mEdit->setEnabled(false); + } + else if (id == radioId) + { + if (!pickFileIfNone()) + return; // revert to previously selected type + mButton->setEnabled(true); + if (mEdit) + mEdit->setEnabled(true); + } + mLastId = id; +} + +/****************************************************************************** +* Prompt for a file name if there is none currently entered. +*/ +bool PickFileRadio::pickFileIfNone() +{ + if (mEdit) + mFile = mEdit->text(); + if (!mFile.isEmpty()) + return true; + slotPickFile(); + return !mFile.isEmpty(); +} + +/****************************************************************************** +* Called when the file picker button is clicked. +*/ +void PickFileRadio::slotPickFile() +{ + mFile = pickFile(); + if (mEdit) + mEdit->setText(mFile); + if (mFile.isEmpty()) + { + // No file is selected, so revert to the previous radio button selection. + // But wait a moment before setting the radio button, or it won't work. + mRevertId = true; // prevent picker dialogue popping up twice + TQTimer::singleShot(0, this, TQT_SLOT(setLastId())); + } +} + +/****************************************************************************** +* Select the previously selected radio button in the group. +*/ +void PickFileRadio::setLastId() +{ + if (mLastId == -1) + setOn(false); // we don't know the previous selection, so just turn this button off + else + mGroup->setButton(mLastId); + mRevertId = false; +} diff --git a/kalarm/pictdefileradio.h b/kalarm/pictdefileradio.h new file mode 100644 index 00000000..ad6e0c25 --- /dev/null +++ b/kalarm/pictdefileradio.h @@ -0,0 +1,121 @@ +/* + * pictdefileradio.h - radio button with an associated file picker + * Program: kalarm + * Copyright (C) 2005 by David Jarvie + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef PICKFILERADIO_H +#define PICKFILERADIO_H + +/** @file pictdefileradio.h - radio button with an associated file picker */ + +#include "radiobutton.h" + +class TQPushButton; +class LineEdit; + +/** + * @short Radio button with associated file picker controls. + * + * The PickFileRadio class is a radio button with an associated button to choose + * a file, and an optional file name edit box. Its purpose is to ensure that while + * the radio button is selected, the chosen file name is never blank. + * + * To achieve this, whenever the button is newly selected and the + * file name is currently blank, the file picker dialogue is displayed to choose a + * file. If the dialogue exits without a file being chosen, the radio button selection + * is reverted to the previously selected button in the parent button group. + * + * The class handles the activation of the file picker dialogue (via a virtual method + * which must be supplied by deriving a class from this one). It also handles all + * enabling and disabling of the browse button and edit box when the enable state of + * the radio button is changed, and when the radio button selection changes. + * + * @author David Jarvie + */ +class PickFileRadio : public RadioButton +{ + Q_OBJECT + + public: + /** Constructor. + * @param button Push button to invoke the file picker dialogue. + * @param edit File name edit widget, or null if there is none. + * @param text Radio button's text. + * @param parent Button group which is to be the parent object for the radio button. + * @param name The name of this widget. + */ + PickFileRadio(TQPushButton* button, LineEdit* edit, const TQString& text, TQButtonGroup* parent, const char* name = 0); + /** Constructor. + * The init() method must be called before the widget can be used. + * @param text Radio button's text. + * @param parent Button group which is to be the parent object for the radio button. + * @param name The name of this widget. + */ + PickFileRadio(const TQString& text, TQButtonGroup* parent, const char* name = 0); + /** Initialises the widget. + * @param button Push button to invoke the file picker dialogue. + * @param edit File name edit widget, or null if there is none. + */ + void init(TQPushButton* button, LineEdit* edit = 0); + /** Sets whether the radio button and associated widgets are read-only for the user. + * If read-only, their states cannot be changed by the user. + * @param readOnly True to set the widgets read-only, false to set them read-write. + */ + virtual void setReadOnly(bool readOnly); + /** Chooses a file, for example by displaying a file selection dialogue. + * This method is called when the push button is clicked - the client + * should not activate a file selection dialogue directly. + * @return Selected file name, or TQString() if no selection made. + */ + virtual TQString pickFile() = 0; + /** Notifies the widget of the currently selected file name. + * This should only be used when no file name edit box is used. + * It should be called to initialise the widget's data, and also any time the file + * name is changed without using the push button. + */ + void setFile(const TQString& file); + /** Returns the currently selected file name. */ + TQString file() const; + /** Returns the associated file name edit widget, or null if none. */ + LineEdit* fileEdit() const { return mEdit; } + /** Returns the associated file browse push button. */ + TQPushButton* pushButton() const { return mButton; } + + public slots: + /** Enables or disables the radio button, and adjusts the enabled state of the + * associated browse button and file name edit box. + */ + virtual void setEnabled(bool); + + private slots: + void slotSelectionChanged(int id); + void slotPickFile(); + void setLastId(); + + private: + bool pickFileIfNone(); + + TQButtonGroup* mGroup; // button group which radio button is in + LineEdit* mEdit; // file name edit box, or null if none + TQPushButton* mButton; // push button to pick a file + TQString mFile; // saved file name (if mEdit is null) + int mLastId; // previous radio button selected + bool mRevertId; // true to revert to the previous radio button selection +}; + +#endif // PICKFILERADIO_H diff --git a/kalarm/preferences.cpp b/kalarm/preferences.cpp index 24669fbe..2e057eaf 100644 --- a/kalarm/preferences.cpp +++ b/kalarm/preferences.cpp @@ -21,7 +21,7 @@ #include "kalarm.h" #include -#include +#include #include #include #include diff --git a/kalarm/sounddlg.cpp b/kalarm/sounddlg.cpp index 1f386f30..d93a3b68 100644 --- a/kalarm/sounddlg.cpp +++ b/kalarm/sounddlg.cpp @@ -44,7 +44,7 @@ #include #endif #include -#include +#include #include #include "checkbox.h" diff --git a/kalarm/soundpicker.cpp b/kalarm/soundpicker.cpp index 00f31893..1ae3a6a8 100644 --- a/kalarm/soundpicker.cpp +++ b/kalarm/soundpicker.cpp @@ -30,7 +30,7 @@ #include #include -#include +#include #include #include #ifndef WITHOUT_ARTS diff --git a/kalarm/traywindow.cpp b/kalarm/traywindow.cpp index 58e8232c..8bcad17e 100644 --- a/kalarm/traywindow.cpp +++ b/kalarm/traywindow.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include "alarmcalendar.h" diff --git a/kandy/src/kandy.cpp b/kandy/src/kandy.cpp index f7c29d0c..eeae6f2d 100644 --- a/kandy/src/kandy.cpp +++ b/kandy/src/kandy.cpp @@ -34,9 +34,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/kandy/src/kandyprefs.kcfgc b/kandy/src/kandyprefs.kcfgc index c615f6fc..55a2574b 100644 --- a/kandy/src/kandyprefs.kcfgc +++ b/kandy/src/kandyprefs.kcfgc @@ -1,4 +1,4 @@ -# Code generation options for kconfig_compiler +# Code generation options for tdeconfig_compiler File=kandy.kcfg ClassName=KandyPrefs Singleton=true diff --git a/kandy/src/kandyview.cpp b/kandy/src/kandyview.cpp index 99336c92..fbf5deaa 100644 --- a/kandy/src/kandyview.cpp +++ b/kandy/src/kandyview.cpp @@ -43,7 +43,7 @@ #include #include #include -#include +#include #include #include diff --git a/kandy/src/mobilegui.cpp b/kandy/src/mobilegui.cpp index 00cfea89..a4217be0 100644 --- a/kandy/src/mobilegui.cpp +++ b/kandy/src/mobilegui.cpp @@ -35,7 +35,7 @@ #include #include -#include +#include #include #include #include diff --git a/kandy/src/mobilemain.cpp b/kandy/src/mobilemain.cpp index 318b3eaa..43210ba8 100644 --- a/kandy/src/mobilemain.cpp +++ b/kandy/src/mobilemain.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/karm/karm_part.cpp b/karm/karm_part.cpp index b8426f22..36a71043 100644 --- a/karm/karm_part.cpp +++ b/karm/karm_part.cpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include diff --git a/karm/karmstorage.cpp b/karm/karmstorage.cpp index bda5831b..0eb16c1e 100644 --- a/karm/karmstorage.cpp +++ b/karm/karmstorage.cpp @@ -49,7 +49,7 @@ #include #include #include -#include +#include #include #include diff --git a/karm/mainwindow.cpp b/karm/mainwindow.cpp index 7e692092..dc9b3344 100644 --- a/karm/mainwindow.cpp +++ b/karm/mainwindow.cpp @@ -10,7 +10,7 @@ #include #include #include // kapp -#include +#include #include #include #include diff --git a/karm/preferences.cpp b/karm/preferences.cpp index 1dd13625..005243ce 100644 --- a/karm/preferences.cpp +++ b/karm/preferences.cpp @@ -6,7 +6,7 @@ #include #include // kapp -#include +#include #include #include #include diff --git a/karm/taskview.cpp b/karm/taskview.cpp index eb63da48..bcabad37 100644 --- a/karm/taskview.cpp +++ b/karm/taskview.cpp @@ -11,9 +11,9 @@ #include #include "kapplication.h" // kapp -#include +#include #include -#include +#include #include // i18n #include #include diff --git a/kfile-plugins/CMakeLists.txt b/kfile-plugins/CMakeLists.txt deleted file mode 100644 index 3f9c0f47..00000000 --- a/kfile-plugins/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -################################################# -# -# (C) 2010-2011 Serghei Amelian -# serghei (DOT) amelian (AT) gmail.com -# -# Improvements and feedback are welcome -# -# This file is released under GPL >= 2 -# -################################################# - -add_subdirectory( vcf ) -add_subdirectory( ics ) diff --git a/kfile-plugins/Makefile.am b/kfile-plugins/Makefile.am deleted file mode 100644 index 7ebdda70..00000000 --- a/kfile-plugins/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -if compile_kpilot -PILOTPLUGIN = palm-databases -endif - -SUBDIRS=vcf ics $(PILOTPLUGIN) - diff --git a/kfile-plugins/RETURNED_ITEMS b/kfile-plugins/RETURNED_ITEMS deleted file mode 100644 index 9985e36d..00000000 --- a/kfile-plugins/RETURNED_ITEMS +++ /dev/null @@ -1,12 +0,0 @@ -If you make a new plugin, please add the list of returned items to this list. - - -vcf plugin: -=========== - -type key W/A details ------------------------------------------------------------------------- -String Name -/- Name of person -String Email -/- Email address - - diff --git a/kfile-plugins/ics/CMakeLists.txt b/kfile-plugins/ics/CMakeLists.txt deleted file mode 100644 index b4d2fca8..00000000 --- a/kfile-plugins/ics/CMakeLists.txt +++ /dev/null @@ -1,40 +0,0 @@ -################################################# -# -# (C) 2010-2011 Serghei Amelian -# serghei (DOT) amelian (AT) gmail.com -# -# Improvements and feedback are welcome -# -# This file is released under GPL >= 2 -# -################################################# - -tde_import( libkmime ) -tde_import( ktnef ) -tde_import( libkcal ) - -include_directories( - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_SOURCE_DIR} - ${CMAKE_SOURCE_DIR}/libtdepim - ${TDE_INCLUDE_DIR} - ${TQT_INCLUDE_DIRS} -) - -link_directories( - ${TQT_LIBRARY_DIRS} -) - - -##### other data ################################ - -install( FILES kfile_ics.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) - - -##### kfile_ics (module) ######################## - -tde_add_kpart( kfile_ics AUTOMOC - SOURCES kfile_ics.cpp - LINK kcal-shared - DESTINATION ${PLUGIN_INSTALL_DIR} -) diff --git a/kfile-plugins/ics/Makefile.am b/kfile-plugins/ics/Makefile.am deleted file mode 100644 index 1a2378e5..00000000 --- a/kfile-plugins/ics/Makefile.am +++ /dev/null @@ -1,24 +0,0 @@ -# Makefile.am for ics file meta info plugin - -# set the include path for X, tdepim, qt and KDE -INCLUDES = \ - -I$(top_srcdir) \ - $(all_includes) - -# these are the headers for your project -noinst_HEADERS = kfile_ics.h - -kde_module_LTLIBRARIES = kfile_ics.la - -kfile_ics_la_SOURCES = kfile_ics.cpp -kfile_ics_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) $(LIB_QT) -ltdecore -kfile_ics_la_LIBADD = $(top_builddir)/libkcal/libkcal.la $(LIB_KSYCOCA) - - -METASOURCES = AUTO - -messages: rc.cpp - $(XGETTEXT) kfile_ics.cpp -o $(podir)/kfile_ics.pot - -services_DATA = kfile_ics.desktop -servicesdir = $(kde_servicesdir) diff --git a/kfile-plugins/ics/kfile_ics.cpp b/kfile-plugins/ics/kfile_ics.cpp deleted file mode 100644 index 0d85344e..00000000 --- a/kfile-plugins/ics/kfile_ics.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2004 Bram Schoenmakers - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation version 2. - * - * This program is distributed in the hope that -t it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#include -#include - -#include -#include - -#include "kfile_ics.h" - -#include - -using namespace KCal; - -typedef KGenericFactory ICSFactory; -K_EXPORT_COMPONENT_FACTORY(kfile_ics, ICSFactory( "kfile_ics" )) - -ICSPlugin::ICSPlugin( TQObject *parent, const char *name, const TQStringList& args ) - : KFilePlugin( parent, name, args ) -{ - KFileMimeTypeInfo* info = addMimeTypeInfo( "text/calendar" ); //TODO: vcs !! - - KFileMimeTypeInfo::GroupInfo* group = 0L; - group = addGroupInfo(info, "ICSInfo", i18n("Calendar Statistics")); - - addItemInfo( group, "ProductID", i18n("Product ID"), TQVariant::String ); - addItemInfo( group, "Events", i18n("Events"), TQVariant::Int ); - addItemInfo( group, "Todos", i18n("To-dos"), TQVariant::Int ); - addItemInfo( group, "TodoCompleted", i18n("Completed To-dos"), TQVariant::Int ); - addItemInfo( group, "TodoOverdue", i18n("Overdue To-dos"), TQVariant::Int ); - addItemInfo( group, "Journals", i18n("Journals"), TQVariant::Int ); -// addItemInfo( group, "Reminders", i18n("Reminders"), TQVariant::Int ); - -} - -/* -I chose to use libkcal instead of reading the calendar manually. It's easier to -maintain this way. -*/ -bool ICSPlugin::readInfo( KFileMetaInfo& info, uint /*what*/ ) -{ - KFileMetaInfoGroup group = appendGroup( info, "ICSInfo"); - - CalendarLocal cal ( TQString::fromLatin1( "UTC" ) ); - if( !cal.load( info.path() ) ) { - kdDebug() << "Could not load calendar" << endl; - return false; - } - - appendItem( group, "ProductID", TQVariant( cal.productId() ) ); - appendItem( group, "Events", TQVariant( int( cal.events().count() ) ) ); - appendItem( group, "Journals", TQVariant( int( cal.journals().count() ) ) ); - Todo::List todos = cal.todos(); - - // count completed and overdue - Todo::List::ConstIterator it = todos.begin(); - Todo::List::ConstIterator end = todos.end(); - - int completed = 0; - int overdue = 0; - for ( ; it != end ; ++it ) { - Todo *todo = *it; - if ( todo->isCompleted() ) - ++completed; - else if ( todo->hasDueDate() && todo->dtDue().date() < TQDate::currentDate() ) - ++overdue; - } - - appendItem( group, "Todos", TQVariant( int(todos.count() ) ) ); - appendItem( group, "TodoCompleted", TQVariant( completed ) ); - appendItem( group, "TodoOverdue", TQVariant( overdue ) ); - - cal.close(); - - return true; -} - -#include "kfile_ics.moc" diff --git a/kfile-plugins/ics/kfile_ics.desktop b/kfile-plugins/ics/kfile_ics.desktop deleted file mode 100644 index a085d707..00000000 --- a/kfile-plugins/ics/kfile_ics.desktop +++ /dev/null @@ -1,56 +0,0 @@ -[Desktop Entry] -Type=Service -Name=ICS information -Name[af]=ICS informasie -Name[be]=Ð†Ð½Ñ„Ð°Ñ€Ð¼Ð°Ñ†Ñ‹Ñ Ð°Ð± ICS -Name[bg]=ICS Ð¸Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ð¸Ñ -Name[br]=Titouroù ICS -Name[ca]=Informació ICS -Name[cs]=Informace o ICS -Name[da]=ICS-information -Name[de]=ICS-Information -Name[el]=ΠληÏοφοÏίες ICS -Name[eo]=ICS-Informo -Name[es]=Información ICS -Name[et]=ICS info -Name[eu]=ICS informazioa -Name[fa]=اطلاعات ICS -Name[fi]=ICS-tiedot -Name[fr]=Information sur ICS -Name[fy]=ICS-ynformaasje -Name[gl]=Información ICS -Name[he]=מידע של ICS -Name[hu]=ICS-jellemzÅ‘k -Name[is]=ICS upplýsingar -Name[it]=Informazioni ICS -Name[ja]=ICS 情報 -Name[kk]=ICS ақпараты -Name[km]=áž–áŸážáŸŒáž˜áž¶áž“ ICS -Name[lt]=ICS informacija -Name[mk]=Информација за ICS -Name[ms]=Maklumat ICS -Name[nb]=ICS-informasjon -Name[nds]=ICS-Informatschoon -Name[ne]=ICS सूचना -Name[nl]=ICS-informatie -Name[nn]=ICS-informasjon -Name[pa]=ICS ਜਾਣਕਾਰੀ -Name[pl]=Informacja ICS -Name[pt]=Informação ICS -Name[pt_BR]=Informações ICS -Name[ru]=Ð˜Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ð¸Ñ ICS -Name[sk]=Informácie o ICS -Name[sl]=Podatki ICS -Name[sr]=ICS информације -Name[sr@Latn]=ICS informacije -Name[sv]=ICS-information -Name[ta]=ICS தகவல௠-Name[tr]=ICS bilgisi -Name[uk]=Ð†Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ñ–Ñ Ð¿Ñ€Ð¾ ICS -Name[zh_CN]=ICS ä¿¡æ¯ -Name[zh_TW]=ICS 資訊 -ServiceTypes=KFilePlugin -X-TDE-Library=kfile_ics -MimeType=text/calendar -PreferredGroups=ICSInfo -PreferredItems=Events,Todos,Journals diff --git a/kfile-plugins/ics/kfile_ics.h b/kfile-plugins/ics/kfile_ics.h deleted file mode 100644 index 27682034..00000000 --- a/kfile-plugins/ics/kfile_ics.h +++ /dev/null @@ -1,37 +0,0 @@ - /* This file is part of the KDE project - * Copyright (C) 2004 Bram Schoenmakers - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#ifndef KFILE_ICS_H -#define KFILE_ICS_H - -#include - -class TQStringList; - -class ICSPlugin : public KFilePlugin -{ - Q_OBJECT - -public: - ICSPlugin( TQObject *parent, const char *name, const TQStringList& args ); - - virtual bool readInfo( KFileMetaInfo& info, uint what ); -}; - -#endif diff --git a/kfile-plugins/palm-databases/Makefile.am b/kfile-plugins/palm-databases/Makefile.am deleted file mode 100644 index fa60fd22..00000000 --- a/kfile-plugins/palm-databases/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -## Makefile.am for palm database meta info plugin - -# set the include path for X, qt and KDE -INCLUDES = $(PISOCK_INCLUDE) $(all_includes) - -# these are the headers for your project -noinst_HEADERS = kfile_palm.h - -kde_module_LTLIBRARIES = kfile_palm.la - -kfile_palm_la_SOURCES = kfile_palm.cpp -kfile_palm_la_LDFLAGS = $(PISOCK_LDFLAGS) $(all_libraries) -module $(KDE_PLUGIN) $(LIB_QT) -ltdecore -kfile_palm_la_LIBADD = $(LIB_KSYCOCA) $(PISOCK_LIB) - -# let automoc handle all of the meta source files (moc) -METASOURCES = AUTO - -messages: rc.cpp - $(XGETTEXT) kfile_palm.cpp -o $(podir)/kfile_palm.pot - -services_DATA = kfile_palm.desktop -servicesdir = $(kde_servicesdir) diff --git a/kfile-plugins/palm-databases/kfile_palm.cpp b/kfile-plugins/palm-databases/kfile_palm.cpp deleted file mode 100644 index c3865076..00000000 --- a/kfile-plugins/palm-databases/kfile_palm.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2004 Reinhold Kainhofer - * Based on the vcf plugin: - * Copyright (C) 2002 Shane Wright - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#include "kfile_palm.h" - -#include -#include - -#include -#include -#include - - -typedef KGenericFactory PalmFactory; - -K_EXPORT_COMPONENT_FACTORY(kfile_palm, PalmFactory( "kfile_palm" )) - -KPalmPlugin::KPalmPlugin(TQObject *parent, const char *name, - const TQStringList &args) - - : KFilePlugin(parent, name, args) -{ - KFileMimeTypeInfo* info = addMimeTypeInfo( "application/vnd.palm" ); - - KFileMimeTypeInfo::GroupInfo* group; - KFileMimeTypeInfo::ItemInfo* item; - - group = addGroupInfo(info, "General", i18n("General Information")); - item = addItemInfo(group, "Name", i18n("Name"), TQVariant::String); - item = addItemInfo(group, "DBType", i18n("DB Type"), TQVariant::String); - item = addItemInfo(group, "TypeID", i18n("Type ID"), TQVariant::String); - item = addItemInfo(group, "CreatorID", i18n("Creator ID"), TQVariant::String); - item = addItemInfo(group, "NrRecords", i18n("# of Records"), TQVariant::Int); - - group = addGroupInfo(info, "TimeStamps", i18n("Time Stamps")); - item = addItemInfo(group, "CreationDate", i18n("Creation Date"), TQVariant::DateTime); - item = addItemInfo(group, "ModificationDate", i18n("Modification Date"), TQVariant::DateTime); - item = addItemInfo(group, "BackupDate", i18n("Backup Date"), TQVariant::DateTime); - - group = addGroupInfo(info, "Flags", i18n("Flags")); - item = addItemInfo(group, "ReadOnly", i18n("Read-Only"), TQVariant::String); - item = addItemInfo(group, "MakeBackup", i18n("Make Backup"), TQVariant::String); - item = addItemInfo(group, "CopyProtected", i18n("Copy Protected"), TQVariant::String); - item = addItemInfo(group, "Reset", i18n("Reset Handheld After Installing"), TQVariant::String); - item = addItemInfo(group, "ExcludeFromSync", i18n("Exclude From Sync"), TQVariant::String); -} - - -bool KPalmPlugin::readInfo( KFileMetaInfo& info, uint /*what*/ ) -{ - int nrRec; - TQString tempName = info.path(); - TQCString fileName = TQFile::encodeName(tempName); - pi_file *dbFile = pi_file_open(const_cast < char *>((const char *) fileName)); - if (dbFile == 0L) return false; - - struct DBInfo dBInfo; - pi_file_get_info( dbFile, &dBInfo ); - pi_file_get_entries( dbFile, &nrRec ); - pi_file_close(dbFile); - - KFileMetaInfoGroup generalGroup = appendGroup(info, "General"); - appendItem(generalGroup, "Name", dBInfo.name ); - appendItem(generalGroup, "DBType", (dBInfo.flags & dlpDBFlagResource)?i18n("PalmOS Application"):i18n("PalmOS Record Database") ); - - char buff[5]; - set_long(buff, dBInfo.type); - buff[4]='\0'; - appendItem(generalGroup, "TypeID", buff ); - - set_long(buff, dBInfo.creator); - buff[4]='\0'; - appendItem(generalGroup, "CreatorID", buff ); - appendItem(generalGroup, "NrRecords", nrRec ); - - - KFileMetaInfoGroup timeGroup = appendGroup(info, "TimeStamps"); - TQDateTime tm; - tm.setTime_t( dBInfo.createDate ); - appendItem(timeGroup, "CreationDate", tm); - tm.setTime_t( dBInfo.modifyDate ); - appendItem(timeGroup, "ModificationDate", tm); - tm.setTime_t( dBInfo.backupDate ); - appendItem(timeGroup, "BackupDate", tm); - - KFileMetaInfoGroup flagGroup = appendGroup(info, "Flags"); - appendItem(flagGroup, "ReadOnly", (dBInfo.flags & dlpDBFlagReadOnly)?i18n("Yes"):i18n("No") ); - appendItem(flagGroup, "MakeBackup", (dBInfo.flags & dlpDBFlagBackup)?i18n("Yes"):i18n("No") ); - appendItem(flagGroup, "CopyProtected", (dBInfo.flags & dlpDBFlagCopyPrevention)?i18n("Yes"):i18n("No") ); - appendItem(flagGroup, "Reset", (dBInfo.flags & dlpDBFlagReset)?i18n("Yes"):i18n("No") ); - appendItem(flagGroup, "ExcludeFromSync", (dBInfo.miscFlags & dlpDBMiscFlagExcludeFromSync)?i18n("Yes"):i18n("No") ); - - return true; -} - -/*bool KPalmPlugin::writeInfo( const KFileMetaInfo& info ) const -{ -// int pi_file_set_info((struct pi_file * pf, struct DBInfo * infop)); -//info["tuteTextTechnical"].value("An integer").toInt() -// Do the stuff with low-level functions. See lines 1119-1142 of pi-file.cc for writing, 244-273 for reading. -}*/ - -#include "kfile_palm.moc" diff --git a/kfile-plugins/palm-databases/kfile_palm.desktop b/kfile-plugins/palm-databases/kfile_palm.desktop deleted file mode 100644 index 5669357d..00000000 --- a/kfile-plugins/palm-databases/kfile_palm.desktop +++ /dev/null @@ -1,59 +0,0 @@ -[Desktop Entry] -Type=Service -Name=PalmOS Database Info -Name[af]=PalmOS databasis informasie -Name[be]=Ð†Ð½Ñ„Ð°Ñ€Ð¼Ð°Ñ†Ñ‹Ñ Ð°Ð± базе дадзеных PalmOS -Name[bg]=Ð˜Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ð¸Ñ Ð·Ð° БД на PalmOS -Name[br]=Titouroù diwar-benn ar stlennvon PalmOS -Name[bs]=Informacije o PalmOS bazi podataka -Name[ca]=Informació de base de dades PalmOS -Name[cs]=Informace o databázi PalmOS -Name[da]=PalmOS database-info -Name[de]=PalmOS Datenbank-Informationen -Name[el]=ΠληÏοφοÏίες βάσης δεδομένων PalmOS -Name[eo]=PalmOS-Datumbazinformo -Name[es]=Info. de la base de datos de PalmOS -Name[et]=PalmOS andmebaasi info -Name[eu]=PalmOS datu-base informazioa -Name[fa]=اطلاعات دادگان PalmOS -Name[fi]=PalmOS-tietokannan tiedot -Name[fr]=Informations sur les bases de données PalmOS -Name[fy]=PalmOS-database ynformaasje -Name[ga]=Eolas faoin Bhunachar Sonraí PalmOS -Name[gl]=Información de Base de Datos de PalmOS -Name[he]=מידע ×ודות בסיס ×”× ×ª×•× ×™× ×©×œ PalmOS -Name[hu]=PalmOS adatbázis-jellemzÅ‘k -Name[is]=PalmOS gagnagrunnsupplýsingar -Name[it]=Informazioni database PalmOs -Name[ja]=PalmOS データベース 情報 -Name[kk]=PalmOS деректер қорының мәліметі -Name[km]=áž–áŸážáŸŒáž˜áž¶áž“​មូលដ្ឋាន​ទិន្ននáŸáž™ PalmOS -Name[lt]=PalmOS duomenų bazÄ—s info -Name[mk]=Информации за PalmOS-база на податоци -Name[ms]=Maklumat Pangkalan Data PalmOS -Name[nb]=PalmOS Database info -Name[nds]=PalmOS-Datenbank-Informatschonen -Name[ne]=PalmOS डाटाबेस सूचना -Name[nl]=PalmOS-database informatie -Name[nn]=PalmOS-databaseinfo -Name[pl]=Baza danych PalmOS -Name[pt]=Informações de Base de Dados PalmOS -Name[pt_BR]=Informações da Base de Dados do PalmOS -Name[ru]=Ð¡Ð²ÐµÐ´ÐµÐ½Ð¸Ñ Ð¾ базе данных PalmOS -Name[se]=PalmOS-diehtovuoÄ‘Ä‘odieÄ‘ut -Name[sk]=Informácie o databázach PalmOS -Name[sl]=Informacije zbirke podatkov za PalmOS -Name[sr]=Информације о PalmOS базама података -Name[sr@Latn]=Informacije o PalmOS bazama podataka -Name[sv]=PalmOS-databasinformation -Name[ta]=பாலà¯à®®à¯OS தரவà¯à®¤à¯à®¤à®³ தகவல௠-Name[tg]=Иттилоот дар бораи бонки додаҳои PalmOS -Name[tr]=PalmOS Veritabanı Bilgisi -Name[uk]=Ð†Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ñ–Ñ Ð¿Ñ€Ð¾ базу даних PalmOS -Name[zh_CN]=PalmOS æ•°æ®åº“ä¿¡æ¯ -Name[zh_TW]=PalmOS 資料庫資訊 -ServiceTypes=KFilePlugin -X-TDE-Library=kfile_palm -MimeType=application/vnd.palm -PreferredGroups=General -PreferredItems=Name,DBType,TypeID,CreatorID,NrRecords,Size diff --git a/kfile-plugins/palm-databases/kfile_palm.h b/kfile-plugins/palm-databases/kfile_palm.h deleted file mode 100644 index ef91a3f0..00000000 --- a/kfile-plugins/palm-databases/kfile_palm.h +++ /dev/null @@ -1,41 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2004 Reinhold Kainhofer - * Based on the vcf plugin: - * Copyright (C) 2002 Shane Wright - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#ifndef __KFILE_PALM_H__ -#define __KFILE_PALM_H__ - -#include - -class TQStringList; - -class KPalmPlugin: public KFilePlugin -{ - Q_OBJECT - - -public: - KPalmPlugin( TQObject *parent, const char *name, const TQStringList& args ); - - virtual bool readInfo( KFileMetaInfo& info, uint what); -// virtual bool writeInfo( const KFileMetaInfo& info ) const; -}; - -#endif diff --git a/kfile-plugins/rfc822/Makefile.am b/kfile-plugins/rfc822/Makefile.am deleted file mode 100644 index f8fa6f94..00000000 --- a/kfile-plugins/rfc822/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -## Makefile.am for rfc822 file meta info plugin - -# set the include path for X, qt and KDE -INCLUDES = $(all_includes) - -# these are the headers for your project -noinst_HEADERS = kfile_rfc822.h - -kde_module_LTLIBRARIES = kfile_rfc822.la - -kfile_rfc822_la_SOURCES = kfile_rfc822.cpp -kfile_rfc822_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) -kfile_rfc822_la_LIBADD = $(LIB_KSYCOCA) - -# let automoc handle all of the meta source files (moc) -METASOURCES = AUTO - -messages: rc.cpp - $(XGETTEXT) kfile_rfc822.cpp -o $(podir)/kfile_rfc822.pot - -services_DATA = kfile_rfc822.desktop -servicesdir = $(kde_servicesdir) diff --git a/kfile-plugins/rfc822/RETURNED_ITEMS b/kfile-plugins/rfc822/RETURNED_ITEMS deleted file mode 100644 index be8c9b7e..00000000 --- a/kfile-plugins/rfc822/RETURNED_ITEMS +++ /dev/null @@ -1,14 +0,0 @@ -If you make a new plugin, please add the list of returned items to this list. - - -rfc822 plugin: -=========== - -type key W/A details ------------------------------------------------------------------------- -String From -/- Name/email of sender -String To -/- Name/email of recipient -String Subject -/- Subject line of message -String Date -/- Date stamped in message -String Content-Type -/- Content type declared in headers - diff --git a/kfile-plugins/rfc822/kfile_rfc822.cpp b/kfile-plugins/rfc822/kfile_rfc822.cpp deleted file mode 100644 index 6d248884..00000000 --- a/kfile-plugins/rfc822/kfile_rfc822.cpp +++ /dev/null @@ -1,161 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2002 Shane Wright - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#include -#include "kfile_rfc822.h" - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#if !defined(__osf__) -#include -#else -typedef unsigned short uint32_t; -#endif - -typedef KGenericFactory Rfc822Factory; - -K_EXPORT_COMPONENT_FACTORY(kfile_rfc822, Rfc822Factory( "kfile_rfc822" )) - -KRfc822Plugin::KRfc822Plugin(TQObject *parent, const char *name, - const TQStringList &args) - - : KFilePlugin(parent, name, args) -{ - KFileMimeTypeInfo* info = addMimeTypeInfo( "message/rfc822" ); - - KFileMimeTypeInfo::GroupInfo* group = 0L; - - group = addGroupInfo(info, "Technical", i18n("Technical Details")); - - KFileMimeTypeInfo::ItemInfo* item; - - item = addItemInfo(group, "From", i18n("From"), TQVariant::String); - item = addItemInfo(group, "To", i18n("To"), TQVariant::String); - item = addItemInfo(group, "Subject", i18n("Subject"), TQVariant::String); - item = addItemInfo(group, "Date", i18n("Date"), TQVariant::String); - item = addItemInfo(group, "Content-Type", i18n("Content-Type"), TQVariant::String); -} - - -bool KRfc822Plugin::readInfo( KFileMetaInfo& info, uint /*what*/ ) -{ - - TQFile file(info.path()); - - if (!file.open(IO_ReadOnly)) - { - kdDebug(7034) << "Couldn't open " << TQFile::encodeName(info.path()) << endl; - return false; - } - - /* - Note to self: probably should use TQCString for all this, but - what we're doing is simple and self-contained so never mind.. - */ - - char id_from[] = "From: "; - char id_to[] = "To: "; - char id_subject[] = "Subject: "; - char id_date[] = "Date: "; - char id_contenttype[] = "Content-Type: "; - - // we need a buffer for lines - char linebuf[4096]; - - // we need a buffer for other stuff - char buf_from[1000] = ""; - char buf_to[1000] = ""; - char buf_subject[1000] = ""; - char buf_date[1000] = ""; - char buf_contenttype[1000] = ""; - - memset(buf_from, 0, 999); - memset(buf_to, 0, 999); - memset(buf_subject, 0, 999); - memset(buf_date, 0, 999); - memset(buf_contenttype, 0, 999); - char * myptr; - - bool done=false; - while (!done) { - - // read a line - file.readLine(linebuf, sizeof( linebuf )); - - // have we got something useful? - if (memcmp(linebuf, id_from, 6) == 0) { - // we have a name - myptr = linebuf + 6; - strncpy(buf_from, myptr, sizeof( buf_from )); - buf_from[998]='\0'; - } else if (memcmp(linebuf, id_to, 4) == 0) { - // we have a name - myptr = linebuf + 4; - strncpy(buf_to, myptr, sizeof( buf_to )); - buf_to[998]='\0'; - } else if (memcmp(linebuf, id_subject, 9) == 0) { - // we have a name - myptr = linebuf + 9; - strncpy(buf_subject, myptr, sizeof( buf_subject )); - buf_subject[998]='\0'; - } else if (memcmp(linebuf, id_date, 6) == 0) { - // we have a name - myptr = linebuf + 6; - strncpy(buf_date, myptr, sizeof( buf_date )); - buf_date[998]='\0'; - } else if (memcmp(linebuf, id_contenttype, 14) == 0) { - // we have a name - myptr = linebuf + 14; - strncpy(buf_contenttype, myptr, sizeof( buf_contenttype )); - buf_contenttype[998]='\0'; - } - - // are we done yet? - if ( - ((strlen(buf_from) > 0) && (strlen(buf_to) > 0) && - (strlen(buf_subject) > 0) && (strlen(buf_date) > 0) && - (strlen(buf_contenttype) > 0)) || - (file.atEnd()) - ) - done = true; - - }; - - KFileMetaInfoGroup group = appendGroup(info, "Technical"); - - if (strlen(buf_from) > 0) appendItem(group, "From", buf_from); - if (strlen(buf_to) > 0) appendItem(group, "To", buf_to); - if (strlen(buf_subject) > 0) appendItem(group, "Subject", buf_subject); - if (strlen(buf_date) > 0) appendItem(group, "Date", buf_date); - if (strlen(buf_contenttype) > 0) appendItem(group, "Content-Type", buf_contenttype); - - return true; -} - -#include "kfile_rfc822.moc" diff --git a/kfile-plugins/rfc822/kfile_rfc822.desktop b/kfile-plugins/rfc822/kfile_rfc822.desktop deleted file mode 100644 index 7717f348..00000000 --- a/kfile-plugins/rfc822/kfile_rfc822.desktop +++ /dev/null @@ -1,62 +0,0 @@ -[Desktop Entry] -Type=Service -Name=Email Info -Name[af]=E-pos informasie -Name[be]=Ð†Ð½Ñ„Ð°Ñ€Ð¼Ð°Ñ†Ñ‹Ñ Ð°Ð± паведамленні Ñлектроннай пошты -Name[bg]=Ð˜Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ð¸Ñ Ð·Ð° е-поща -Name[br]=Titouroù postel -Name[ca]=Informació de correu-e -Name[cs]=Informace o emailu -Name[cy]=Gwybodaeth Ebost -Name[da]=E-mail-info -Name[de]=E-Mail-Info -Name[el]=ΠληÏοφοÏίες Email -Name[eo]=RetpoÅt-informo -Name[es]=Info de correo electrónico -Name[et]=Kirja info -Name[eu]=E-posta informazioa -Name[fa]=اطلاعات رایانامه -Name[fi]=Sähköpostitiedot -Name[fr]=Informations sur le courrier électronique -Name[fy]=E-port-ynformaasje -Name[gl]=Información de Correo-e -Name[he]=מידע על דו×"ל -Name[hi]=ई-मेल जानकारी -Name[hr]=Email Informacije -Name[hu]=E-mail-jellemzÅ‘k -Name[is]=Tölvupóst upplýsingar -Name[it]=Informazioni di posta elettronica -Name[ja]=Eメール 情報 -Name[kk]=Эл.пошта мәліметі -Name[km]=áž–áŸážáŸŒáž˜áž¶áž“​អ៊ីមែល -Name[lt]=E. paÅ¡to info -Name[mk]=Информации за е-пошта -Name[ms]=Info Emel -Name[nb]=E-post-info -Name[nds]=Nettbreef-Informatschonen -Name[ne]=इमेल सूचना -Name[nl]=E-mail-informatie -Name[nn]=Epost-info -Name[pa]=ਈ-ਪੱਤਰ ਜਾਣਕਾਰੀ -Name[pl]=Informacja o e-mailu -Name[pt]=Informação do E-Mail -Name[pt_BR]=Informações sobre E-mail -Name[ro]=InformaÅ£ii e-mail -Name[ru]=Ð¡Ð²ÐµÐ´ÐµÐ½Ð¸Ñ Ð¾Ð± Ñлектронной почте -Name[se]=E-boastadieÄ‘ut -Name[sk]=Informácie o emaily -Name[sl]=Informacije o e-poÅ¡ti -Name[sr]=Е-поштанÑке информације -Name[sr@Latn]=E-poÅ¡tanske informacije -Name[sv]=E-postinformation -Name[ta]=மினà¯à®©à®žà¯à®šà®²à¯ தகவல௠-Name[tg]=Иттилоот дар бораи почтаи Ñлектронӣ -Name[tr]=E-Posta Bilgisi -Name[uk]=Ð†Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ñ–Ñ Ð¿Ñ€Ð¾ Ð¿Ð¾Ð²Ñ–Ð´Ð¾Ð¼Ð»ÐµÐ½Ð½Ñ ÐµÐ». пошти -Name[zh_CN]=电å­é‚®ä»¶ä¿¡æ¯ -Name[zh_TW]=é›»å­éƒµä»¶è³‡è¨Š -ServiceTypes=KFilePlugin -X-TDE-Library=kfile_rfc822 -MimeType=message/rfc822 -PreferredGroups=Technical -PreferredItems=From,To,Subject,Date,Content-Type diff --git a/kfile-plugins/rfc822/kfile_rfc822.h b/kfile-plugins/rfc822/kfile_rfc822.h deleted file mode 100644 index 2fcfaa18..00000000 --- a/kfile-plugins/rfc822/kfile_rfc822.h +++ /dev/null @@ -1,38 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2002 Shane Wright - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#ifndef __KFILE_RFC822_H__ -#define __KFILE_RFC822_H__ - -#include - -class TQStringList; - -class KRfc822Plugin: public KFilePlugin -{ - Q_OBJECT - - -public: - KRfc822Plugin( TQObject *parent, const char *name, const TQStringList& args ); - - virtual bool readInfo( KFileMetaInfo& info, uint what); -}; - -#endif diff --git a/kfile-plugins/vcf/CMakeLists.txt b/kfile-plugins/vcf/CMakeLists.txt deleted file mode 100644 index 114c6da7..00000000 --- a/kfile-plugins/vcf/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -################################################# -# -# (C) 2010-2011 Serghei Amelian -# serghei (DOT) amelian (AT) gmail.com -# -# Improvements and feedback are welcome -# -# This file is released under GPL >= 2 -# -################################################# - -include_directories( - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_BINARY_DIR} - ${TDE_INCLUDE_DIR} - ${TQT_INCLUDE_DIRS} -) - -link_directories( - ${TQT_LIBRARY_DIRS} -) - - -##### other data ################################ - -install( FILES kfile_vcf.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) - - -##### kfile_vcf (module) ######################## - -tde_add_kpart( kfile_vcf AUTOMOC - SOURCES kfile_vcf.cpp - LINK kabc-shared - DESTINATION ${PLUGIN_INSTALL_DIR} -) diff --git a/kfile-plugins/vcf/Makefile.am b/kfile-plugins/vcf/Makefile.am deleted file mode 100644 index 087600d7..00000000 --- a/kfile-plugins/vcf/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -## Makefile.am for vcf file meta info plugin - -# set the include path for X, qt and KDE -INCLUDES = $(all_includes) - -# these are the headers for your project -noinst_HEADERS = kfile_vcf.h - -kde_module_LTLIBRARIES = kfile_vcf.la - -kfile_vcf_la_SOURCES = kfile_vcf.cpp -kfile_vcf_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) $(LIB_QT) -ltdecore -kfile_vcf_la_LIBADD = $(LIB_KSYCOCA) $(LIB_KABC) - -# let automoc handle all of the meta source files (moc) -METASOURCES = AUTO - -messages: rc.cpp - $(XGETTEXT) kfile_vcf.cpp -o $(podir)/kfile_vcf.pot - -services_DATA = kfile_vcf.desktop -servicesdir = $(kde_servicesdir) diff --git a/kfile-plugins/vcf/kfile_vcf.cpp b/kfile-plugins/vcf/kfile_vcf.cpp deleted file mode 100644 index c8c853f7..00000000 --- a/kfile-plugins/vcf/kfile_vcf.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2002 Shane Wright - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#include -#include -#include "kfile_vcf.h" - -#include -#include -#include -#include - -#include -#include - -typedef KGenericFactory VcfFactory; - -K_EXPORT_COMPONENT_FACTORY(kfile_vcf, VcfFactory( "kfile_vcf" )) - -KVcfPlugin::KVcfPlugin(TQObject *parent, const char *name, - const TQStringList &args) - - : KFilePlugin(parent, name, args) -{ - KFileMimeTypeInfo* info = addMimeTypeInfo( "text/x-vcard" ); - - KFileMimeTypeInfo::GroupInfo* group = 0L; - - group = addGroupInfo(info, "Technical", i18n("Technical Details")); - - KFileMimeTypeInfo::ItemInfo* item; - - item = addItemInfo(group, "Name", i18n("Name"), TQVariant::String); - item = addItemInfo(group, "Email", i18n("Email"), TQVariant::String); - item = addItemInfo(group, "Telephone", i18n("Telephone"), TQVariant::String); -} - - -bool KVcfPlugin::readInfo( KFileMetaInfo& info, uint /*what*/ ) -{ - TQFile file(info.path()); - - if (!file.open(IO_ReadOnly)) - { - kdDebug(7034) << "Couldn't open " << TQString(TQFile::encodeName(info.path())) << endl; - return false; - } - - // even the vcard thumbnail TQString::fromUtf8(buf_name));creator reads the full file ... - // The following is partly copied from there - TQString contents = file.readAll(); - file.close(); - - KABC::VCardConverter converter; -#if defined(KABC_VCARD_ENCODING_FIX) - KABC::Addressee addr = converter.parseVCardRaw( contents.utf8() ); -#else - KABC::Addressee addr = converter.parseVCard( contents ); -#endif - KFileMetaInfoGroup group = appendGroup(info, "Technical"); - - // prepare the text - TQString name = addr.formattedName().simplifyWhiteSpace(); - if ( name.isEmpty() ) - name = addr.givenName() + " " + addr.familyName(); - name = name.simplifyWhiteSpace(); - - if ( ! name.isEmpty() ) - appendItem(group, "Name", name); - - if ( ! addr.preferredEmail().isEmpty() ) - appendItem(group, "Email", addr.preferredEmail()); - - KABC::PhoneNumber::List pnList = addr.phoneNumbers(); - TQStringList phoneNumbers; - for (unsigned int no=0; no - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#ifndef __KFILE_VCF_H__ -#define __KFILE_VCF_H__ - -#include - -class TQStringList; - -class KVcfPlugin: public KFilePlugin -{ - Q_OBJECT - - -public: - KVcfPlugin( TQObject *parent, const char *name, const TQStringList& args ); - - virtual bool readInfo( KFileMetaInfo& info, uint what); -}; - -#endif diff --git a/kioslaves/CMakeLists.txt b/kioslaves/CMakeLists.txt deleted file mode 100644 index 56a5fcba..00000000 --- a/kioslaves/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -################################################# -# -# (C) 2010-2011 Serghei Amelian -# serghei (DOT) amelian (AT) gmail.com -# -# Improvements and feedback are welcome -# -# This file is released under GPL >= 2 -# -################################################# - -include( ConfigureChecks.cmake ) - -add_subdirectory( imap4 ) -add_subdirectory( mbox ) - -if( WITH_SASL ) - add_subdirectory( sieve ) -else( ) - message( "*** sieve kioslave will not be built (because lack of sasl support)" ) -endif( ) diff --git a/kioslaves/ConfigureChecks.cmake b/kioslaves/ConfigureChecks.cmake deleted file mode 100644 index 9cbd46c0..00000000 --- a/kioslaves/ConfigureChecks.cmake +++ /dev/null @@ -1,22 +0,0 @@ -################################################# -# -# (C) 2010-2011 Serghei Amelian -# serghei (DOT) amelian (AT) gmail.com -# -# Improvements and feedback are welcome -# -# This file is released under GPL >= 2 -# -################################################# - -if( WITH_SASL ) - check_include_file( sasl/sasl.h HAVE_SASL_SASL_H ) - if( HAVE_SASL_SASL_H ) - check_library_exists( sasl2 sasl_client_init "" HAVE_LIBSASL2 ) - endif( ) - if( HAVE_LIBSASL2 ) - set( SASL_LIBRARY sasl2 CACHE INTERNAL "" ) - else( ) - tde_message_fatal( "cyrus-sasl are requested, but not found on your system" ) - endif( ) -endif( ) diff --git a/kioslaves/Mainpage.dox b/kioslaves/Mainpage.dox deleted file mode 100644 index 24e1ca68..00000000 --- a/kioslaves/Mainpage.dox +++ /dev/null @@ -1,9 +0,0 @@ -/** @mainpage -* -* IO Slaves. -* -* KDE PIM contains a few KIOSlaves. The most important -* of these is the IMAP4Protocol slave which is used for IMAP operations. -* Similarly, the MBoxProtocol slave is used to access mbox files. -* -*/ diff --git a/kioslaves/Makefile.am b/kioslaves/Makefile.am deleted file mode 100644 index 8258295e..00000000 --- a/kioslaves/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -## $Id$ - -if compile_kio_sieve - SIEVE_SUBDIR = sieve -endif - -SUBDIRS = imap4 mbox $(SIEVE_SUBDIR) - -DOXYGEN_REFERENCES = kioslaves/imap4 kioslaves/mbox -include $(top_srcdir)/admin/Doxyfile.am - diff --git a/kioslaves/configure.in.bot b/kioslaves/configure.in.bot deleted file mode 100644 index fdad4b63..00000000 --- a/kioslaves/configure.in.bot +++ /dev/null @@ -1,6 +0,0 @@ -if test "x$with_sasl" = xcheck && test -z "$SASL2_LIBS"; then - echo "" - echo "cyrus-sasl 2 library is missing. The sieve ioslave will not be built, and imap4 will lack of a lot of authentication methods." - echo "" - all_tests=bad -fi diff --git a/kioslaves/configure.in.in b/kioslaves/configure.in.in deleted file mode 100644 index 47b98682..00000000 --- a/kioslaves/configure.in.in +++ /dev/null @@ -1,27 +0,0 @@ -KDE_CHECK_SSL - -AC_ARG_WITH(sasl, - [AC_HELP_STRING(--with-sasl, - [enable support for authentication through cyrus-sasl @<:@default=check@:>@])], - [], with_sasl=check) - -sasl2_header="no" -SASL2_LIBS="" -if test "x$with_sasl" != xno; then - KDE_CHECK_HEADERS(sasl/sasl.h, sasl2_header="yes") - if test "$sasl2_header" = "yes" ; then - KDE_CHECK_LIB(sasl2, sasl_client_init, SASL2_LIBS="-lsasl2") - fi - - if test "x$SASL2_LIBS" != "x" ; then - AC_DEFINE_UNQUOTED(HAVE_LIBSASL2, 1, [Define if you have cyrus-sasl2 libraries]) - fi - - if test "x$with_sasl" != xcheck && test -z "$SASL2_LIBS"; then - AC_MSG_ERROR([--with-sasl was given, but test for cyrus-sasl failed]) - fi -fi - -AC_SUBST(SASL2_LIBS) - -AM_CONDITIONAL(compile_kio_sieve, test -n "$SASL2_LIBS") diff --git a/kioslaves/imap4/CMakeLists.txt b/kioslaves/imap4/CMakeLists.txt deleted file mode 100644 index adb628c3..00000000 --- a/kioslaves/imap4/CMakeLists.txt +++ /dev/null @@ -1,44 +0,0 @@ -################################################# -# -# (C) 2010-2011 Serghei Amelian -# serghei (DOT) amelian (AT) gmail.com -# -# Improvements and feedback are welcome -# -# This file is released under GPL >= 2 -# -################################################# - -tde_import( libkmime ) - -include_directories( - ${CMAKE_BINARY_DIR} - ${CMAKE_SOURCE_DIR}/libemailfunctions - ${CMAKE_SOURCE_DIR}/libkmime - ${CMAKE_SOURCE_DIR}/libtdepim - ${TDE_INCLUDE_DIR} - ${TQT_INCLUDE_DIRS} -) - -link_directories( - ${TQT_LIBRARY_DIRS} -) - - -##### other data ################################ - -install( FILES - imap4.protocol imaps.protocol - DESTINATION ${SERVICES_INSTALL_DIR} ) - - -##### kio_imap4 (module) ######################## - -tde_add_kpart( kio_imap4 - SOURCES - imapcommand.cc imaplist.cc mailaddress.cc mimeheader.cc - rfcdecoder.cc imap4.cc imapinfo.cc imapparser.cc - mailheader.cc mimehdrline.cc mimeio.cc - LINK emailfunctions-static kmime-shared kio-shared ${SASL_LIBRARY} - DESTINATION ${PLUGIN_INSTALL_DIR} -) diff --git a/kioslaves/imap4/Makefile.am b/kioslaves/imap4/Makefile.am deleted file mode 100644 index d7198727..00000000 --- a/kioslaves/imap4/Makefile.am +++ /dev/null @@ -1,26 +0,0 @@ -INCLUDES= -I$(top_srcdir)/libkmime \ - -I$(srcdir)/.. $(SSL_INCLUDES) \ - -I$(top_srcdir)/libemailfunctions \ - $(all_includes) - -####### Files - -kde_module_LTLIBRARIES = kio_imap4.la - -kio_imap4_la_SOURCES = imapcommand.cc imaplist.cc mailaddress.cc \ - mimeheader.cc rfcdecoder.cc imap4.cc imapinfo.cc imapparser.cc mailheader.cc \ - mimehdrline.cc mimeio.cc -kio_imap4_la_LIBADD = $(LIB_KIO) $(SASL2_LIBS) ../../libkmime/libkmime.la \ - ../../libemailfunctions/libemailfunctions.la -kio_imap4_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) -module $(KDE_PLUGIN) - -noinst_HEADERS = imap4.h -EXTRA_DIST = README - -kdelnk_DATA = imap4.protocol imaps.protocol -kdelnkdir = $(kde_servicesdir) - -messages: - $(XGETTEXT) *.cc -o $(podir)/kio_imap4.pot - -include $(top_srcdir)/admin/Doxyfile.am diff --git a/kioslaves/imap4/PATCHING b/kioslaves/imap4/PATCHING deleted file mode 100644 index 39bcdce9..00000000 --- a/kioslaves/imap4/PATCHING +++ /dev/null @@ -1,7 +0,0 @@ -If you are patching this code, please be very sensitive to performance issues. -The parser is already very slow and resource intensive. Be careful not to add -any extra string iterations (copies, QCString.length(), etc), mallocs, or -implicit object creation/copies. Use calltree before and after your patch to -verify that it is not too expensive, along with cpu usage timing and even -wall clock time. - diff --git a/kioslaves/imap4/README b/kioslaves/imap4/README deleted file mode 100644 index bc05146a..00000000 --- a/kioslaves/imap4/README +++ /dev/null @@ -1,48 +0,0 @@ -This is s.carstens@gmx.de release of KDE 2.0 kioslave -for the IMAP protocol. - -It supports LOGIN, AUTHENTICATE LOGIN, AUTHENTICATE ANONYMOUS and -AUTHENTICATE CRAM-MD5. -It supports the rfc2192 URL naming convention. - -- UIDVALIDITY check is conditional -- put will check if the mailbox exists and create it - or will append the data to that mailbox - (no append after create) - use edit->new->textfile from konqueror -- move will try to guess the correct destination - as konqueror appends the source mailbox name to - the destination -- del will currently delete empty directories, - mark messages for deletion. - If deleting a directory konqueror does the following: - - list the box - - take the box url + file name and try to delete it - - delete the box - As the konqueror created urls are invalid we ignore them - at the moment. -- relative URL's are not supported because - konqueror will not handle them -- there are 2 additional section keywords - ENVELOPE will do a FETCH ENVELOPE - STRUCTURE will do a FETCH BODYSTRUCTURE - normal behaviour is FETCH BODY.PEEK[section] - -- the mime types delivered are not really consistent - with the returned data - - it will return inode/directory on list entries - which contain inferiors - - it will return message/digest on selectable mailboxes - with file type S_IFDIR - - type message/rfc822-imap on selected messages - and type S_IFREG - -In Konqueror set the mimetype message/rfc822 to use -the inline viewer. - -Try it: imap://user@host/ - imap://user;AUTH=*@host/ - imap://user;AUTH=LOGIN@host/ - imap://user;AUTH=CRAM-MD5@host/ - -comments to s.carstens@gmx.de diff --git a/kioslaves/imap4/configure.in.in b/kioslaves/imap4/configure.in.in deleted file mode 100644 index 680e26e0..00000000 --- a/kioslaves/imap4/configure.in.in +++ /dev/null @@ -1 +0,0 @@ -KDE_CHECK_SSL diff --git a/kioslaves/imap4/imap4.cc b/kioslaves/imap4/imap4.cc deleted file mode 100644 index 6654bb3d..00000000 --- a/kioslaves/imap4/imap4.cc +++ /dev/null @@ -1,2734 +0,0 @@ -/********************************************************************** - * - * imap4.cc - IMAP4rev1 KIOSlave - * Copyright (C) 2001-2002 Michael Haeckel - * Copyright (C) 1999 John Corey - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Send comments and bug fixes to jcorey@fruity.ath.cx - * - *********************************************************************/ - -/** - * @class IMAP4Protocol - * @note References: - * - RFC 2060 - Internet Message Access Protocol - Version 4rev1 - December 1996 - * - RFC 2192 - IMAP URL Scheme - September 1997 - * - RFC 1731 - IMAP Authentication Mechanisms - December 1994 - * (Discusses KERBEROSv4, GSSAPI, and S/Key) - * - RFC 2195 - IMAP/POP AUTHorize Extension for Simple Challenge/Response - * - September 1997 (CRAM-MD5 authentication method) - * - RFC 2104 - HMAC: Keyed-Hashing for Message Authentication - February 1997 - * - RFC 2086 - IMAP4 ACL extension - January 1997 - * - http://www.ietf.org/internet-drafts/draft-daboo-imap-annotatemore-05.txt - * IMAP ANNOTATEMORE draft - April 2004. - * - * - * Supported URLs: - * \verbatim -imap://server/ -imap://user:pass@server/ -imap://user;AUTH=method:pass@server/ -imap://server/folder/ - * \endverbatim - * These URLs cause the following actions (in order): - * - Prompt for user/pass, list all folders in home directory - * - Uses LOGIN to log in - * - Uses AUTHENTICATE to log in - * - List messages in folder - * - * @note API notes: - * Not receiving the required write access for a folder means - * ERR_CANNOT_OPEN_FOR_WRITING. - * ERR_DOES_NOT_EXIST is reserved for folders. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "imap4.h" - -#include "rfcdecoder.h" - -#include - -#include -#include -#include -#include -#include - -#ifdef HAVE_LIBSASL2 -extern "C" { -#include -} -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "tdepimmacros.h" - -#define IMAP_PROTOCOL "imap" -#define IMAP_SSL_PROTOCOL "imaps" - -using namespace TDEIO; - -extern "C" -{ - void sigalrm_handler (int); - KDE_EXPORT int kdemain (int argc, char **argv); -} - -int -kdemain (int argc, char **argv) -{ - kdDebug(7116) << "IMAP4::kdemain" << endl; - - TDEInstance instance ("kio_imap4"); - if (argc != 4) - { - fprintf(stderr, "Usage: kio_imap4 protocol domain-socket1 domain-socket2\n"); - ::exit (-1); - } - -#ifdef HAVE_LIBSASL2 - if ( sasl_client_init( NULL ) != SASL_OK ) { - fprintf(stderr, "SASL library initialization failed!\n"); - ::exit (-1); - } -#endif - - //set debug handler - - IMAP4Protocol *slave; - if (strcasecmp (argv[1], IMAP_SSL_PROTOCOL) == 0) - slave = new IMAP4Protocol (argv[2], argv[3], true); - else if (strcasecmp (argv[1], IMAP_PROTOCOL) == 0) - slave = new IMAP4Protocol (argv[2], argv[3], false); - else - abort (); - slave->dispatchLoop (); - delete slave; - -#ifdef HAVE_LIBSASL2 - sasl_done(); -#endif - - return 0; -} - -void -sigchld_handler (int signo) -{ - int pid, status; - - while (true && signo == SIGCHLD) - { - pid = waitpid (-1, &status, WNOHANG); - if (pid <= 0) - { - // Reinstall signal handler, since Linux resets to default after - // the signal occurred ( BSD handles it different, but it should do - // no harm ). - signal (SIGCHLD, sigchld_handler); - return; - } - } -} - -IMAP4Protocol::IMAP4Protocol (const TQCString & pool, const TQCString & app, bool isSSL):TCPSlaveBase ((isSSL ? 993 : 143), - (isSSL ? IMAP_SSL_PROTOCOL : IMAP_PROTOCOL), pool, - app, isSSL), imapParser (), mimeIO (), outputBuffer(outputCache) -{ - outputBufferIndex = 0; - mySSL = isSSL; - readBuffer[0] = 0x00; - relayEnabled = false; - readBufferLen = 0; - cacheOutput = false; - decodeContent = false; - mTimeOfLastNoop = TQDateTime(); -} - -IMAP4Protocol::~IMAP4Protocol () -{ - closeDescriptor(); - kdDebug(7116) << "IMAP4: Finishing" << endl; -} - -void -IMAP4Protocol::get (const KURL & _url) -{ - if (!makeLogin()) return; - kdDebug(7116) << "IMAP4::get - " << _url.prettyURL() << endl; - TQString aBox, aSequence, aType, aSection, aValidity, aDelimiter, aInfo; - enum IMAP_TYPE aEnum = - parseURL (_url, aBox, aSection, aType, aSequence, aValidity, aDelimiter, aInfo); - if (aEnum != ITYPE_ATTACH) - mimeType (getMimeType(aEnum)); - if (aInfo == "DECODE") - decodeContent = true; - - if (aSequence == "0:0" && getState() == ISTATE_SELECT) - { - imapCommand *cmd = doCommand (imapCommand::clientNoop()); - completeQueue.removeRef(cmd); - } - - if (aSequence.isEmpty ()) - { - aSequence = "1:*"; - } - - mProcessedSize = 0; - imapCommand *cmd = NULL; - if (!assureBox (aBox, true)) return; - -#ifdef USE_VALIDITY - if (selectInfo.uidValidityAvailable () && !aValidity.isEmpty () - && selectInfo.uidValidity () != aValidity.toULong ()) - { - // this url is stale - error (ERR_COULD_NOT_READ, _url.prettyURL()); - return; - } - else -#endif - { - // The "section" specified by the application can be: - // * empty (which means body, size and flags) - // * a known keyword, like STRUCTURE, ENVELOPE, HEADER, BODY.PEEK[...] - // (in which case the slave has some logic to add the necessary items) - // * Otherwise, it specifies the exact data items to request. In this case, all - // the logic is in the app. - - TQString aUpper = aSection.upper(); - if (aUpper.find ("STRUCTURE") != -1) - { - aSection = "BODYSTRUCTURE"; - } - else if (aUpper.find ("ENVELOPE") != -1) - { - aSection = "UID RFC822.SIZE FLAGS ENVELOPE"; - if (hasCapability("IMAP4rev1")) { - aSection += " BODY.PEEK[HEADER.FIELDS (REFERENCES)]"; - } else { - // imap4 does not know HEADER.FIELDS - aSection += " RFC822.HEADER.LINES (REFERENCES)"; - } - } - else if (aUpper == "HEADER") - { - aSection = "UID RFC822.HEADER RFC822.SIZE FLAGS"; - } - else if (aUpper.find ("BODY.PEEK[") != -1) - { - if (aUpper.find ("BODY.PEEK[]") != -1) - { - if (!hasCapability("IMAP4rev1")) // imap4 does not know BODY.PEEK[] - aSection.replace("BODY.PEEK[]", "RFC822.PEEK"); - } - aSection.prepend("UID RFC822.SIZE FLAGS "); - } - else if (aSection.isEmpty()) - { - aSection = "UID BODY[] RFC822.SIZE FLAGS"; - } - if (aEnum == ITYPE_BOX || aEnum == ITYPE_DIR_AND_BOX) - { - // write the digest header - cacheOutput = true; - outputLine - ("Content-Type: multipart/digest; boundary=\"IMAPDIGEST\"\r\n", 55); - if (selectInfo.recentAvailable ()) - outputLineStr ("X-Recent: " + - TQString::number(selectInfo.recent ()) + "\r\n"); - if (selectInfo.countAvailable ()) - outputLineStr ("X-Count: " + TQString::number(selectInfo.count ()) + - "\r\n"); - if (selectInfo.unseenAvailable ()) - outputLineStr ("X-Unseen: " + - TQString::number(selectInfo.unseen ()) + "\r\n"); - if (selectInfo.uidValidityAvailable ()) - outputLineStr ("X-uidValidity: " + - TQString::number(selectInfo.uidValidity ()) + - "\r\n"); - if (selectInfo.uidNextAvailable ()) - outputLineStr ("X-UidNext: " + - TQString::number(selectInfo.uidNext ()) + "\r\n"); - if (selectInfo.flagsAvailable ()) - outputLineStr ("X-Flags: " + TQString::number(selectInfo.flags ()) + - "\r\n"); - if (selectInfo.permanentFlagsAvailable ()) - outputLineStr ("X-PermanentFlags: " + - TQString::number(selectInfo.permanentFlags ()) + "\r\n"); - if (selectInfo.readWriteAvailable ()) { - if (selectInfo.readWrite()) { - outputLine ("X-Access: Read/Write\r\n", 22); - } else { - outputLine ("X-Access: Read only\r\n", 21); - } - } - outputLine ("\r\n", 2); - flushOutput(TQString()); - cacheOutput = false; - } - - if (aEnum == ITYPE_MSG || (aEnum == ITYPE_ATTACH && !decodeContent)) - relayEnabled = true; // normal mode, relay data - - if (aSequence != "0:0") - { - TQString contentEncoding; - if (aEnum == ITYPE_ATTACH && decodeContent) - { - // get the MIME header and fill getLastHandled() - TQString mySection = aSection; - mySection.replace("]", ".MIME]"); - cmd = sendCommand (imapCommand::clientFetch (aSequence, mySection)); - do - { - while (!parseLoop ()) ; - } - while (!cmd->isComplete ()); - completeQueue.removeRef (cmd); - // get the content encoding now because getLastHandled will be cleared - if (getLastHandled() && getLastHandled()->getHeader()) - contentEncoding = getLastHandled()->getHeader()->getEncoding(); - - // from here on collect the data - // it is send to the client in flushOutput in one go - // needed to decode the content - cacheOutput = true; - } - - cmd = sendCommand (imapCommand::clientFetch (aSequence, aSection)); - int res; - aUpper = aSection.upper(); - do - { - while (!(res = parseLoop())) ; - if (res == -1) break; - - mailHeader *lastone = 0; - imapCache *cache = getLastHandled (); - if (cache) - lastone = cache->getHeader (); - - if (cmd && !cmd->isComplete ()) - { - if ((aUpper.find ("BODYSTRUCTURE") != -1) - || (aUpper.find ("FLAGS") != -1) - || (aUpper.find ("UID") != -1) - || (aUpper.find ("ENVELOPE") != -1) - || (aUpper.find ("BODY.PEEK[0]") != -1 - && (aEnum == ITYPE_BOX || aEnum == ITYPE_DIR_AND_BOX))) - { - if (aEnum == ITYPE_BOX || aEnum == ITYPE_DIR_AND_BOX) - { - // write the mime header (default is here message/rfc822) - outputLine ("--IMAPDIGEST\r\n", 14); - cacheOutput = true; - if (cache && cache->getUid () != 0) - outputLineStr ("X-UID: " + - TQString::number(cache->getUid ()) + "\r\n"); - if (cache && cache->getSize () != 0) - outputLineStr ("X-Length: " + - TQString::number(cache->getSize ()) + "\r\n"); - if (cache && !cache->getDate ().isEmpty()) - outputLineStr ("X-Date: " + cache->getDate () + "\r\n"); - if (cache && cache->getFlags () != 0) - outputLineStr ("X-Flags: " + - TQString::number(cache->getFlags ()) + "\r\n"); - } else cacheOutput = true; - if ( lastone && !decodeContent ) - lastone->outputPart (*this); - cacheOutput = false; - flushOutput(contentEncoding); - } - } // if not complete - } - while (cmd && !cmd->isComplete ()); - if (aEnum == ITYPE_BOX || aEnum == ITYPE_DIR_AND_BOX) - { - // write the end boundary - outputLine ("--IMAPDIGEST--\r\n", 16); - } - - completeQueue.removeRef (cmd); - } - } - - // just to keep everybody happy when no data arrived - data (TQByteArray ()); - - finished (); - relayEnabled = false; - cacheOutput = false; - kdDebug(7116) << "IMAP4::get - finished" << endl; -} - -void -IMAP4Protocol::listDir (const KURL & _url) -{ - kdDebug(7116) << " IMAP4::listDir - " << _url.prettyURL() << endl; - - if (_url.path().isEmpty()) - { - KURL url = _url; - url.setPath("/"); - redirection( url ); - finished(); - return; - } - - TQString myBox, mySequence, myLType, mySection, myValidity, myDelimiter, myInfo; - // parseURL with caching - enum IMAP_TYPE myType = - parseURL (_url, myBox, mySection, myLType, mySequence, myValidity, - myDelimiter, myInfo, true); - - if (!makeLogin()) return; - - if (myType == ITYPE_DIR || myType == ITYPE_DIR_AND_BOX) - { - TQString listStr = myBox; - imapCommand *cmd; - - if (!listStr.isEmpty () && !listStr.endsWith(myDelimiter) && - mySection != "FOLDERONLY") - listStr += myDelimiter; - - if (mySection.isEmpty()) - { - listStr += "%"; - } else if (mySection == "COMPLETE") { - listStr += "*"; - } - kdDebug(7116) << "IMAP4Protocol::listDir - listStr=" << listStr << endl; - cmd = - doCommand (imapCommand::clientList ("", listStr, - (myLType == "LSUB" || myLType == "LSUBNOCHECK"))); - if (cmd->result () == "OK") - { - TQString mailboxName; - UDSEntry entry; - UDSAtom atom; - KURL aURL = _url; - if (aURL.path().find(';') != -1) - aURL.setPath(aURL.path().left(aURL.path().find(';'))); - - kdDebug(7116) << "IMAP4Protocol::listDir - got " << listResponses.count () << endl; - - if (myLType == "LSUB") - { - // fire the same command as LIST to check if the box really exists - TQValueList listResponsesSave = listResponses; - doCommand (imapCommand::clientList ("", listStr, false)); - for (TQValueListIterator < imapList > it = listResponsesSave.begin (); - it != listResponsesSave.end (); ++it) - { - bool boxOk = false; - for (TQValueListIterator < imapList > it2 = listResponses.begin (); - it2 != listResponses.end (); ++it2) - { - if ((*it2).name() == (*it).name()) - { - boxOk = true; - // copy the flags from the LIST-command - (*it) = (*it2); - break; - } - } - if (boxOk) - doListEntry (aURL, myBox, (*it), (mySection != "FOLDERONLY")); - else // this folder is dead - kdDebug(7116) << "IMAP4Protocol::listDir - suppress " << (*it).name() << endl; - } - listResponses = listResponsesSave; - } - else // LIST or LSUBNOCHECK - { - for (TQValueListIterator < imapList > it = listResponses.begin (); - it != listResponses.end (); ++it) - { - doListEntry (aURL, myBox, (*it), (mySection != "FOLDERONLY")); - } - } - entry.clear (); - listEntry (entry, true); - } - else - { - error (ERR_CANNOT_ENTER_DIRECTORY, _url.prettyURL()); - completeQueue.removeRef (cmd); - return; - } - completeQueue.removeRef (cmd); - } - if ((myType == ITYPE_BOX || myType == ITYPE_DIR_AND_BOX) - && myLType != "LIST" && myLType != "LSUB" && myLType != "LSUBNOCHECK") - { - KURL aURL = _url; - aURL.setQuery (TQString()); - const TQString encodedUrl = aURL.url(0, 106); // utf-8 - - if (!_url.query ().isEmpty ()) - { - TQString query = KURL::decode_string (_url.query ()); - query = query.right (query.length () - 1); - if (!query.isEmpty()) - { - imapCommand *cmd = NULL; - - if (!assureBox (myBox, true)) return; - - if (!selectInfo.countAvailable() || selectInfo.count()) - { - cmd = doCommand (imapCommand::clientSearch (query)); - if (cmd->result() != "OK") - { - error(ERR_UNSUPPORTED_ACTION, _url.prettyURL()); - completeQueue.removeRef (cmd); - return; - } - completeQueue.removeRef (cmd); - - TQStringList list = getResults (); - int stretch = 0; - - if (selectInfo.uidNextAvailable ()) - stretch = TQString::number(selectInfo.uidNext ()).length (); - UDSEntry entry; - imapCache fake; - - for (TQStringList::ConstIterator it = list.begin(); it != list.end(); - ++it) - { - fake.setUid((*it).toULong()); - doListEntry (encodedUrl, stretch, &fake); - } - entry.clear (); - listEntry (entry, true); - } - } - } - else - { - if (!assureBox (myBox, true)) return; - - kdDebug(7116) << "IMAP4: select returned:" << endl; - if (selectInfo.recentAvailable ()) - kdDebug(7116) << "Recent: " << selectInfo.recent () << "d" << endl; - if (selectInfo.countAvailable ()) - kdDebug(7116) << "Count: " << selectInfo.count () << "d" << endl; - if (selectInfo.unseenAvailable ()) - kdDebug(7116) << "Unseen: " << selectInfo.unseen () << "d" << endl; - if (selectInfo.uidValidityAvailable ()) - kdDebug(7116) << "uidValidity: " << selectInfo.uidValidity () << "d" << endl; - if (selectInfo.flagsAvailable ()) - kdDebug(7116) << "Flags: " << selectInfo.flags () << "d" << endl; - if (selectInfo.permanentFlagsAvailable ()) - kdDebug(7116) << "PermanentFlags: " << selectInfo.permanentFlags () << "d" << endl; - if (selectInfo.readWriteAvailable ()) - kdDebug(7116) << "Access: " << (selectInfo.readWrite ()? "Read/Write" : "Read only") << endl; - -#ifdef USE_VALIDITY - if (selectInfo.uidValidityAvailable () - && selectInfo.uidValidity () != myValidity.toULong ()) - { - //redirect - KURL newUrl = _url; - - newUrl.setPath ("/" + myBox + ";UIDVALIDITY=" + - TQString::number(selectInfo.uidValidity ())); - kdDebug(7116) << "IMAP4::listDir - redirecting to " << newUrl.prettyURL() << endl; - redirection (newUrl); - - - } - else -#endif - if (selectInfo.count () > 0) - { - int stretch = 0; - - if (selectInfo.uidNextAvailable ()) - stretch = TQString::number(selectInfo.uidNext ()).length (); - // kdDebug(7116) << selectInfo.uidNext() << "d used to stretch " << stretch << endl; - UDSEntry entry; - - if (mySequence.isEmpty()) mySequence = "1:*"; - - bool withSubject = mySection.isEmpty(); - if (mySection.isEmpty()) mySection = "UID RFC822.SIZE ENVELOPE"; - - bool withFlags = mySection.upper().find("FLAGS") != -1; - imapCommand *fetch = - sendCommand (imapCommand:: - clientFetch (mySequence, mySection)); - imapCache *cache; - do - { - while (!parseLoop ()) ; - - cache = getLastHandled (); - - if (cache && !fetch->isComplete()) - doListEntry (encodedUrl, stretch, cache, withFlags, withSubject); - } - while (!fetch->isComplete ()); - entry.clear (); - listEntry (entry, true); - } - } - } - if ( !selectInfo.alert().isNull() ) { - if ( !myBox.isEmpty() ) { - warning( i18n( "Message from %1 while processing '%2': %3" ).arg( myHost, myBox, selectInfo.alert() ) ); - } else { - warning( i18n( "Message from %1: %2" ).arg( myHost, TQString(selectInfo.alert()) ) ); - } - selectInfo.setAlert( 0 ); - } - - kdDebug(7116) << "IMAP4Protocol::listDir - Finishing listDir" << endl; - finished (); -} - -void -IMAP4Protocol::setHost (const TQString & _host, int _port, - const TQString & _user, const TQString & _pass) -{ - if (myHost != _host || myPort != _port || myUser != _user || myPass != _pass) - { // what's the point of doing 4 string compares to avoid 4 string copies? - // DF: I guess to avoid calling closeConnection() unnecessarily. - if (!myHost.isEmpty ()) - closeConnection (); - myHost = _host; - myPort = _port; - myUser = _user; - myPass = _pass; - } -} - -void -IMAP4Protocol::parseRelay (const TQByteArray & buffer) -{ - if (relayEnabled) { - // relay data immediately - data( buffer ); - mProcessedSize += buffer.size(); - processedSize( mProcessedSize ); - } else if (cacheOutput) - { - // collect data - if ( !outputBuffer.isOpen() ) { - outputBuffer.open(IO_WriteOnly); - } - outputBuffer.at(outputBufferIndex); - outputBuffer.writeBlock(buffer, buffer.size()); - outputBufferIndex += buffer.size(); - } -} - -void -IMAP4Protocol::parseRelay (ulong len) -{ - if (relayEnabled) - totalSize (len); -} - - -bool IMAP4Protocol::parseRead(TQByteArray & buffer, ulong len, ulong relay) -{ - char buf[8192]; - while (buffer.size() < len) - { - ssize_t readLen = myRead(buf, TQMIN(len - buffer.size(), sizeof(buf) - 1)); - if (readLen == 0) - { - kdDebug(7116) << "parseRead: readLen == 0 - connection broken" << endl; - error (ERR_CONNECTION_BROKEN, myHost); - setState(ISTATE_CONNECT); - closeConnection(); - return FALSE; - } - if (relay > buffer.size()) - { - TQByteArray relayData; - ssize_t relbuf = relay - buffer.size(); - int currentRelay = TQMIN(relbuf, readLen); - relayData.setRawData(buf, currentRelay); - parseRelay(relayData); - relayData.resetRawData(buf, currentRelay); - } - { - TQBuffer stream (buffer); - stream.open (IO_WriteOnly); - stream.at (buffer.size ()); - stream.writeBlock (buf, readLen); - stream.close (); - } - } - return (buffer.size() == len); -} - - -bool IMAP4Protocol::parseReadLine (TQByteArray & buffer, ulong relay) -{ - if (myHost.isEmpty()) return FALSE; - - while (true) { - ssize_t copyLen = 0; - if (readBufferLen > 0) - { - while (copyLen < readBufferLen && readBuffer[copyLen] != '\n') copyLen++; - if (copyLen < readBufferLen) copyLen++; - if (relay > 0) - { - TQByteArray relayData; - - if (copyLen < (ssize_t) relay) - relay = copyLen; - relayData.setRawData (readBuffer, relay); - parseRelay (relayData); - relayData.resetRawData (readBuffer, relay); -// kdDebug(7116) << "relayed : " << relay << "d" << endl; - } - // append to buffer - { - TQBuffer stream (buffer); - - stream.open (IO_WriteOnly); - stream.at (buffer.size ()); - stream.writeBlock (readBuffer, copyLen); - stream.close (); -// kdDebug(7116) << "appended " << copyLen << "d got now " << buffer.size() << endl; - } - - readBufferLen -= copyLen; - if (readBufferLen) - memmove(readBuffer, &readBuffer[copyLen], readBufferLen); - if (buffer[buffer.size() - 1] == '\n') return TRUE; - } - if (!isConnectionValid()) - { - kdDebug(7116) << "parseReadLine - connection broken" << endl; - error (ERR_CONNECTION_BROKEN, myHost); - setState(ISTATE_CONNECT); - closeConnection(); - return FALSE; - } - if (!waitForResponse( responseTimeout() )) - { - error(ERR_SERVER_TIMEOUT, myHost); - setState(ISTATE_CONNECT); - closeConnection(); - return FALSE; - } - readBufferLen = read(readBuffer, IMAP_BUFFER - 1); - if (readBufferLen == 0) - { - kdDebug(7116) << "parseReadLine: readBufferLen == 0 - connection broken" << endl; - error (ERR_CONNECTION_BROKEN, myHost); - setState(ISTATE_CONNECT); - closeConnection(); - return FALSE; - } - } -} - -void -IMAP4Protocol::setSubURL (const KURL & _url) -{ - kdDebug(7116) << "IMAP4::setSubURL - " << _url.prettyURL() << endl; - TDEIO::TCPSlaveBase::setSubURL (_url); -} - -void -IMAP4Protocol::put (const KURL & _url, int, bool, bool) -{ - kdDebug(7116) << "IMAP4::put - " << _url.prettyURL() << endl; -// TDEIO::TCPSlaveBase::put(_url,permissions,overwrite,resume); - TQString aBox, aSequence, aLType, aSection, aValidity, aDelimiter, aInfo; - enum IMAP_TYPE aType = - parseURL (_url, aBox, aSection, aLType, aSequence, aValidity, aDelimiter, aInfo); - - // see if it is a box - if (aType != ITYPE_BOX && aType != ITYPE_DIR_AND_BOX) - { - if (aBox[aBox.length () - 1] == '/') - aBox = aBox.right (aBox.length () - 1); - imapCommand *cmd = doCommand (imapCommand::clientCreate (aBox)); - - if (cmd->result () != "OK") { - error (ERR_COULD_NOT_WRITE, _url.prettyURL()); - completeQueue.removeRef (cmd); - return; - } - completeQueue.removeRef (cmd); - } - else - { - TQPtrList < TQByteArray > bufferList; - int length = 0; - - int result; - // Loop until we got 'dataEnd' - do - { - TQByteArray *buffer = new TQByteArray (); - dataReq (); // Request for data - result = readData (*buffer); - if (result > 0) - { - bufferList.append (buffer); - length += result; - } else { - delete buffer; - } - } - while (result > 0); - - if (result != 0) - { - error (ERR_ABORTED, _url.prettyURL()); - return; - } - - imapCommand *cmd = - sendCommand (imapCommand::clientAppend (aBox, aSection, length)); - while (!parseLoop ()) ; - - // see if server is waiting - if (!cmd->isComplete () && !getContinuation ().isEmpty ()) - { - bool sendOk = true; - ulong wrote = 0; - - TQByteArray *buffer; - // send data to server - while (!bufferList.isEmpty () && sendOk) - { - buffer = bufferList.take (0); - - sendOk = - (write (buffer->data (), buffer->size ()) == - (ssize_t) buffer->size ()); - wrote += buffer->size (); - processedSize(wrote); - delete buffer; - if (!sendOk) - { - error (ERR_CONNECTION_BROKEN, myHost); - completeQueue.removeRef (cmd); - setState(ISTATE_CONNECT); - closeConnection(); - return; - } - } - parseWriteLine (""); - // Wait until cmd is complete, or connection breaks. - while (!cmd->isComplete () && getState() != ISTATE_NO) - parseLoop (); - if ( getState() == ISTATE_NO ) { - // TODO KDE4: pass cmd->resultInfo() as third argument. - // ERR_CONNECTION_BROKEN expects a host, no way to pass details about the problem. - error( ERR_CONNECTION_BROKEN, myHost ); - completeQueue.removeRef (cmd); - closeConnection(); - return; - } - else if (cmd->result () != "OK") { - error( ERR_SLAVE_DEFINED, cmd->resultInfo() ); - completeQueue.removeRef (cmd); - return; - } - else - { - if (hasCapability("UIDPLUS")) - { - TQString uid = cmd->resultInfo(); - if (uid.find("APPENDUID") != -1) - { - uid = uid.section(" ", 2, 2); - uid.truncate(uid.length()-1); - infoMessage("UID "+uid); - } - } - // MUST reselect to get the new message - else if (aBox == getCurrentBox ()) - { - cmd = - doCommand (imapCommand:: - clientSelect (aBox, !selectInfo.readWrite ())); - completeQueue.removeRef (cmd); - } - } - } - else - { - //error (ERR_COULD_NOT_WRITE, myHost); - // Better ship the error message, e.g. "Over Quota" - error (ERR_SLAVE_DEFINED, cmd->resultInfo()); - completeQueue.removeRef (cmd); - return; - } - - completeQueue.removeRef (cmd); - } - - finished (); -} - -void -IMAP4Protocol::mkdir (const KURL & _url, int) -{ - kdDebug(7116) << "IMAP4::mkdir - " << _url.prettyURL() << endl; - TQString aBox, aSequence, aLType, aSection, aValidity, aDelimiter, aInfo; - parseURL(_url, aBox, aSection, aLType, aSequence, aValidity, aDelimiter, aInfo); - kdDebug(7116) << "IMAP4::mkdir - create " << aBox << endl; - imapCommand *cmd = doCommand (imapCommand::clientCreate(aBox)); - - if (cmd->result () != "OK") - { - kdDebug(7116) << "IMAP4::mkdir - " << cmd->resultInfo() << endl; - error (ERR_COULD_NOT_MKDIR, _url.prettyURL()); - completeQueue.removeRef (cmd); - return; - } - completeQueue.removeRef (cmd); - - // start a new listing to find the type of the folder - enum IMAP_TYPE type = - parseURL(_url, aBox, aSection, aLType, aSequence, aValidity, aDelimiter, aInfo); - if (type == ITYPE_BOX) - { - bool ask = ( aInfo.find( "ASKUSER" ) != -1 ); - if ( ask && - messageBox(QuestionYesNo, - i18n("The following folder will be created on the server: %1 " - "What do you want to store in this folder?").arg( aBox ), - i18n("Create Folder"), - i18n("&Messages"), i18n("&Subfolders")) == KMessageBox::No ) - { - cmd = doCommand(imapCommand::clientDelete(aBox)); - completeQueue.removeRef (cmd); - cmd = doCommand(imapCommand::clientCreate(aBox + aDelimiter)); - if (cmd->result () != "OK") - { - error (ERR_COULD_NOT_MKDIR, _url.prettyURL()); - completeQueue.removeRef (cmd); - return; - } - completeQueue.removeRef (cmd); - } - } - - cmd = doCommand(imapCommand::clientSubscribe(aBox)); - completeQueue.removeRef(cmd); - - finished (); -} - -void -IMAP4Protocol::copy (const KURL & src, const KURL & dest, int, bool overwrite) -{ - kdDebug(7116) << "IMAP4::copy - [" << (overwrite ? "Overwrite" : "NoOverwrite") << "] " << src.prettyURL() << " -> " << dest.prettyURL() << endl; - TQString sBox, sSequence, sLType, sSection, sValidity, sDelimiter, sInfo; - TQString dBox, dSequence, dLType, dSection, dValidity, dDelimiter, dInfo; - enum IMAP_TYPE sType = - parseURL (src, sBox, sSection, sLType, sSequence, sValidity, sDelimiter, sInfo); - enum IMAP_TYPE dType = - parseURL (dest, dBox, dSection, dLType, dSequence, dValidity, dDelimiter, dInfo); - - // see if we have to create anything - if (dType != ITYPE_BOX && dType != ITYPE_DIR_AND_BOX) - { - // this might be konqueror - int sub = dBox.find (sBox); - - // might be moving to upper folder - if (sub > 0) - { - KURL testDir = dest; - - TQString subDir = dBox.right (dBox.length () - dBox.findRev ('/')); - TQString topDir = dBox.left (sub); - testDir.setPath ("/" + topDir); - dType = - parseURL (testDir, topDir, dSection, dLType, dSequence, dValidity, - dDelimiter, dInfo); - - kdDebug(7116) << "IMAP4::copy - checking this destination " << topDir << endl; - // see if this is what the user wants - if (dType == ITYPE_BOX || dType == ITYPE_DIR_AND_BOX) - { - kdDebug(7116) << "IMAP4::copy - assuming this destination " << topDir << endl; - dBox = topDir; - } - else - { - - // maybe if we create a new mailbox - topDir = "/" + topDir + subDir; - testDir.setPath (topDir); - kdDebug(7116) << "IMAP4::copy - checking this destination " << topDir << endl; - dType = - parseURL (testDir, topDir, dSection, dLType, dSequence, dValidity, - dDelimiter, dInfo); - if (dType != ITYPE_BOX && dType != ITYPE_DIR_AND_BOX) - { - // ok then we'll create a mailbox - imapCommand *cmd = doCommand (imapCommand::clientCreate (topDir)); - - // on success we'll use it, else we'll just try to create the given dir - if (cmd->result () == "OK") - { - kdDebug(7116) << "IMAP4::copy - assuming this destination " << topDir << endl; - dType = ITYPE_BOX; - dBox = topDir; - } - else - { - completeQueue.removeRef (cmd); - cmd = doCommand (imapCommand::clientCreate (dBox)); - if (cmd->result () == "OK") - dType = ITYPE_BOX; - else - error (ERR_COULD_NOT_WRITE, dest.prettyURL()); - } - completeQueue.removeRef (cmd); - } - } - - } - } - if (sType == ITYPE_MSG || sType == ITYPE_BOX || sType == ITYPE_DIR_AND_BOX) - { - //select the source box - if (!assureBox(sBox, true)) return; - kdDebug(7116) << "IMAP4::copy - " << sBox << " -> " << dBox << endl; - - //issue copy command - imapCommand *cmd = - doCommand (imapCommand::clientCopy (dBox, sSequence)); - if (cmd->result () != "OK") - { - kdError(5006) << "IMAP4::copy - " << cmd->resultInfo() << endl; - error (ERR_COULD_NOT_WRITE, dest.prettyURL()); - completeQueue.removeRef (cmd); - return; - } else { - if (hasCapability("UIDPLUS")) - { - TQString uid = cmd->resultInfo(); - if (uid.find("COPYUID") != -1) - { - uid = uid.section(" ", 2, 3); - uid.truncate(uid.length()-1); - infoMessage("UID "+uid); - } - } - } - completeQueue.removeRef (cmd); - } - else - { - error (ERR_ACCESS_DENIED, src.prettyURL()); - return; - } - finished (); -} - -void -IMAP4Protocol::del (const KURL & _url, bool isFile) -{ - kdDebug(7116) << "IMAP4::del - [" << (isFile ? "File" : "NoFile") << "] " << _url.prettyURL() << endl; - TQString aBox, aSequence, aLType, aSection, aValidity, aDelimiter, aInfo; - enum IMAP_TYPE aType = - parseURL (_url, aBox, aSection, aLType, aSequence, aValidity, aDelimiter, aInfo); - - switch (aType) - { - case ITYPE_BOX: - case ITYPE_DIR_AND_BOX: - if (!aSequence.isEmpty ()) - { - if (aSequence == "*") - { - if (!assureBox (aBox, false)) return; - imapCommand *cmd = doCommand (imapCommand::clientExpunge ()); - if (cmd->result () != "OK") { - error (ERR_CANNOT_DELETE, _url.prettyURL()); - completeQueue.removeRef (cmd); - return; - } - completeQueue.removeRef (cmd); - } - else - { - // if open for read/write - if (!assureBox (aBox, false)) return; - imapCommand *cmd = - doCommand (imapCommand:: - clientStore (aSequence, "+FLAGS.SILENT", "\\DELETED")); - if (cmd->result () != "OK") { - error (ERR_CANNOT_DELETE, _url.prettyURL()); - completeQueue.removeRef (cmd); - return; - } - completeQueue.removeRef (cmd); - } - } - else - { - if (getCurrentBox() == aBox) - { - imapCommand *cmd = doCommand(imapCommand::clientClose()); - completeQueue.removeRef(cmd); - setState(ISTATE_LOGIN); - } - // We unsubscribe, otherwise we get ghost folders on UW-IMAP - imapCommand *cmd = doCommand(imapCommand::clientUnsubscribe(aBox)); - completeQueue.removeRef(cmd); - cmd = doCommand(imapCommand::clientDelete (aBox)); - // If this doesn't work, we try to empty the mailbox first - if (cmd->result () != "OK") - { - completeQueue.removeRef(cmd); - if (!assureBox(aBox, false)) return; - bool stillOk = true; - if (stillOk) - { - imapCommand *cmd = doCommand( - imapCommand::clientStore("1:*", "+FLAGS.SILENT", "\\DELETED")); - if (cmd->result () != "OK") stillOk = false; - completeQueue.removeRef(cmd); - } - if (stillOk) - { - imapCommand *cmd = doCommand(imapCommand::clientClose()); - if (cmd->result () != "OK") stillOk = false; - completeQueue.removeRef(cmd); - setState(ISTATE_LOGIN); - } - if (stillOk) - { - imapCommand *cmd = doCommand (imapCommand::clientDelete(aBox)); - if (cmd->result () != "OK") stillOk = false; - completeQueue.removeRef(cmd); - } - if (!stillOk) - { - error (ERR_COULD_NOT_RMDIR, _url.prettyURL()); - return; - } - } else { - completeQueue.removeRef (cmd); - } - } - break; - - case ITYPE_DIR: - { - imapCommand *cmd = doCommand (imapCommand::clientDelete (aBox)); - if (cmd->result () != "OK") { - error (ERR_COULD_NOT_RMDIR, _url.prettyURL()); - completeQueue.removeRef (cmd); - return; - } - completeQueue.removeRef (cmd); - } - break; - - case ITYPE_MSG: - { - // if open for read/write - if (!assureBox (aBox, false)) return; - imapCommand *cmd = - doCommand (imapCommand:: - clientStore (aSequence, "+FLAGS.SILENT", "\\DELETED")); - if (cmd->result () != "OK") { - error (ERR_CANNOT_DELETE, _url.prettyURL()); - completeQueue.removeRef (cmd); - return; - } - completeQueue.removeRef (cmd); - } - break; - - case ITYPE_UNKNOWN: - case ITYPE_ATTACH: - error (ERR_CANNOT_DELETE, _url.prettyURL()); - break; - } - finished (); -} - -/* - * Copy a mail: data = 'C' + srcURL (KURL) + destURL (KURL) - * Capabilities: data = 'c'. Result shipped in infoMessage() signal - * No-op: data = 'N' - * Namespace: data = 'n'. Result shipped in infoMessage() signal - * The format is: section=namespace=delimiter - * Note that the namespace can be empty - * Unsubscribe: data = 'U' + URL (KURL) - * Subscribe: data = 'u' + URL (KURL) - * Change the status: data = 'S' + URL (KURL) + Flags (TQCString) - * ACL commands: data = 'A' + command + URL (KURL) + command-dependent args - * AnnotateMore commands: data = 'M' + 'G'et/'S'et + URL + entry + command-dependent args - * Search: data = 'E' + URL (KURL) - * Quota commands: data = 'Q' + 'R'oot/'G'et/'S'et + URL + entry + command-dependent args - * Custom command: data = 'X' + 'N'ormal/'E'xtended + command + command-dependent args - */ -void -IMAP4Protocol::special (const TQByteArray & aData) -{ - kdDebug(7116) << "IMAP4Protocol::special" << endl; - if (!makeLogin()) return; - - TQDataStream stream(aData, IO_ReadOnly); - - int tmp; - stream >> tmp; - - switch (tmp) { - case 'C': - { - // copy - KURL src; - KURL dest; - stream >> src >> dest; - copy(src, dest, 0, FALSE); - break; - } - case 'c': - { - // capabilities - infoMessage(imapCapabilities.join(" ")); - finished(); - break; - } - case 'N': - { - // NOOP - imapCommand *cmd = doCommand(imapCommand::clientNoop()); - if (cmd->result () != "OK") - { - kdDebug(7116) << "NOOP did not succeed - connection broken" << endl; - completeQueue.removeRef (cmd); - error (ERR_CONNECTION_BROKEN, myHost); - return; - } - completeQueue.removeRef (cmd); - finished(); - break; - } - case 'n': - { - // namespace in the form "section=namespace=delimiter" - // entries are separated by , - infoMessage( imapNamespaces.join(",") ); - finished(); - break; - } - case 'U': - { - // unsubscribe - KURL _url; - stream >> _url; - TQString aBox, aSequence, aLType, aSection, aValidity, aDelimiter, aInfo; - parseURL (_url, aBox, aSection, aLType, aSequence, aValidity, aDelimiter, aInfo); - imapCommand *cmd = doCommand(imapCommand::clientUnsubscribe(aBox)); - if (cmd->result () != "OK") - { - completeQueue.removeRef (cmd); - error(ERR_SLAVE_DEFINED, i18n("Unsubscribe of folder %1 " - "failed. The server returned: %2") - .arg(_url.prettyURL()) - .arg(cmd->resultInfo())); - return; - } - completeQueue.removeRef (cmd); - finished(); - break; - } - case 'u': - { - // subscribe - KURL _url; - stream >> _url; - TQString aBox, aSequence, aLType, aSection, aValidity, aDelimiter, aInfo; - parseURL (_url, aBox, aSection, aLType, aSequence, aValidity, aDelimiter, aInfo); - imapCommand *cmd = doCommand(imapCommand::clientSubscribe(aBox)); - if (cmd->result () != "OK") - { - completeQueue.removeRef (cmd); - error(ERR_SLAVE_DEFINED, i18n("Subscribe of folder %1 " - "failed. The server returned: %2") - .arg(_url.prettyURL()) - .arg(cmd->resultInfo())); - return; - } - completeQueue.removeRef (cmd); - finished(); - break; - } - case 'A': - { - // acl - int cmd; - stream >> cmd; - if ( hasCapability( "ACL" ) ) { - specialACLCommand( cmd, stream ); - } else { - error( ERR_UNSUPPORTED_ACTION, "ACL" ); - } - break; - } - case 'M': - { - // annotatemore - int cmd; - stream >> cmd; - if ( hasCapability( "ANNOTATEMORE" ) ) { - specialAnnotateMoreCommand( cmd, stream ); - } else { - error( ERR_UNSUPPORTED_ACTION, "ANNOTATEMORE" ); - } - break; - } - case 'Q': - { - // quota - int cmd; - stream >> cmd; - if ( hasCapability( "QUOTA" ) ) { - specialQuotaCommand( cmd, stream ); - } else { - error( ERR_UNSUPPORTED_ACTION, "QUOTA" ); - } - break; - } - case 'S': - { - // status - KURL _url; - TQCString newFlags; - stream >> _url >> newFlags; - - TQString aBox, aSequence, aLType, aSection, aValidity, aDelimiter, aInfo; - parseURL (_url, aBox, aSection, aLType, aSequence, aValidity, aDelimiter, aInfo); - if (!assureBox(aBox, false)) return; - - // make sure we only touch flags we know - TQCString knownFlags = "\\SEEN \\ANSWERED \\FLAGGED \\DRAFT"; - const imapInfo info = getSelected(); - if ( info.permanentFlagsAvailable() && (info.permanentFlags() & imapInfo::User) ) { - knownFlags += " KMAILFORWARDED KMAILTODO KMAILWATCHED KMAILIGNORED $FORWARDED $TODO $WATCHED $IGNORED"; - } - - imapCommand *cmd = doCommand (imapCommand:: - clientStore (aSequence, "-FLAGS.SILENT", knownFlags)); - if (cmd->result () != "OK") - { - completeQueue.removeRef (cmd); - error(ERR_COULD_NOT_WRITE, i18n("Changing the flags of message %1 " - "failed.").arg(_url.prettyURL())); - return; - } - completeQueue.removeRef (cmd); - if (!newFlags.isEmpty()) - { - cmd = doCommand (imapCommand:: - clientStore (aSequence, "+FLAGS.SILENT", newFlags)); - if (cmd->result () != "OK") - { - completeQueue.removeRef (cmd); - error(ERR_COULD_NOT_WRITE, i18n("Changing the flags of message %1 " - "failed.").arg(_url.prettyURL())); - return; - } - completeQueue.removeRef (cmd); - } - finished(); - break; - } - case 's': - { - // seen - KURL _url; - bool seen; - TQCString newFlags; - stream >> _url >> seen; - - TQString aBox, aSequence, aLType, aSection, aValidity, aDelimiter, aInfo; - parseURL (_url, aBox, aSection, aLType, aSequence, aValidity, aDelimiter, aInfo); - if ( !assureBox(aBox, true) ) // read-only because changing SEEN should be possible even then - return; - - imapCommand *cmd; - if ( seen ) - cmd = doCommand( imapCommand::clientStore( aSequence, "+FLAGS.SILENT", "\\SEEN" ) ); - else - cmd = doCommand( imapCommand::clientStore( aSequence, "-FLAGS.SILENT", "\\SEEN" ) ); - - if (cmd->result () != "OK") - { - completeQueue.removeRef (cmd); - error(ERR_COULD_NOT_WRITE, i18n("Changing the flags of message %1 " - "failed.").arg(_url.prettyURL())); - return; - } - completeQueue.removeRef (cmd); - finished(); - break; - } - - case 'E': - { - // search - specialSearchCommand( stream ); - break; - } - case 'X': - { - // custom command - specialCustomCommand( stream ); - break; - } - default: - kdWarning(7116) << "Unknown command in special(): " << tmp << endl; - error( ERR_UNSUPPORTED_ACTION, TQString(TQChar(tmp)) ); - break; - } -} - -void -IMAP4Protocol::specialACLCommand( int command, TQDataStream& stream ) -{ - // All commands start with the URL to the box - KURL _url; - stream >> _url; - TQString aBox, aSequence, aLType, aSection, aValidity, aDelimiter, aInfo; - parseURL (_url, aBox, aSection, aLType, aSequence, aValidity, aDelimiter, aInfo); - - switch( command ) { - case 'S': // SETACL - { - TQString user, acl; - stream >> user >> acl; - kdDebug(7116) << "SETACL " << aBox << " " << user << " " << acl << endl; - imapCommand *cmd = doCommand(imapCommand::clientSetACL(aBox, user, acl)); - if (cmd->result () != "OK") - { - error(ERR_SLAVE_DEFINED, i18n("Setting the Access Control List on folder %1 " - "for user %2 failed. The server returned: %3") - .arg(_url.prettyURL()) - .arg(user) - .arg(cmd->resultInfo())); - return; - } - completeQueue.removeRef (cmd); - finished(); - break; - } - case 'D': // DELETEACL - { - TQString user; - stream >> user; - kdDebug(7116) << "DELETEACL " << aBox << " " << user << endl; - imapCommand *cmd = doCommand(imapCommand::clientDeleteACL(aBox, user)); - if (cmd->result () != "OK") - { - error(ERR_SLAVE_DEFINED, i18n("Deleting the Access Control List on folder %1 " - "for user %2 failed. The server returned: %3") - .arg(_url.prettyURL()) - .arg(user) - .arg(cmd->resultInfo())); - return; - } - completeQueue.removeRef (cmd); - finished(); - break; - } - case 'G': // GETACL - { - kdDebug(7116) << "GETACL " << aBox << endl; - imapCommand *cmd = doCommand(imapCommand::clientGetACL(aBox)); - if (cmd->result () != "OK") - { - error(ERR_SLAVE_DEFINED, i18n("Retrieving the Access Control List on folder %1 " - "failed. The server returned: %2") - .arg(_url.prettyURL()) - .arg(cmd->resultInfo())); - return; - } - // Returning information to the application from a special() command isn't easy. - // I'm reusing the infoMessage trick seen above (for capabilities), but this - // limits me to a string instead of a stringlist. Using DQUOTE as separator, - // because it's forbidden in userids by rfc3501 - kdDebug(7116) << getResults() << endl; - infoMessage(getResults().join( "\"" )); - finished(); - break; - } - case 'L': // LISTRIGHTS - { - // Do we need this one? It basically shows which rights are tied together, but that's all? - error( ERR_UNSUPPORTED_ACTION, TQString(TQChar(command)) ); - break; - } - case 'M': // MYRIGHTS - { - kdDebug(7116) << "MYRIGHTS " << aBox << endl; - imapCommand *cmd = doCommand(imapCommand::clientMyRights(aBox)); - if (cmd->result () != "OK") - { - error(ERR_SLAVE_DEFINED, i18n("Retrieving the Access Control List on folder %1 " - "failed. The server returned: %2") - .arg(_url.prettyURL()) - .arg(cmd->resultInfo())); - return; - } - TQStringList lst = getResults(); - kdDebug(7116) << "myrights results: " << lst << endl; - if ( !lst.isEmpty() ) { - Q_ASSERT( lst.count() == 1 ); - infoMessage( lst.first() ); - } - finished(); - break; - } - default: - kdWarning(7116) << "Unknown special ACL command:" << command << endl; - error( ERR_UNSUPPORTED_ACTION, TQString(TQChar(command)) ); - } -} - -void -IMAP4Protocol::specialSearchCommand( TQDataStream& stream ) -{ - kdDebug(7116) << "IMAP4Protocol::specialSearchCommand" << endl; - KURL _url; - stream >> _url; - TQString aBox, aSequence, aLType, aSection, aValidity, aDelimiter, aInfo; - parseURL (_url, aBox, aSection, aLType, aSequence, aValidity, aDelimiter, aInfo); - if (!assureBox(aBox, false)) return; - - imapCommand *cmd = doCommand (imapCommand::clientSearch( aSection )); - if (cmd->result () != "OK") - { - error(ERR_SLAVE_DEFINED, i18n("Searching of folder %1 " - "failed. The server returned: %2") - .arg(aBox) - .arg(cmd->resultInfo())); - return; - } - completeQueue.removeRef(cmd); - TQStringList lst = getResults(); - kdDebug(7116) << "IMAP4Protocol::specialSearchCommand '" << aSection << - "' returns " << lst << endl; - infoMessage( lst.join( " " ) ); - - finished(); -} - -void -IMAP4Protocol::specialCustomCommand( TQDataStream& stream ) -{ - kdDebug(7116) << "IMAP4Protocol::specialCustomCommand" << endl; - - TQString command, arguments; - int type; - stream >> type; - stream >> command >> arguments; - - /** - * In 'normal' mode we send the command with all information in one go - * and retrieve the result. - */ - if ( type == 'N' ) { - kdDebug(7116) << "IMAP4Protocol::specialCustomCommand: normal mode" << endl; - imapCommand *cmd = doCommand (imapCommand::clientCustom( command, arguments )); - if (cmd->result () != "OK") - { - error(ERR_SLAVE_DEFINED, i18n("Custom command %1:%2 " - "failed. The server returned: %3") - .arg(command) - .arg(arguments) - .arg(cmd->resultInfo())); - return; - } - completeQueue.removeRef(cmd); - TQStringList lst = getResults(); - kdDebug(7116) << "IMAP4Protocol::specialCustomCommand '" << command << - ":" << arguments << - "' returns " << lst << endl; - infoMessage( lst.join( " " ) ); - - finished(); - } else - /** - * In 'extended' mode we send a first header and push the data of the request in - * streaming mode. - */ - if ( type == 'E' ) { - kdDebug(7116) << "IMAP4Protocol::specialCustomCommand: extended mode" << endl; - imapCommand *cmd = sendCommand (imapCommand::clientCustom( command, TQString() )); - while ( !parseLoop () ) ; - - // see if server is waiting - if (!cmd->isComplete () && !getContinuation ().isEmpty ()) - { - const TQByteArray buffer = arguments.utf8(); - - // send data to server - bool sendOk = (write (buffer.data (), buffer.size ()) == (ssize_t)buffer.size ()); - processedSize( buffer.size() ); - - if ( !sendOk ) { - error ( ERR_CONNECTION_BROKEN, myHost ); - completeQueue.removeRef ( cmd ); - setState(ISTATE_CONNECT); - closeConnection(); - return; - } - } - parseWriteLine (""); - - do - { - while (!parseLoop ()) ; - } - while (!cmd->isComplete ()); - - completeQueue.removeRef (cmd); - - TQStringList lst = getResults(); - kdDebug(7116) << "IMAP4Protocol::specialCustomCommand: returns " << lst << endl; - infoMessage( lst.join( " " ) ); - - finished (); - } -} - -void -IMAP4Protocol::specialAnnotateMoreCommand( int command, TQDataStream& stream ) -{ - // All commands start with the URL to the box - KURL _url; - stream >> _url; - TQString aBox, aSequence, aLType, aSection, aValidity, aDelimiter, aInfo; - parseURL (_url, aBox, aSection, aLType, aSequence, aValidity, aDelimiter, aInfo); - - switch( command ) { - case 'S': // SETANNOTATION - { - // Params: - // KURL URL of the mailbox - // TQString entry (should be an actual entry name, no % or *; empty for server entries) - // TQMap attributes (name and value) - TQString entry; - TQMap attributes; - stream >> entry >> attributes; - kdDebug(7116) << "SETANNOTATION " << aBox << " " << entry << " " << attributes.count() << " attributes" << endl; - imapCommand *cmd = doCommand(imapCommand::clientSetAnnotation(aBox, entry, attributes)); - if (cmd->result () != "OK") - { - error(ERR_SLAVE_DEFINED, i18n("Setting the annotation %1 on folder %2 " - " failed. The server returned: %3") - .arg(entry) - .arg(_url.prettyURL()) - .arg(cmd->resultInfo())); - return; - } - completeQueue.removeRef (cmd); - finished(); - break; - } - case 'G': // GETANNOTATION. - { - // Params: - // KURL URL of the mailbox - // TQString entry (should be an actual entry name, no % or *; empty for server entries) - // TQStringList attributes (list of attributes to be retrieved, possibly with % or *) - TQString entry; - TQStringList attributeNames; - stream >> entry >> attributeNames; - kdDebug(7116) << "GETANNOTATION " << aBox << " " << entry << " " << attributeNames << endl; - imapCommand *cmd = doCommand(imapCommand::clientGetAnnotation(aBox, entry, attributeNames)); - if (cmd->result () != "OK") - { - error(ERR_SLAVE_DEFINED, i18n("Retrieving the annotation %1 on folder %2 " - "failed. The server returned: %3") - .arg(entry) - .arg(_url.prettyURL()) - .arg(cmd->resultInfo())); - return; - } - // Returning information to the application from a special() command isn't easy. - // I'm reusing the infoMessage trick seen above (for capabilities and acls), but this - // limits me to a string instead of a stringlist. Let's use \r as separator. - kdDebug(7116) << getResults() << endl; - infoMessage(getResults().join( "\r" )); - finished(); - break; - } - default: - kdWarning(7116) << "Unknown special annotate command:" << command << endl; - error( ERR_UNSUPPORTED_ACTION, TQString(TQChar(command)) ); - } -} - -void -IMAP4Protocol::specialQuotaCommand( int command, TQDataStream& stream ) -{ - // All commands start with the URL to the box - KURL _url; - stream >> _url; - TQString aBox, aSequence, aLType, aSection, aValidity, aDelimiter, aInfo; - parseURL (_url, aBox, aSection, aLType, aSequence, aValidity, aDelimiter, aInfo); - - switch( command ) { - case 'R': // GETQUOTAROOT - { - kdDebug(7116) << "QUOTAROOT " << aBox << endl; - imapCommand *cmd = doCommand(imapCommand::clientGetQuotaroot( aBox ) ); - if (cmd->result () != "OK") - { - error(ERR_SLAVE_DEFINED, i18n("Retrieving the quota root information on folder %1 " - "failed. The server returned: %2") - .arg(_url.prettyURL()) - .arg(cmd->resultInfo())); - return; - } - infoMessage(getResults().join( "\r" )); - finished(); - break; - } - case 'G': // GETQUOTA - { - kdDebug(7116) << "GETQUOTA command" << endl; - kdWarning(7116) << "UNIMPLEMENTED" << endl; - break; - } - case 'S': // SETQUOTA - { - kdDebug(7116) << "SETQUOTA command" << endl; - kdWarning(7116) << "UNIMPLEMENTED" << endl; - break; - } - default: - kdWarning(7116) << "Unknown special quota command:" << command << endl; - error( ERR_UNSUPPORTED_ACTION, TQString(TQChar(command)) ); - } -} - -void -IMAP4Protocol::rename (const KURL & src, const KURL & dest, bool overwrite) -{ - kdDebug(7116) << "IMAP4::rename - [" << (overwrite ? "Overwrite" : "NoOverwrite") << "] " << src.prettyURL() << " -> " << dest.prettyURL() << endl; - TQString sBox, sSequence, sLType, sSection, sValidity, sDelimiter, sInfo; - TQString dBox, dSequence, dLType, dSection, dValidity, dDelimiter, dInfo; - enum IMAP_TYPE sType = - parseURL (src, sBox, sSection, sLType, sSequence, sValidity, sDelimiter, sInfo, false); - enum IMAP_TYPE dType = - parseURL (dest, dBox, dSection, dLType, dSequence, dValidity, dDelimiter, dInfo, false); - - if (dType == ITYPE_UNKNOWN) - { - switch (sType) - { - case ITYPE_BOX: - case ITYPE_DIR: - case ITYPE_DIR_AND_BOX: - { - if (getState() == ISTATE_SELECT && sBox == getCurrentBox()) - { - kdDebug(7116) << "IMAP4::rename - close " << getCurrentBox() << endl; - // mailbox can only be renamed if it is closed - imapCommand *cmd = doCommand (imapCommand::clientClose()); - bool ok = cmd->result() == "OK"; - completeQueue.removeRef(cmd); - if (!ok) - { - kdWarning(7116) << "Unable to close mailbox!" << endl; - error(ERR_CANNOT_RENAME, src.path()); - return; - } - setState(ISTATE_LOGIN); - } - imapCommand *cmd = doCommand (imapCommand::clientRename (sBox, dBox)); - if (cmd->result () != "OK") { - error (ERR_CANNOT_RENAME, src.path()); - completeQueue.removeRef (cmd); - return; - } - completeQueue.removeRef (cmd); - } - break; - - case ITYPE_MSG: - case ITYPE_ATTACH: - case ITYPE_UNKNOWN: - error (ERR_CANNOT_RENAME, src.path()); - break; - } - } - else - { - error (ERR_CANNOT_RENAME, src.path()); - return; - } - finished (); -} - -void -IMAP4Protocol::slave_status () -{ - bool connected = (getState() != ISTATE_NO) && isConnectionValid(); - kdDebug(7116) << "IMAP4::slave_status " << connected << endl; - slaveStatus ( connected ? myHost : TQString(), connected ); -} - -void -IMAP4Protocol::dispatch (int command, const TQByteArray & data) -{ - kdDebug(7116) << "IMAP4::dispatch - command=" << command << endl; - TDEIO::TCPSlaveBase::dispatch (command, data); -} - -void -IMAP4Protocol::stat (const KURL & _url) -{ - kdDebug(7116) << "IMAP4::stat - " << _url.prettyURL() << endl; - TQString aBox, aSequence, aLType, aSection, aValidity, aDelimiter, aInfo; - // parseURL with caching - enum IMAP_TYPE aType = - parseURL (_url, aBox, aSection, aLType, aSequence, aValidity, aDelimiter, - aInfo, true); - - UDSEntry entry; - UDSAtom atom; - - atom.m_uds = UDS_NAME; - atom.m_str = aBox; - entry.append (atom); - - if (!aSection.isEmpty()) - { - if (getState() == ISTATE_SELECT && aBox == getCurrentBox()) - { - imapCommand *cmd = doCommand (imapCommand::clientClose()); - bool ok = cmd->result() == "OK"; - completeQueue.removeRef(cmd); - if (!ok) - { - error(ERR_COULD_NOT_STAT, aBox); - return; - } - setState(ISTATE_LOGIN); - } - bool ok = false; - TQString cmdInfo; - if (aType == ITYPE_MSG || aType == ITYPE_ATTACH) - ok = true; - else - { - imapCommand *cmd = doCommand(imapCommand::clienStatus(aBox, aSection)); - ok = cmd->result() == "OK"; - cmdInfo = cmd->resultInfo(); - completeQueue.removeRef(cmd); - } - if (!ok) - { - bool found = false; - imapCommand *cmd = doCommand (imapCommand::clientList ("", aBox)); - if (cmd->result () == "OK") - { - for (TQValueListIterator < imapList > it = listResponses.begin (); - it != listResponses.end (); ++it) - { - if (aBox == (*it).name ()) found = true; - } - } - completeQueue.removeRef (cmd); - if (found) - error(ERR_COULD_NOT_STAT, aBox); - else - error(TDEIO::ERR_DOES_NOT_EXIST, aBox); - return; - } - if ((aSection == "UIDNEXT" && geStatus().uidNextAvailable()) - || (aSection == "UNSEEN" && geStatus().unseenAvailable())) - { - atom.m_uds = UDS_SIZE; - atom.m_str = TQString(); - atom.m_long = (aSection == "UIDNEXT") ? geStatus().uidNext() - : geStatus().unseen(); - entry.append(atom); - } - } else - if (aType == ITYPE_BOX || aType == ITYPE_DIR_AND_BOX || aType == ITYPE_MSG || - aType == ITYPE_ATTACH) - { - ulong validity = 0; - // see if the box is already in select/examine state - if (aBox == getCurrentBox ()) - validity = selectInfo.uidValidity (); - else - { - // do a status lookup on the box - // only do this if the box is not selected - // the server might change the validity for new select/examine - imapCommand *cmd = - doCommand (imapCommand::clienStatus (aBox, "UIDVALIDITY")); - completeQueue.removeRef (cmd); - validity = geStatus ().uidValidity (); - } - validity = 0; // temporary - - if (aType == ITYPE_BOX || aType == ITYPE_DIR_AND_BOX) - { - // has no or an invalid uidvalidity - if (validity > 0 && validity != aValidity.toULong ()) - { - //redirect - KURL newUrl = _url; - - newUrl.setPath ("/" + aBox + ";UIDVALIDITY=" + - TQString::number(validity)); - kdDebug(7116) << "IMAP4::stat - redirecting to " << newUrl.prettyURL() << endl; - redirection (newUrl); - } - } - else if (aType == ITYPE_MSG || aType == ITYPE_ATTACH) - { - //must determine if this message exists - //cause konqueror will check this on paste operations - - // has an invalid uidvalidity - // or no messages in box - if (validity > 0 && validity != aValidity.toULong ()) - { - aType = ITYPE_UNKNOWN; - kdDebug(7116) << "IMAP4::stat - url has invalid validity [" << validity << "d] " << _url.prettyURL() << endl; - } - } - } - - atom.m_uds = UDS_MIME_TYPE; - atom.m_str = getMimeType (aType); - entry.append (atom); - - kdDebug(7116) << "IMAP4: stat: " << atom.m_str << endl; - switch (aType) - { - case ITYPE_DIR: - atom.m_uds = UDS_FILE_TYPE; - atom.m_str = TQString(); - atom.m_long = S_IFDIR; - entry.append (atom); - break; - - case ITYPE_BOX: - case ITYPE_DIR_AND_BOX: - atom.m_uds = UDS_FILE_TYPE; - atom.m_str = TQString(); - atom.m_long = S_IFDIR; - entry.append (atom); - break; - - case ITYPE_MSG: - case ITYPE_ATTACH: - atom.m_uds = UDS_FILE_TYPE; - atom.m_str = TQString(); - atom.m_long = S_IFREG; - entry.append (atom); - break; - - case ITYPE_UNKNOWN: - error (ERR_DOES_NOT_EXIST, _url.prettyURL()); - break; - } - - statEntry (entry); - kdDebug(7116) << "IMAP4::stat - Finishing stat" << endl; - finished (); -} - -void IMAP4Protocol::openConnection() -{ - if (makeLogin()) connected(); -} - -void IMAP4Protocol::closeConnection() -{ - if (getState() == ISTATE_NO) return; - if (getState() == ISTATE_SELECT && metaData("expunge") == "auto") - { - imapCommand *cmd = doCommand (imapCommand::clientExpunge()); - completeQueue.removeRef (cmd); - } - if (getState() != ISTATE_CONNECT) - { - imapCommand *cmd = doCommand (imapCommand::clientLogout()); - completeQueue.removeRef (cmd); - } - closeDescriptor(); - setState(ISTATE_NO); - completeQueue.clear(); - sentQueue.clear(); - lastHandled = 0; - currentBox = TQString(); - readBufferLen = 0; -} - -bool IMAP4Protocol::makeLogin () -{ - if (getState () == ISTATE_LOGIN || getState () == ISTATE_SELECT) - return true; - - kdDebug(7116) << "IMAP4::makeLogin - checking login" << endl; - bool alreadyConnected = getState() == ISTATE_CONNECT; - kdDebug(7116) << "IMAP4::makeLogin - alreadyConnected " << alreadyConnected << endl; - if (alreadyConnected || connectToHost (myHost.latin1(), myPort)) - { -// fcntl (m_iSock, F_SETFL, (fcntl (m_iSock, F_GETFL) | O_NDELAY)); - - setState(ISTATE_CONNECT); - - myAuth = metaData("auth"); - myTLS = metaData("tls"); - kdDebug(7116) << "myAuth: " << myAuth << endl; - - imapCommand *cmd; - - unhandled.clear (); - if (!alreadyConnected) while (!parseLoop ()) ; //get greeting - TQString greeting; - if (!unhandled.isEmpty()) greeting = unhandled.first().stripWhiteSpace(); - unhandled.clear (); //get rid of it - cmd = doCommand (new imapCommand ("CAPABILITY", "")); - - kdDebug(7116) << "IMAP4: setHost: capability" << endl; - for (TQStringList::Iterator it = imapCapabilities.begin (); - it != imapCapabilities.end (); ++it) - { - kdDebug(7116) << "'" << (*it) << "'" << endl; - } - completeQueue.removeRef (cmd); - - if (!hasCapability("IMAP4") && !hasCapability("IMAP4rev1")) - { - error(ERR_COULD_NOT_LOGIN, i18n("The server %1 supports neither " - "IMAP4 nor IMAP4rev1.\nIt identified itself with: %2") - .arg(myHost).arg(greeting)); - closeConnection(); - return false; - } - - if (metaData("nologin") == "on") return TRUE; - - if (myTLS == "on" && !hasCapability(TQString("STARTTLS"))) - { - error(ERR_COULD_NOT_LOGIN, i18n("The server does not support TLS.\n" - "Disable this security feature to connect unencrypted.")); - closeConnection(); - return false; - } - if ((myTLS == "on" || (canUseTLS() && myTLS != "off")) && - hasCapability(TQString("STARTTLS"))) - { - imapCommand *cmd = doCommand (imapCommand::clientStartTLS()); - if (cmd->result () == "OK") - { - completeQueue.removeRef(cmd); - int tlsrc = startTLS(); - if (tlsrc == 1) - { - kdDebug(7116) << "TLS mode has been enabled." << endl; - imapCommand *cmd2 = doCommand (new imapCommand ("CAPABILITY", "")); - for (TQStringList::Iterator it = imapCapabilities.begin (); - it != imapCapabilities.end (); ++it) - { - kdDebug(7116) << "'" << (*it) << "'" << endl; - } - completeQueue.removeRef (cmd2); - } else { - kdWarning(7116) << "TLS mode setup has failed. Aborting." << endl; - error (ERR_COULD_NOT_LOGIN, i18n("Starting TLS failed.")); - closeConnection(); - return false; - } - } else completeQueue.removeRef(cmd); - } - - if (myAuth.isEmpty () || myAuth == "*") { - if (hasCapability (TQString ("LOGINDISABLED"))) { - error (ERR_COULD_NOT_LOGIN, i18n("LOGIN is disabled by the server.")); - closeConnection(); - return false; - } - } - else { - if (!hasCapability (TQString ("AUTH=") + myAuth)) { - error (ERR_COULD_NOT_LOGIN, i18n("The authentication method %1 is not " - "supported by the server.").arg(myAuth)); - closeConnection(); - return false; - } - } - - if ( greeting.contains( TQRegExp( "Cyrus IMAP4 v2.1" ) ) ) { - removeCapability( "ANNOTATEMORE" ); - } - - // starting from Cyrus IMAP 2.3.9, shared seen flags are available - TQRegExp regExp( "Cyrus\\sIMAP[4]{0,1}\\sv(\\d+)\\.(\\d+)\\.(\\d+)", false ); - if ( regExp.search( greeting ) >= 0 ) { - const int major = regExp.cap( 1 ).toInt(); - const int minor = regExp.cap( 2 ).toInt(); - const int patch = regExp.cap( 3 ).toInt(); - if ( major > 2 || (major == 2 && (minor > 3 || (minor == 3 && patch > 9))) ) { - kdDebug(7116) << k_funcinfo << "Cyrus IMAP >= 2.3.9 detected, enabling shared seen flag support" << endl; - imapCapabilities.append( "x-kmail-sharedseen" ); - } - } - - kdDebug(7116) << "IMAP4::makeLogin - attempting login" << endl; - - TDEIO::AuthInfo authInfo; - authInfo.username = myUser; - authInfo.password = myPass; - authInfo.prompt = i18n ("Username and password for your IMAP account:"); - - kdDebug(7116) << "IMAP4::makeLogin - open_PassDlg said user=" << myUser << " pass=xx" << endl; - - TQString resultInfo; - if (myAuth.isEmpty () || myAuth == "*") - { - if (myUser.isEmpty () || myPass.isEmpty ()) { - if(openPassDlg (authInfo)) { - myUser = authInfo.username; - myPass = authInfo.password; - } - } - if (!clientLogin (myUser, myPass, resultInfo)) - error(TDEIO::ERR_COULD_NOT_AUTHENTICATE, i18n("Unable to login. Probably the " - "password is wrong.\nThe server %1 replied:\n%2").arg(myHost).arg(resultInfo)); - } - else - { -#ifdef HAVE_LIBSASL2 - if (!clientAuthenticate (this, authInfo, myHost, myAuth, mySSL, resultInfo)) - error(TDEIO::ERR_COULD_NOT_AUTHENTICATE, i18n("Unable to authenticate via %1.\n" - "The server %2 replied:\n%3").arg(myAuth).arg(myHost).arg(resultInfo)); - else { - myUser = authInfo.username; - myPass = authInfo.password; - } -#else - error(TDEIO::ERR_COULD_NOT_LOGIN, i18n("SASL authentication is not compiled into kio_imap4.")); -#endif - } - if ( hasCapability("NAMESPACE") ) - { - // get all namespaces and save the namespace - delimiter association - cmd = doCommand( imapCommand::clientNamespace() ); - if (cmd->result () == "OK") - { - kdDebug(7116) << "makeLogin - registered namespaces" << endl; - } - completeQueue.removeRef (cmd); - } - // get the default delimiter (empty listing) - cmd = doCommand( imapCommand::clientList("", "") ); - if (cmd->result () == "OK") - { - TQValueListIterator < imapList > it = listResponses.begin(); - if ( it == listResponses.end() ) - { - // empty answer - this is a buggy imap server - // as a fallback we fire a normal listing and take the first answer - completeQueue.removeRef (cmd); - cmd = doCommand( imapCommand::clientList("", "%") ); - if (cmd->result () == "OK") - { - it = listResponses.begin(); - } - } - if ( it != listResponses.end() ) - { - namespaceToDelimiter[TQString()] = (*it).hierarchyDelimiter(); - kdDebug(7116) << "makeLogin - delimiter for empty ns='" << - (*it).hierarchyDelimiter() << "'" << endl; - if ( !hasCapability("NAMESPACE") ) - { - // server does not support namespaces - TQString nsentry = TQString::number( 0 ) + "==" - + (*it).hierarchyDelimiter(); - imapNamespaces.append( nsentry ); - } - } - } - completeQueue.removeRef (cmd); - } else { - kdDebug(7116) << "makeLogin - NO login" << endl; - } - - return getState() == ISTATE_LOGIN; -} - -void -IMAP4Protocol::parseWriteLine (const TQString & aStr) -{ - //kdDebug(7116) << "Writing: " << aStr << endl; - TQCString writer = aStr.utf8(); - int len = writer.length(); - - // append CRLF if necessary - if (len == 0 || (writer[len - 1] != '\n')) { - len += 2; - writer += "\r\n"; - } - - // write it - write(writer.data(), len); -} - -TQString -IMAP4Protocol::getMimeType (enum IMAP_TYPE aType) -{ - switch (aType) - { - case ITYPE_DIR: - return "inode/directory"; - break; - - case ITYPE_BOX: - return "message/digest"; - break; - - case ITYPE_DIR_AND_BOX: - return "message/directory"; - break; - - case ITYPE_MSG: - return "message/rfc822"; - break; - - // this should be handled by flushOutput - case ITYPE_ATTACH: - return "application/octet-stream"; - break; - - case ITYPE_UNKNOWN: - default: - return "unknown/unknown"; - } -} - - - -void -IMAP4Protocol::doListEntry (const KURL & _url, int stretch, imapCache * cache, - bool withFlags, bool withSubject) -{ - KURL aURL = _url; - aURL.setQuery (TQString()); - const TQString encodedUrl = aURL.url(0, 106); // utf-8 - doListEntry(encodedUrl, stretch, cache, withFlags, withSubject); -} - - - -void -IMAP4Protocol::doListEntry (const TQString & encodedUrl, int stretch, imapCache * cache, - bool withFlags, bool withSubject) -{ - if (cache) - { - UDSEntry entry; - UDSAtom atom; - - entry.clear (); - - const TQString uid = TQString::number(cache->getUid()); - - atom.m_uds = UDS_NAME; - atom.m_str = uid; - atom.m_long = 0; - if (stretch > 0) - { - atom.m_str = "0000000000000000" + atom.m_str; - atom.m_str = atom.m_str.right (stretch); - } - if (withSubject) - { - mailHeader *header = cache->getHeader(); - if (header) - atom.m_str += " " + header->getSubject(); - } - entry.append (atom); - - atom.m_uds = UDS_URL; - atom.m_str = encodedUrl; // utf-8 - if (atom.m_str[atom.m_str.length () - 1] != '/') - atom.m_str += '/'; - atom.m_str += ";UID=" + uid; - atom.m_long = 0; - entry.append (atom); - - atom.m_uds = UDS_FILE_TYPE; - atom.m_str = TQString(); - atom.m_long = S_IFREG; - entry.append (atom); - - atom.m_uds = UDS_SIZE; - atom.m_long = cache->getSize(); - entry.append (atom); - - atom.m_uds = UDS_MIME_TYPE; - atom.m_str = "message/rfc822"; - atom.m_long = 0; - entry.append (atom); - - atom.m_uds = UDS_USER; - atom.m_str = myUser; - entry.append (atom); - - atom.m_uds = TDEIO::UDS_ACCESS; - atom.m_long = (withFlags) ? cache->getFlags() : S_IRUSR | S_IXUSR | S_IWUSR; - entry.append (atom); - - listEntry (entry, false); - } -} - -void -IMAP4Protocol::doListEntry (const KURL & _url, const TQString & myBox, - const imapList & item, bool appendPath) -{ - KURL aURL = _url; - aURL.setQuery (TQString()); - UDSEntry entry; - UDSAtom atom; - int hdLen = item.hierarchyDelimiter().length(); - - { - // mailboxName will be appended to the path if appendPath is true - TQString mailboxName = item.name (); - - // some beautification - if (mailboxName.find (myBox) == 0 && mailboxName.length() > myBox.length()) - { - mailboxName = - mailboxName.right (mailboxName.length () - myBox.length ()); - } - if (mailboxName[0] == '/') - mailboxName = mailboxName.right (mailboxName.length () - 1); - if (mailboxName.left(hdLen) == item.hierarchyDelimiter()) - mailboxName = mailboxName.right(mailboxName.length () - hdLen); - if (mailboxName.right(hdLen) == item.hierarchyDelimiter()) - mailboxName.truncate(mailboxName.length () - hdLen); - - atom.m_uds = UDS_NAME; - if (!item.hierarchyDelimiter().isEmpty() && - mailboxName.find(item.hierarchyDelimiter()) != -1) - atom.m_str = mailboxName.section(item.hierarchyDelimiter(), -1); - else - atom.m_str = mailboxName; - - // konqueror will die with an assertion failure otherwise - if (atom.m_str.isEmpty ()) - atom.m_str = ".."; - - if (!atom.m_str.isEmpty ()) - { - atom.m_long = 0; - entry.append (atom); - - if (!item.noSelect ()) - { - atom.m_uds = UDS_MIME_TYPE; - if (!item.noInferiors ()) - { - atom.m_str = "message/directory"; - } else { - atom.m_str = "message/digest"; - } - atom.m_long = 0; - entry.append (atom); - mailboxName += '/'; - - // explicitly set this as a directory for KFileDialog - atom.m_uds = UDS_FILE_TYPE; - atom.m_str = TQString(); - atom.m_long = S_IFDIR; - entry.append (atom); - } - else if (!item.noInferiors ()) - { - atom.m_uds = UDS_MIME_TYPE; - atom.m_str = "inode/directory"; - atom.m_long = 0; - entry.append (atom); - mailboxName += '/'; - - // explicitly set this as a directory for KFileDialog - atom.m_uds = UDS_FILE_TYPE; - atom.m_str = TQString(); - atom.m_long = S_IFDIR; - entry.append (atom); - } - else - { - atom.m_uds = UDS_MIME_TYPE; - atom.m_str = "unknown/unknown"; - atom.m_long = 0; - entry.append (atom); - } - - atom.m_uds = UDS_URL; - TQString path = aURL.path(); - atom.m_str = aURL.url (0, 106); // utf-8 - if (appendPath) - { - if (path[path.length() - 1] == '/' && !path.isEmpty() && path != "/") - path.truncate(path.length() - 1); - if (!path.isEmpty() && path != "/" - && path.right(hdLen) != item.hierarchyDelimiter()) { - path += item.hierarchyDelimiter(); - } - path += mailboxName; - if (path.upper() == "/INBOX/") { - // make sure the client can rely on INBOX - path = path.upper(); - } - } - aURL.setPath(path); - atom.m_str = aURL.url(0, 106); // utf-8 - atom.m_long = 0; - entry.append (atom); - - atom.m_uds = UDS_USER; - atom.m_str = myUser; - entry.append (atom); - - atom.m_uds = UDS_ACCESS; - atom.m_long = S_IRUSR | S_IXUSR | S_IWUSR; - entry.append (atom); - - atom.m_uds = UDS_EXTRA; - atom.m_str = item.attributesAsString(); - atom.m_long = 0; - entry.append (atom); - - listEntry (entry, false); - } - } -} - -enum IMAP_TYPE -IMAP4Protocol::parseURL (const KURL & _url, TQString & _box, - TQString & _section, TQString & _type, TQString & _uid, - TQString & _validity, TQString & _hierarchyDelimiter, - TQString & _info, bool cache) -{ - enum IMAP_TYPE retVal; - retVal = ITYPE_UNKNOWN; - - imapParser::parseURL (_url, _box, _section, _type, _uid, _validity, _info); -// kdDebug(7116) << "URL: query - '" << KURL::decode_string(_url.query()) << "'" << endl; - - // get the delimiter - TQString myNamespace = namespaceForBox( _box ); - kdDebug(7116) << "IMAP4::parseURL - namespace=" << myNamespace << endl; - if ( namespaceToDelimiter.contains(myNamespace) ) - { - _hierarchyDelimiter = namespaceToDelimiter[myNamespace]; - kdDebug(7116) << "IMAP4::parseURL - delimiter=" << _hierarchyDelimiter << endl; - } - - if (!_box.isEmpty ()) - { - kdDebug(7116) << "IMAP4::parseURL - box=" << _box << endl; - - if (makeLogin ()) - { - if (getCurrentBox () != _box || - _type == "LIST" || _type == "LSUB" || _type == "LSUBNOCHECK") - { - if ( cache ) - { - // assume a normal box - retVal = ITYPE_DIR_AND_BOX; - } else - { - // start a listing for the box to get the type - imapCommand *cmd; - - cmd = doCommand (imapCommand::clientList ("", _box)); - if (cmd->result () == "OK") - { - for (TQValueListIterator < imapList > it = listResponses.begin (); - it != listResponses.end (); ++it) - { - //kdDebug(7116) << "IMAP4::parseURL - checking " << _box << " to " << (*it).name() << endl; - if (_box == (*it).name ()) - { - if ( !(*it).hierarchyDelimiter().isEmpty() ) - _hierarchyDelimiter = (*it).hierarchyDelimiter(); - if ((*it).noSelect ()) - { - retVal = ITYPE_DIR; - } - else if ((*it).noInferiors ()) - { - retVal = ITYPE_BOX; - } - else - { - retVal = ITYPE_DIR_AND_BOX; - } - } - } - // if we got no list response for the box see if it's a prefix - if ( retVal == ITYPE_UNKNOWN && - namespaceToDelimiter.contains(_box) ) { - retVal = ITYPE_DIR; - } - } else { - kdDebug(7116) << "IMAP4::parseURL - got error for " << _box << endl; - } - completeQueue.removeRef (cmd); - } // cache - } - else // current == box - { - retVal = ITYPE_BOX; - } - } - else - kdDebug(7116) << "IMAP4::parseURL: no login!" << endl; - - } - else // empty box - { - // the root is just a dir - kdDebug(7116) << "IMAP4: parseURL: box [root]" << endl; - retVal = ITYPE_DIR; - } - - // see if it is a real sequence or a simple uid - if (retVal == ITYPE_BOX || retVal == ITYPE_DIR_AND_BOX) - { - if (!_uid.isEmpty ()) - { - if (_uid.find (':') == -1 && _uid.find (',') == -1 - && _uid.find ('*') == -1) - retVal = ITYPE_MSG; - } - } - if (retVal == ITYPE_MSG) - { - if ( (_section.find ("BODY.PEEK[", 0, false) != -1 || - _section.find ("BODY[", 0, false) != -1) && - _section.find(".MIME") == -1 && - _section.find(".HEADER") == -1 ) - retVal = ITYPE_ATTACH; - } - if ( _hierarchyDelimiter.isEmpty() && - (_type == "LIST" || _type == "LSUB" || _type == "LSUBNOCHECK") ) - { - // this shouldn't happen but when the delimiter is really empty - // we try to reconstruct it from the URL - if (!_box.isEmpty()) - { - int start = _url.path().findRev(_box); - if (start != -1) - _hierarchyDelimiter = _url.path().mid(start-1, start); - kdDebug(7116) << "IMAP4::parseURL - reconstructed delimiter:" << _hierarchyDelimiter - << " from URL " << _url.path() << endl; - } - if (_hierarchyDelimiter.isEmpty()) - _hierarchyDelimiter = "/"; - } - kdDebug(7116) << "IMAP4::parseURL - return " << retVal << endl; - - return retVal; -} - -int -IMAP4Protocol::outputLine (const TQCString & _str, int len) -{ - if (len == -1) { - len = _str.length(); - } - - if (cacheOutput) - { - if ( !outputBuffer.isOpen() ) { - outputBuffer.open(IO_WriteOnly); - } - outputBuffer.at(outputBufferIndex); - outputBuffer.writeBlock(_str.data(), len); - outputBufferIndex += len; - return 0; - } - - TQByteArray temp; - bool relay = relayEnabled; - - relayEnabled = true; - temp.setRawData (_str.data (), len); - parseRelay (temp); - temp.resetRawData (_str.data (), len); - - relayEnabled = relay; - return 0; -} - -void IMAP4Protocol::flushOutput(TQString contentEncoding) -{ - // send out cached data to the application - if (outputBufferIndex == 0) - return; - outputBuffer.close(); - outputCache.resize(outputBufferIndex); - if (decodeContent) - { - // get the coding from the MIME header - TQByteArray decoded; - if (contentEncoding.find("quoted-printable", 0, false) == 0) - decoded = KCodecs::quotedPrintableDecode(outputCache); - else if (contentEncoding.find("base64", 0, false) == 0) - KCodecs::base64Decode(outputCache, decoded); - else - decoded = outputCache; - - TQString mimetype = KMimeType::findByContent( decoded )->name(); - kdDebug(7116) << "IMAP4::flushOutput - mimeType " << mimetype << endl; - mimeType(mimetype); - decodeContent = false; - data( decoded ); - } else { - data( outputCache ); - } - mProcessedSize += outputBufferIndex; - processedSize( mProcessedSize ); - outputBufferIndex = 0; - outputCache[0] = '\0'; - outputBuffer.setBuffer(outputCache); -} - -ssize_t IMAP4Protocol::myRead(void *data, ssize_t len) -{ - if (readBufferLen) - { - ssize_t copyLen = (len < readBufferLen) ? len : readBufferLen; - memcpy(data, readBuffer, copyLen); - readBufferLen -= copyLen; - if (readBufferLen) memcpy(readBuffer, &readBuffer[copyLen], readBufferLen); - return copyLen; - } - if (!isConnectionValid()) return 0; - waitForResponse( responseTimeout() ); - return read(data, len); -} - -bool -IMAP4Protocol::assureBox (const TQString & aBox, bool readonly) -{ - if (aBox.isEmpty()) return false; - - imapCommand *cmd = 0; - - if (aBox != getCurrentBox () || (!getSelected().readWrite() && !readonly)) - { - // open the box with the appropriate mode - kdDebug(7116) << "IMAP4Protocol::assureBox - opening box" << endl; - selectInfo = imapInfo(); - cmd = doCommand (imapCommand::clientSelect (aBox, readonly)); - bool ok = cmd->result() == "OK"; - TQString cmdInfo = cmd->resultInfo(); - completeQueue.removeRef (cmd); - - if (!ok) - { - bool found = false; - cmd = doCommand (imapCommand::clientList ("", aBox)); - if (cmd->result () == "OK") - { - for (TQValueListIterator < imapList > it = listResponses.begin (); - it != listResponses.end (); ++it) - { - if (aBox == (*it).name ()) found = true; - } - } - completeQueue.removeRef (cmd); - if (found) { - if (cmdInfo.find("permission", 0, false) != -1) { - // not allowed to enter this folder - error(ERR_ACCESS_DENIED, cmdInfo); - } else { - error(ERR_SLAVE_DEFINED, i18n("Unable to open folder %1. The server replied: %2").arg(aBox).arg(cmdInfo)); - } - } else { - error(TDEIO::ERR_DOES_NOT_EXIST, aBox); - } - return false; - } - } - else - { - // Give the server a chance to deliver updates every ten seconds. - // Doing this means a server roundtrip and since assureBox is called - // after every mail, we do it with a timeout. - kdDebug(7116) << "IMAP4Protocol::assureBox - reusing box" << endl; - if ( mTimeOfLastNoop.secsTo( TQDateTime::currentDateTime() ) > 10 ) { - cmd = doCommand (imapCommand::clientNoop ()); - completeQueue.removeRef (cmd); - mTimeOfLastNoop = TQDateTime::currentDateTime(); - kdDebug(7116) << "IMAP4Protocol::assureBox - noop timer fired" << endl; - } - } - - // if it is the mode we want - if (!getSelected().readWrite() && !readonly) - { - error(TDEIO::ERR_CANNOT_OPEN_FOR_WRITING, aBox); - return false; - } - - return true; -} diff --git a/kioslaves/imap4/imap4.h b/kioslaves/imap4/imap4.h deleted file mode 100644 index 164cf855..00000000 --- a/kioslaves/imap4/imap4.h +++ /dev/null @@ -1,205 +0,0 @@ -#ifndef _IMAP4_H -#define _IMAP4_H -/********************************************************************** - * - * imap4.h - IMAP4rev1 KIOSlave - * Copyright (C) 2001-2002 Michael Haeckel - * Copyright (C) 1999 John Corey - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Send comments and bug fixes to jcorey@fruity.ath.cx - * - *********************************************************************/ - -#include "imapparser.h" -#include "mimeio.h" - -#include -#include - -#define IMAP_BUFFER 8192 - -/** @brief type of object the url refers too */ -enum IMAP_TYPE -{ - ITYPE_UNKNOWN, /*< unknown type */ - ITYPE_DIR, /*< Object is a directory. i.e. does not contain message, just mailboxes */ - ITYPE_BOX, /*< Object is a mailbox. i.e. contains mails */ - ITYPE_DIR_AND_BOX, /*< Object contains both mails and mailboxes */ - ITYPE_MSG, /*< Object is a mail */ - ITYPE_ATTACH /*< Object is an attachment */ -}; - -/** @brief IOSlave derived class */ -class IMAP4Protocol:public - TDEIO::TCPSlaveBase, - public - imapParser, - public - mimeIO -{ - -public: - - // reimplement the TCPSlave - IMAP4Protocol (const TQCString & pool, const TQCString & app, bool isSSL); - virtual ~IMAP4Protocol (); - - virtual void openConnection(); - virtual void closeConnection(); - - virtual void setHost (const TQString & _host, int _port, const TQString & _user, - const TQString & _pass); - /** - * @brief get a message or part of a message - * the data is normally send as we get it from the server - * if you want the slave to decode the content (e.g. for attachments) - * then append an additional INFO=DECODE to the URL - */ - virtual void get (const KURL & _url); - /** - * @brief stat a mailbox, message, attachment - */ - virtual void stat (const KURL & _url); - virtual void slave_status (); - /** - * @brief delete a mailbox - */ - virtual void del (const KURL & _url, bool isFile); - /** - * @brief Capabilites, NOOP, (Un)subscribe, Change status, - * Change ACL - */ - virtual void special (const TQByteArray & data); - /** - * @brief list a directory/mailbox - */ - virtual void listDir (const KURL & _url); - virtual void setSubURL (const KURL & _url); - virtual void dispatch (int command, const TQByteArray & data); - /** - * @brief create a mailbox - */ - virtual void mkdir (const KURL & url, int permissions); - virtual void put (const KURL & url, int permissions, bool overwrite, - bool resume); - virtual void rename (const KURL & src, const KURL & dest, bool overwrite); - virtual void copy (const KURL & src, const KURL & dest, int permissions, - bool overwrite); - - /** @brief reimplement the parser - * relay hook to send the fetched data directly to an upper level - */ - virtual void parseRelay (const TQByteArray & buffer); - - /** @brief reimplement the parser - * relay hook to announce the fetched data directly to an upper level - */ - virtual void parseRelay (ulong); - - /** @brief reimplement the parser - * read at least len bytes */ - virtual bool parseRead (TQByteArray &buffer,ulong len,ulong relay=0); - - /** @brief reimplement the parser - * @brief read at least a line (up to CRLF) */ - virtual bool parseReadLine (TQByteArray & buffer, ulong relay = 0); - - /** @brief reimplement the parser - * @brief write argument to the server */ - virtual void parseWriteLine (const TQString &); - - /** @brief reimplement the mimeIO */ - virtual int outputLine (const TQCString & _str, int len = -1); - - /** @brief send out cached data to the application */ - virtual void flushOutput(TQString contentEncoding = TQString()); - -protected: - - // select or examine the box if needed - bool assureBox (const TQString & aBox, bool readonly); - - ssize_t myRead(void *data, ssize_t len); - - /** - * @brief Parses the given URL - * The return values are set by parsing the URL and querying the server - * - * If you set caching to true the server is not queried but the type is always - * set to ITYPE_DIR_AND_BOX - */ - enum IMAP_TYPE - parseURL (const KURL & _url, TQString & _box, TQString & _section, - TQString & _type, TQString & _uid, TQString & _validity, - TQString & _hierarchyDelimiter, TQString & _info, - bool cache = false); - TQString getMimeType (enum IMAP_TYPE); - - bool makeLogin (); - - void outputLineStr (const TQString & _str) - { - outputLine (_str.latin1 (), _str.length()); - } - void doListEntry (const KURL & _url, int stretch, imapCache * cache = NULL, - bool withFlags = FALSE, bool withSubject = FALSE); - - /** - * Send a list entry (folder) to the application - * If @p appendPath is true the foldername will be appended - * to the path of @p url - */ - void doListEntry (const KURL & url, const TQString & myBox, - const imapList & item, bool appendPath = true); - - /** Send an ACL command which is identified by @p command */ - void specialACLCommand( int command, TQDataStream& stream ); - - /** Send an annotation command which is identified by @p command */ - void specialAnnotateMoreCommand( int command, TQDataStream& stream ); - void specialQuotaCommand( int command, TQDataStream& stream ); - - /** Search current folder, the search string is passed as SECTION */ - void specialSearchCommand( TQDataStream& ); - - /** Send a custom command to the server */ - void specialCustomCommand( TQDataStream& ); - -private: - - // This method behaves like the above method but takes an already encoded url, - // so you don't have to call KURL::url() for every mail. - void doListEntry (const TQString & encodedUrl, int stretch, imapCache * cache = NULL, - bool withFlags = FALSE, bool withSubject = FALSE); - - TQString myHost, myUser, myPass, myAuth, myTLS; - int myPort; - bool mySSL; - - bool relayEnabled, cacheOutput, decodeContent; - TQByteArray outputCache; - TQBuffer outputBuffer; - TQ_ULONG outputBufferIndex; - TDEIO::filesize_t mProcessedSize; - - char readBuffer[IMAP_BUFFER]; - ssize_t readBufferLen; - int readSize; - TQDateTime mTimeOfLastNoop; -}; - -#endif diff --git a/kioslaves/imap4/imap4.protocol b/kioslaves/imap4/imap4.protocol deleted file mode 100644 index 1ab92042..00000000 --- a/kioslaves/imap4/imap4.protocol +++ /dev/null @@ -1,29 +0,0 @@ -[Protocol] -# The executable, of course -#### Temporary name -exec=kio_imap4 -# protocol that will appear in URLs -protocol=imap - -# input/output can be one of: filesystem, stream, none -input=stream -output=filesystem - -# Headings for file listings? -listing=Name,Type,Size,Owner -deleting=true -linking=false -# For now, reading yes, writing no -reading=true -writing=false -# For now, no moving -moving=false - -# Can be source protocol -source=true - -# List of capabilities (e.g. special() commands) -Capabilities=Subscription,ACL,Quota - -Icon=folder_inbox -DocPath=kioslave/imap.html diff --git a/kioslaves/imap4/imapcommand.cc b/kioslaves/imap4/imapcommand.cc deleted file mode 100644 index 4b9faadf..00000000 --- a/kioslaves/imap4/imapcommand.cc +++ /dev/null @@ -1,408 +0,0 @@ -/********************************************************************** - * - * imapcommand.cc - IMAP4rev1 command handler - * Copyright (C) 2000 s.carstens@gmx.de - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Send comments and bug fixes to s.carstens@gmx.de - * - *********************************************************************/ - -#include "imapcommand.h" -#include "rfcdecoder.h" - -/*#include - -#include -#include -#include -#include - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include */ - -imapCommand::imapCommand () -{ - mComplete = false; - mId = TQString(); -} - -imapCommand::imapCommand (const TQString & command, const TQString & parameter) -// aCommand(NULL), -// mResult(NULL), -// mParameter(NULL) -{ - mComplete = false; - aCommand = command; - aParameter = parameter; - mId = TQString(); -} - -bool -imapCommand::isComplete () -{ - return mComplete; -} - -const TQString & -imapCommand::result () -{ - return mResult; -} - -const TQString & -imapCommand::resultInfo () -{ - return mResultInfo; -} - -const TQString & -imapCommand::id () -{ - return mId; -} - -const TQString & -imapCommand::parameter () -{ - return aParameter; -} - -const TQString & -imapCommand::command () -{ - return aCommand; -} - -void -imapCommand::setId (const TQString & id) -{ - if (mId.isEmpty ()) - mId = id; -} - -void -imapCommand::setComplete () -{ - mComplete = true; -} - -void -imapCommand::setResult (const TQString & result) -{ - mResult = result; -} - -void -imapCommand::setResultInfo (const TQString & result) -{ - mResultInfo = result; -} - -void -imapCommand::setCommand (const TQString & command) -{ - aCommand = command; -} - -void -imapCommand::setParameter (const TQString & parameter) -{ - aParameter = parameter; -} - -const TQString -imapCommand::getStr () -{ - if (parameter().isEmpty()) - return id() + " " + command() + "\r\n"; - else - return id() + " " + command() + " " + parameter() + "\r\n"; -} - -imapCommand * -imapCommand::clientNoop () -{ - return new imapCommand ("NOOP", ""); -} - -imapCommand * -imapCommand::clientFetch (ulong uid, const TQString & fields, bool nouid) -{ - return clientFetch (uid, uid, fields, nouid); -} - -imapCommand * -imapCommand::clientFetch (ulong fromUid, ulong toUid, const TQString & fields, - bool nouid) -{ - TQString uid = TQString::number(fromUid); - - if (fromUid != toUid) - { - uid += ":"; - if (toUid < fromUid) - uid += "*"; - else - uid += TQString::number(toUid); - } - return clientFetch (uid, fields, nouid); -} - -imapCommand * -imapCommand::clientFetch (const TQString & sequence, const TQString & fields, - bool nouid) -{ - return new imapCommand (nouid ? "FETCH" : "UID FETCH", - sequence + " (" + fields + ")"); -} - -imapCommand * -imapCommand::clientList (const TQString & reference, const TQString & path, - bool lsub) -{ - return new imapCommand (lsub ? "LSUB" : "LIST", - TQString ("\"") + rfcDecoder::toIMAP (reference) + - "\" \"" + rfcDecoder::toIMAP (path) + "\""); -} - -imapCommand * -imapCommand::clientSelect (const TQString & path, bool examine) -{ - Q_UNUSED(examine); - /** @note We use always SELECT, because UW-IMAP doesn't check for new mail, when - used with the "mbox driver" and the folder is opened with EXAMINE - and Courier can't append to a mailbox that is in EXAMINE state */ - return new imapCommand ("SELECT", - TQString ("\"") + rfcDecoder::toIMAP (path) + "\""); -} - -imapCommand * -imapCommand::clientClose() -{ - return new imapCommand("CLOSE", ""); -} - -imapCommand * -imapCommand::clientCopy (const TQString & box, const TQString & sequence, - bool nouid) -{ - return new imapCommand (nouid ? "COPY" : "UID COPY", - sequence + " \"" + rfcDecoder::toIMAP (box) + "\""); -} - -imapCommand * -imapCommand::clientAppend (const TQString & box, const TQString & flags, - ulong size) -{ - return new imapCommand ("APPEND", - "\"" + rfcDecoder::toIMAP (box) + "\" " + - ((flags.isEmpty()) ? "" : ("(" + flags + ") ")) + - "{" + TQString::number(size) + "}"); -} - -imapCommand * -imapCommand::clienStatus (const TQString & path, const TQString & parameters) -{ - return new imapCommand ("STATUS", - TQString ("\"") + rfcDecoder::toIMAP (path) + - "\" (" + parameters + ")"); -} - -imapCommand * -imapCommand::clientCreate (const TQString & path) -{ - return new imapCommand ("CREATE", - TQString ("\"") + rfcDecoder::toIMAP (path) + "\""); -} - -imapCommand * -imapCommand::clientDelete (const TQString & path) -{ - return new imapCommand ("DELETE", - TQString ("\"") + rfcDecoder::toIMAP (path) + "\""); -} - -imapCommand * -imapCommand::clientSubscribe (const TQString & path) -{ - return new imapCommand ("SUBSCRIBE", - TQString ("\"") + rfcDecoder::toIMAP (path) + "\""); -} - -imapCommand * -imapCommand::clientUnsubscribe (const TQString & path) -{ - return new imapCommand ("UNSUBSCRIBE", - TQString ("\"") + rfcDecoder::toIMAP (path) + "\""); -} - -imapCommand * -imapCommand::clientExpunge () -{ - return new imapCommand ("EXPUNGE", TQString ("")); -} - -imapCommand * -imapCommand::clientRename (const TQString & src, const TQString & dest) -{ - return new imapCommand ("RENAME", - TQString ("\"") + rfcDecoder::toIMAP (src) + - "\" \"" + rfcDecoder::toIMAP (dest) + "\""); -} - -imapCommand * -imapCommand::clientSearch (const TQString & search, bool nouid) -{ - return new imapCommand (nouid ? "SEARCH" : "UID SEARCH", search); -} - -imapCommand * -imapCommand::clientStore (const TQString & set, const TQString & item, - const TQString & data, bool nouid) -{ - return new imapCommand (nouid ? "STORE" : "UID STORE", - set + " " + item + " (" + data + ")"); -} - -imapCommand * -imapCommand::clientLogout () -{ - return new imapCommand ("LOGOUT", ""); -} - -imapCommand * -imapCommand::clientStartTLS () -{ - return new imapCommand ("STARTTLS", ""); -} - -imapCommand * -imapCommand::clientSetACL( const TQString& box, const TQString& user, const TQString& acl ) -{ - return new imapCommand ("SETACL", TQString("\"") + rfcDecoder::toIMAP (box) - + "\" \"" + rfcDecoder::toIMAP (user) - + "\" \"" + rfcDecoder::toIMAP (acl) + "\""); -} - -imapCommand * -imapCommand::clientDeleteACL( const TQString& box, const TQString& user ) -{ - return new imapCommand ("DELETEACL", TQString("\"") + rfcDecoder::toIMAP (box) - + "\" \"" + rfcDecoder::toIMAP (user) - + "\""); -} - -imapCommand * -imapCommand::clientGetACL( const TQString& box ) -{ - return new imapCommand ("GETACL", TQString("\"") + rfcDecoder::toIMAP (box) - + "\""); -} - -imapCommand * -imapCommand::clientListRights( const TQString& box, const TQString& user ) -{ - return new imapCommand ("LISTRIGHTS", TQString("\"") + rfcDecoder::toIMAP (box) - + "\" \"" + rfcDecoder::toIMAP (user) - + "\""); -} - -imapCommand * -imapCommand::clientMyRights( const TQString& box ) -{ - return new imapCommand ("MYRIGHTS", TQString("\"") + rfcDecoder::toIMAP (box) - + "\""); -} - -imapCommand * -imapCommand::clientSetAnnotation( const TQString& box, const TQString& entry, const TQMap& attributes ) -{ - TQString parameter = TQString("\"") + rfcDecoder::toIMAP (box) - + "\" \"" + rfcDecoder::toIMAP (entry) - + "\" ("; - for( TQMap::ConstIterator it = attributes.begin(); it != attributes.end(); ++it ) { - parameter += "\""; - parameter += rfcDecoder::toIMAP (it.key()); - parameter += "\" \""; - parameter += rfcDecoder::toIMAP (it.data()); - parameter += "\" "; - } - // Turn last space into a ')' - parameter[parameter.length()-1] = ')'; - - return new imapCommand ("SETANNOTATION", parameter); -} - -imapCommand * -imapCommand::clientGetAnnotation( const TQString& box, const TQString& entry, const TQStringList& attributeNames ) -{ - TQString parameter = TQString("\"") + rfcDecoder::toIMAP (box) - + "\" \"" + rfcDecoder::toIMAP (entry) - + "\" "; - if ( attributeNames.count() == 1 ) - parameter += "\"" + rfcDecoder::toIMAP (attributeNames.first()) + '"'; - else { - parameter += '('; - for( TQStringList::ConstIterator it = attributeNames.begin(); it != attributeNames.end(); ++it ) { - parameter += "\"" + rfcDecoder::toIMAP (*it) + "\" "; - } - // Turn last space into a ')' - parameter[parameter.length()-1] = ')'; - } - return new imapCommand ("GETANNOTATION", parameter); -} - -imapCommand * -imapCommand::clientNamespace() -{ - return new imapCommand("NAMESPACE", ""); -} - -imapCommand * -imapCommand::clientGetQuotaroot( const TQString& box ) -{ - TQString parameter = TQString("\"") + rfcDecoder::toIMAP (box) + '"'; - return new imapCommand ("GETQUOTAROOT", parameter); -} - -imapCommand * -imapCommand::clientCustom( const TQString& command, const TQString& arguments ) -{ - return new imapCommand (command, arguments); -} - diff --git a/kioslaves/imap4/imapcommand.h b/kioslaves/imap4/imapcommand.h deleted file mode 100644 index 9e283442..00000000 --- a/kioslaves/imap4/imapcommand.h +++ /dev/null @@ -1,394 +0,0 @@ -#ifndef _IMAPCOMMAND_H -#define _IMAPCOMMAND_H -/********************************************************************** - * - * imapcommand.h - IMAP4rev1 command handler - * Copyright (C) 2000 Sven Carstens - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Send comments and bug fixes to - * - *********************************************************************/ - -#include -#include -#include - -/** - * @brief encapulate a IMAP command - * @author Svenn Carstens - * @date 2000 - * @todo fix the documentation - */ - -class imapCommand -{ -public: - - /** - * @brief Constructor - */ - imapCommand (); - /** - * @fn imapCommand (const TQString & command, const TQString & parameter); - * @brief Constructor - * @param command Imap command - * @param parameter Parameters to the command - * @return none - */ - imapCommand (const TQString & command, const TQString & parameter); - /** - * @fn bool isComplete (); - * @brief is it complete? - * @return whether the command is completed - */ - bool isComplete (); - /** - * @fn const TQString & result (); - * @brief get the result of the command - * @return The result, i.e. first word of the result line, like OK - */ - const TQString & result (); - /** - * @fn const TQString & resultInfo (); - * @brief get information about the result - * @return Information about the result, i.e. the rest of the result line - */ - const TQString & resultInfo (); - /** - * @fn const TQString & parameter (); - * @brief get the parameter - * @return the parameter - */ - const TQString & parameter (); - /** - * @fn const TQString & command (); - * @brief get the command - * @return the command - */ - const TQString & command (); - /** - * @fn const TQString & id (); - * @brief get the id - * @return the id - */ - const TQString & id (); - - /** - * @fn void setId (const TQString &); - * @brief set the id - * @param id the id used by the command - * @return none - */ - void setId (const TQString &); - /** - * @fn void setComplete (); - * @brief set the completed state - * @return none - */ - void setComplete (); - /** - * @fn void setResult (const TQString &); - * @brief set the completed state - * @param result the command result - * @return none - */ - void setResult (const TQString &); - /** - * @fn void setResultInfo (const TQString &); - * @brief set the completed state - * @param result the command result information - * @return none - */ - void setResultInfo (const TQString &); - /** - * @fn void setCommand (const TQString &); - * @brief set the command - * @param command the imap command - * @return none - */ - void setCommand (const TQString &); - /** - * @fn void setParameter (const TQString &); - * @brief set the command parameter(s) - * @param parameter the comand parameter(s) - * @return none - */ - void setParameter (const TQString &); - /** - * @fn const TQString getStr (); - * @brief returns the data to send to the server - * The function returns the complete data to be sent to - * the server (\ \ [\]) - * @return the data to send to the server - * @todo possibly rename function to be clear of it's purpose - */ - const TQString getStr (); - - /** - * @fn static imapCommand *clientNoop (); - * @brief Create a NOOP command - * @return a NOOP imapCommand - */ - static imapCommand *clientNoop (); - /** - * @fn static imapCommand *clientFetch (ulong uid, const TQString & fields, bool nouid = false); - * @brief Create a FETCH command - * @param uid Uid of the message to fetch - * @param fields options to pass to the server - * @param nouid Perform a FETCH or UID FETCH command - * @return a FETCH imapCommand - * Fetch a single uid - */ - static imapCommand *clientFetch (ulong uid, const TQString & fields, - bool nouid = false); - /** - * @fn static imapCommand *clientFetch (ulong fromUid, ulong toUid, const TQString & fields, bool nouid = false); - * @brief Create a FETCH command - * @param fromUid start uid of the messages to fetch - * @param toUid last uid of the messages to fetch - * @param fields options to pass to the server - * @param nouid Perform a FETCH or UID FETCH command - * @return a FETCH imapCommand - * Fetch a range of uids - */ - static imapCommand *clientFetch (ulong fromUid, ulong toUid, - const TQString & fields, bool nouid = - false); - /** - * @fn static imapCommand *clientFetch (const TQString & sequence, const TQString & fields, bool nouid = false); - * @brief Create a FETCH command - * @param sequence a IMAP FETCH sequence string - * @param fields options to pass to the server - * @param nouid Perform a FETCH or UID FETCH command - * @return a FETCH imapCommand - * Fetch a range of uids. The other clientFetch functions are just - * wrappers around this function. - */ - static imapCommand *clientFetch (const TQString & sequence, - const TQString & fields, bool nouid = - false); - /** - * @fn static imapCommand *clientList (const TQString & reference, const TQString & path, bool lsub = false); - * @brief Create a LIST command - * @param reference - * @param path The path to list - * @param lsub Perform a LIST or a LSUB command - * @return a LIST imapCommand - */ - static imapCommand *clientList (const TQString & reference, - const TQString & path, bool lsub = false); - /** - * @fn static imapCommand *clientSelect (const TQString & path, bool examine = false); - * @brief Create a SELECT command - * @param path The path to select - * @param lsub Perform a SELECT or a EXAMINE command - * @return a SELECT imapCommand - */ - static imapCommand *clientSelect (const TQString & path, bool examine = - false); - /** - * @fn static imapCommand *clientClose(); - * @brief Create a CLOSE command - * @return a CLOSE imapCommand - */ - static imapCommand *clientClose(); - /** - * @brief Create a STATUS command - * @param path - * @param parameters - * @return a STATUS imapCommand - */ - static imapCommand *clienStatus (const TQString & path, - const TQString & parameters); - /** - * @brief Create a COPY command - * @param box - * @param sequence - * @param nouid Perform a COPY or UID COPY command - * @return a COPY imapCommand - */ - static imapCommand *clientCopy (const TQString & box, - const TQString & sequence, bool nouid = - false); - /** - * @brief Create a APPEND command - * @param box - * @param flags - * @param size - * @return a APPEND imapCommand - */ - static imapCommand *clientAppend (const TQString & box, - const TQString & flags, ulong size); - /** - * @brief Create a CREATE command - * @param path - * @return a CREATE imapCommand - */ - static imapCommand *clientCreate (const TQString & path); - /** - * @brief Create a DELETE command - * @param path - * @return a DELETE imapCommand - */ - static imapCommand *clientDelete (const TQString & path); - /** - * @brief Create a SUBSCRIBE command - * @param path - * @return a SUBSCRIBE imapCommand - */ - static imapCommand *clientSubscribe (const TQString & path); - /** - * @brief Create a UNSUBSCRIBE command - * @param path - * @return a UNSUBSCRIBE imapCommand - */ - static imapCommand *clientUnsubscribe (const TQString & path); - /** - * @brief Create a EXPUNGE command - * @return a EXPUNGE imapCommand - */ - static imapCommand *clientExpunge (); - /** - * @brief Create a RENAME command - * @param src Source - * @param dest Destination - * @return a RENAME imapCommand - */ - static imapCommand *clientRename (const TQString & src, - const TQString & dest); - /** - * @brief Create a SEARCH command - * @param search - * @param nouid Perform a UID SEARCH or a SEARCH command - * @return a SEARCH imapCommand - */ - static imapCommand *clientSearch (const TQString & search, bool nouid = - false); - /** - * @brief Create a STORE command - * @param set - * @param item - * @param data - * @param nouid Perform a UID STORE or a STORE command - * @return a STORE imapCommand - */ - static imapCommand *clientStore (const TQString & set, const TQString & item, - const TQString & data, bool nouid = false); - /** - * @brief Create a LOGOUT command - * @return a LOGOUT imapCommand - */ - static imapCommand *clientLogout (); - /** - * @brief Create a STARTTLS command - * @return a STARTTLS imapCommand - */ - static imapCommand *clientStartTLS (); - - //////////// ACL support (RFC 2086) ///////////// - /** - * @brief Create a SETACL command - * @param box mailbox name - * @param user authentication identifier - * @param acl access right modification (starting with optional +/-) - * @return a SETACL imapCommand - */ - static imapCommand *clientSetACL ( const TQString& box, const TQString& user, const TQString& acl ); - - /** - * @brief Create a DELETEACL command - * @param box mailbox name - * @param user authentication identifier - * @return a DELETEACL imapCommand - */ - static imapCommand *clientDeleteACL ( const TQString& box, const TQString& user ); - - /** - * @brief Create a GETACL command - * @param box mailbox name - * @return a GETACL imapCommand - */ - static imapCommand *clientGetACL ( const TQString& box ); - - /** - * @brief Create a LISTRIGHTS command - * @param box mailbox name - * @param user authentication identifier - * @return a LISTRIGHTS imapCommand - */ - static imapCommand *clientListRights ( const TQString& box, const TQString& user ); - - /** - * @brief Create a MYRIGHTS command - * @param box mailbox name - * @return a MYRIGHTS imapCommand - */ - static imapCommand *clientMyRights ( const TQString& box ); - - //////////// ANNOTATEMORE support ///////////// - /** - * @brief Create a SETANNOTATION command - * @param box mailbox name - * @param entry entry specifier - * @param attributes map of attribute names + values - * @return a SETANNOTATION imapCommand - */ - static imapCommand *clientSetAnnotation ( const TQString& box, const TQString& entry, const TQMap& attributes ); - - /** - * @brief Create a GETANNOTATION command - * @param box mailbox name - * @param entry entry specifier - * @param attributeNames attribute specifier - * @return a GETANNOTATION imapCommand - */ - static imapCommand *clientGetAnnotation ( const TQString& box, const TQString& entry, const TQStringList& attributeNames ); - - /** - * @brief Create a NAMESPACE command - * @return a NAMESPACE imapCommand - */ - static imapCommand *clientNamespace (); - - /** - * @brief Create a GETQUOTAROOT command - * @param box mailbox name - * @return a GETQUOTAROOT imapCommand - */ - static imapCommand *clientGetQuotaroot ( const TQString& box ); - - /** - * @brief Create a custom command - * @param command The custom command - * @param arguments The custom arguments - * @return a custom imapCommand - */ - static imapCommand *clientCustom ( const TQString& command, const TQString& arguments ); - -protected: - TQString aCommand; - TQString mId; - bool mComplete; - TQString aParameter; - TQString mResult; - TQString mResultInfo; - -private: - imapCommand & operator = (const imapCommand &); -}; - -#endif diff --git a/kioslaves/imap4/imapinfo.cc b/kioslaves/imap4/imapinfo.cc deleted file mode 100644 index 4d1fc805..00000000 --- a/kioslaves/imap4/imapinfo.cc +++ /dev/null @@ -1,236 +0,0 @@ -/********************************************************************** - * - * imapinfo.cc - IMAP4rev1 SELECT / EXAMINE handler - * Copyright (C) 2000 Sven Carstens - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Send comments and bug fixes to - * - *********************************************************************/ - -/* - References: - RFC 2060 - Internet Message Access Protocol - Version 4rev1 - December 1996 - RFC 2192 - IMAP URL Scheme - September 1997 - RFC 1731 - IMAP Authentication Mechanisms - December 1994 - (Discusses KERBEROSv4, GSSAPI, and S/Key) - RFC 2195 - IMAP/POP AUTHorize Extension for Simple Challenge/Response - - September 1997 (CRAM-MD5 authentication method) - RFC 2104 - HMAC: Keyed-Hashing for Message Authentication - February 1997 - - Supported URLs: - imap://server/ - Prompt for user/pass, list all folders in home directory - imap://user:pass@server/ - Uses LOGIN to log in - imap://user;AUTH=method:pass@server/ - Uses AUTHENTICATE to log in - - imap://server/folder/ - List messages in folder - */ - -#include "imapinfo.h" -#include "imapparser.h" - -#include - -imapInfo::imapInfo ():count_ (0), -recent_ (0), -unseen_ (0), -uidValidity_ (0), -uidNext_ (0), -flags_ (0), -permanentFlags_ (0), -readWrite_ (false), -countAvailable_ (false), -recentAvailable_ (false), -unseenAvailable_ (false), -uidValidityAvailable_ (false), -uidNextAvailable_ (false), -flagsAvailable_ (false), -permanentFlagsAvailable_ (false), readWriteAvailable_ (false) -{ -} - -imapInfo::imapInfo (const imapInfo & mi):count_ (mi.count_), -recent_ (mi.recent_), -unseen_ (mi.unseen_), -uidValidity_ (mi.uidValidity_), -uidNext_ (mi.uidNext_), -flags_ (mi.flags_), -permanentFlags_ (mi.permanentFlags_), -readWrite_ (mi.readWrite_), -countAvailable_ (mi.countAvailable_), -recentAvailable_ (mi.recentAvailable_), -unseenAvailable_ (mi.unseenAvailable_), -uidValidityAvailable_ (mi.uidValidityAvailable_), -uidNextAvailable_ (mi.uidNextAvailable_), -flagsAvailable_ (mi.flagsAvailable_), -permanentFlagsAvailable_ (mi.permanentFlagsAvailable_), -readWriteAvailable_ (mi.readWriteAvailable_) -{ -} - -imapInfo & imapInfo::operator = (const imapInfo & mi) -{ - // Avoid a = a. - if (this == &mi) - return *this; - - count_ = mi.count_; - recent_ = mi.recent_; - unseen_ = mi.unseen_; - uidValidity_ = mi.uidValidity_; - uidNext_ = mi.uidNext_; - flags_ = mi.flags_; - permanentFlags_ = mi.permanentFlags_; - readWrite_ = mi.readWrite_; - countAvailable_ = mi.countAvailable_; - recentAvailable_ = mi.recentAvailable_; - unseenAvailable_ = mi.unseenAvailable_; - uidValidityAvailable_ = mi.uidValidityAvailable_; - uidNextAvailable_ = mi.uidNextAvailable_; - flagsAvailable_ = mi.flagsAvailable_; - permanentFlagsAvailable_ = mi.permanentFlagsAvailable_; - readWriteAvailable_ = mi.readWriteAvailable_; - - return *this; -} - -imapInfo::imapInfo (const TQStringList & list):count_ (0), -recent_ (0), -unseen_ (0), -uidValidity_ (0), -uidNext_ (0), -flags_ (0), -permanentFlags_ (0), -readWrite_ (false), -countAvailable_ (false), -recentAvailable_ (false), -unseenAvailable_ (false), -uidValidityAvailable_ (false), -uidNextAvailable_ (false), -flagsAvailable_ (false), -permanentFlagsAvailable_ (false), readWriteAvailable_ (false) -{ - for (TQStringList::ConstIterator it (list.begin ()); it != list.end (); ++it) - { - TQString line (*it); - - line.truncate(line.length() - 2); - TQStringList tokens(TQStringList::split (' ', line)); - - kdDebug(7116) << "Processing: " << line << endl; - if (tokens[0] != "*") - continue; - - if (tokens[1] == "OK") - { - if (tokens[2] == "[UNSEEN") - setUnseen (tokens[3].left (tokens[3].length () - 1).toULong ()); - - else if (tokens[2] == "[UIDVALIDITY") - setUidValidity (tokens[3].left (tokens[3].length () - 1).toULong ()); - - else if (tokens[2] == "[UIDNEXT") - setUidNext (tokens[3].left (tokens[3].length () - 1).toULong ()); - - else if (tokens[2] == "[PERMANENTFLAGS") - { - int flagsStart = line.find('('); - int flagsEnd = line.find(')'); - - kdDebug(7116) << "Checking permFlags from " << flagsStart << " to " << flagsEnd << endl; - if ((-1 != flagsStart) && (-1 != flagsEnd) && flagsStart < flagsEnd) - setPermanentFlags (_flags (line.mid (flagsStart, flagsEnd).latin1())); - - } - else if (tokens[2] == "[READ-WRITE") - { - setReadWrite (true); - } - else if (tokens[2] == "[READ-ONLY") - { - setReadWrite (false); - } - else - { - kdDebug(7116) << "unknown token2: " << tokens[2] << endl; - } - } - else if (tokens[1] == "FLAGS") - { - int flagsStart = line.find ('('); - int flagsEnd = line.find (')'); - - if ((-1 != flagsStart) && (-1 != flagsEnd) && flagsStart < flagsEnd) - setFlags (_flags (line.mid (flagsStart, flagsEnd).latin1() )); - } - else - { - if (tokens[2] == "EXISTS") - setCount (tokens[1].toULong ()); - - else if (tokens[2] == "RECENT") - setRecent (tokens[1].toULong ()); - - else - kdDebug(7116) << "unknown token1/2: " << tokens[1] << " " << tokens[2] << endl; - } - } - -} - -ulong imapInfo::_flags (const TQCString & inFlags) -{ - ulong flags = 0; - parseString flagsString; - flagsString.data.duplicate(inFlags.data(), inFlags.length()); - - if (flagsString[0] == '(') - flagsString.pos++; - - while (!flagsString.isEmpty () && flagsString[0] != ')') - { - TQCString entry = imapParser::parseOneWordC(flagsString).upper(); - - if (entry.isEmpty ()) - flagsString.clear(); - else if (0 != entry.contains ("\\SEEN")) - flags ^= Seen; - else if (0 != entry.contains ("\\ANSWERED")) - flags ^= Answered; - else if (0 != entry.contains ("\\FLAGGED")) - flags ^= Flagged; - else if (0 != entry.contains ("\\DELETED")) - flags ^= Deleted; - else if (0 != entry.contains ("\\DRAFT")) - flags ^= Draft; - else if (0 != entry.contains ("\\RECENT")) - flags ^= Recent; - else if (0 != entry.contains ("\\*")) - flags ^= User; - - // non standard kmail falgs - else if ( entry.contains( "KMAILFORWARDED" ) || entry.contains( "$FORWARDED" ) ) - flags = flags | Forwarded; - else if ( entry.contains( "KMAILTODO" ) || entry.contains( "$TODO" ) ) - flags = flags | Todo; - else if ( entry.contains( "KMAILWATCHED" ) || entry.contains( "$WATCHED" ) ) - flags = flags | Watched; - else if ( entry.contains( "KMAILIGNORED" ) || entry.contains( "$IGNORED" ) ) - flags = flags | Ignored; - } - - return flags; -} diff --git a/kioslaves/imap4/imapinfo.h b/kioslaves/imap4/imapinfo.h deleted file mode 100644 index 73505449..00000000 --- a/kioslaves/imap4/imapinfo.h +++ /dev/null @@ -1,232 +0,0 @@ -#ifndef _IMAPINFO_H -#define _IMAPINFO_H -/********************************************************************** - * - * imapinfo.h - IMAP4rev1 SELECT / EXAMINE handler - * Copyright (C) 2000 Sven Carstens - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Send comments and bug fixes to - * - *********************************************************************/ - -#include -#include - -//class handling the info we get on EXAMINE and SELECT -class imapInfo -{ -public: - - - enum MessageAttribute - { - Seen = 1 << 0, - Answered = 1 << 1, - Flagged = 1 << 2, - Deleted = 1 << 3, - Draft = 1 << 4, - Recent = 1 << 5, - User = 1 << 6, - // non standard flags - Forwarded = 1 << 7, - Todo = 1 << 8, - Watched = 1 << 9, - Ignored = 1 << 10 - }; - - - imapInfo (); - imapInfo (const TQStringList &); - imapInfo (const imapInfo &); - imapInfo & operator = (const imapInfo &); - - static ulong _flags (const TQCString &); - - void setCount (ulong l) - { - countAvailable_ = true; - count_ = l; - } - - void setRecent (ulong l) - { - recentAvailable_ = true; - recent_ = l; - } - - void setUnseen (ulong l) - { - unseenAvailable_ = true; - unseen_ = l; - } - - void setUidValidity (ulong l) - { - uidValidityAvailable_ = true; - uidValidity_ = l; - } - - void setUidNext (ulong l) - { - uidNextAvailable_ = true; - uidNext_ = l; - } - - void setFlags (ulong l) - { - flagsAvailable_ = true; - flags_ = l; - } - - void setFlags (const TQCString & inFlag) - { - flagsAvailable_ = true; - flags_ = _flags (inFlag); - } - - void setPermanentFlags (ulong l) - { - permanentFlagsAvailable_ = true; - permanentFlags_ = l; - } - - void setPermanentFlags (const TQCString & inFlag) - { - permanentFlagsAvailable_ = true; - permanentFlags_ = _flags (inFlag); - } - - void setReadWrite (bool b) - { - readWriteAvailable_ = true; - readWrite_ = b; - } - - void setAlert( const char* cstr ) - { - alert_ = cstr; - } - - ulong count () const - { - return count_; - } - - ulong recent () const - { - return recent_; - } - - ulong unseen () const - { - return unseen_; - } - - ulong uidValidity () const - { - return uidValidity_; - } - - ulong uidNext () const - { - return uidNext_; - } - - ulong flags () const - { - return flags_; - } - - ulong permanentFlags () const - { - return permanentFlags_; - } - - bool readWrite () const - { - return readWrite_; - } - - ulong countAvailable () const - { - return countAvailable_; - } - - ulong recentAvailable () const - { - return recentAvailable_; - } - - ulong unseenAvailable () const - { - return unseenAvailable_; - } - - ulong uidValidityAvailable () const - { - return uidValidityAvailable_; - } - - ulong uidNextAvailable () const - { - return uidNextAvailable_; - } - - ulong flagsAvailable () const - { - return flagsAvailable_; - } - - ulong permanentFlagsAvailable () const - { - return permanentFlagsAvailable_; - } - - bool readWriteAvailable () const - { - return readWriteAvailable_; - } - - TQCString alert() const - { - return alert_; - } - -private: - - TQCString alert_; - - ulong count_; - ulong recent_; - ulong unseen_; - ulong uidValidity_; - ulong uidNext_; - ulong flags_; - ulong permanentFlags_; - bool readWrite_; - - bool countAvailable_; - bool recentAvailable_; - bool unseenAvailable_; - bool uidValidityAvailable_; - bool uidNextAvailable_; - bool flagsAvailable_; - bool permanentFlagsAvailable_; - bool readWriteAvailable_; -}; - -#endif diff --git a/kioslaves/imap4/imaplist.cc b/kioslaves/imap4/imaplist.cc deleted file mode 100644 index 92918d8c..00000000 --- a/kioslaves/imap4/imaplist.cc +++ /dev/null @@ -1,135 +0,0 @@ -/********************************************************************** - * - * imapinfo.cc - IMAP4rev1 EXAMINE / SELECT handler - * Copyright (C) 2000 Sven Carstens - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Send comments and bug fixes to - * - *********************************************************************/ - -/* - References: - RFC 2060 - Internet Message Access Protocol - Version 4rev1 - December 1996 - RFC 2192 - IMAP URL Scheme - September 1997 - RFC 1731 - IMAP Authentication Mechanisms - December 1994 - (Discusses KERBEROSv4, GSSAPI, and S/Key) - RFC 2195 - IMAP/POP AUTHorize Extension for Simple Challenge/Response - - September 1997 (CRAM-MD5 authentication method) - RFC 2104 - HMAC: Keyed-Hashing for Message Authentication - February 1997 - - Supported URLs: - imap://server/ - Prompt for user/pass, list all folders in home directory - imap://user:pass@server/ - Uses LOGIN to log in - imap://user;AUTH=method:pass@server/ - Uses AUTHENTICATE to log in - - imap://server/folder/ - List messages in folder - */ - -#include "rfcdecoder.h" -#include "imaplist.h" -#include "imapparser.h" - -#include - -imapList::imapList (): parser_(0), noInferiors_ (false), -noSelect_ (false), marked_ (false), unmarked_ (false), -hasChildren_ (false), hasNoChildren_ (false) -{ -} - -imapList::imapList (const imapList & lr):parser_(lr.parser_), -hierarchyDelimiter_ (lr.hierarchyDelimiter_), -name_ (lr.name_), -noInferiors_ (lr.noInferiors_), -noSelect_ (lr.noSelect_), marked_ (lr.marked_), unmarked_ (lr.unmarked_), -hasChildren_ (lr.hasChildren_), hasNoChildren_ (lr.hasNoChildren_), -attributes_ (lr.attributes_) -{ -} - -imapList & imapList::operator = (const imapList & lr) -{ - // Avoid a = a. - if (this == &lr) - return *this; - - parser_ = lr.parser_; - hierarchyDelimiter_ = lr.hierarchyDelimiter_; - name_ = lr.name_; - noInferiors_ = lr.noInferiors_; - noSelect_ = lr.noSelect_; - marked_ = lr.marked_; - unmarked_ = lr.unmarked_; - hasChildren_ = lr.hasChildren_; - hasNoChildren_ = lr.hasNoChildren_; - attributes_ = lr.attributes_; - - return *this; -} - -imapList::imapList (const TQString & inStr, imapParser &parser) -: parser_(&parser), -noInferiors_ (false), -noSelect_ (false), -marked_ (false), unmarked_ (false), hasChildren_ (false), -hasNoChildren_ (false) -{ - parseString s; - s.data.duplicate(inStr.latin1(), inStr.length()); - - if (s[0] != '(') - return; //not proper format for us - - s.pos++; // tie off ( - - parseAttributes( s ); - - s.pos++; // tie off ) - parser_->skipWS (s); - - hierarchyDelimiter_ = parser_->parseOneWordC(s); - if (hierarchyDelimiter_ == "NIL") - hierarchyDelimiter_ = TQString(); - name_ = rfcDecoder::fromIMAP (parser_->parseLiteral (s)); // decode modified UTF7 -} - -void imapList::parseAttributes( parseString & str ) -{ - TQCString attribute, orig; - - while ( !str.isEmpty () && str[0] != ')' ) - { - orig = parser_->parseOneWordC(str); - attributes_ << orig; - attribute = orig.lower(); - if (-1 != attribute.find ("\\noinferiors")) - noInferiors_ = true; - else if (-1 != attribute.find ("\\noselect")) - noSelect_ = true; - else if (-1 != attribute.find ("\\marked")) - marked_ = true; - else if (-1 != attribute.find ("\\unmarked")) - unmarked_ = true; - else if (-1 != attribute.find ("\\haschildren")) - hasChildren_ = true; - else if (-1 != attribute.find ("\\hasnochildren")) - hasNoChildren_ = true; - else - kdDebug(7116) << "imapList::imapList: bogus attribute " << attribute << endl; - } -} - diff --git a/kioslaves/imap4/imaplist.h b/kioslaves/imap4/imaplist.h deleted file mode 100644 index 9aa01f78..00000000 --- a/kioslaves/imap4/imaplist.h +++ /dev/null @@ -1,137 +0,0 @@ -#ifndef _IMAPLIST_H -#define _IMAPLIST_H -/********************************************************************** - * - * imaplist.h - IMAP4rev1 list response handler - * Copyright (C) 2000 Sven Carstens - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Send comments and bug fixes to - * - *********************************************************************/ - -#include -#include - -class parseString; -class imapParser; - -//the class handling the responses from list -class imapList -{ -public: - - imapList (); - imapList (const TQString &, imapParser &); - imapList (const imapList &); - imapList & operator = (const imapList &); - - // process the attributes - void parseAttributes( parseString & ); - - // return all atributes concatenated - TQString attributesAsString() const - { - return attributes_.join(","); - } - - TQString hierarchyDelimiter () const - { - return hierarchyDelimiter_; - } - void setHierarchyDelimiter (const TQString & _str) - { - hierarchyDelimiter_ = _str; - } - - TQString name () const - { - return name_; - } - void setName (const TQString & _str) - { - name_ = _str; - } - - bool noInferiors () const - { - return noInferiors_; - } - void setNoInferiors (bool _val) - { - noInferiors_ = _val; - } - - bool noSelect () const - { - return noSelect_; - } - void setNoSelect (bool _val) - { - noSelect_ = _val; - } - - bool hasChildren () const - { - return hasChildren_; - } - void setHasChildren (bool _val) - { - hasChildren_ = _val; - } - - bool hasNoChildren () const - { - return hasNoChildren_; - } - void setHasNoChildren (bool _val) - { - hasNoChildren_ = _val; - } - - bool marked () const - { - return marked_; - } - void setMarked (bool _val) - { - marked_ = _val; - } - - bool unmarked () const - { - return unmarked_; - } - void setUnmarked (bool _val) - { - unmarked_ = _val; - } - -private: - - imapParser* parser_; - TQString hierarchyDelimiter_; - TQString name_; - bool noInferiors_; - bool noSelect_; - bool marked_; - bool unmarked_; - bool hasChildren_; - bool hasNoChildren_; - TQStringList attributes_; -}; - -#endif diff --git a/kioslaves/imap4/imapparser.cc b/kioslaves/imap4/imapparser.cc deleted file mode 100644 index 8cb06e31..00000000 --- a/kioslaves/imap4/imapparser.cc +++ /dev/null @@ -1,2094 +0,0 @@ -/********************************************************************** - * - * imapparser.cc - IMAP4rev1 Parser - * Copyright (C) 2001-2002 Michael Haeckel - * Copyright (C) 2000 s.carstens@gmx.de - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Send comments and bug fixes to s.carstens@gmx.de - * - *********************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "rfcdecoder.h" - -#include "imapparser.h" - -#include "imapinfo.h" - -#include "mailheader.h" -#include "mimeheader.h" -#include "mailaddress.h" - -#include - -#include -#include - -#ifdef HAVE_LIBSASL2 -extern "C" { -#include -} -#endif - -#include -#include -#include -#include - -#include -#include -#include - -#include -#include - -#ifdef HAVE_LIBSASL2 -static sasl_callback_t callbacks[] = { - { SASL_CB_ECHOPROMPT, NULL, NULL }, - { SASL_CB_NOECHOPROMPT, NULL, NULL }, - { SASL_CB_GETREALM, NULL, NULL }, - { SASL_CB_USER, NULL, NULL }, - { SASL_CB_AUTHNAME, NULL, NULL }, - { SASL_CB_PASS, NULL, NULL }, - { SASL_CB_CANON_USER, NULL, NULL }, - { SASL_CB_LIST_END, NULL, NULL } -}; -#endif - -imapParser::imapParser () -{ - sentQueue.setAutoDelete (false); - completeQueue.setAutoDelete (true); - currentState = ISTATE_NO; - commandCounter = 0; - lastHandled = 0; -} - -imapParser::~imapParser () -{ - delete lastHandled; - lastHandled = 0; -} - -imapCommand * -imapParser::doCommand (imapCommand * aCmd) -{ - int pl = 0; - sendCommand (aCmd); - while (pl != -1 && !aCmd->isComplete ()) { - while ((pl = parseLoop ()) == 0) - ; - } - - return aCmd; -} - -imapCommand * -imapParser::sendCommand (imapCommand * aCmd) -{ - aCmd->setId (TQString::number(commandCounter++)); - sentQueue.append (aCmd); - - continuation.resize(0); - const TQString& command = aCmd->command(); - - if (command == "SELECT" || command == "EXAMINE") - { - // we need to know which box we are selecting - parseString p; - p.fromString(aCmd->parameter()); - currentBox = parseOneWordC(p); - kdDebug(7116) << "imapParser::sendCommand - setting current box to " << currentBox << endl; - } - else if (command == "CLOSE") - { - // we no longer have a box open - currentBox = TQString(); - } - else if (command.find ("SEARCH") != -1 - || command == "GETACL" - || command == "LISTRIGHTS" - || command == "MYRIGHTS" - || command == "GETANNOTATION" - || command == "NAMESPACE" - || command == "GETQUOTAROOT" - || command == "GETQUOTA" - || command == "X-GET-OTHER-USERS" - || command == "X-GET-DELEGATES" - || command == "X-GET-OUT-OF-OFFICE") - { - lastResults.clear (); - } - else if (command == "LIST" - || command == "LSUB") - { - listResponses.clear (); - } - parseWriteLine (aCmd->getStr ()); - return aCmd; -} - -bool -imapParser::clientLogin (const TQString & aUser, const TQString & aPass, - TQString & resultInfo) -{ - imapCommand *cmd; - bool retVal = false; - - cmd = - doCommand (new - imapCommand ("LOGIN", "\"" + rfcDecoder::quoteIMAP(aUser) - + "\" \"" + rfcDecoder::quoteIMAP(aPass) + "\"")); - - if (cmd->result () == "OK") - { - currentState = ISTATE_LOGIN; - retVal = true; - } - resultInfo = cmd->resultInfo(); - completeQueue.removeRef (cmd); - - return retVal; -} - -#ifdef HAVE_LIBSASL2 -static bool sasl_interact( TDEIO::SlaveBase *slave, TDEIO::AuthInfo &ai, void *in ) -{ - kdDebug(7116) << "sasl_interact" << endl; - sasl_interact_t *interact = ( sasl_interact_t * ) in; - - //some mechanisms do not require username && pass, so it doesn't need a popup - //window for getting this info - for ( ; interact->id != SASL_CB_LIST_END; interact++ ) { - if ( interact->id == SASL_CB_AUTHNAME || - interact->id == SASL_CB_PASS ) { - - if ( ai.username.isEmpty() || ai.password.isEmpty() ) { - if (!slave->openPassDlg(ai)) - return false; - } - break; - } - } - - interact = ( sasl_interact_t * ) in; - while( interact->id != SASL_CB_LIST_END ) { - kdDebug(7116) << "SASL_INTERACT id: " << interact->id << endl; - switch( interact->id ) { - case SASL_CB_USER: - case SASL_CB_AUTHNAME: - kdDebug(7116) << "SASL_CB_[USER|AUTHNAME]: '" << ai.username << "'" << endl; - interact->result = strdup( ai.username.utf8() ); - interact->len = strlen( (const char *) interact->result ); - break; - case SASL_CB_PASS: - kdDebug(7116) << "SASL_CB_PASS: [hidden] " << endl; - interact->result = strdup( ai.password.utf8() ); - interact->len = strlen( (const char *) interact->result ); - break; - default: - interact->result = 0; - interact->len = 0; - break; - } - interact++; - } - return true; -} -#endif - -bool -imapParser::clientAuthenticate ( TDEIO::SlaveBase *slave, TDEIO::AuthInfo &ai, - const TQString & aFTQDN, const TQString & aAuth, bool isSSL, TQString & resultInfo) -{ - bool retVal = false; -#ifdef HAVE_LIBSASL2 - int result; - sasl_conn_t *conn = 0; - sasl_interact_t *client_interact = 0; - const char *out = 0; - uint outlen = 0; - const char *mechusing = 0; - TQByteArray tmp, challenge; - - kdDebug(7116) << "aAuth: " << aAuth << " FTQDN: " << aFTQDN << " isSSL: " << isSSL << endl; - - // see if server supports this authenticator - if (!hasCapability ("AUTH=" + aAuth)) - return false; - -// result = sasl_client_new( isSSL ? "imaps" : "imap", - result = sasl_client_new( "imap", /* FIXME: with cyrus-imapd, even imaps' digest-uri - must be 'imap'. I don't know if it's good or bad. */ - aFTQDN.latin1(), - 0, 0, callbacks, 0, &conn ); - - if ( result != SASL_OK ) { - kdDebug(7116) << "sasl_client_new failed with: " << result << endl; - resultInfo = TQString::fromUtf8( sasl_errdetail( conn ) ); - return false; - } - - do { - result = sasl_client_start(conn, aAuth.latin1(), &client_interact, - hasCapability("SASL-IR") ? &out : 0, &outlen, &mechusing); - - if ( result == SASL_INTERACT ) { - if ( !sasl_interact( slave, ai, client_interact ) ) { - sasl_dispose( &conn ); - return false; - } - } - } while ( result == SASL_INTERACT ); - - if ( result != SASL_CONTINUE && result != SASL_OK ) { - kdDebug(7116) << "sasl_client_start failed with: " << result << endl; - resultInfo = TQString::fromUtf8( sasl_errdetail( conn ) ); - sasl_dispose( &conn ); - return false; - } - imapCommand *cmd; - - tmp.setRawData( out, outlen ); - KCodecs::base64Encode( tmp, challenge ); - tmp.resetRawData( out, outlen ); - // then lets try it - TQString firstCommand = aAuth; - if ( !challenge.isEmpty() ) { - firstCommand += " "; - firstCommand += TQString::fromLatin1( challenge.data(), challenge.size() ); - } - cmd = sendCommand (new imapCommand ("AUTHENTICATE", firstCommand.latin1())); - - int pl = 0; - while ( pl != -1 && !cmd->isComplete () ) - { - //read the next line - while ((pl = parseLoop()) == 0) ; - - if (!continuation.isEmpty()) - { -// kdDebug(7116) << "S: " << TQCString(continuation.data(),continuation.size()+1) << endl; - if ( continuation.size() > 4 ) { - tmp.setRawData( continuation.data() + 2, continuation.size() - 4 ); - KCodecs::base64Decode( tmp, challenge ); -// kdDebug(7116) << "S-1: " << TQCString(challenge.data(),challenge.size()+1) << endl; - tmp.resetRawData( continuation.data() + 2, continuation.size() - 4 ); - } - - do { - result = sasl_client_step(conn, challenge.isEmpty() ? 0 : challenge.data(), - challenge.size(), - &client_interact, - &out, &outlen); - - if (result == SASL_INTERACT) { - if ( !sasl_interact( slave, ai, client_interact ) ) { - sasl_dispose( &conn ); - return false; - } - } - } while ( result == SASL_INTERACT ); - - if ( result != SASL_CONTINUE && result != SASL_OK ) { - kdDebug(7116) << "sasl_client_step failed with: " << result << endl; - resultInfo = TQString::fromUtf8( sasl_errdetail( conn ) ); - sasl_dispose( &conn ); - return false; - } - - tmp.setRawData( out, outlen ); -// kdDebug(7116) << "C-1: " << TQCString(tmp.data(),tmp.size()+1) << endl; - KCodecs::base64Encode( tmp, challenge ); - tmp.resetRawData( out, outlen ); -// kdDebug(7116) << "C: " << TQCString(challenge.data(),challenge.size()+1) << endl; - parseWriteLine (challenge); - continuation.resize(0); - } - } - - if (cmd->result () == "OK") - { - currentState = ISTATE_LOGIN; - retVal = true; - } - resultInfo = cmd->resultInfo(); - completeQueue.removeRef (cmd); - - sasl_dispose( &conn ); //we don't use sasl_en/decode(), so it's safe to dispose the connection. -#endif //HAVE_LIBSASL2 - return retVal; -} - -void -imapParser::parseUntagged (parseString & result) -{ - //kdDebug(7116) << "imapParser::parseUntagged - '" << result.cstr() << "'" << endl; - - parseOneWordC(result); // * - TQByteArray what = parseLiteral (result); // see whats coming next - - if(!what.isEmpty ()) { - switch (what[0]) - { - //the status responses - case 'B': // BAD or BYE - if (tqstrncmp(what, "BAD", what.size()) == 0) - { - parseResult (what, result); - } - else if (tqstrncmp(what, "BYE", what.size()) == 0) - { - parseResult (what, result); - if ( sentQueue.count() ) { - // BYE that interrupts a command -> copy the reason for it - imapCommand *current = sentQueue.at (0); - current->setResultInfo(result.cstr()); - } - currentState = ISTATE_NO; - } - break; - - case 'N': // NO - if (what[1] == 'O' && what.size() == 2) - { - parseResult (what, result); - } - else if (tqstrncmp(what, "NAMESPACE", what.size()) == 0) - { - parseNamespace (result); - } - break; - - case 'O': // OK - if (what[1] == 'K' && what.size() == 2) - { - parseResult (what, result); - } else if (tqstrncmp(what, "OTHER-USER", 10) == 0) { // X-GET-OTHER-USER - parseOtherUser (result); - } else if (tqstrncmp(what, "OUT-OF-OFFICE", 13) == 0) { // X-GET-OUT-OF-OFFICE - parseOutOfOffice (result); - } - break; - case 'D': - if (tqstrncmp(what, "DELEGATE", 8) == 0) { // X-GET-DELEGATES - parseDelegate (result); - } - break; - - case 'P': // PREAUTH - if (tqstrncmp(what, "PREAUTH", what.size()) == 0) - { - parseResult (what, result); - currentState = ISTATE_LOGIN; - } - break; - - // parse the other responses - case 'C': // CAPABILITY - if (tqstrncmp(what, "CAPABILITY", what.size()) == 0) - { - parseCapability (result); - } - break; - - case 'F': // FLAGS - if (tqstrncmp(what, "FLAGS", what.size()) == 0) - { - parseFlags (result); - } - break; - - case 'L': // LIST or LSUB or LISTRIGHTS - if (tqstrncmp(what, "LIST", what.size()) == 0) - { - parseList (result); - } - else if (tqstrncmp(what, "LSUB", what.size()) == 0) - { - parseLsub (result); - } - else if (tqstrncmp(what, "LISTRIGHTS", what.size()) == 0) - { - parseListRights (result); - } - break; - - case 'M': // MYRIGHTS - if (tqstrncmp(what, "MYRIGHTS", what.size()) == 0) - { - parseMyRights (result); - } - break; - case 'S': // SEARCH or STATUS - if (tqstrncmp(what, "SEARCH", what.size()) == 0) - { - parseSearch (result); - } - else if (tqstrncmp(what, "STATUS", what.size()) == 0) - { - parsetStatus (result); - } - break; - - case 'A': // ACL or ANNOTATION - if (tqstrncmp(what, "ACL", what.size()) == 0) - { - parseAcl (result); - } - else if (tqstrncmp(what, "ANNOTATION", what.size()) == 0) - { - parseAnnotation (result); - } - break; - case 'Q': // QUOTA or QUOTAROOT - if ( what.size() > 5 && tqstrncmp(what, "QUOTAROOT", what.size()) == 0) - { - parseQuotaRoot( result ); - } - else if (tqstrncmp(what, "QUOTA", what.size()) == 0) - { - parseQuota( result ); - } - break; - case 'X': // Custom command - { - parseCustom( result ); - } - break; - default: - //better be a number - { - ulong number; - bool valid; - - number = TQCString(what, what.size() + 1).toUInt(&valid); - if (valid) - { - what = parseLiteral (result); - if(!what.isEmpty ()) { - switch (what[0]) - { - case 'E': - if (tqstrncmp(what, "EXISTS", what.size()) == 0) - { - parseExists (number, result); - } - else if (tqstrncmp(what, "EXPUNGE", what.size()) == 0) - { - parseExpunge (number, result); - } - break; - - case 'F': - if (tqstrncmp(what, "FETCH", what.size()) == 0) - { - seenUid = TQString(); - parseFetch (number, result); - } - break; - - case 'S': - if (tqstrncmp(what, "STORE", what.size()) == 0) // deprecated store - { - seenUid = TQString(); - parseFetch (number, result); - } - break; - - case 'R': - if (tqstrncmp(what, "RECENT", what.size()) == 0) - { - parseRecent (number, result); - } - break; - default: - break; - } - } - } - } - break; - } //switch - } -} //func - - -void -imapParser::parseResult (TQByteArray & result, parseString & rest, - const TQString & command) -{ - if (command == "SELECT") - selectInfo.setReadWrite(true); - - if (rest[0] == '[') - { - rest.pos++; - TQCString option = parseOneWordC(rest, TRUE); - - switch (option[0]) - { - case 'A': // ALERT - if (option == "ALERT") - { - rest.pos = rest.data.find(']', rest.pos) + 1; - // The alert text is after [ALERT]. - // Is this correct or do we need to care about litterals? - selectInfo.setAlert( rest.cstr() ); - } - break; - - case 'N': // NEWNAME - if (option == "NEWNAME") - { - } - break; - - case 'P': //PARSE or PERMANENTFLAGS - if (option == "PARSE") - { - } - else if (option == "PERMANENTFLAGS") - { - uint end = rest.data.find(']', rest.pos); - TQCString flags(rest.data.data() + rest.pos, end - rest.pos); - selectInfo.setPermanentFlags (flags); - rest.pos = end; - } - break; - - case 'R': //READ-ONLY or READ-WRITE - if (option == "READ-ONLY") - { - selectInfo.setReadWrite (false); - } - else if (option == "READ-WRITE") - { - selectInfo.setReadWrite (true); - } - break; - - case 'T': //TRYCREATE - if (option == "TRYCREATE") - { - } - break; - - case 'U': //UIDVALIDITY or UNSEEN - if (option == "UIDVALIDITY") - { - ulong value; - if (parseOneNumber (rest, value)) - selectInfo.setUidValidity (value); - } - else if (option == "UNSEEN") - { - ulong value; - if (parseOneNumber (rest, value)) - selectInfo.setUnseen (value); - } - else if (option == "UIDNEXT") - { - ulong value; - if (parseOneNumber (rest, value)) - selectInfo.setUidNext (value); - } - else - break; - - } - if (rest[0] == ']') - rest.pos++; //tie off ] - skipWS (rest); - } - - if (command.isEmpty()) - { - // This happens when parsing an intermediate result line (those that start with '*'). - // No state change involved, so we can stop here. - return; - } - - switch (command[0].latin1 ()) - { - case 'A': - if (command == "AUTHENTICATE") - if (tqstrncmp(result, "OK", result.size()) == 0) - currentState = ISTATE_LOGIN; - break; - - case 'L': - if (command == "LOGIN") - if (tqstrncmp(result, "OK", result.size()) == 0) - currentState = ISTATE_LOGIN; - break; - - case 'E': - if (command == "EXAMINE") - { - if (tqstrncmp(result, "OK", result.size()) == 0) - currentState = ISTATE_SELECT; - else - { - if (currentState == ISTATE_SELECT) - currentState = ISTATE_LOGIN; - currentBox = TQString(); - } - kdDebug(7116) << "imapParser::parseResult - current box is now " << currentBox << endl; - } - break; - - case 'S': - if (command == "SELECT") - { - if (tqstrncmp(result, "OK", result.size()) == 0) - currentState = ISTATE_SELECT; - else - { - if (currentState == ISTATE_SELECT) - currentState = ISTATE_LOGIN; - currentBox = TQString(); - } - kdDebug(7116) << "imapParser::parseResult - current box is now " << currentBox << endl; - } - break; - - default: - break; - } - -} - -void imapParser::parseCapability (parseString & result) -{ - TQCString temp( result.cstr() ); - imapCapabilities = TQStringList::split ( ' ', KPIM::kAsciiToLower( temp.data() ) ); -} - -void imapParser::parseFlags (parseString & result) -{ - selectInfo.setFlags(result.cstr()); -} - -void imapParser::parseList (parseString & result) -{ - imapList this_one; - - if (result[0] != '(') - return; //not proper format for us - - result.pos++; // tie off ( - - this_one.parseAttributes( result ); - - result.pos++; // tie off ) - skipWS (result); - - this_one.setHierarchyDelimiter(parseLiteralC(result)); - this_one.setName (rfcDecoder::fromIMAP(parseLiteralC(result))); // decode modified UTF7 - - listResponses.append (this_one); -} - -void imapParser::parseLsub (parseString & result) -{ - imapList this_one (result.cstr(), *this); - listResponses.append (this_one); -} - -void imapParser::parseListRights (parseString & result) -{ - parseOneWordC (result); // skip mailbox name - parseOneWordC (result); // skip user id - int outlen = 1; - while ( outlen ) { - TQCString word = parseOneWordC (result, false, &outlen); - lastResults.append (word); - } -} - -void imapParser::parseAcl (parseString & result) -{ - parseOneWordC (result); // skip mailbox name - int outlen = 1; - // The result is user1 perm1 user2 perm2 etc. The caller will sort it out. - while ( outlen && !result.isEmpty() ) { - TQCString word = parseLiteralC (result, false, false, &outlen); - lastResults.append (word); - } -} - -void imapParser::parseAnnotation (parseString & result) -{ - parseOneWordC (result); // skip mailbox name - skipWS (result); - parseOneWordC (result); // skip entry name (we know it since we don't allow wildcards in it) - skipWS (result); - if (result.isEmpty() || result[0] != '(') - return; - result.pos++; - skipWS (result); - int outlen = 1; - // The result is name1 value1 name2 value2 etc. The caller will sort it out. - while ( outlen && !result.isEmpty() && result[0] != ')' ) { - TQCString word = parseLiteralC (result, false, false, &outlen); - lastResults.append (word); - } -} - - -void imapParser::parseQuota (parseString & result) -{ - // quota_response ::= "QUOTA" SP astring SP quota_list - // quota_list ::= "(" #quota_resource ")" - // quota_resource ::= atom SP number SP number - TQCString root = parseOneWordC( result ); - if ( root.isEmpty() ) { - lastResults.append( "" ); - } else { - lastResults.append( root ); - } - if (result.isEmpty() || result[0] != '(') - return; - result.pos++; - skipWS (result); - TQStringList triplet; - int outlen = 1; - while ( outlen && !result.isEmpty() && result[0] != ')' ) { - TQCString word = parseLiteralC (result, false, false, &outlen); - triplet.append(word); - } - lastResults.append( triplet.join(" ") ); -} - -void imapParser::parseQuotaRoot (parseString & result) -{ - // quotaroot_response - // ::= "QUOTAROOT" SP astring *(SP astring) - parseOneWordC (result); // skip mailbox name - skipWS (result); - if ( result.isEmpty() ) - return; - TQStringList roots; - int outlen = 1; - while ( outlen && !result.isEmpty() ) { - TQCString word = parseLiteralC (result, false, false, &outlen); - roots.append (word); - } - lastResults.append( roots.isEmpty()? "" : roots.join(" ") ); -} - -void imapParser::parseCustom (parseString & result) -{ - int outlen = 1; - TQCString word = parseLiteralC (result, false, false, &outlen); - lastResults.append( word ); -} - -void imapParser::parseOtherUser (parseString & result) -{ - lastResults.append( parseOneWordC( result ) ); -} - -void imapParser::parseDelegate (parseString & result) -{ - const TQString email = parseOneWordC( result ); - - TQStringList rights; - int outlen = 1; - while ( outlen && !result.isEmpty() ) { - TQCString word = parseLiteralC( result, false, false, &outlen ); - rights.append( word ); - } - - lastResults.append( email + ":" + rights.join( "," ) ); -} - -void imapParser::parseOutOfOffice (parseString & result) -{ - const TQString state = parseOneWordC (result); - parseOneWordC (result); // skip encoding - - int outlen = 1; - TQCString msg = parseLiteralC (result, false, false, &outlen); - - lastResults.append( state + "^" + TQString::fromUtf8( msg ) ); -} - -void imapParser::parseMyRights (parseString & result) -{ - parseOneWordC (result); // skip mailbox name - Q_ASSERT( lastResults.isEmpty() ); // we can only be called once - lastResults.append (parseOneWordC (result) ); -} - -void imapParser::parseSearch (parseString & result) -{ - ulong value; - - while (parseOneNumber (result, value)) - { - lastResults.append (TQString::number(value)); - } -} - -void imapParser::parsetStatus (parseString & inWords) -{ - lasStatus = imapInfo (); - - parseLiteralC(inWords); // swallow the box - if (inWords.isEmpty() || inWords[0] != '(') - return; - - inWords.pos++; - skipWS (inWords); - - while (!inWords.isEmpty() && inWords[0] != ')') - { - ulong value; - - TQCString label = parseOneWordC(inWords); - if (parseOneNumber (inWords, value)) - { - if (label == "MESSAGES") - lasStatus.setCount (value); - else if (label == "RECENT") - lasStatus.setRecent (value); - else if (label == "UIDVALIDITY") - lasStatus.setUidValidity (value); - else if (label == "UNSEEN") - lasStatus.setUnseen (value); - else if (label == "UIDNEXT") - lasStatus.setUidNext (value); - } - } - - if (inWords[0] == ')') - inWords.pos++; - skipWS (inWords); -} - -void imapParser::parseExists (ulong value, parseString & result) -{ - selectInfo.setCount (value); - result.pos = result.data.size(); -} - -void imapParser::parseExpunge (ulong value, parseString & result) -{ - Q_UNUSED(value); - Q_UNUSED(result); -} - -void imapParser::parseAddressList (parseString & inWords, TQPtrList& list) -{ - if (inWords.isEmpty()) - return; - if (inWords[0] != '(') - { - parseOneWordC (inWords); // parse NIL - } - else - { - inWords.pos++; - skipWS (inWords); - - while (!inWords.isEmpty () && inWords[0] != ')') - { - if (inWords[0] == '(') { - mailAddress *addr = new mailAddress; - parseAddress(inWords, *addr); - list.append(addr); - } else { - break; - } - } - - if (!inWords.isEmpty() && inWords[0] == ')') - inWords.pos++; - skipWS (inWords); - } -} - -const mailAddress& imapParser::parseAddress (parseString & inWords, mailAddress& retVal) -{ - inWords.pos++; - skipWS (inWords); - - retVal.setFullName(parseLiteralC(inWords)); - retVal.setCommentRaw(parseLiteralC(inWords)); - retVal.setUser(parseLiteralC(inWords)); - retVal.setHost(parseLiteralC(inWords)); - - if (!inWords.isEmpty() && inWords[0] == ')') - inWords.pos++; - skipWS (inWords); - - return retVal; -} - -mailHeader * imapParser::parseEnvelope (parseString & inWords) -{ - mailHeader *envelope = 0; - - if (inWords[0] != '(') - return envelope; - inWords.pos++; - skipWS (inWords); - - envelope = new mailHeader; - - //date - envelope->setDate(parseLiteralC(inWords)); - - //subject - envelope->setSubject(parseLiteralC(inWords)); - - TQPtrList list; - list.setAutoDelete(true); - - //from - parseAddressList(inWords, list); - if (!list.isEmpty()) { - envelope->setFrom(*list.last()); - list.clear(); - } - - //sender - parseAddressList(inWords, list); - if (!list.isEmpty()) { - envelope->setSender(*list.last()); - list.clear(); - } - - //reply-to - parseAddressList(inWords, list); - if (!list.isEmpty()) { - envelope->setReplyTo(*list.last()); - list.clear(); - } - - //to - parseAddressList (inWords, envelope->to()); - - //cc - parseAddressList (inWords, envelope->cc()); - - //bcc - parseAddressList (inWords, envelope->bcc()); - - //in-reply-to - envelope->setInReplyTo(parseLiteralC(inWords)); - - //message-id - envelope->setMessageId(parseLiteralC(inWords)); - - // see if we have more to come - while (!inWords.isEmpty () && inWords[0] != ')') - { - //eat the extensions to this part - if (inWords[0] == '(') - parseSentence (inWords); - else - parseLiteralC (inWords); - } - - if (!inWords.isEmpty() && inWords[0] == ')') - inWords.pos++; - skipWS (inWords); - - return envelope; -} - -// parse parameter pairs into a dictionary -// caller must clean up the dictionary items -TQAsciiDict < TQString > imapParser::parseDisposition (parseString & inWords) -{ - TQCString disposition; - TQAsciiDict < TQString > retVal (17, false); - - // return value is a shallow copy - retVal.setAutoDelete (false); - - if (inWords[0] != '(') - { - //disposition only - disposition = parseOneWordC (inWords); - } - else - { - inWords.pos++; - skipWS (inWords); - - //disposition - disposition = parseOneWordC (inWords); - retVal = parseParameters (inWords); - if (inWords[0] != ')') - return retVal; - inWords.pos++; - skipWS (inWords); - } - - if (!disposition.isEmpty ()) - { - retVal.insert ("content-disposition", new TQString(disposition)); - } - - return retVal; -} - -// parse parameter pairs into a dictionary -// caller must clean up the dictionary items -TQAsciiDict < TQString > imapParser::parseParameters (parseString & inWords) -{ - TQAsciiDict < TQString > retVal (17, false); - - // return value is a shallow copy - retVal.setAutoDelete (false); - - if (inWords[0] != '(') - { - //better be NIL - parseOneWordC (inWords); - } - else - { - inWords.pos++; - skipWS (inWords); - - while (!inWords.isEmpty () && inWords[0] != ')') - { - TQCString l1 = parseLiteralC(inWords); - TQCString l2 = parseLiteralC(inWords); - retVal.insert (l1, new TQString(l2)); - } - - if (inWords[0] != ')') - return retVal; - inWords.pos++; - skipWS (inWords); - } - - return retVal; -} - -mimeHeader * imapParser::parseSimplePart (parseString & inWords, - TQString & inSection, mimeHeader * localPart) -{ - TQCString subtype; - TQCString typeStr; - TQAsciiDict < TQString > parameters (17, false); - ulong size; - - parameters.setAutoDelete (true); - - if (inWords[0] != '(') - return 0; - - if (!localPart) - localPart = new mimeHeader; - - localPart->setPartSpecifier (inSection); - - inWords.pos++; - skipWS (inWords); - - //body type - typeStr = parseLiteralC(inWords); - - //body subtype - subtype = parseLiteralC(inWords); - - localPart->setType (typeStr + "/" + subtype); - - //body parameter parenthesized list - parameters = parseParameters (inWords); - { - TQAsciiDictIterator < TQString > it (parameters); - - while (it.current ()) - { - localPart->setTypeParm (it.currentKey (), *(it.current ())); - ++it; - } - parameters.clear (); - } - - //body id - localPart->setID (parseLiteralC(inWords)); - - //body description - localPart->setDescription (parseLiteralC(inWords)); - - //body encoding - localPart->setEncoding (parseLiteralC(inWords)); - - //body size - if (parseOneNumber (inWords, size)) - localPart->setLength (size); - - // type specific extensions - if (localPart->getType().upper() == "MESSAGE/RFC822") - { - //envelope structure - mailHeader *envelope = parseEnvelope (inWords); - - //body structure - parseBodyStructure (inWords, inSection, envelope); - - localPart->setNestedMessage (envelope); - - //text lines - ulong lines; - parseOneNumber (inWords, lines); - } - else - { - if (typeStr == "TEXT") - { - //text lines - ulong lines; - parseOneNumber (inWords, lines); - } - - // md5 - parseLiteralC(inWords); - - // body disposition - parameters = parseDisposition (inWords); - { - TQString *disposition = parameters["content-disposition"]; - - if (disposition) - localPart->setDisposition (disposition->ascii ()); - parameters.remove ("content-disposition"); - TQAsciiDictIterator < TQString > it (parameters); - while (it.current ()) - { - localPart->setDispositionParm (it.currentKey (), - *(it.current ())); - ++it; - } - - parameters.clear (); - } - - // body language - parseSentence (inWords); - } - - // see if we have more to come - while (!inWords.isEmpty () && inWords[0] != ')') - { - //eat the extensions to this part - if (inWords[0] == '(') - parseSentence (inWords); - else - parseLiteralC(inWords); - } - if (inWords[0] == ')') - inWords.pos++; - skipWS (inWords); - - return localPart; -} - -mimeHeader * imapParser::parseBodyStructure (parseString & inWords, - TQString & inSection, mimeHeader * localPart) -{ - bool init = false; - if (inSection.isEmpty()) - { - // first run - init = true; - // assume one part - inSection = "1"; - } - int section = 0; - - if (inWords[0] != '(') - { - // skip "" - parseOneWordC (inWords); - return 0; - } - inWords.pos++; - skipWS (inWords); - - if (inWords[0] == '(') - { - TQByteArray subtype; - TQAsciiDict < TQString > parameters (17, false); - TQString outSection; - parameters.setAutoDelete (true); - if (!localPart) - localPart = new mimeHeader; - else - { - // might be filled from an earlier run - localPart->clearNestedParts (); - localPart->clearTypeParameters (); - localPart->clearDispositionParameters (); - // an envelope was passed in so this is the multipart header - outSection = inSection + ".HEADER"; - } - if (inWords[0] == '(' && init) - inSection = "0"; - - // set the section - if ( !outSection.isEmpty() ) { - localPart->setPartSpecifier(outSection); - } else { - localPart->setPartSpecifier(inSection); - } - - // is multipart (otherwise its a simplepart and handled later) - while (inWords[0] == '(') - { - outSection = TQString::number(++section); - if (!init) - outSection = inSection + "." + outSection; - mimeHeader *subpart = parseBodyStructure (inWords, outSection, 0); - localPart->addNestedPart (subpart); - } - - // fetch subtype - subtype = parseOneWordC (inWords); - - localPart->setType ("MULTIPART/" + b2c(subtype)); - - // fetch parameters - parameters = parseParameters (inWords); - { - TQAsciiDictIterator < TQString > it (parameters); - - while (it.current ()) - { - localPart->setTypeParm (it.currentKey (), *(it.current ())); - ++it; - } - parameters.clear (); - } - - // body disposition - parameters = parseDisposition (inWords); - { - TQString *disposition = parameters["content-disposition"]; - - if (disposition) - localPart->setDisposition (disposition->ascii ()); - parameters.remove ("content-disposition"); - TQAsciiDictIterator < TQString > it (parameters); - while (it.current ()) - { - localPart->setDispositionParm (it.currentKey (), - *(it.current ())); - ++it; - } - parameters.clear (); - } - - // body language - parseSentence (inWords); - - } - else - { - // is simple part - inWords.pos--; - inWords.data[inWords.pos] = '('; //fake a sentence - if ( localPart ) - inSection = inSection + ".1"; - localPart = parseSimplePart (inWords, inSection, localPart); - inWords.pos--; - inWords.data[inWords.pos] = ')'; //remove fake - } - - // see if we have more to come - while (!inWords.isEmpty () && inWords[0] != ')') - { - //eat the extensions to this part - if (inWords[0] == '(') - parseSentence (inWords); - else - parseLiteralC(inWords); - } - - if (inWords[0] == ')') - inWords.pos++; - skipWS (inWords); - - return localPart; -} - -void imapParser::parseBody (parseString & inWords) -{ - // see if we got a part specifier - if (inWords[0] == '[') - { - TQCString specifier; - TQCString label; - inWords.pos++; - - specifier = parseOneWordC (inWords, TRUE); - - if (inWords[0] == '(') - { - inWords.pos++; - - while (!inWords.isEmpty () && inWords[0] != ')') - { - label = parseOneWordC (inWords); - } - - if (!inWords.isEmpty () && inWords[0] == ')') - inWords.pos++; - } - if (!inWords.isEmpty () && inWords[0] == ']') - inWords.pos++; - skipWS (inWords); - - // parse the header - if (specifier == "0") - { - mailHeader *envelope = 0; - if (lastHandled) - envelope = lastHandled->getHeader (); - - if (!envelope || seenUid.isEmpty ()) - { - kdDebug(7116) << "imapParser::parseBody - discarding " << envelope << " " << seenUid.ascii () << endl; - // don't know where to put it, throw it away - parseLiteralC(inWords, true); - } - else - { - kdDebug(7116) << "imapParser::parseBody - reading " << envelope << " " << seenUid.ascii () << endl; - // fill it up with data - TQString theHeader = parseLiteralC(inWords, true); - mimeIOTQString myIO; - - myIO.setString (theHeader); - envelope->parseHeader (myIO); - - } - } - else if (specifier == "HEADER.FIELDS") - { - // BODY[HEADER.FIELDS (References)] {n} - //kdDebug(7116) << "imapParser::parseBody - HEADER.FIELDS: " - // << TQCString(label.data(), label.size()+1) << endl; - if (label == "REFERENCES") - { - mailHeader *envelope = 0; - if (lastHandled) - envelope = lastHandled->getHeader (); - - if (!envelope || seenUid.isEmpty ()) - { - kdDebug(7116) << "imapParser::parseBody - discarding " << envelope << " " << seenUid.ascii () << endl; - // don't know where to put it, throw it away - parseLiteralC (inWords, true); - } - else - { - TQCString references = parseLiteralC(inWords, true); - int start = references.find ('<'); - int end = references.findRev ('>'); - if (start < end) - references = references.mid (start, end - start + 1); - envelope->setReferences(references.simplifyWhiteSpace()); - } - } - else - { // not a header we care about throw it away - parseLiteralC(inWords, true); - } - } - else - { - if (specifier.find(".MIME") != -1) - { - mailHeader *envelope = new mailHeader; - TQString theHeader = parseLiteralC(inWords, false); - mimeIOTQString myIO; - myIO.setString (theHeader); - envelope->parseHeader (myIO); - if (lastHandled) - lastHandled->setHeader (envelope); - return; - } - // throw it away - kdDebug(7116) << "imapParser::parseBody - discarding " << seenUid.ascii () << endl; - parseLiteralC(inWords, true); - } - - } - else // no part specifier - { - mailHeader *envelope = 0; - if (lastHandled) - envelope = lastHandled->getHeader (); - - if (!envelope || seenUid.isEmpty ()) - { - kdDebug(7116) << "imapParser::parseBody - discarding " << envelope << " " << seenUid.ascii () << endl; - // don't know where to put it, throw it away - parseSentence (inWords); - } - else - { - kdDebug(7116) << "imapParser::parseBody - reading " << envelope << " " << seenUid.ascii () << endl; - // fill it up with data - TQString section; - mimeHeader *body = parseBodyStructure (inWords, section, envelope); - if (body != envelope) - delete body; - } - } -} - -void imapParser::parseFetch (ulong /* value */, parseString & inWords) -{ - if (inWords[0] != '(') - return; - inWords.pos++; - skipWS (inWords); - - delete lastHandled; - lastHandled = 0; - - while (!inWords.isEmpty () && inWords[0] != ')') - { - if (inWords[0] == '(') - parseSentence (inWords); - else - { - TQCString word = parseLiteralC(inWords, false, true); - - if(!word.isEmpty()) { - switch (word[0]) - { - case 'E': - if (word == "ENVELOPE") - { - mailHeader *envelope = 0; - - if (lastHandled) - envelope = lastHandled->getHeader (); - else - lastHandled = new imapCache(); - - if (envelope && !envelope->getMessageId ().isEmpty ()) - { - // we have seen this one already - // or don't know where to put it - parseSentence (inWords); - } - else - { - envelope = parseEnvelope (inWords); - if (envelope) - { - envelope->setPartSpecifier (seenUid + ".0"); - lastHandled->setHeader (envelope); - lastHandled->setUid (seenUid.toULong ()); - } - } - } - break; - - case 'B': - if (word == "BODY") - { - parseBody (inWords); - } - else if (word == "BODY[]" ) - { - // Do the same as with "RFC822" - parseLiteralC(inWords, true); - } - else if (word == "BODYSTRUCTURE") - { - mailHeader *envelope = 0; - - if (lastHandled) - envelope = lastHandled->getHeader (); - - // fill it up with data - TQString section; - mimeHeader *body = - parseBodyStructure (inWords, section, envelope); - TQByteArray data; - TQDataStream stream( data, IO_WriteOnly ); - if (body) body->serialize(stream); - parseRelay(data); - - delete body; - } - break; - - case 'U': - if (word == "UID") - { - seenUid = parseOneWordC(inWords); - mailHeader *envelope = 0; - if (lastHandled) - envelope = lastHandled->getHeader (); - else - lastHandled = new imapCache(); - - if (seenUid.isEmpty ()) - { - // unknown what to do - kdDebug(7116) << "imapParser::parseFetch - UID empty" << endl; - } - else - { - lastHandled->setUid (seenUid.toULong ()); - } - if (envelope) - envelope->setPartSpecifier (seenUid); - } - break; - - case 'R': - if (word == "RFC822.SIZE") - { - ulong size; - parseOneNumber (inWords, size); - - if (!lastHandled) lastHandled = new imapCache(); - lastHandled->setSize (size); - } - else if (word.find ("RFC822") == 0) - { - // might be RFC822 RFC822.TEXT RFC822.HEADER - parseLiteralC(inWords, true); - } - break; - - case 'I': - if (word == "INTERNALDATE") - { - TQCString date = parseOneWordC(inWords); - if (!lastHandled) lastHandled = new imapCache(); - lastHandled->setDate(date); - } - break; - - case 'F': - if (word == "FLAGS") - { - //kdDebug(7116) << "GOT FLAGS " << inWords.cstr() << endl; - if (!lastHandled) lastHandled = new imapCache(); - lastHandled->setFlags (imapInfo::_flags (inWords.cstr())); - } - break; - - default: - parseLiteralC(inWords); - break; - } - } else { - parseLiteralC(inWords); - } - } - } - - // see if we have more to come - while (!inWords.isEmpty () && inWords[0] != ')') - { - //eat the extensions to this part - if (inWords[0] == '(') - parseSentence (inWords); - else - parseLiteralC(inWords); - } - - if (inWords.isEmpty() || inWords[0] != ')') - return; - inWords.pos++; - skipWS (inWords); -} - - -// default parser -void imapParser::parseSentence (parseString & inWords) -{ - bool first = true; - int stack = 0; - - //find the first nesting parentheses - - while (!inWords.isEmpty () && (stack != 0 || first)) - { - first = false; - skipWS (inWords); - - unsigned char ch = inWords[0]; - switch (ch) - { - case '(': - inWords.pos++; - ++stack; - break; - case ')': - inWords.pos++; - --stack; - break; - case '[': - inWords.pos++; - ++stack; - break; - case ']': - inWords.pos++; - --stack; - break; - default: - parseLiteralC(inWords); - skipWS (inWords); - break; - } - } - skipWS (inWords); -} - -void imapParser::parseRecent (ulong value, parseString & result) -{ - selectInfo.setRecent (value); - result.pos = result.data.size(); -} - -void imapParser::parseNamespace (parseString & result) -{ - if ( result[0] != '(' ) - return; - - TQString delimEmpty; - if ( namespaceToDelimiter.contains( TQString() ) ) - delimEmpty = namespaceToDelimiter[TQString()]; - - namespaceToDelimiter.clear(); - imapNamespaces.clear(); - - // remember what section we're in (user, other users, shared) - int ns = -1; - bool personalAvailable = false; - while ( !result.isEmpty() ) - { - if ( result[0] == '(' ) - { - result.pos++; // tie off ( - if ( result[0] == '(' ) - { - // new namespace section - result.pos++; // tie off ( - ++ns; - } - // namespace prefix - TQCString prefix = parseOneWordC( result ); - // delimiter - TQCString delim = parseOneWordC( result ); - kdDebug(7116) << "imapParser::parseNamespace ns='" << prefix << - "',delim='" << delim << "'" << endl; - if ( ns == 0 ) - { - // at least one personal ns - personalAvailable = true; - } - TQString nsentry = TQString::number( ns ) + "=" + TQString(prefix) + - "=" + TQString(delim); - imapNamespaces.append( nsentry ); - if ( prefix.right( 1 ) == delim ) { - // strip delimiter to get a correct entry for comparisons - prefix.resize( prefix.length() ); - } - namespaceToDelimiter[prefix] = delim; - - result.pos++; // tie off ) - skipWS( result ); - } else if ( result[0] == ')' ) - { - result.pos++; // tie off ) - skipWS( result ); - } else if ( result[0] == 'N' ) - { - // drop NIL - ++ns; - parseOneWordC( result ); - } else { - // drop whatever it is - parseOneWordC( result ); - } - } - if ( !delimEmpty.isEmpty() ) { - // remember default delimiter - namespaceToDelimiter[TQString()] = delimEmpty; - if ( !personalAvailable ) - { - // at least one personal ns would be nice - kdDebug(7116) << "imapParser::parseNamespace - registering own personal ns" << endl; - TQString nsentry = "0==" + delimEmpty; - imapNamespaces.append( nsentry ); - } - } -} - -int imapParser::parseLoop () -{ - parseString result; - - if (!parseReadLine(result.data)) return -1; - - //kdDebug(7116) << result.cstr(); // includes \n - - if (result.data.isEmpty()) - return 0; - if (!sentQueue.count ()) - { - // maybe greeting or BYE everything else SHOULD not happen, use NOOP or IDLE - kdDebug(7116) << "imapParser::parseLoop - unhandledResponse: \n" << result.cstr() << endl; - unhandled << result.cstr(); - } - else - { - imapCommand *current = sentQueue.at (0); - switch (result[0]) - { - case '*': - result.data.resize(result.data.size() - 2); // tie off CRLF - parseUntagged (result); - break; - case '+': - continuation.duplicate(result.data); - break; - default: - { - TQCString tag = parseLiteralC(result); - if (current->id() == tag.data()) - { - result.data.resize(result.data.size() - 2); // tie off CRLF - TQByteArray resultCode = parseLiteral (result); //the result - current->setResult (resultCode); - current->setResultInfo(result.cstr()); - current->setComplete (); - - sentQueue.removeRef (current); - completeQueue.append (current); - if (result.length()) - parseResult (resultCode, result, current->command()); - } - else - { - kdDebug(7116) << "imapParser::parseLoop - unknown tag '" << tag << "'" << endl; - TQCString cstr = tag + " " + result.cstr(); - result.data = cstr; - result.pos = 0; - result.data.resize(cstr.length()); - } - } - break; - } - } - - return 1; -} - -void -imapParser::parseRelay (const TQByteArray & buffer) -{ - Q_UNUSED(buffer); - tqWarning - ("imapParser::parseRelay - virtual function not reimplemented - data lost"); -} - -void -imapParser::parseRelay (ulong len) -{ - Q_UNUSED(len); - tqWarning - ("imapParser::parseRelay - virtual function not reimplemented - announcement lost"); -} - -bool imapParser::parseRead (TQByteArray & buffer, ulong len, ulong relay) -{ - Q_UNUSED(buffer); - Q_UNUSED(len); - Q_UNUSED(relay); - tqWarning - ("imapParser::parseRead - virtual function not reimplemented - no data read"); - return FALSE; -} - -bool imapParser::parseReadLine (TQByteArray & buffer, ulong relay) -{ - Q_UNUSED(buffer); - Q_UNUSED(relay); - tqWarning - ("imapParser::parseReadLine - virtual function not reimplemented - no data read"); - return FALSE; -} - -void -imapParser::parseWriteLine (const TQString & str) -{ - Q_UNUSED(str); - tqWarning - ("imapParser::parseWriteLine - virtual function not reimplemented - no data written"); -} - -void -imapParser::parseURL (const KURL & _url, TQString & _box, TQString & _section, - TQString & _type, TQString & _uid, TQString & _validity, TQString & _info) -{ - TQStringList parameters; - - _box = _url.path (); - kdDebug(7116) << "imapParser::parseURL " << _box << endl; - int paramStart = _box.find("/;"); - if ( paramStart > -1 ) - { - TQString paramString = _box.right( _box.length() - paramStart-2 ); - parameters = TQStringList::split (';', paramString); //split parameters - _box.truncate( paramStart ); // strip parameters - } - // extract parameters - for (TQStringList::ConstIterator it (parameters.begin ()); - it != parameters.end (); ++it) - { - TQString temp = (*it); - - int pt = temp.find ('/'); - if (pt > 0) - { - if (temp.findRev ('"', pt) == -1 || temp.find('"', pt) == -1) - { - // if we have non-quoted '/' separator we'll just nuke it - temp.truncate(pt); - } - } - if (temp.find ("section=", 0, false) == 0) - _section = temp.right (temp.length () - 8); - else if (temp.find ("type=", 0, false) == 0) - _type = temp.right (temp.length () - 5); - else if (temp.find ("uid=", 0, false) == 0) - _uid = temp.right (temp.length () - 4); - else if (temp.find ("uidvalidity=", 0, false) == 0) - _validity = temp.right (temp.length () - 12); - else if (temp.find ("info=", 0, false) == 0) - _info = temp.right (temp.length () - 5); - } -// kdDebug(7116) << "URL: section= " << _section << ", type= " << _type << ", uid= " << _uid << endl; -// kdDebug(7116) << "URL: user() " << _url.user() << endl; -// kdDebug(7116) << "URL: path() " << _url.path() << endl; -// kdDebug(7116) << "URL: encodedPathAndQuery() " << _url.encodedPathAndQuery() << endl; - - if (!_box.isEmpty ()) - { - // strip / - if (_box[0] == '/') - _box = _box.right (_box.length () - 1); - if (!_box.isEmpty () && _box[_box.length () - 1] == '/') - _box.truncate(_box.length() - 1); - } - kdDebug(7116) << "URL: box= " << _box << ", section= " << _section << ", type= " - << _type << ", uid= " << _uid << ", validity= " << _validity << ", info= " << _info << endl; -} - - -TQCString imapParser::parseLiteralC(parseString & inWords, bool relay, bool stopAtBracket, int *outlen) { - - if (!inWords.isEmpty() && inWords[0] == '{') - { - TQCString retVal; - long srunLen = inWords.find ('}', 1); // Can return -1, so use a signed long - if (srunLen > 0) - { - ulong runLen = (ulong)srunLen; - bool proper; - ulong runLenSave = runLen + 1; - TQCString tmpstr(runLen); - inWords.takeMidNoResize(tmpstr, 1, runLen - 1); - runLen = tmpstr.toULong (&proper); - inWords.pos += runLenSave; - if (proper) - { - //now get the literal from the server - if (relay) - parseRelay (runLen); - TQByteArray rv; - parseRead (rv, runLen, relay ? runLen : 0); - rv.resize(TQMAX(runLen, rv.size())); // what's the point? - retVal = b2c(rv); - inWords.clear(); - parseReadLine (inWords.data); // must get more - - // no duplicate data transfers - relay = false; - } - else - { - kdDebug(7116) << "imapParser::parseLiteral - error parsing {} - " /*<< strLen*/ << endl; - } - } - else - { - inWords.clear(); - kdDebug(7116) << "imapParser::parseLiteral - error parsing unmatched {" << endl; - } - if (outlen) { - *outlen = retVal.length(); // optimize me - } - skipWS (inWords); - return retVal; - } - - return parseOneWordC(inWords, stopAtBracket, outlen); -} - -// does not know about literals ( {7} literal ) -TQCString imapParser::parseOneWordC (parseString & inWords, bool stopAtBracket, int *outLen) -{ - uint retValSize = 0; - uint len = inWords.length(); - if (len == 0) { - return TQCString(); - } - - if (len > 0 && inWords[0] == '"') - { - unsigned int i = 1; - bool quote = FALSE; - while (i < len && (inWords[i] != '"' || quote)) - { - if (inWords[i] == '\\') quote = !quote; - else quote = FALSE; - i++; - } - if (i < len) - { - TQCString retVal(i); - inWords.pos++; - inWords.takeLeftNoResize(retVal, i - 1); - len = i - 1; - int offset = 0; - for (unsigned int j = 0; j <= len; j++) { - if (retVal[j] == '\\') { - offset++; - j++; - } - retVal[j - offset] = retVal[j]; - } - retVal[len - offset] = 0; - retValSize = len - offset; - inWords.pos += i; - skipWS (inWords); - if (outLen) { - *outLen = retValSize; - } - return retVal; - } - else - { - kdDebug(7116) << "imapParser::parseOneWord - error parsing unmatched \"" << endl; - TQCString retVal = inWords.cstr(); - retValSize = len; - inWords.clear(); - if (outLen) { - *outLen = retValSize; - } - return retVal; - } - } - else - { - // not quoted - unsigned int i; - // search for end - for (i = 0; i < len; ++i) { - char ch = inWords[i]; - if (ch <= ' ' || ch == '(' || ch == ')' || - (stopAtBracket && (ch == '[' || ch == ']'))) - break; - } - - TQCString retVal(i+1); - inWords.takeLeftNoResize(retVal, i); - retValSize = i; - inWords.pos += i; - - if (retVal == "NIL") { - retVal.truncate(0); - retValSize = 0; - } - skipWS (inWords); - if (outLen) { - *outLen = retValSize; - } - return retVal; - } -} - -bool imapParser::parseOneNumber (parseString & inWords, ulong & num) -{ - bool valid; - num = parseOneWordC(inWords, TRUE).toULong(&valid); - return valid; -} - -bool imapParser::hasCapability (const TQString & cap) -{ - TQString c = cap.lower(); -// kdDebug(7116) << "imapParser::hasCapability - Looking for '" << cap << "'" << endl; - for (TQStringList::ConstIterator it = imapCapabilities.begin (); - it != imapCapabilities.end (); ++it) - { -// kdDebug(7116) << "imapParser::hasCapability - Examining '" << (*it) << "'" << endl; - if ( !(kasciistricmp(c.ascii(), (*it).ascii())) ) - { - return true; - } - } - return false; -} - -void imapParser::removeCapability (const TQString & cap) -{ - imapCapabilities.remove(cap.lower()); -} - -TQString imapParser::namespaceForBox( const TQString & box ) -{ - kdDebug(7116) << "imapParse::namespaceForBox " << box << endl; - TQString myNamespace; - if ( !box.isEmpty() ) - { - TQValueList list = namespaceToDelimiter.keys(); - TQString cleanPrefix; - for ( TQValueList::Iterator it = list.begin(); it != list.end(); ++it ) - { - if ( !(*it).isEmpty() && box.find( *it ) != -1 ) - return (*it); - } - } - return myNamespace; -} - diff --git a/kioslaves/imap4/imapparser.h b/kioslaves/imap4/imapparser.h deleted file mode 100644 index 7c498b09..00000000 --- a/kioslaves/imap4/imapparser.h +++ /dev/null @@ -1,504 +0,0 @@ -#ifndef _IMAPPARSER_H -#define _IMAPPARSER_H -/********************************************************************** - * - * imapparser.h - IMAP4rev1 Parser - * Copyright (C) 2001-2002 Michael Haeckel - * Copyright (C) 2000 s.carstens@gmx.de - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Send comments and bug fixes to s.carstens@gmx.de - * - *********************************************************************/ - -#include -#include -#include -#include - -#include -#include - -#include "imaplist.h" -#include "imapcommand.h" -#include "imapinfo.h" - -#include "mailheader.h" - -class KURL; -class TQString; -class mailAddress; -class mimeHeader; - - -/** @brief a string used during parsing - * the string allows you to move the effective start of the string using - * str.pos++ and str.pos--. - * @bug it is possible to move past the beginning and end of the string - */ -class parseString -{ -public: - parseString() { pos = 0; } - char operator[](uint i) const { return data[i + pos]; } - bool isEmpty() const { return pos >= data.size(); } - TQCString cstr() const - { - if (pos >= data.size()) return TQCString(); - return TQCString(data.data() + pos, data.size() - pos + 1); - } - int find(char c, int index = 0) - { - int res = data.find(c, index + pos); - return (res == -1) ? res : (res - pos); - } - // Warning: does not check for going past end of "data" - void takeLeft(TQCString& dest, uint len) const - { - dest.resize(len + 1); - tqmemmove(dest.data(), data.data() + pos, len); - } - // Warning: does not check for going past end of "data" - void takeLeftNoResize(TQCString& dest, uint len) const - { - tqmemmove(dest.data(), data.data() + pos, len); - } - // Warning: does not check for going past end of "data" - void takeMid(TQCString& dest, uint start, uint len) const - { - dest.resize(len + 1); - tqmemmove(dest.data(), data.data() + pos + start, len); - } - // Warning: does not check for going past end of "data" - void takeMidNoResize(TQCString& dest, uint start, uint len) const - { - tqmemmove(dest.data(), data.data() + pos + start, len); - } - void clear() - { - data.resize(0); - pos = 0; - } - uint length() - { - if( pos < data.size() ) { - return data.size() - pos; - } else { - return 0; - } - } - void fromString(const TQString &s) - { - clear(); - data.duplicate(s.latin1(), s.length()); - } - TQByteArray data; - uint pos; -}; - -class imapCache -{ -public: - imapCache () - { - myHeader = NULL; - mySize = 0; - myFlags = 0; - myUid = 0; - } - - ~imapCache () - { - if (myHeader) delete myHeader; - } - - mailHeader *getHeader () - { - return myHeader; - } - void setHeader (mailHeader * inHeader) - { - myHeader = inHeader; - } - - ulong getSize () - { - return mySize; - } - void setSize (ulong inSize) - { - mySize = inSize; - } - - ulong getUid () - { - return myUid; - } - void setUid (ulong inUid) - { - myUid = inUid; - } - - ulong getFlags () - { - return myFlags; - } - void setFlags (ulong inFlags) - { - myFlags = inFlags; - } - - TQCString getDate () - { - return myDate; - } - void setDate (const TQCString & _str) - { - myDate = _str; - } - void clear() - { - if (myHeader) delete myHeader; - myHeader = NULL; - mySize = 0; - myFlags = 0; - myDate = TQCString(); - myUid = 0; - } - -protected: - mailHeader * myHeader; - ulong mySize; - ulong myFlags; - ulong myUid; - TQCString myDate; -}; - - -class imapParser -{ - -public: - - /** the different states the client can be in */ - enum IMAP_STATE - { - ISTATE_NO, /**< Not connected */ - ISTATE_CONNECT, /**< Connected but not logged in */ - ISTATE_LOGIN, /**< Logged in */ - ISTATE_SELECT /**< A folder is currently selected */ - }; - -public: - imapParser (); - virtual ~ imapParser (); - - /** @brief Get the current state */ - enum IMAP_STATE getState () { return currentState; } - /** @brief Set the current state */ - void setState(enum IMAP_STATE state) { currentState = state; } - - /* @brief return the currently selected mailbox */ - const TQString getCurrentBox () - { - return rfcDecoder::fromIMAP(currentBox); - }; - - /** - * @brief do setup and send the command to parseWriteLine - * @param aCmd The command to perform - * @return The completed command - */ - imapCommand *sendCommand (imapCommand * aCmd); - /** - * @brief perform a command and wait to parse the result - * @param aCmd The command to perform - * @return The completed command - */ - imapCommand *doCommand (imapCommand * aCmd); - - - /** - * @brief plaintext login - * @param aUser Username - * @param aPass Password - * @param resultInfo The resultinfo from the command - * @return success or failure - */ - bool clientLogin (const TQString & aUser, const TQString & aPass, TQString & resultInfo); - /** - * @brief non-plaintext login - * @param aUser Username - * @param aPass Password - * @param aAuth authentication method - * @param isSSL are we using SSL - * @param resultInfo The resultinfo from the command - * @return success or failure - */ - bool clientAuthenticate (TDEIO::SlaveBase *slave, TDEIO::AuthInfo &ai, const TQString & aFTQDN, - const TQString & aAuth, bool isSSL, TQString & resultInfo); - - /** - * main loop for the parser - * reads one line and dispatches it to the appropriate sub parser - */ - int parseLoop (); - - /** - * @brief parses all untagged responses and passes them on to the - * following parsers - */ - void parseUntagged (parseString & result); - - /** @brief parse a RECENT line */ - void parseRecent (ulong value, parseString & result); - /** @brief parse a RESULT line */ - void parseResult (TQByteArray & result, parseString & rest, - const TQString & command = TQString()); - /** @brief parse a CAPABILITY line */ - void parseCapability (parseString & result); - /** @brief parse a FLAGS line */ - void parseFlags (parseString & result); - /** @brief parse a LIST line */ - void parseList (parseString & result); - /** @brief parse a LSUB line */ - void parseLsub (parseString & result); - /** @brief parse a LISTRIGHTS line */ - void parseListRights (parseString & result); - /** @brief parse a MYRIGHTS line */ - void parseMyRights (parseString & result); - /** @brief parse a SEARCH line */ - void parseSearch (parseString & result); - /** @brief parse a STATUS line */ - void parsetStatus (parseString & result); - /** @brief parse a EXISTS line */ - void parseExists (ulong value, parseString & result); - /** @brief parse a EXPUNGE line */ - void parseExpunge (ulong value, parseString & result); - /** @brief parse a ACL line */ - void parseAcl (parseString & result); - /** @brief parse a ANNOTATION line */ - void parseAnnotation (parseString & result); - /** @brief parse a NAMESPACE line */ - void parseNamespace (parseString & result); - /** @brief parse a QUOTAROOT line */ - void parseQuotaRoot (parseString & result); - /** @brief parse a QUOTA line */ - void parseQuota (parseString & result); - /** @brief parse a custom command line */ - void parseCustom (parseString & result); - /** @brief parse a OTHER-USER line */ - void parseOtherUser (parseString & result); - /** @brief parse a DELEGATE line */ - void parseDelegate (parseString & result); - /** @brief parse a OUT-OF-OFFICE line */ - void parseOutOfOffice (parseString & result); - - /** - * parses the results of a fetch command - * processes it with the following sub parsers - */ - void parseFetch (ulong value, parseString & inWords); - - /** read a envelope from imap and parse the addresses */ - mailHeader *parseEnvelope (parseString & inWords); - /** @brief parse an address list and return a list of addresses */ - void parseAddressList (parseString & inWords, TQPtrList& list); - /** @brief parse an address and return the ref again */ - const mailAddress& parseAddress (parseString & inWords, mailAddress& buffer); - - /** parse the result of the body command */ - void parseBody (parseString & inWords); - - /** parse the body structure recursively */ - mimeHeader *parseBodyStructure (parseString & inWords, - TQString & section, mimeHeader * inHeader = 0); - - /** parse only one not nested part */ - mimeHeader *parseSimplePart (parseString & inWords, TQString & section, - mimeHeader * localPart = 0); - - /** parse a parameter list (name value pairs) */ - TQAsciiDict < TQString > parseParameters (parseString & inWords); - - /** - * parse the disposition list (disposition (name value pairs)) - * the disposition has the key 'content-disposition' - */ - TQAsciiDict < TQString > parseDisposition (parseString & inWords); - - // reimplement these - - /** relay hook to send the fetched data directly to an upper level */ - virtual void parseRelay (const TQByteArray & buffer); - - /** relay hook to announce the fetched data directly to an upper level - */ - virtual void parseRelay (ulong); - - /** read at least len bytes */ - virtual bool parseRead (TQByteArray & buffer, ulong len, ulong relay = 0); - - /** read at least a line (up to CRLF) */ - virtual bool parseReadLine (TQByteArray & buffer, ulong relay = 0); - - /** write argument to server */ - virtual void parseWriteLine (const TQString &); - - // generic parser routines - - /** parse a parenthesized list */ - void parseSentence (parseString & inWords); - - /** parse a literal or word, may require more data */ - TQCString parseLiteralC(parseString & inWords, bool relay = false, - bool stopAtBracket = false, int *outlen = 0); - inline TQByteArray parseLiteral (parseString & inWords, bool relay = false, - bool stopAtBracket = false) { - int len = 0; // string size - // Choice: we can create an extra TQCString, or we can get the buffer in - // the wrong size to start. Let's try option b. - TQCString tmp = parseLiteralC(inWords, relay, stopAtBracket, &len); - return TQByteArray().duplicate(tmp.data(), len); - } - - // static parser routines, can be used elsewhere - - static TQCString b2c(const TQByteArray &ba) - { return TQCString(ba.data(), ba.size() + 1); } - - /** parse one word (maybe quoted) upto next space " ) ] } */ - static TQCString parseOneWordC (parseString & inWords, - bool stopAtBracket = FALSE, int *len = 0); - - /** parse one number using parseOneWord */ - static bool parseOneNumber (parseString & inWords, ulong & num); - - /** extract the box,section,list type, uid, uidvalidity,info from an url */ - static void parseURL (const KURL & _url, TQString & _box, TQString & _section, - TQString & _type, TQString & _uid, TQString & _validity, - TQString & _info); - - - /** @brief return the last handled foo - * @todo work out what a foo is - */ - imapCache *getLastHandled () - { - return lastHandled; - }; - -/** @brief return the last results */ - const TQStringList & getResults () - { - return lastResults; - }; - - /** @brief return the last status code */ - const imapInfo & geStatus () - { - return lasStatus; - }; - /** return the select info */ - const imapInfo & getSelected () - { - return selectInfo; - }; - - const TQByteArray & getContinuation () - { - return continuation; - }; - - /** @brief see if server has a capability */ - bool hasCapability (const TQString &); - - void removeCapability (const TQString & cap); - - static inline void skipWS (parseString & inWords) - { - char c; - while (!inWords.isEmpty() && - ((c = inWords[0]) == ' ' || c == '\t' || c == '\r' || c == '\n')) - { - inWords.pos++; - } - } - - /** @brief find the namespace for the given box */ - TQString namespaceForBox( const TQString & box ); - - -protected: - - /** the current state we're in */ - enum IMAP_STATE currentState; - - /** the box selected */ - TQString currentBox; - - /** @brief here we store the result from select/examine and unsolicited updates */ - imapInfo selectInfo; - - /** @brief the results from the last status command */ - imapInfo lasStatus; - - /** @brief the results from the capabilities, split at ' ' */ - TQStringList imapCapabilities; - - /** @brief the results from list/lsub/listrights commands */ - TQValueList < imapList > listResponses; - - /** @brief queues handling the running commands */ - TQPtrList < imapCommand > sentQueue; // no autodelete - TQPtrList < imapCommand > completeQueue; // autodelete !! - - /** - * everything we didn't handle, everything but the greeting is bogus - */ - TQStringList unhandled; - - /** the last continuation request (there MUST not be more than one pending) */ - TQByteArray continuation; - - /** the last uid seen while a fetch */ - TQString seenUid; - imapCache *lastHandled; - - ulong commandCounter; - - /** @brief the results from search/acl commands */ - TQStringList lastResults; - - /** - * @brief namespace prefix - delimiter association - * The namespace is cleaned before so that it does not contain the delimiter - */ - TQMap namespaceToDelimiter; - - /** - * @brief list of namespaces in the form: section=namespace=delimiter - * section is 0 (personal), 1 (other users) or 2 (shared) - */ - TQStringList imapNamespaces; - -private: - - /** we don't want to be able to copy this object */ - imapParser & operator = (const imapParser &); // hide the copy ctor - -}; -#endif diff --git a/kioslaves/imap4/imaps.protocol b/kioslaves/imap4/imaps.protocol deleted file mode 100644 index 8d3ebac8..00000000 --- a/kioslaves/imap4/imaps.protocol +++ /dev/null @@ -1,30 +0,0 @@ -[Protocol] -# The executable, of course -#### Temporary name -exec=kio_imap4 -# protocol that will appear in URLs -#### This ioslave is temporarily named imaps, while imaps remains in tdebase -protocol=imaps - -# input/output can be one of: filesystem, stream, none -input=stream -output=filesystem - -# Headings for file listings? -listing=Name,Type,Size,Owner -deleting=true -linking=false -# For now, reading yes, writing no -reading=true -writing=false -# For now, no moving -moving=false - -# Can be source protocol -source=true - -# List of capabilities (e.g. special() commands) -Capabilities=Subscription,ACL,Quota - -Icon=folder_inbox -DocPath=kioslave/imaps.html diff --git a/kioslaves/imap4/mailaddress.cc b/kioslaves/imap4/mailaddress.cc deleted file mode 100644 index 0ddd2ff0..00000000 --- a/kioslaves/imap4/mailaddress.cc +++ /dev/null @@ -1,323 +0,0 @@ -/********************************************************************** - * - * mailaddress.cc - mail address parser - * Copyright (C) 2000 Sven Carstens - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Send comments and bug fixes to - * - *********************************************************************/ - - -#include "mailaddress.h" -#include "rfcdecoder.h" -#include "mimehdrline.h" -#include - -mailAddress::mailAddress () -{ -} - -mailAddress::mailAddress (const mailAddress & lr): -user (lr.user), -host (lr.host), -rawFullName (lr.rawFullName), -rawComment (lr.rawComment) -{ -// kdDebug(7116) << "mailAddress::mailAddress - " << getStr() << endl; -} - -mailAddress & mailAddress::operator = (const mailAddress & lr) -{ - // Avoid a = a. - if (this == &lr) - return *this; - - user = lr.user; - host = lr.host; - rawFullName = lr.rawFullName; - rawComment = lr.rawComment; - -// kdDebug(7116) << "mailAddress::operator= - " << getStr() << endl; - - return *this; -} - - - - -mailAddress::~mailAddress () -{ -} - -mailAddress::mailAddress (char *aCStr) -{ - parseAddress (aCStr); -} - -int -mailAddress::parseAddress (char *aCStr) -{ - int retVal = 0; - int skip; - uint len; - int pt; - - if (aCStr) - { - //skip leading white space - skip = mimeHdrLine::skipWS ((const char *) aCStr); - if (skip > 0) - { - aCStr += skip; - retVal += skip; - } - while (*aCStr) - { - int advance; - - switch (*aCStr) - { - case '"': - advance = mimeHdrLine::parseQuoted ('"', '"', aCStr); - rawFullName += TQCString (aCStr, advance + 1); - break; - case '(': - advance = mimeHdrLine::parseQuoted ('(', ')', aCStr); - rawComment += TQCString (aCStr, advance + 1); - break; - case '<': - advance = mimeHdrLine::parseQuoted ('<', '>', aCStr); - user = TQCString (aCStr, advance + 1); // copy it - len = advance; - user = user.mid (1, len - 2); // strip <> - len -= 2; - pt = user.find('@'); - host = user.right (len - pt - 1); // split it into host - user.truncate(pt); // and user - break; - default: - advance = mimeHdrLine::parseWord ((const char *) aCStr); - //if we've seen a FQ mailname the rest must be quoted or is just junk - if (user.isEmpty ()) - { - if (*aCStr != ',') - { - rawFullName += TQCString (aCStr, advance + 1); - if (mimeHdrLine::skipWS ((const char *) &aCStr[advance]) > 0) - { - rawFullName += ' '; - } - } - } - break; - } - if (advance) - { - retVal += advance; - aCStr += advance; - } - else - break; - advance = mimeHdrLine::skipWS ((const char *) aCStr); - if (advance > 0) - { - retVal += advance; - aCStr += advance; - } - //reached end of current address - if (*aCStr == ',') - { - advance++; - break; - } - } - //let's see what we've got - if (rawFullName.isEmpty ()) - { - if (user.isEmpty ()) - retVal = 0; - else - { - if (host.isEmpty ()) - { - rawFullName = user; - user.truncate(0); - } - } - } - else if (user.isEmpty ()) - { - pt = rawFullName.find ('@'); - if (pt >= 0) - { - user = rawFullName; - host = user.right (user.length () - pt - 1); - user.truncate(pt); - rawFullName.truncate(0); - } - } - -#if 0 -// dead - if (!rawFullName.isEmpty ()) - { -// if(fullName[0] == '"') -// fullName = fullName.mid(1,fullName.length()-2); -// fullName = fullName.simplifyWhiteSpace().stripWhiteSpace(); -// fullName = rfcDecoder::decodeRFC2047String(fullName.ascii()); - } -#endif - if (!rawComment.isEmpty ()) - { - if (rawComment[0] == '(') - rawComment = rawComment.mid (1, rawComment.length () - 2); - rawComment = rawComment.stripWhiteSpace (); -// comment = rfcDecoder::decodeRFC2047String(comment.ascii()); - } - } - else - { - //debug(); - } - return retVal; -} - -const TQCString -mailAddress::getStr () -{ - TQCString retVal(128); // Should be generally big enough - - if (!rawFullName.isEmpty ()) - { - KMime::addQuotes( rawFullName, false ); - retVal = rawFullName + " "; - } - if (!user.isEmpty ()) - { - retVal += '<'; - retVal += user; - if (!host.isEmpty ()) { - retVal += '@'; - retVal += host; - } - retVal += '>'; - } - if (!rawComment.isEmpty ()) - { - retVal = '(' + rawComment + ')'; - } -// kdDebug(7116) << "mailAddress::getStr - '" << retVal << "'" << endl; - return retVal; -} - -bool -mailAddress::isEmpty () const -{ - return user.isEmpty (); -} - -void -mailAddress::setFullName (const TQString & _str) -{ - rawFullName = rfcDecoder::encodeRFC2047String (_str).latin1 (); -} -const TQString -mailAddress::getFullName () const -{ - return rfcDecoder::decodeRFC2047String (rawFullName); -} - -void -mailAddress::setCommentRaw (const TQCString & _str) -{ - rawComment = _str; -} - -void -mailAddress::setComment (const TQString & _str) -{ - rawComment = rfcDecoder::encodeRFC2047String (_str).latin1 (); -} -const TQString -mailAddress::getComment () const -{ - return rfcDecoder::decodeRFC2047String (rawComment); -} - -const TQCString & -mailAddress::getCommentRaw () const -{ - return rawComment; -} - -TQString -mailAddress::emailAddrAsAnchor (const mailAddress & adr, bool shortAdr) -{ - TQString retVal; - if (!adr.getFullName ().isEmpty ()) - { - // should do some umlaut escaping - retVal += adr.getFullName () + " "; - } - if (!adr.getUser ().isEmpty () && !shortAdr) - { - retVal += "<" + adr.getUser (); - if (!adr.getHost ().isEmpty ()) - retVal += "@" + adr.getHost (); - retVal += "> "; - } - if (!adr.getComment ().isEmpty ()) - { - // should do some umlaut escaping - retVal = '(' + adr.getComment () + ')'; - } - - if (!adr.getUser ().isEmpty ()) - { - TQString mail; - mail = adr.getUser (); - if (!mail.isEmpty () && !adr.getHost ().isEmpty ()) - mail += "@" + adr.getHost (); - if (!mail.isEmpty ()) - retVal = "" + retVal + ""; - } - return retVal; -} - -TQString -mailAddress::emailAddrAsAnchor (const TQPtrList < mailAddress > &list, bool value) -{ - TQString retVal; - TQPtrListIterator < mailAddress > it (list); - - while (it.current ()) - { - retVal += emailAddrAsAnchor ((*it.current ()), value) + "

\n"; - ++it; - } - - return retVal; -} - - -void mailAddress::clear() { - user.truncate(0); - host.truncate(0); - rawFullName.truncate(0); - rawComment.truncate(0); -} - diff --git a/kioslaves/imap4/mailaddress.h b/kioslaves/imap4/mailaddress.h deleted file mode 100644 index 644034b2..00000000 --- a/kioslaves/imap4/mailaddress.h +++ /dev/null @@ -1,81 +0,0 @@ -#ifndef _MAILADDRESS_H -#define _MAILADDRESS_H -/********************************************************************** - * - * mailaddress.h - mail address handler - * Copyright (C) 2000 s.carstens@gmx.de - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Send comments and bug fixes to s.carstens@gmx.de - * - *********************************************************************/ - -#include -#include -#include -#include "rfcdecoder.h" - -class mailAddress -{ -public: - mailAddress (); - ~mailAddress (); - mailAddress (char *aCStr); - mailAddress (const mailAddress &); - mailAddress & operator = (const mailAddress &); - - void setUser (const TQCString & aUser) - { - user = aUser; - } - const TQCString & getUser () const - { - return user; - } - void setHost (const TQCString & aHost) - { - host = aHost; - } - const TQCString & getHost () const - { - return host; - } - - void setFullName (const TQString & aFull); - const TQString getFullName () const; - - void setComment (const TQString & aComment); - void setCommentRaw (const TQCString &); - const TQString getComment () const; - const TQCString & getCommentRaw () const; - - int parseAddress (char *); - const TQCString getStr (); - bool isEmpty () const; - - static TQString emailAddrAsAnchor (const mailAddress &, bool); - static TQString emailAddrAsAnchor (const TQPtrList < mailAddress > &, bool); - - void clear(); - -private: - TQCString user; - TQCString host; - TQCString rawFullName; - TQCString rawComment; -}; - -#endif diff --git a/kioslaves/imap4/mailheader.cc b/kioslaves/imap4/mailheader.cc deleted file mode 100644 index c520b909..00000000 --- a/kioslaves/imap4/mailheader.cc +++ /dev/null @@ -1,203 +0,0 @@ -/*************************************************************************** - mailheader.cc - description - ------------------- - begin : Tue Oct 24 2000 - copyright : (C) 2000 by Sven Carstens - email : s.carstens@gmx.de - ***************************************************************************/ - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#include "mailheader.h" -#include "rfcdecoder.h" - -mailHeader::mailHeader () -{ - toAdr.setAutoDelete (true); - ccAdr.setAutoDelete (true); - bccAdr.setAutoDelete (true); - setType ("text/plain"); - gmt_offset = 0; -} - -mailHeader::~mailHeader () -{ -} - -void -mailHeader::addHdrLine (mimeHdrLine * inLine) -{ - mimeHdrLine *addLine = new mimeHdrLine (inLine); - - const TQCString label(addLine->getLabel()); - TQCString value(addLine->getValue()); - - if (!tqstricmp (label, "Return-Path")) { - returnpathAdr.parseAddress (value.data ()); - goto out; - } - if (!tqstricmp (label, "Sender")) { - senderAdr.parseAddress (value.data ()); - goto out; - } - if (!tqstricmp (label, "From")) { - fromAdr.parseAddress (value.data ()); - goto out; - } - if (!tqstricmp (label, "Reply-To")) { - replytoAdr.parseAddress (value.data ()); - goto out; - } - if (!tqstricmp (label, "To")) { - mailHeader::parseAddressList (value, &toAdr); - goto out; - } - if (!tqstricmp (label, "CC")) { - mailHeader::parseAddressList (value, &ccAdr); - goto out; - } - if (!tqstricmp (label, "BCC")) { - mailHeader::parseAddressList (value, &bccAdr); - goto out; - } - if (!tqstricmp (label, "Subject")) { - _subject = value.simplifyWhiteSpace(); - goto out; - } - if (!tqstricmp (label.data (), "Date")) { - mDate = value; - goto out; - } - if (!tqstricmp (label.data (), "Message-ID")) { - int start = value.findRev ('<'); - int end = value.findRev ('>'); - if (start < end) - messageID = value.mid (start, end - start + 1); - else { - tqWarning("bad Message-ID"); - /* messageID = value; */ - } - goto out; - } - if (!tqstricmp (label.data (), "In-Reply-To")) { - int start = value.findRev ('<'); - int end = value.findRev ('>'); - if (start < end) - inReplyTo = value.mid (start, end - start + 1); - goto out; - } - - // everything else is handled by mimeHeader - mimeHeader::addHdrLine (inLine); - delete addLine; - return; - - out: -// cout << label.data() << ": '" << value.data() << "'" << endl; - - //need only to add this line if not handled by mimeHeader - originalHdrLines.append (addLine); -} - -void -mailHeader::outputHeader (mimeIO & useIO) -{ - static const TQCString __returnPath("Return-Path: ", 14); - static const TQCString __from ("From: ", 7); - static const TQCString __sender ("Sender: ", 9); - static const TQCString __replyTo ("Reply-To: ", 11); - static const TQCString __to ("To: ", 5); - static const TQCString __cc ("CC: ", 5); - static const TQCString __bcc ("BCC: ", 6); - static const TQCString __subject ("Subject: ", 10); - static const TQCString __messageId ("Message-ID: ", 13); - static const TQCString __inReplyTo ("In-Reply-To: ", 14); - static const TQCString __references("References: ", 13); - static const TQCString __date ("Date: ", 7); - - if (!returnpathAdr.isEmpty()) - useIO.outputMimeLine(__returnPath + returnpathAdr.getStr()); - if (!fromAdr.isEmpty()) - useIO.outputMimeLine(__from + fromAdr.getStr()); - if (!senderAdr.isEmpty()) - useIO.outputMimeLine(__sender + senderAdr.getStr()); - if (!replytoAdr.isEmpty()) - useIO.outputMimeLine(__replyTo + replytoAdr.getStr()); - - if (toAdr.count()) - useIO.outputMimeLine(mimeHdrLine::truncateLine(__to + - mailHeader::getAddressStr(&toAdr))); - if (ccAdr.count()) - useIO.outputMimeLine(mimeHdrLine::truncateLine(__cc + - mailHeader::getAddressStr(&ccAdr))); - if (bccAdr.count()) - useIO.outputMimeLine(mimeHdrLine::truncateLine(__bcc + - mailHeader::getAddressStr(&bccAdr))); - if (!_subject.isEmpty()) - useIO.outputMimeLine(mimeHdrLine::truncateLine(__subject + _subject)); - if (!messageID.isEmpty()) - useIO.outputMimeLine(mimeHdrLine::truncateLine(__messageId + messageID)); - if (!inReplyTo.isEmpty()) - useIO.outputMimeLine(mimeHdrLine::truncateLine(__inReplyTo + inReplyTo)); - if (!references.isEmpty()) - useIO.outputMimeLine(mimeHdrLine::truncateLine(__references + references)); - - if (!mDate.isEmpty()) - useIO.outputMimeLine(__date + mDate); - mimeHeader::outputHeader(useIO); -} - -int -mailHeader::parseAddressList (const char *inCStr, - TQPtrList < mailAddress > *aList) -{ - int advance = 0; - int skip = 1; - char *aCStr = (char *) inCStr; - - if (!aCStr || !aList) - return 0; - while (skip > 0) - { - mailAddress *aAddress = new mailAddress; - skip = aAddress->parseAddress (aCStr); - if (skip) - { - aCStr += skip; - if (skip < 0) - advance -= skip; - else - advance += skip; - aList->append (aAddress); - } - else - { - delete aAddress; - break; - } - } - return advance; -} - -TQCString -mailHeader::getAddressStr (TQPtrList < mailAddress > *aList) -{ - TQCString retVal; - - TQPtrListIterator < mailAddress > it = TQPtrListIterator < mailAddress > (*aList); - while (it.current ()) - { - retVal += it.current ()->getStr (); - ++it; - if (it.current ()) - retVal += ", "; - } - return retVal; -} diff --git a/kioslaves/imap4/mailheader.h b/kioslaves/imap4/mailheader.h deleted file mode 100644 index 633d61b7..00000000 --- a/kioslaves/imap4/mailheader.h +++ /dev/null @@ -1,190 +0,0 @@ -/*************************************************************************** - mailheader.h - description - ------------------- - begin : Tue Oct 24 2000 - copyright : (C) 2000 by Sven Carstens - email : s.carstens@gmx.de - ***************************************************************************/ - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#ifndef MAILHEADER_H -#define MAILHEADER_H - -#include "mimeheader.h" -#include "mailaddress.h" -#include "mimeio.h" -#include "rfcdecoder.h" - -/** - *@author Sven Carstens - */ - -class mailHeader:public mimeHeader -{ -public: - mailHeader (); - ~mailHeader (); - - virtual void addHdrLine (mimeHdrLine *); - virtual void outputHeader (mimeIO &); - - void addTo (const mailAddress & _adr) - { - toAdr.append (new mailAddress (_adr)); - } - void addCC (const mailAddress & _adr) - { - ccAdr.append (new mailAddress (_adr)); - } - void addBCC (const mailAddress & _adr) - { - bccAdr.append (new mailAddress (_adr)); - } - - void setFrom (const mailAddress & _adr) - { - fromAdr = _adr; - } - void setSender (const mailAddress & _adr) - { - senderAdr = _adr; - } - void setReturnPath (const mailAddress & _adr) - { - returnpathAdr = _adr; - } - void setReplyTo (const mailAddress & _adr) - { - replytoAdr = _adr; - } - - const TQCString& getMessageId () - { - return messageID; - } - void setMessageId (const TQCString & _str) - { - messageID = _str; - } - - const TQCString& getInReplyTo () - { - return inReplyTo; - } - void setInReplyTo (const TQCString & _str) - { - inReplyTo = _str; - } - - const TQCString& getReferences () - { - return references; - } - void setReferences (const TQCString & _str) - { - references = _str; - } - - /** - * set a unicode subject - */ - void setSubject (const TQString & _str) - { - _subject = rfcDecoder::encodeRFC2047String(_str).latin1(); - } - /** - * set a encoded subject - */ - void setSubjectEncoded (const TQCString & _str) - { - _subject = _str.simplifyWhiteSpace(); - } - - /** - * get the unicode subject - */ - const TQString getSubject () - { - return rfcDecoder::decodeRFC2047String(_subject); - } - /** - * get the encoded subject - */ - const TQCString& getSubjectEncoded () - { - return _subject; - } - - /** - * set the date - */ - void setDate (const TQCString & _str) - { - mDate = _str; - } - - /** - * get the date - */ - const TQCString& date () - { - return mDate; - } - - static int parseAddressList (const char *, TQPtrList < mailAddress > *); - static TQCString getAddressStr (TQPtrList < mailAddress > *); - TQPtrList < mailAddress > &to () - { - return toAdr; - } - TQPtrList < mailAddress > &cc () - { - return ccAdr; - } - TQPtrList < mailAddress > &bcc () - { - return bccAdr; - } -#ifdef KMAIL_COMPATIBLE - TQString subject () - { - return getSubject (); - } - const mailAddress & from () - { - return fromAdr; - } - const mailAddress & replyTo () - { - return replytoAdr; - } - void readConfig (void) - {; - } -#endif - -private: - TQPtrList < mailAddress > toAdr; - TQPtrList < mailAddress > ccAdr; - TQPtrList < mailAddress > bccAdr; - mailAddress fromAdr; - mailAddress senderAdr; - mailAddress returnpathAdr; - mailAddress replytoAdr; - TQCString _subject; - TQCString mDate; - int gmt_offset; - TQCString messageID; - TQCString inReplyTo; - TQCString references; -}; - -#endif diff --git a/kioslaves/imap4/mimehdrline.cc b/kioslaves/imap4/mimehdrline.cc deleted file mode 100644 index 9646ed26..00000000 --- a/kioslaves/imap4/mimehdrline.cc +++ /dev/null @@ -1,521 +0,0 @@ -/*************************************************************************** - mimehdrline.cc - description - ------------------- - begin : Wed Oct 11 2000 - copyright : (C) 2000 by Sven Carstens - email : s.carstens@gmx.de - ***************************************************************************/ - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#include -#include -#include -#include -#include - -#include "mimehdrline.h" -#include "rfcdecoder.h" - -using namespace std; - -const char *wdays[] = { - "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" -}; - -const char *months[] = { - "Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" -}; - -mimeHdrLine::mimeHdrLine (): -mimeValue ((const char *) NULL), mimeLabel ((const char *) NULL) -{ -} - -mimeHdrLine::mimeHdrLine (const TQCString & aLabel, const TQCString & aValue): -mimeValue (aValue), -mimeLabel (aLabel) -{ -} - -mimeHdrLine::mimeHdrLine (mimeHdrLine * aHdrLine): -mimeValue (aHdrLine->mimeValue), mimeLabel (aHdrLine->mimeLabel) -{ -} - -mimeHdrLine::~mimeHdrLine () -{ -} - -int -mimeHdrLine::appendStr (const char *inCStr) -{ - int retVal = 0; - int skip; - char *aCStr = (char *) inCStr; - - if (aCStr) - { - skip = skipWS (aCStr); - if (skip && !mimeLabel.isEmpty ()) - { - if (skip > 0) - { - mimeValue += TQCString (aCStr, skip + 1); - aCStr += skip; - retVal += skip; - skip = parseFullLine (aCStr); - mimeValue += TQCString (aCStr, skip + 1); - retVal += skip; - aCStr += skip; - } - } - else - { - if (mimeLabel.isEmpty ()) - return setStr (aCStr); - } - } - return retVal; -} - -/** parse a Line into the class -move input ptr accordingly -and report characters slurped */ -int -mimeHdrLine::setStr (const char *inCStr) -{ - int retVal = 0; - char *aCStr = (char *) inCStr; -// char *begin = aCStr; - mimeLabel = TQCString ((const char *) NULL); - mimeValue = TQCString ((const char *) NULL); - - if (aCStr) - { - // can't have spaces on normal lines - if (!skipWS (aCStr)) - { - int label = 0, advance; - while ((advance = parseWord (&aCStr[label]))) - { - label += advance; - } - if (label && aCStr[label - 1] != ':') - retVal = 0; - else - { - mimeLabel = TQCString (aCStr, label); //length including zero - retVal += label; - aCStr += label; - } - } - if (retVal) - { - int skip; - skip = skipWS (aCStr); - if (skip < 0) - skip *= -1; - aCStr += skip; - retVal += skip; - skip = parseFullLine (aCStr); - mimeValue = TQCString (aCStr, skip + 1); - retVal += skip; - aCStr += skip; - } - else - { - //Skip malformed line - while (*aCStr && *aCStr != '\r' && *aCStr != '\n') - { - retVal--; - aCStr++; - } - if (*aCStr == '\r') - { - retVal--; - aCStr++; - } - if (*aCStr == '\n') - { - retVal--; - aCStr++; - } - } - } - else - { - //debug - } - return retVal; -} - -/** slurp one word*/ -int -mimeHdrLine::parseWord (const char *inCStr) -{ - int retVal = 0; - char *aCStr = (char *) inCStr; - - if (aCStr && *aCStr) - { - if (*aCStr == '"') - return mimeHdrLine::parseQuoted ('"', '"', aCStr); - else - return mimeHdrLine::parseHalfWord (aCStr); - } - else - { - //debug(); - } - return retVal; -} - -/** slurp one word*/ -int -mimeHdrLine::parseQuoted (char startQuote, char endQuote, const char *inCStr) -{ - char *aCStr = (char *) inCStr; - int retVal = 0; - - if (aCStr && *aCStr) - { - if (*aCStr == startQuote) - { - aCStr++; - retVal++; - } - else - return 0; - while (*aCStr && *aCStr != endQuote) - { - //skip over backticks - if (*aCStr == '\\') - { - aCStr++; - retVal++; - } - //eat this - aCStr++; - retVal++; - } - if (*aCStr == endQuote) - { - aCStr++; - retVal++; - } - } - else - { - //debug(); - } - return retVal; -} - -/** slurp one alphanumerical word without continuation*/ -int -mimeHdrLine::parseAlphaNum (const char *inCStr) -{ - int retVal = 0; - char *aCStr = (char *) inCStr; - - if (aCStr) - { - while (*aCStr && isalnum (*aCStr)) - { - //skip over backticks - if (*aCStr == '\\') - { - aCStr++; - retVal++; - } - //eat this - aCStr++; - retVal++; - } - } - else - { - //debug(); - } - return retVal; -} - -int -mimeHdrLine::parseHalfWord (const char *inCStr) -{ - int retVal = 0; - char *aCStr = (char *) inCStr; - - if (aCStr && *aCStr) - { - if (isalnum (*aCStr)) - return mimeHdrLine::parseAlphaNum (aCStr); - //skip over backticks - if (*aCStr == '\\') - { - aCStr++; - retVal++; - } - else if (!isspace (*aCStr)) - { - //eat this - aCStr++; - retVal++; - } - } - else - { - //debug(); - } - return retVal; -} - -/** slurp one line without continuation*/ -int -mimeHdrLine::parseHalfLine (const char *inCStr) -{ - int retVal = 0; - char *aCStr = (char *) inCStr; - - if (aCStr) - { - while (*aCStr && *aCStr != '\n') - { - //skip over backticks - if (*aCStr == '\\') - { - aCStr++; - retVal++; - } - //eat this - aCStr++; - retVal++; - } - if (*aCStr == '\n') - { - aCStr++; - retVal++; - } - } - else - { - //debug(); - } - return retVal; -} - -/** skip all white space characters including continuation*/ -int -mimeHdrLine::skipWS (const char *inCStr) -{ - int retVal = 0; - char *aCStr = (char *) inCStr; - - if (aCStr && *aCStr) - { - while (*aCStr == ' ' || *aCStr == '\t') - { - aCStr++; - retVal++; - } - //check out for continuation lines - if (*aCStr == '\r') - { - aCStr++; - retVal++; - } - if (*aCStr++ == '\n') - if (*aCStr == '\t' || *aCStr == ' ') - { - int skip = mimeHdrLine::skipWS (aCStr); - if (skip < 0) - skip *= -1; - retVal += 1 + skip; - } - else - { - retVal = -retVal - 1; - } - } - else - { - //debug(); - } - return retVal; -} - -/** parses continuated lines */ -int -mimeHdrLine::parseFullLine (const char *inCStr) -{ - int retVal = 0; - char *aCStr = (char *) inCStr; - int skip; - - if (aCStr) - { - //skip leading white space - skip = skipWS (aCStr); - if (skip > 0) - { - aCStr += skip; - retVal += skip; - } - while (*aCStr) - { - int advance; - - if ((advance = parseHalfLine (aCStr))) - { - retVal += advance; - aCStr += advance; - } - else if ((advance = skipWS (aCStr))) - { - if (advance > 0) - { - retVal += advance; - aCStr += advance; - } - else - { - retVal -= advance; - break; - } - } - else - break; - } - } - else - { - //debug(); - } - return retVal; -} - -/** parses continuated lines */ -int -mimeHdrLine::parseSeparator (char separator, const char *inCStr) -{ - char *aCStr = (char *) inCStr; - int retVal = 0; - int skip; - - if (aCStr) - { - //skip leading white space - skip = skipWS (aCStr); - if (skip > 0) - { - aCStr += skip; - retVal += skip; - } - while (*aCStr) - { - int advance; - - if (*aCStr != separator) - { - if ((advance = mimeHdrLine::parseWord (aCStr))) - { - retVal += advance; - aCStr += advance; - } - else if ((advance = mimeHdrLine::skipWS (aCStr))) - { - if (advance > 0) - { - retVal += advance; - aCStr += advance; - } - else - { - retVal -= advance; - break; - } - } - else - break; - } - else - { - //include separator in result - retVal++; - aCStr++; - break; - } - } - } - else - { - //debug(); - } - return retVal; -} - -/** return the label */ - -const TQCString& -mimeHdrLine::getLabel () -{ - return mimeLabel; -} - -/** return the value */ -const TQCString& -mimeHdrLine::getValue () -{ - return mimeValue; -} - - -// FIXME: very inefficient still -TQCString -mimeHdrLine::truncateLine(TQCString aLine, unsigned int truncate) -{ - int cutHere; - TQCString retVal; - uint len = aLine.length(); - - // see if we have a line of the form "key: value" (like "Subject: bla") - // then we do not want to truncate between key and value - int validStart = aLine.find(": "); - if (validStart > -1) { - validStart += 2; - } - while (len > truncate) { - cutHere = aLine.findRev(' ', truncate); - if (cutHere < 1 || cutHere < validStart) { - cutHere = aLine.findRev('\t', truncate); - if (cutHere < 1) { - cutHere = aLine.find(' ', 1); - if (cutHere < 1) { - cutHere = aLine.find('\t', 1); - if (cutHere < 1) { - // simply truncate - return aLine.left(truncate); - } - } - } - } - - retVal += aLine.left(cutHere) + '\n'; - int chop = len - cutHere; - aLine = aLine.right(chop); - len -= chop; - } - retVal += aLine; - - return retVal; -} - diff --git a/kioslaves/imap4/mimehdrline.h b/kioslaves/imap4/mimehdrline.h deleted file mode 100644 index e31c1864..00000000 --- a/kioslaves/imap4/mimehdrline.h +++ /dev/null @@ -1,67 +0,0 @@ -/*************************************************************************** - mimehdrline.h - description - ------------------- - begin : Wed Oct 11 2000 - copyright : (C) 2000 by Sven Carstens - email : s.carstens@gmx.de - ***************************************************************************/ - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#ifndef MIMEHDRLINE_H -#define MIMEHDRLINE_H - - -#include -#include - -/** - *@author Sven Carstens - */ - -class mimeHdrLine -{ -public: - mimeHdrLine (); - mimeHdrLine (mimeHdrLine *); - mimeHdrLine (const TQCString &, const TQCString &); - ~mimeHdrLine (); - /** parse a Line into the class -and report characters slurped */ - int setStr (const char *); - int appendStr (const char *); - /** return the value */ - const TQCString& getValue (); - /** return the label */ - const TQCString& getLabel (); - static TQCString truncateLine (TQCString, unsigned int truncate = 80); - static int parseSeparator (char, const char *); - static int parseQuoted (char, char, const char *); - /** skip all white space characters */ - static int skipWS (const char *); - /** slurp one word respecting backticks */ - static int parseHalfWord (const char *); - static int parseWord (const char *); - static int parseAlphaNum (const char *); - -protected: // Protected attributes - /** contains the Value - */ - TQCString mimeValue; - /** contains the Label of the line - */ - TQCString mimeLabel; -protected: // Protected methods - /** parses a continuated line */ - int parseFullLine (const char *); - int parseHalfLine (const char *); -}; - -#endif diff --git a/kioslaves/imap4/mimeheader.cc b/kioslaves/imap4/mimeheader.cc deleted file mode 100644 index 72e3827b..00000000 --- a/kioslaves/imap4/mimeheader.cc +++ /dev/null @@ -1,745 +0,0 @@ -/*************************************************************************** - mimeheader.cc - description - ------------------- - begin : Fri Oct 20 2000 - copyright : (C) 2000 by Sven Carstens - email : s.carstens@gmx.de - ***************************************************************************/ - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#include "mimeheader.h" -#include "mimehdrline.h" -#include "mailheader.h" -#include "rfcdecoder.h" - -#include - -// #include -#include -#include -#include -#include -#include -#include -#include - -mimeHeader::mimeHeader (): -typeList (17, false), dispositionList (17, false) -{ - // Case insensitive hashes are killing us. Also are they too small? - originalHdrLines.setAutoDelete (true); - additionalHdrLines.setAutoDelete (false); // is also in original lines - nestedParts.setAutoDelete (true); - typeList.setAutoDelete (true); - dispositionList.setAutoDelete (true); - nestedMessage = NULL; - contentLength = 0; - contentType = "application/octet-stream"; -} - -mimeHeader::~mimeHeader () -{ -} - -/* -TQPtrList mimeHeader::getAllParts() -{ - TQPtrList retVal; - - // caller is responsible for clearing - retVal.setAutoDelete( false ); - nestedParts.setAutoDelete( false ); - - // shallow copy - retVal = nestedParts; - - // can't have duplicate pointers - nestedParts.clear(); - - // restore initial state - nestedParts.setAutoDelete( true ); - - return retVal; -} */ - -void -mimeHeader::addHdrLine (mimeHdrLine * aHdrLine) -{ - mimeHdrLine *addLine = new mimeHdrLine (aHdrLine); - if (addLine) - { - originalHdrLines.append (addLine); - if (tqstrnicmp (addLine->getLabel (), "Content-", 8)) - { - additionalHdrLines.append (addLine); - } - else - { - int skip; - const char *aCStr = addLine->getValue ().data (); - TQDict < TQString > *aList = 0; - - skip = mimeHdrLine::parseSeparator (';', aCStr); - if (skip > 0) - { - int cut = 0; - if (skip >= 2) - { - if (aCStr[skip - 1] == '\r') - cut++; - if (aCStr[skip - 1] == '\n') - cut++; - if (aCStr[skip - 2] == '\r') - cut++; - if (aCStr[skip - 1] == ';') - cut++; - } - TQCString mimeValue = TQCString (aCStr, skip - cut + 1); // cutting of one because of 0x00 - - - if (!tqstricmp (addLine->getLabel (), "Content-Disposition")) - { - aList = &dispositionList; - _contentDisposition = mimeValue; - } - else if (!tqstricmp (addLine->getLabel (), "Content-Type")) - { - aList = &typeList; - contentType = mimeValue; - } - else - if (!tqstricmp (addLine->getLabel (), "Content-Transfer-Encoding")) - { - contentEncoding = mimeValue; - } - else if (!tqstricmp (addLine->getLabel (), "Content-ID")) - { - contentID = mimeValue; - } - else if (!tqstricmp (addLine->getLabel (), "Content-Description")) - { - _contentDescription = mimeValue; - } - else if (!tqstricmp (addLine->getLabel (), "Content-MD5")) - { - contentMD5 = mimeValue; - } - else if (!tqstricmp (addLine->getLabel (), "Content-Length")) - { - contentLength = mimeValue.toULong (); - } - else - { - additionalHdrLines.append (addLine); - } -// cout << addLine->getLabel().data() << ": '" << mimeValue.data() << "'" << endl; - - aCStr += skip; - while ((skip = mimeHdrLine::parseSeparator (';', aCStr))) - { - if (skip > 0) - { - addParameter (TQCString (aCStr, skip).simplifyWhiteSpace(), aList); -// cout << "-- '" << aParm.data() << "'" << endl; - mimeValue = TQCString (addLine->getValue ().data (), skip); - aCStr += skip; - } - else - break; - } - } - } - } -} - -void -mimeHeader::addParameter (const TQCString& aParameter, TQDict < TQString > *aList) -{ - if ( !aList ) - return; - - TQString *aValue; - TQCString aLabel; - int pos = aParameter.find ('='); -// cout << aParameter.left(pos).data(); - aValue = new TQString (); - aValue->setLatin1 (aParameter.right (aParameter.length () - pos - 1)); - aLabel = aParameter.left (pos); - if ((*aValue)[0] == '"') - *aValue = aValue->mid (1, aValue->length () - 2); - - aList->insert (aLabel, aValue); -// cout << "=" << aValue->data() << endl; -} - -TQString -mimeHeader::getDispositionParm (const TQCString& aStr) -{ - return getParameter (aStr, &dispositionList); -} - -TQString -mimeHeader::getTypeParm (const TQCString& aStr) -{ - return getParameter (aStr, &typeList); -} - -void -mimeHeader::setDispositionParm (const TQCString& aLabel, const TQString& aValue) -{ - setParameter (aLabel, aValue, &dispositionList); - return; -} - -void -mimeHeader::setTypeParm (const TQCString& aLabel, const TQString& aValue) -{ - setParameter (aLabel, aValue, &typeList); -} - -TQDictIterator < TQString > mimeHeader::getDispositionIterator () -{ - return TQDictIterator < TQString > (dispositionList); -} - -TQDictIterator < TQString > mimeHeader::getTypeIterator () -{ - return TQDictIterator < TQString > (typeList); -} - -TQPtrListIterator < mimeHdrLine > mimeHeader::getOriginalIterator () -{ - return TQPtrListIterator < mimeHdrLine > (originalHdrLines); -} - -TQPtrListIterator < mimeHdrLine > mimeHeader::getAdditionalIterator () -{ - return TQPtrListIterator < mimeHdrLine > (additionalHdrLines); -} - -void -mimeHeader::outputHeader (mimeIO & useIO) -{ - if (!getDisposition ().isEmpty ()) - { - useIO.outputMimeLine (TQCString ("Content-Disposition: ") - + getDisposition () - + outputParameter (&dispositionList)); - } - - if (!getType ().isEmpty ()) - { - useIO.outputMimeLine (TQCString ("Content-Type: ") - + getType () + outputParameter (&typeList)); - } - if (!getDescription ().isEmpty ()) - useIO.outputMimeLine (TQCString ("Content-Description: ") + - getDescription ()); - if (!getID ().isEmpty ()) - useIO.outputMimeLine (TQCString ("Content-ID: ") + getID ()); - if (!getMD5 ().isEmpty ()) - useIO.outputMimeLine (TQCString ("Content-MD5: ") + getMD5 ()); - if (!getEncoding ().isEmpty ()) - useIO.outputMimeLine (TQCString ("Content-Transfer-Encoding: ") + - getEncoding ()); - - TQPtrListIterator < mimeHdrLine > ait = getAdditionalIterator (); - while (ait.current ()) - { - useIO.outputMimeLine (ait.current ()->getLabel () + ": " + - ait.current ()->getValue ()); - ++ait; - } - useIO.outputMimeLine (TQCString ("")); -} - -TQString -mimeHeader::getParameter (const TQCString& aStr, TQDict < TQString > *aDict) -{ - TQString retVal, *found; - if (aDict) - { - //see if it is a normal parameter - found = aDict->find (aStr); - if (!found) - { - //might be a continuated or encoded parameter - found = aDict->find (aStr + "*"); - if (!found) - { - //continuated parameter - TQString decoded, encoded; - int part = 0; - - do - { - TQCString search; - search.setNum (part); - search = aStr + "*" + search; - found = aDict->find (search); - if (!found) - { - found = aDict->find (search + "*"); - if (found) - encoded += rfcDecoder::encodeRFC2231String (*found); - } - else - { - encoded += *found; - } - part++; - } - while (found); - if (encoded.find ('\'') >= 0) - { - retVal = rfcDecoder::decodeRFC2231String (encoded.local8Bit ()); - } - else - { - retVal = - rfcDecoder::decodeRFC2231String (TQCString ("''") + - encoded.local8Bit ()); - } - } - else - { - //simple encoded parameter - retVal = rfcDecoder::decodeRFC2231String (found->local8Bit ()); - } - } - else - { - retVal = *found; - } - } - return retVal; -} - -void -mimeHeader::setParameter (const TQCString& aLabel, const TQString& aValue, - TQDict < TQString > *aDict) -{ - bool encoded = true; - uint vlen, llen; - TQString val = aValue; - - if (aDict) - { - - //see if it needs to get encoded - if (encoded && aLabel.find ('*') == -1) - { - val = rfcDecoder::encodeRFC2231String (aValue); - } - //kdDebug(7116) << "mimeHeader::setParameter() - val = '" << val << "'" << endl; - //see if it needs to be truncated - vlen = val.length(); - llen = aLabel.length(); - if (vlen + llen + 4 > 80 && llen < 80 - 8 - 2 ) - { - const int limit = 80 - 8 - 2 - (int)llen; - // the -2 is there to allow extending the length of a part of val - // by 1 or 2 in order to prevent an encoded character from being - // split in half - int i = 0; - TQString shortValue; - TQCString shortLabel; - - while (!val.isEmpty ()) - { - int partLen; // the length of the next part of the value - if ( limit >= int(vlen) ) { - // the rest of the value fits completely into one continued header - partLen = vlen; - } - else { - partLen = limit; - // make sure that we don't split an encoded char in half - if ( val[partLen-1] == '%' ) { - partLen += 2; - } - else if ( partLen > 1 && val[partLen-2] == '%' ) { - partLen += 1; - } - // make sure partLen does not exceed vlen (could happen in case of - // an incomplete encoded char) - if ( partLen > int(vlen) ) { - partLen = vlen; - } - } - shortValue = val.left( partLen ); - shortLabel.setNum (i); - shortLabel = aLabel + "*" + shortLabel; - val = val.right( vlen - partLen ); - vlen = vlen - partLen; - if (encoded) - { - if (i == 0) - { - shortValue = "''" + shortValue; - } - shortLabel += "*"; - } - //kdDebug(7116) << "mimeHeader::setParameter() - shortLabel = '" << shortLabel << "'" << endl; - //kdDebug(7116) << "mimeHeader::setParameter() - shortValue = '" << shortValue << "'" << endl; - //kdDebug(7116) << "mimeHeader::setParameter() - val = '" << val << "'" << endl; - aDict->insert (shortLabel, new TQString (shortValue)); - i++; - } - } - else - { - aDict->insert (aLabel, new TQString (val)); - } - } -} - -TQCString -mimeHeader::outputParameter (TQDict < TQString > *aDict) -{ - TQCString retVal; - if (aDict) - { - TQDictIterator < TQString > it (*aDict); - while (it.current ()) - { - retVal += (";\n\t" + it.currentKey () + "=").latin1 (); - if (it.current ()->find (' ') > 0 || it.current ()->find (';') > 0) - { - retVal += '"' + it.current ()->utf8 () + '"'; - } - else - { - retVal += it.current ()->utf8 (); - } - // << it.current()->utf8() << "'"; - ++it; - } - retVal += "\n"; - } - return retVal; -} - -void -mimeHeader::outputPart (mimeIO & useIO) -{ - TQPtrListIterator < mimeHeader > nestedParts = getNestedIterator (); - TQCString boundary; - if (!getTypeParm ("boundary").isEmpty ()) - boundary = getTypeParm ("boundary").latin1 (); - - outputHeader (useIO); - if (!getPreBody ().isEmpty ()) - useIO.outputMimeLine (getPreBody ()); - if (getNestedMessage ()) - getNestedMessage ()->outputPart (useIO); - while (nestedParts.current ()) - { - if (!boundary.isEmpty ()) - useIO.outputMimeLine ("--" + boundary); - nestedParts.current ()->outputPart (useIO); - ++nestedParts; - } - if (!boundary.isEmpty ()) - useIO.outputMimeLine ("--" + boundary + "--"); - if (!getPostBody ().isEmpty ()) - useIO.outputMimeLine (getPostBody ()); -} - -int -mimeHeader::parsePart (mimeIO & useIO, const TQString& boundary) -{ - int retVal = 0; - bool mbox = false; - TQCString preNested, postNested; - mbox = parseHeader (useIO); - - kdDebug(7116) << "mimeHeader::parsePart - parsing part '" << getType () << "'" << endl; - if (!tqstrnicmp (getType (), "Multipart", 9)) - { - retVal = parseBody (useIO, preNested, getTypeParm ("boundary")); //this is a message in mime format stuff - setPreBody (preNested); - int localRetVal; - do - { - mimeHeader *aHeader = new mimeHeader; - - // set default type for multipart/digest - if (!tqstrnicmp (getType (), "Multipart/Digest", 16)) - aHeader->setType ("Message/RFC822"); - - localRetVal = aHeader->parsePart (useIO, getTypeParm ("boundary")); - addNestedPart (aHeader); - } - while (localRetVal); //get nested stuff - } - if (!tqstrnicmp (getType (), "Message/RFC822", 14)) - { - mailHeader *msgHeader = new mailHeader; - retVal = msgHeader->parsePart (useIO, boundary); - setNestedMessage (msgHeader); - } - else - { - retVal = parseBody (useIO, postNested, boundary, mbox); //just a simple part remaining - setPostBody (postNested); - } - return retVal; -} - -int -mimeHeader::parseBody (mimeIO & useIO, TQCString & messageBody, - const TQString& boundary, bool mbox) -{ - TQCString inputStr; - TQCString buffer; - TQString partBoundary; - TQString partEnd; - int retVal = 0; //default is last part - - if (!boundary.isEmpty ()) - { - partBoundary = TQString ("--") + boundary; - partEnd = TQString ("--") + boundary + "--"; - } - - while (useIO.inputLine (inputStr)) - { - //check for the end of all parts - if (!partEnd.isEmpty () - && !tqstrnicmp (inputStr, partEnd.latin1 (), partEnd.length () - 1)) - { - retVal = 0; //end of these parts - break; - } - else if (!partBoundary.isEmpty () - && !tqstrnicmp (inputStr, partBoundary.latin1 (), - partBoundary.length () - 1)) - { - retVal = 1; //continue with next part - break; - } - else if (mbox && inputStr.find ("From ") == 0) - { - retVal = 0; // end of mbox - break; - } - buffer += inputStr; - if (buffer.length () > 16384) - { - messageBody += buffer; - buffer = ""; - } - } - - messageBody += buffer; - return retVal; -} - -bool -mimeHeader::parseHeader (mimeIO & useIO) -{ - bool mbox = false; - bool first = true; - mimeHdrLine my_line; - TQCString inputStr; - - kdDebug(7116) << "mimeHeader::parseHeader - starting parsing" << endl; - while (useIO.inputLine (inputStr)) - { - int appended; - if (inputStr.find ("From ") != 0 || !first) - { - first = false; - appended = my_line.appendStr (inputStr); - if (!appended) - { - addHdrLine (&my_line); - appended = my_line.setStr (inputStr); - } - if (appended <= 0) - break; - } - else - { - mbox = true; - first = false; - } - inputStr = (const char *) NULL; - } - - kdDebug(7116) << "mimeHeader::parseHeader - finished parsing" << endl; - return mbox; -} - -mimeHeader * -mimeHeader::bodyPart (const TQString & _str) -{ - // see if it is nested a little deeper - int pt = _str.find('.'); - if (pt != -1) - { - TQString tempStr = _str; - mimeHeader *tempPart; - - tempStr = _str.right (_str.length () - pt - 1); - if (nestedMessage) - { - kdDebug(7116) << "mimeHeader::bodyPart - recursing message" << endl; - tempPart = nestedMessage->nestedParts.at (_str.left(pt).toULong() - 1); - } - else - { - kdDebug(7116) << "mimeHeader::bodyPart - recursing mixed" << endl; - tempPart = nestedParts.at (_str.left(pt).toULong() - 1); - } - if (tempPart) - tempPart = tempPart->bodyPart (tempStr); - return tempPart; - } - - kdDebug(7116) << "mimeHeader::bodyPart - returning part " << _str << endl; - // or pick just the plain part - if (nestedMessage) - { - kdDebug(7116) << "mimeHeader::bodyPart - message" << endl; - return nestedMessage->nestedParts.at (_str.toULong () - 1); - } - kdDebug(7116) << "mimeHeader::bodyPart - mixed" << endl; - return nestedParts.at (_str.toULong () - 1); -} - -void mimeHeader::serialize(TQDataStream& stream) -{ - int nestedcount = nestedParts.count(); - if (nestedParts.isEmpty() && nestedMessage) - nestedcount = 1; - stream << nestedcount << contentType << TQString (getTypeParm ("name")) << _contentDescription - << _contentDisposition << contentEncoding << contentLength << partSpecifier; - // serialize nested message - if (nestedMessage) - nestedMessage->serialize(stream); - - // serialize nested parts - if (!nestedParts.isEmpty()) - { - TQPtrListIterator < mimeHeader > it(nestedParts); - mimeHeader* part; - while ( (part = it.current()) != 0 ) - { - ++it; - part->serialize(stream); - } - } -} - -#ifdef KMAIL_COMPATIBLE -// compatibility subroutines -TQString -mimeHeader::bodyDecoded () -{ - kdDebug(7116) << "mimeHeader::bodyDecoded" << endl; - TQByteArray temp; - - temp = bodyDecodedBinary (); - return TQString::fromLatin1 (temp.data (), temp.count ()); -} - -TQByteArray -mimeHeader::bodyDecodedBinary () -{ - TQByteArray retVal; - - if (contentEncoding.find ("quoted-printable", 0, false) == 0) - retVal = KCodecs::quotedPrintableDecode(postMultipartBody); - else if (contentEncoding.find ("base64", 0, false) == 0) - KCodecs::base64Decode(postMultipartBody, retVal); - else retVal = postMultipartBody; - - kdDebug(7116) << "mimeHeader::bodyDecodedBinary - size is " << retVal.size () << endl; - return retVal; -} - -void -mimeHeader::setBodyEncodedBinary (const TQByteArray & _arr) -{ - setBodyEncoded (_arr); -} - -void -mimeHeader::setBodyEncoded (const TQByteArray & _arr) -{ - TQByteArray setVal; - - kdDebug(7116) << "mimeHeader::setBodyEncoded - in size " << _arr.size () << endl; - if (contentEncoding.find ("quoted-printable", 0, false) == 0) - setVal = KCodecs::quotedPrintableEncode(_arr); - else if (contentEncoding.find ("base64", 0, false) == 0) - KCodecs::base64Encode(_arr, setVal); - else - setVal.duplicate (_arr); - kdDebug(7116) << "mimeHeader::setBodyEncoded - out size " << setVal.size () << endl; - - postMultipartBody.duplicate (setVal); - kdDebug(7116) << "mimeHeader::setBodyEncoded - out size " << postMultipartBody.size () << endl; -} - -TQString -mimeHeader::iconName () -{ - TQString fileName; - - // FIXME: bug? Why throw away this data? - fileName = - KMimeType::mimeType (contentType.lower ())->icon (TQString(), false); - fileName = - TDEGlobal::instance ()->iconLoader ()->iconPath (fileName, KIcon::Desktop); -// if (fileName.isEmpty()) -// fileName = TDEGlobal::instance()->iconLoader()->iconPath( "unknown", KIcon::Desktop ); - return fileName; -} - -void -mimeHeader::setNestedMessage (mailHeader * inPart, bool destroy) -{ -// if(nestedMessage && destroy) delete nestedMessage; - nestedMessage = inPart; -} - -TQString -mimeHeader::headerAsString () -{ - mimeIOTQString myIO; - - outputHeader (myIO); - return myIO.getString (); -} - -TQString -mimeHeader::magicSetType (bool aAutoDecode) -{ - TQString mimetype; - TQByteArray body; - KMimeMagicResult *result; - - KMimeMagic::self ()->setFollowLinks (TRUE); // is it necessary ? - - if (aAutoDecode) - body = bodyDecodedBinary (); - else - body = postMultipartBody; - - result = KMimeMagic::self ()->findBufferType (body); - mimetype = result->mimeType (); - contentType = mimetype; - return mimetype; -} -#endif diff --git a/kioslaves/imap4/mimeheader.h b/kioslaves/imap4/mimeheader.h deleted file mode 100644 index bc2fd2bc..00000000 --- a/kioslaves/imap4/mimeheader.h +++ /dev/null @@ -1,337 +0,0 @@ -/*************************************************************************** - mimeheader.h - description - ------------------- - begin : Fri Oct 20 2000 - copyright : (C) 2000 by Sven Carstens - email : s.carstens@gmx.de - ***************************************************************************/ - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#ifndef MIMEHEADER_H -#define MIMEHEADER_H - -#include -#include - -#include "mimehdrline.h" -#include "mimeio.h" -#include "rfcdecoder.h" - -/** - *@author Sven Carstens - */ - -class mimeHeader -{ -public: - mimeHeader (); - virtual ~ mimeHeader (); - - virtual void addHdrLine (mimeHdrLine *); - virtual void outputHeader (mimeIO &); - virtual void outputPart (mimeIO &); - - - TQCString outputParameter (TQDict < TQString > *); - - int parsePart (mimeIO &, const TQString&); - int parseBody (mimeIO &, TQCString &, const TQString&, bool mbox = false); - - // parse a header. returns true if it had a leading 'From ' line - bool parseHeader (mimeIO &); - - TQString getDispositionParm (const TQCString&); - void setDispositionParm (const TQCString&, const TQString&); - TQDictIterator < TQString > getDispositionIterator (); - - TQString getTypeParm (const TQCString&); - void setTypeParm (const TQCString&, const TQString&); - TQDictIterator < TQString > getTypeIterator (); - - // recursively serialize all important contents to the TQDataStream - void serialize(TQDataStream& stream); - - const TQCString& getType () - { - return contentType; - } - void setType (const TQCString & _str) - { - contentType = _str; - } - - const TQCString& getDescription () - { - return _contentDescription; - } - void setDescription (const TQCString & _str) - { - _contentDescription = _str; - } - - TQCString getDisposition () - { - return _contentDisposition; - } - void setDisposition (const TQCString & _str) - { - _contentDisposition = _str; - } - - TQCString getEncoding () - { - return contentEncoding; - } - void setEncoding (const TQCString & _str) - { - contentEncoding = _str; - } - - TQCString getMD5 () - { - return contentMD5; - } - void setMD5 (const TQCString & _str) - { - contentMD5 = _str; - } - - TQCString getID () - { - return contentID; - } - void setID (const TQCString & _str) - { - contentID = _str; - } - - unsigned long getLength () - { - return contentLength; - } - void setLength (unsigned long _len) - { - contentLength = _len; - } - - const TQString & getPartSpecifier () - { - return partSpecifier; - } - void setPartSpecifier (const TQString & _str) - { - partSpecifier = _str; - } - - TQPtrListIterator < mimeHdrLine > getOriginalIterator (); - TQPtrListIterator < mimeHdrLine > getAdditionalIterator (); - void setContent (const TQCString &aContent) - { - mimeContent = aContent; - } - TQCString getContent () - { - return mimeContent; - } - - TQCString getBody () - { - return preMultipartBody + postMultipartBody; - } - TQCString getPreBody () - { - return preMultipartBody; - } - void setPreBody (TQCString & inBody) - { - preMultipartBody = inBody; - } - - TQCString getPostBody () - { - return postMultipartBody; - } - void setPostBody (TQCString & inBody) - { - postMultipartBody = inBody; - contentLength = inBody.length (); - } - - mimeHeader *getNestedMessage () - { - return nestedMessage; - } - void setNestedMessage (mimeHeader * inPart, bool destroy = true) - { - if (nestedMessage && destroy) - delete nestedMessage; - nestedMessage = inPart; - } - -// mimeHeader *getNestedPart() { return nestedPart; }; - void addNestedPart (mimeHeader * inPart) - { - nestedParts.append (inPart); - } - TQPtrListIterator < mimeHeader > getNestedIterator () - { - return TQPtrListIterator < mimeHeader > (nestedParts); - } - - // clears all parts and deletes them from memory - void clearNestedParts () - { - nestedParts.clear (); - } - - // clear all parameters to content-type - void clearTypeParameters () - { - typeList.clear (); - } - - // clear all parameters to content-disposition - void clearDispositionParameters () - { - dispositionList.clear (); - } - - // return the specified body part or NULL - mimeHeader *bodyPart (const TQString &); - -#ifdef KMAIL_COMPATIBLE - ulong msgSize () - { - return contentLength; - } - uint numBodyParts () - { - return nestedParts.count (); - } - mimeHeader *bodyPart (int which, mimeHeader ** ret = NULL) - { - if (ret) - (*ret) = nestedParts.at (which); - return nestedParts.at (which); - } - void write (const TQString &) - { - } - TQString typeStr () - { - return TQString (contentType.left (contentType.find ('/'))); - } - void setTypeStr (const TQString & _str) - { - contentType = TQCString (_str.latin1 ()) + "/" + subtypeStr ().latin1 (); - } - TQString subtypeStr () - { - return TQString (contentType. - right (contentType.length () - contentType.find ('/') - - 1)); - } - void setSubtypeStr (const TQString & _str) - { - contentType = TQCString (typeStr ().latin1 ()) + "/" + _str.latin1 (); - } - TQString cteStr () - { - return TQString (getEncoding ()); - } - void setCteStr (const TQString & _str) - { - setEncoding (_str.latin1 ()); - } - TQString contentDisposition () - { - return TQString (_contentDisposition); - } - TQString body () - { - return TQString (postMultipartBody); - } - TQString charset () - { - return getTypeParm ("charset"); - } - TQString bodyDecoded (); - void setBodyEncoded (const TQByteArray &); - void setBodyEncodedBinary (const TQByteArray &); - TQByteArray bodyDecodedBinary (); - TQString name () - { - return TQString (getTypeParm ("name")); - } - void setName (const TQString & _str) - { - setTypeParm ("name", _str); - } - TQString fileName () - { - return TQString (getDispositionParm ("filename")); - } - TQString contentDescription () - { - return TQString (rfcDecoder::decodeRFC2047String (_contentDescription)); - } - void setContentDescription (const TQString & _str) - { - _contentDescription = rfcDecoder::encodeRFC2047String (_str).latin1 (); - } - TQString msgIdMD5 () - { - return TQString (contentMD5); - } - TQString iconName (); - TQString magicSetType (bool aAutoDecode = true); - TQString headerAsString (); - ulong size () - { - return 0; - } - void fromString (const TQByteArray &) - {; - } - void setContentDisposition (const TQString & _str) - { - setDisposition (_str.latin1 ()); - } -#endif - -protected: - static void addParameter (const TQCString&, TQDict < TQString > *); - static TQString getParameter (const TQCString&, TQDict < TQString > *); - static void setParameter (const TQCString&, const TQString&, TQDict < TQString > *); - - TQPtrList < mimeHdrLine > originalHdrLines; - -private: - TQPtrList < mimeHdrLine > additionalHdrLines; - TQDict < TQString > typeList; - TQDict < TQString > dispositionList; - TQCString contentType; - TQCString _contentDisposition; - TQCString contentEncoding; - TQCString _contentDescription; - TQCString contentID; - TQCString contentMD5; - unsigned long contentLength; - TQCString mimeContent; - TQCString preMultipartBody; - TQCString postMultipartBody; - mimeHeader *nestedMessage; - TQPtrList < mimeHeader > nestedParts; - TQString partSpecifier; - -}; - -#endif diff --git a/kioslaves/imap4/mimeio.cc b/kioslaves/imap4/mimeio.cc deleted file mode 100644 index 757c11a4..00000000 --- a/kioslaves/imap4/mimeio.cc +++ /dev/null @@ -1,188 +0,0 @@ -/*************************************************************************** - mimeio.cc - description - ------------------- - begin : Wed Oct 25 2000 - copyright : (C) 2000 by Sven Carstens - email : s.carstens@gmx.de - ***************************************************************************/ - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#include -using namespace std; - -#include "mimeio.h" - -mimeIO::mimeIO () -{ - theCRLF = "\r\n"; - crlfLen = 2; -} - -mimeIO::~mimeIO () -{ -} - -int -mimeIO::inputLine (TQCString & aLine) -{ - char input; - - aLine = (const char *) NULL; - while (inputChar (input)) - { - aLine += input; - if (input == '\n') - break; - } -// cout << aLine.length() << " - " << aLine; - return aLine.length (); -} - -int -mimeIO::outputLine (const TQCString & aLine, int len) -{ - int i; - - if (len == -1) { - len = aLine.length(); - } - int start = len; - for (i = 0; i < start; i++) - if (!outputChar (aLine[i])) - break; - return i; -} - -int -mimeIO::outputMimeLine (const TQCString & inLine) -{ - int retVal = 0; - TQCString aLine = inLine; - int len = inLine.length(); - - int theLF = aLine.findRev ('\n'); - if (theLF == len - 1 && theLF != -1) - { - //we have a trailing LF, now check for CR - if (aLine[theLF - 1] == '\r') - theLF--; - //truncate the line - aLine.truncate(theLF); - len = theLF; - theLF = -1; - } - //now truncate the line - { - int start, end, offset; - start = 0; - end = aLine.find ('\n', start); - while (end >= 0) - { - offset = 1; - if (end && aLine[end - 1] == '\r') - { - offset++; - end--; - } - outputLine (aLine.mid (start, end - start) + theCRLF, end - start + crlfLen); - start = end + offset; - end = aLine.find ('\n', start); - } - outputLine (aLine.mid (start, len - start) + theCRLF, len - start + crlfLen); - } - return retVal; -} - -int -mimeIO::inputChar (char &aChar) -{ - if (cin.eof ()) - { -// cout << "EOF" << endl; - return 0; - } - cin.get (aChar); - return 1; -} - -int -mimeIO::outputChar (char aChar) -{ - cout << aChar; - return 1; -} - -void -mimeIO::setCRLF (const char *aCRLF) -{ - theCRLF = aCRLF; - crlfLen = strlen(aCRLF); -} - -mimeIOTQFile::mimeIOTQFile (const TQString & aName): -mimeIO (), -myFile (aName) -{ - myFile.open (IO_ReadOnly); -} - -mimeIOTQFile::~mimeIOTQFile () -{ - myFile.close (); -} - -int -mimeIOTQFile::outputLine (const TQCString &, int) -{ - return 0; -} - -int -mimeIOTQFile::inputLine (TQCString & data) -{ - data.resize( 1024 ); - myFile.readLine (data.data(), 1024); - - return data.length (); -} - -mimeIOTQString::mimeIOTQString () -{ -} - -mimeIOTQString::~mimeIOTQString () -{ -} - -int -mimeIOTQString::outputLine (const TQCString & _str, int len) -{ - if (len == -1) { - len = _str.length(); - } - theString += _str; - return len; -} - -int -mimeIOTQString::inputLine (TQCString & _str) -{ - if (theString.isEmpty ()) - return 0; - - int i = theString.find ('\n'); - - if (i == -1) - return 0; - _str = theString.left (i + 1).latin1 (); - theString = theString.right (theString.length () - i - 1); - return _str.length (); -} diff --git a/kioslaves/imap4/mimeio.h b/kioslaves/imap4/mimeio.h deleted file mode 100644 index 37a96998..00000000 --- a/kioslaves/imap4/mimeio.h +++ /dev/null @@ -1,79 +0,0 @@ -/*************************************************************************** - mimeio.h - description - ------------------- - begin : Wed Oct 25 2000 - copyright : (C) 2000 by Sven Carstens - email : s.carstens@gmx.de - ***************************************************************************/ - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#ifndef MIMEIO_H -#define MIMEIO_H - -#include -#include - -/** - *@author Sven Carstens - */ - -class mimeIO -{ -public: - mimeIO (); - virtual ~ mimeIO (); - - virtual int outputLine (const TQCString &, int len = -1); - virtual int outputMimeLine (const TQCString &); - virtual int inputLine (TQCString &); - virtual int outputChar (char); - virtual int inputChar (char &); - - void setCRLF (const char *); - -protected: - TQCString theCRLF; - int crlfLen; -}; - -class mimeIOTQFile:public mimeIO -{ -public: - mimeIOTQFile (const TQString &); - virtual ~ mimeIOTQFile (); - virtual int outputLine (const TQCString &, int len = -1); - virtual int inputLine (TQCString &); - -protected: - TQFile myFile; -}; - -class mimeIOTQString:public mimeIO -{ -public: - mimeIOTQString (); - virtual ~ mimeIOTQString (); - virtual int outputLine (const TQCString &, int len = -1); - virtual int inputLine (TQCString &); - const TQString& getString () const - { - return theString; - } - void setString (const TQString & _str) - { - theString = _str; - } - -protected: - TQString theString; -}; - -#endif diff --git a/kioslaves/imap4/rfcdecoder.cc b/kioslaves/imap4/rfcdecoder.cc deleted file mode 100644 index 08b641b7..00000000 --- a/kioslaves/imap4/rfcdecoder.cc +++ /dev/null @@ -1,668 +0,0 @@ -/********************************************************************** - * - * rfcdecoder.cc - handler for various rfc/mime encodings - * Copyright (C) 2000 s.carstens@gmx.de - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Send comments and bug fixes to s.carstens@gmx.de - * - *********************************************************************/ -#include "rfcdecoder.h" - -#include -#include - -#include -#include - -#include -#include -#include -#include - -// This part taken from rfc 2192 IMAP URL Scheme. C. Newman. September 1997. -// adapted to QT-Toolkit by Sven Carstens 2000 - -static unsigned char base64chars[] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+,"; -#define UNDEFINED 64 -#define MAXLINE 76 - -/* UTF16 definitions */ -#define UTF16MASK 0x03FFUL -#define UTF16SHIFT 10 -#define UTF16BASE 0x10000UL -#define UTF16HIGHSTART 0xD800UL -#define UTF16HIGHEND 0xDBFFUL -#define UTF16LOSTART 0xDC00UL -#define UTF16LOEND 0xDFFFUL - -/* Convert an IMAP mailbox to a Unicode path - */ -TQString rfcDecoder::fromIMAP (const TQString & inSrc) -{ - unsigned char c, i, bitcount; - unsigned long ucs4, utf16, bitbuf; - unsigned char base64[256], utf8[6]; - unsigned long srcPtr = 0; - TQCString dst; - TQCString src = inSrc.ascii (); - uint srcLen = inSrc.length(); - - /* initialize modified base64 decoding table */ - memset (base64, UNDEFINED, sizeof (base64)); - for (i = 0; i < sizeof (base64chars); ++i) - { - base64[(int)base64chars[i]] = i; - } - - /* loop until end of string */ - while (srcPtr < srcLen) - { - c = src[srcPtr++]; - /* deal with literal characters and &- */ - if (c != '&' || src[srcPtr] == '-') - { - /* encode literally */ - dst += c; - /* skip over the '-' if this is an &- sequence */ - if (c == '&') - srcPtr++; - } - else - { - /* convert modified UTF-7 -> UTF-16 -> UCS-4 -> UTF-8 -> HEX */ - bitbuf = 0; - bitcount = 0; - ucs4 = 0; - while ((c = base64[(unsigned char) src[srcPtr]]) != UNDEFINED) - { - ++srcPtr; - bitbuf = (bitbuf << 6) | c; - bitcount += 6; - /* enough bits for a UTF-16 character? */ - if (bitcount >= 16) - { - bitcount -= 16; - utf16 = (bitcount ? bitbuf >> bitcount : bitbuf) & 0xffff; - /* convert UTF16 to UCS4 */ - if (utf16 >= UTF16HIGHSTART && utf16 <= UTF16HIGHEND) - { - ucs4 = (utf16 - UTF16HIGHSTART) << UTF16SHIFT; - continue; - } - else if (utf16 >= UTF16LOSTART && utf16 <= UTF16LOEND) - { - ucs4 += utf16 - UTF16LOSTART + UTF16BASE; - } - else - { - ucs4 = utf16; - } - /* convert UTF-16 range of UCS4 to UTF-8 */ - if (ucs4 <= 0x7fUL) - { - utf8[0] = ucs4; - i = 1; - } - else if (ucs4 <= 0x7ffUL) - { - utf8[0] = 0xc0 | (ucs4 >> 6); - utf8[1] = 0x80 | (ucs4 & 0x3f); - i = 2; - } - else if (ucs4 <= 0xffffUL) - { - utf8[0] = 0xe0 | (ucs4 >> 12); - utf8[1] = 0x80 | ((ucs4 >> 6) & 0x3f); - utf8[2] = 0x80 | (ucs4 & 0x3f); - i = 3; - } - else - { - utf8[0] = 0xf0 | (ucs4 >> 18); - utf8[1] = 0x80 | ((ucs4 >> 12) & 0x3f); - utf8[2] = 0x80 | ((ucs4 >> 6) & 0x3f); - utf8[3] = 0x80 | (ucs4 & 0x3f); - i = 4; - } - /* copy it */ - for (c = 0; c < i; ++c) - { - dst += utf8[c]; - } - } - } - /* skip over trailing '-' in modified UTF-7 encoding */ - if (src[srcPtr] == '-') - ++srcPtr; - } - } - return TQString::fromUtf8 (dst.data ()); -} - -/* replace " with \" and \ with \\ " and \ characters */ -TQString rfcDecoder::quoteIMAP(const TQString &src) -{ - uint len = src.length(); - TQString result; - result.reserve(2 * len); - for (unsigned int i = 0; i < len; i++) - { - if (src[i] == '"' || src[i] == '\\') - result += '\\'; - result += src[i]; - } - //result.squeeze(); - unnecessary and slow - return result; -} - -/* Convert Unicode path to modified UTF-7 IMAP mailbox - */ -TQString rfcDecoder::toIMAP (const TQString & inSrc) -{ - unsigned int utf8pos, utf8total, c, utf7mode, bitstogo, utf16flag; - unsigned long ucs4, bitbuf; - TQCString src = inSrc.utf8 (); - TQString dst; - - ulong srcPtr = 0; - utf7mode = 0; - utf8total = 0; - bitstogo = 0; - utf8pos = 0; - bitbuf = 0; - ucs4 = 0; - while (srcPtr < src.length ()) - { - c = (unsigned char) src[srcPtr++]; - /* normal character? */ - if (c >= ' ' && c <= '~') - { - /* switch out of UTF-7 mode */ - if (utf7mode) - { - if (bitstogo) - { - dst += base64chars[(bitbuf << (6 - bitstogo)) & 0x3F]; - bitstogo = 0; - } - dst += '-'; - utf7mode = 0; - } - dst += c; - /* encode '&' as '&-' */ - if (c == '&') - { - dst += '-'; - } - continue; - } - /* switch to UTF-7 mode */ - if (!utf7mode) - { - dst += '&'; - utf7mode = 1; - } - /* Encode US-ASCII characters as themselves */ - if (c < 0x80) - { - ucs4 = c; - utf8total = 1; - } - else if (utf8total) - { - /* save UTF8 bits into UCS4 */ - ucs4 = (ucs4 << 6) | (c & 0x3FUL); - if (++utf8pos < utf8total) - { - continue; - } - } - else - { - utf8pos = 1; - if (c < 0xE0) - { - utf8total = 2; - ucs4 = c & 0x1F; - } - else if (c < 0xF0) - { - utf8total = 3; - ucs4 = c & 0x0F; - } - else - { - /* NOTE: can't convert UTF8 sequences longer than 4 */ - utf8total = 4; - ucs4 = c & 0x03; - } - continue; - } - /* loop to split ucs4 into two utf16 chars if necessary */ - utf8total = 0; - do - { - if (ucs4 >= UTF16BASE) - { - ucs4 -= UTF16BASE; - bitbuf = (bitbuf << 16) | ((ucs4 >> UTF16SHIFT) + UTF16HIGHSTART); - ucs4 = (ucs4 & UTF16MASK) + UTF16LOSTART; - utf16flag = 1; - } - else - { - bitbuf = (bitbuf << 16) | ucs4; - utf16flag = 0; - } - bitstogo += 16; - /* spew out base64 */ - while (bitstogo >= 6) - { - bitstogo -= 6; - dst += base64chars[(bitstogo ? (bitbuf >> bitstogo) : bitbuf) & 0x3F]; - } - } - while (utf16flag); - } - /* if in UTF-7 mode, finish in ASCII */ - if (utf7mode) - { - if (bitstogo) - { - dst += base64chars[(bitbuf << (6 - bitstogo)) & 0x3F]; - } - dst += '-'; - } - return quoteIMAP(dst); -} - -//----------------------------------------------------------------------------- -TQString rfcDecoder::decodeQuoting(const TQString &aStr) -{ - TQString result; - unsigned int strLength(aStr.length()); - for (unsigned int i = 0; i < strLength ; i++) - { - if (aStr[i] == "\\") i++; - result += aStr[i]; - } - return result; -} - -//----------------------------------------------------------------------------- -TQTextCodec * -rfcDecoder::codecForName (const TQString & _str) -{ - if (_str.isEmpty ()) - return NULL; - return TQTextCodec::codecForName (_str.lower (). - replace ("windows", "cp").latin1 ()); -} - -//----------------------------------------------------------------------------- -const TQString -rfcDecoder::decodeRFC2047String (const TQString & _str) -{ - TQString throw_away; - - return decodeRFC2047String (_str, throw_away); -} - -//----------------------------------------------------------------------------- -const TQString -rfcDecoder::decodeRFC2047String (const TQString & _str, TQString & charset) -{ - TQString throw_away; - - return decodeRFC2047String (_str, charset, throw_away); -} - -//----------------------------------------------------------------------------- -const TQString -rfcDecoder::decodeRFC2047String (const TQString & _str, TQString & charset, - TQString & language) -{ - //do we have a rfc string - if (_str.find("=?") < 0) - return _str; - - TQCString aStr = _str.ascii (); // TQString.length() means Unicode chars - TQCString result; - char *pos, *beg, *end, *mid = NULL; - TQCString str; - char encoding = 0, ch; - bool valid; - const int maxLen = 200; - int i; - -// result.truncate(aStr.length()); - for (pos = aStr.data (); *pos; pos++) - { - if (pos[0] != '=' || pos[1] != '?') - { - result += *pos; - continue; - } - beg = pos + 2; - end = beg; - valid = TRUE; - // parse charset name - for (i = 2, pos += 2; - i < maxLen && (*pos != '?' && (ispunct (*pos) || isalnum (*pos))); - i++) - pos++; - if (*pos != '?' || i < 4 || i >= maxLen) - valid = FALSE; - else - { - charset = TQCString (beg, i - 1); // -2 + 1 for the zero - int pt = charset.findRev('*'); - if (pt != -1) - { - // save language for later usage - language = charset.right (charset.length () - pt - 1); - - // tie off language as defined in rfc2047 - charset.truncate(pt); - } - // get encoding and check delimiting question marks - encoding = toupper (pos[1]); - if (pos[2] != '?' - || (encoding != 'Q' && encoding != 'B' && encoding != 'q' - && encoding != 'b')) - valid = FALSE; - pos += 3; - i += 3; -// kdDebug(7116) << "rfcDecoder::decodeRFC2047String - charset " << charset << " - language " << language << " - '" << pos << "'" << endl; - } - if (valid) - { - mid = pos; - // search for end of encoded part - while (i < maxLen && *pos && !(*pos == '?' && *(pos + 1) == '=')) - { - i++; - pos++; - } - end = pos + 2; //end now points to the first char after the encoded string - if (i >= maxLen || !*pos) - valid = FALSE; - } - if (valid) - { - ch = *pos; - *pos = '\0'; - str = TQCString (mid).left ((int) (mid - pos - 1)); - if (encoding == 'Q') - { - // decode quoted printable text - for (i = str.length () - 1; i >= 0; i--) - if (str[i] == '_') - str[i] = ' '; -// kdDebug(7116) << "rfcDecoder::decodeRFC2047String - before QP '" << str << "'" << endl; - - str = KCodecs::quotedPrintableDecode(str); -// kdDebug(7116) << "rfcDecoder::decodeRFC2047String - after QP '" << str << "'" << endl; - } - else - { - // decode base64 text - str = KCodecs::base64Decode(str); - } - *pos = ch; - int len = str.length(); - for (i = 0; i < len; i++) - result += (char) (TQChar) str[i]; - - pos = end - 1; - } - else - { -// kdDebug(7116) << "rfcDecoder::decodeRFC2047String - invalid" << endl; - //result += "=?"; - //pos = beg -1; // because pos gets increased shortly afterwards - pos = beg - 2; - result += *pos++; - result += *pos; - } - } - if (!charset.isEmpty ()) - { - TQTextCodec *aCodec = codecForName (charset.ascii ()); - if (aCodec) - { -// kdDebug(7116) << "Codec is " << aCodec->name() << endl; - return aCodec->toUnicode (result); - } - } - return result; -} - - -//----------------------------------------------------------------------------- -const char especials[17] = "()<>@,;:\"/[]?.= "; - -const TQString -rfcDecoder::encodeRFC2047String (const TQString & _str) -{ - if (_str.isEmpty ()) - return _str; - const signed char *latin = reinterpret_cast(_str.latin1()), *l, *start, *stop; - char hexcode; - int numQuotes, i; - int rptr = 0; - // My stats show this number results in 12 resize() out of 73,000 - int resultLen = 3 * _str.length() / 2; - TQCString result(resultLen); - - while (*latin) - { - l = latin; - start = latin; - while (*l) - { - if (*l == 32) - start = l + 1; - if (*l < 0) - break; - l++; - } - if (*l) - { - numQuotes = 1; - while (*l) - { - /* The encoded word must be limited to 75 character */ - for (i = 0; i < 16; i++) - if (*l == especials[i]) - numQuotes++; - if (*l < 0) - numQuotes++; - /* Stop after 58 = 75 - 17 characters or at "= 58 || *l == 60) - break; - l++; - } - if (*l) - { - stop = l - 1; - while (stop >= start && *stop != 32) - stop--; - if (stop <= start) - stop = l; - } - else - stop = l; - if (resultLen - rptr - 1 <= start - latin + 1 + 16 /* =?iso-88... */) { - resultLen += (start - latin + 1) * 2 + 20; // more space - result.resize(resultLen); - } - while (latin < start) - { - result[rptr++] = *latin; - latin++; - } - strcpy(&result[rptr], "=?iso-8859-1?q?"); rptr += 15; - if (resultLen - rptr - 1 <= 3*(stop - latin + 1)) { - resultLen += (stop - latin + 1) * 4 + 20; // more space - result.resize(resultLen); - } - while (latin < stop) // can add up to 3 chars/iteration - { - numQuotes = 0; - for (i = 0; i < 16; i++) - if (*latin == especials[i]) - numQuotes = 1; - if (*latin < 0) - numQuotes = 1; - if (numQuotes) - { - result[rptr++] = '='; - hexcode = ((*latin & 0xF0) >> 4) + 48; - if (hexcode >= 58) - hexcode += 7; - result[rptr++] = hexcode; - hexcode = (*latin & 0x0F) + 48; - if (hexcode >= 58) - hexcode += 7; - result[rptr++] = hexcode; - } - else - { - result[rptr++] = *latin; - } - latin++; - } - result[rptr++] = '?'; - result[rptr++] = '='; - } - else - { - while (*latin) - { - if (rptr == resultLen - 1) { - resultLen += 30; - result.resize(resultLen); - } - result[rptr++] = *latin; - latin++; - } - } - } - result[rptr] = 0; - //free (latinStart); - return result; -} - - -//----------------------------------------------------------------------------- -const TQString -rfcDecoder::encodeRFC2231String (const TQString & _str) -{ - if (_str.isEmpty ()) - return _str; - signed char *latin = (signed char *) calloc (1, _str.length () + 1); - char *latin_us = (char *) latin; - strcpy (latin_us, _str.latin1 ()); - signed char *l = latin; - char hexcode; - int i; - bool quote; - while (*l) - { - if (*l < 0) - break; - l++; - } - if (!*l) { - free(latin); - return _str.ascii (); - } - TQCString result; - l = latin; - while (*l) - { - quote = *l < 0; - for (i = 0; i < 16; i++) - if (*l == especials[i]) - quote = true; - if (quote) - { - result += "%"; - hexcode = ((*l & 0xF0) >> 4) + 48; - if (hexcode >= 58) - hexcode += 7; - result += hexcode; - hexcode = (*l & 0x0F) + 48; - if (hexcode >= 58) - hexcode += 7; - result += hexcode; - } - else - { - result += *l; - } - l++; - } - free (latin); - return result; -} - - -//----------------------------------------------------------------------------- -const TQString -rfcDecoder::decodeRFC2231String (const TQString & _str) -{ - int p = _str.find ('\''); - - //see if it is an rfc string - if (p < 0) - return _str; - - int l = _str.findRev ('\''); - - //second is language - if (p >= l) - return _str; - - //first is charset or empty - TQString charset = _str.left (p); - TQString st = _str.mid (l + 1); - TQString language = _str.mid (p + 1, l - p - 1); - - //kdDebug(7116) << "Charset: " << charset << " Language: " << language << endl; - - char ch, ch2; - p = 0; - while (p < (int) st.length ()) - { - if (st.at (p) == 37) - { - ch = st.at (p + 1).latin1 () - 48; - if (ch > 16) - ch -= 7; - ch2 = st.at (p + 2).latin1 () - 48; - if (ch2 > 16) - ch2 -= 7; - st.at (p) = ch * 16 + ch2; - st.remove (p + 1, 2); - } - p++; - } - return st; -} diff --git a/kioslaves/imap4/rfcdecoder.h b/kioslaves/imap4/rfcdecoder.h deleted file mode 100644 index 2095b2ed..00000000 --- a/kioslaves/imap4/rfcdecoder.h +++ /dev/null @@ -1,89 +0,0 @@ -#ifndef RFCDECODER_H -#define RFCDECODER_H -/********************************************************************** - * - * rfcdecoder.h - handler for various rfc/mime encodings - * Copyright (C) 2000 s.carstens@gmx.de - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Send comments and bug fixes to s.carstens@gmx.de - * - *********************************************************************/ - -#include - -class TQTextCodec; - -/** - * handler for various rfc/mime encodings - * @author Sven Carstens - * @date 2000 - * @todo rename to rfcCodecs as it encodes too. - */ -class rfcDecoder -{ - -public: - -/** Convert an IMAP mailbox to a Unicode path - */ - static TQString fromIMAP (const TQString & src); -/** Convert Unicode path to modified UTF-7 IMAP mailbox - */ - static TQString toIMAP (const TQString & inSrc); -/** replace " with \" and \ with \\ " and \ characters */ - static TQString quoteIMAP (const TQString & src); - - /** remove \ from a string - * @bug I'm pretty sure this doesn't do what the author meant it to do - */ - static TQString decodeQuoting(const TQString &aStr); - - /** - * fetch a codec by name - * @return Text Codec object - */ - static TQTextCodec *codecForName (const TQString &); - - // decoder for RFC2047 and RFC1522 - /** decode a RFC2047 String */ - static const TQString decodeRFC2047String (const TQString & _str, - TQString & charset, - TQString & language); - /** decode a RFC2047 String */ - static const TQString decodeRFC2047String (const TQString & _str, - TQString & charset); - /** decode a RFC2047 String */ - static const TQString decodeRFC2047String (const TQString & _str); - - // encoder for RFC2047 and RFC1522 - /** encode a RFC2047 String */ - static const TQString encodeRFC2047String (const TQString & _str, - TQString & charset, - TQString & language); - /** encode a RFC2047 String */ - static const TQString encodeRFC2047String (const TQString & _str, - TQString & charset); - /** encode a RFC2047 String */ - static const TQString encodeRFC2047String (const TQString & _str); - - /** encode a RFC2231 String */ - static const TQString encodeRFC2231String (const TQString & _str); - /** decode a RFC2231 String */ - static const TQString decodeRFC2231String (const TQString & _str); -}; - -#endif diff --git a/kioslaves/imap4/selectinfo.h b/kioslaves/imap4/selectinfo.h deleted file mode 100644 index bf75a85b..00000000 --- a/kioslaves/imap4/selectinfo.h +++ /dev/null @@ -1,202 +0,0 @@ -#ifndef _IMAPINFO_H -#define _IMAPINFO_H -/********************************************************************** - * - * imapinfo.h - IMAP4rev1 SELECT / EXAMINE handler - * Copyright (C) 2000 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Send comments and bug fixes to - * - *********************************************************************/ - -#include -#include - -//class handling the info we get on EXAMINE and SELECT -class imapInfo -{ -public: - - imapInfo (); - imapInfo (const TQStringList &); - imapInfo (const imapInfo &); - imapInfo & operator = (const imapInfo &); - - ulong _flags (const TQString &) const; - - void setCount (ulong l) - { - countAvailable_ = true; - count_ = l; - } - - void setRecent (ulong l) - { - recentAvailable_ = true; - recent_ = l; - } - - void setUnseen (ulong l) - { - unseenAvailable_ = true; - unseen_ = l; - } - - void setUidValidity (ulong l) - { - uidValidityAvailable_ = true; - uidValidity_ = l; - } - - void setUidNext (ulong l) - { - uidNextAvailable_ = true; - uidNext_ = l; - } - - void setFlags (ulong l) - { - flagsAvailable_ = true; - flags_ = l; - } - - void setFlags (const TQString & inFlag) - { - flagsAvailable_ = true; - flags_ = _flags (inFlag); - } - - void setPermanentFlags (ulong l) - { - permanentFlagsAvailable_ = true; - permanentFlags_ = l; - } - - void setPermanentFlags (const TQString & inFlag) - { - permanentFlagsAvailable_ = true; - permanentFlags_ = _flags (inFlag); - } - - void setReadWrite (bool b) - { - readWriteAvailable_ = true; - readWrite_ = b; - } - - ulong count () const - { - return count_; - } - - ulong recent () const - { - return recent_; - } - - ulong unseen () const - { - return unseen_; - } - - ulong uidValidity () const - { - return uidValidity_; - } - - ulong uidNext () const - { - return uidNext_; - } - - ulong flags () const - { - return flags_; - } - - ulong permanentFlags () const - { - return permanentFlags_; - } - - bool readWrite () const - { - return readWrite_; - } - - ulong countAvailable () const - { - return countAvailable_; - } - - ulong recentAvailable () const - { - return recentAvailable_; - } - - ulong unseenAvailable () const - { - return unseenAvailable_; - } - - ulong uidValidityAvailable () const - { - return uidValidityAvailable_; - } - - ulong uidNextAvailable () const - { - return uidNextAvailable_; - } - - ulong flagsAvailable () const - { - return flagsAvailable_; - } - - ulong permanentFlagsAvailable () const - { - return permanentFlagsAvailable_; - } - - bool readWriteAvailable () const - { - return readWriteAvailable_; - } - -private: - - ulong count_; - ulong recent_; - ulong unseen_; - ulong uidValidity_; - ulong uidNext_; - ulong flags_; - ulong permanentFlags_; - bool readWrite_; - - bool countAvailable_; - bool recentAvailable_; - bool unseenAvailable_; - bool uidValidityAvailable_; - bool uidNextAvailable_; - bool flagsAvailable_; - bool permanentFlagsAvailable_; - bool readWriteAvailable_; -}; - -#endif diff --git a/kioslaves/mbox/AUTHORS b/kioslaves/mbox/AUTHORS deleted file mode 100644 index 333010f6..00000000 --- a/kioslaves/mbox/AUTHORS +++ /dev/null @@ -1 +0,0 @@ -Mart Kelder diff --git a/kioslaves/mbox/CMakeLists.txt b/kioslaves/mbox/CMakeLists.txt deleted file mode 100644 index b823d8b9..00000000 --- a/kioslaves/mbox/CMakeLists.txt +++ /dev/null @@ -1,36 +0,0 @@ -################################################# -# -# (C) 2010-2011 Serghei Amelian -# serghei (DOT) amelian (AT) gmail.com -# -# Improvements and feedback are welcome -# -# This file is released under GPL >= 2 -# -################################################# - -include_directories( - ${CMAKE_BINARY_DIR} - ${CMAKE_SOURCE_DIR}/libtdepim - ${TDE_INCLUDE_DIR} - ${TQT_INCLUDE_DIRS} -) - -link_directories( - ${TQT_LIBRARY_DIRS} -) - - -##### other data ################################ - -install( FILES mbox.protocol DESTINATION ${SERVICES_INSTALL_DIR} ) - - -##### kio_mbox (module) ######################### - -tde_add_kpart( kio_mbox - SOURCES - mbox.cc mboxfile.cc readmbox.cc stat.cc urlinfo.cc - LINK kio-shared - DESTINATION ${PLUGIN_INSTALL_DIR} -) diff --git a/kioslaves/mbox/Makefile.am b/kioslaves/mbox/Makefile.am deleted file mode 100644 index 0fc50524..00000000 --- a/kioslaves/mbox/Makefile.am +++ /dev/null @@ -1,30 +0,0 @@ -INCLUDES= $(all_includes) - -####### Files - -METASOURCES = AUTO - -kde_module_LTLIBRARIES = kio_mbox.la - -kio_mbox_la_SOURCES = \ - mbox.cc \ - mboxfile.cc \ - readmbox.cc \ - stat.cc \ - urlinfo.cc -kio_mbox_la_LIBADD = $(LIB_KIO) $(LIB_QT) $(LIB_TDECORE) -kio_mbox_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) -module $(KDE_PLUGIN) - -noinst_HEADERS = \ - mbox.h \ - mboxfile.h \ - readmbox.h \ - stat.h \ - urlinfo.h - -kdelnk_DATA = mbox.protocol -kdelnkdir = $(kde_servicesdir) - - -include $(top_srcdir)/admin/Doxyfile.am - diff --git a/kioslaves/mbox/README b/kioslaves/mbox/README deleted file mode 100644 index f0441661..00000000 --- a/kioslaves/mbox/README +++ /dev/null @@ -1,7 +0,0 @@ -This is a simple kioslave for accessing mbox-files with kio. - -At the moment, it doesn't support locking or writing, it is just reading and listing messages. - -Usage: - mbox:/path/to/mbox/file For listing the files in a mbox-file - mbox:/path/to/mbox/file/id For getting an id out of a mbox-file. diff --git a/kioslaves/mbox/mbox.cc b/kioslaves/mbox/mbox.cc deleted file mode 100644 index 0c4fca81..00000000 --- a/kioslaves/mbox/mbox.cc +++ /dev/null @@ -1,168 +0,0 @@ -/* - * This is a simple kioslave to handle mbox-files. - * Copyright (C) 2004 Mart Kelder (mart.kde@hccnet.nl) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -#include "mbox.h" - -#include "readmbox.h" -#include "stat.h" -#include "urlinfo.h" - -#include -#include - -#include -#include -#include -#include -#include -#include - -#include - -#include "tdepimmacros.h" - -#include "mbox.h" - -extern "C" { KDE_EXPORT int kdemain(int argc, char* argv[]); } - -int kdemain( int argc, char * argv[] ) -{ - KLocale::setMainCatalogue("tdelibs"); - TDEInstance instance("kio_mbox"); - (void) TDEGlobal::locale(); - - if (argc != 4) { - fprintf(stderr, "Usage: kio_mbox protocol " - "domain-socket1 domain-socket2\n"); - exit(-1); - } - - MBoxProtocol slave(argv[2], argv[3]); - slave.dispatchLoop(); - - return 0; -} - -MBoxProtocol::MBoxProtocol( const TQCString& arg1, const TQCString& arg2 ) - : TDEIO::SlaveBase( "mbox2", arg1, arg2 ), - m_errorState( true ) -{ - -} - -MBoxProtocol::~MBoxProtocol() -{ -} - -void MBoxProtocol::get( const KURL& url ) -{ - m_errorState = false; - - UrlInfo info( url, UrlInfo::message ); - TQString line; - TQByteArray ba_line; - - if( info.type() == UrlInfo::invalid && !m_errorState ) - { - error( TDEIO::ERR_DOES_NOT_EXIST, info.url() ); - return; - } - - ReadMBox mbox( &info, this ); - - while( !mbox.atEnd() && !m_errorState) - { - line = mbox.currentLine(); - line += '\n'; - ba_line = TQCString( line.utf8() ); - ba_line.truncate( ba_line.size() - 1 ); //Removing training '\0' - data( ba_line ); - mbox.nextLine(); - }; - - if( !m_errorState ) - { - data( TQByteArray() ); - finished(); - } -} - -void MBoxProtocol::listDir( const KURL& url ) -{ - m_errorState = false; - - TDEIO::UDSEntry entry; - UrlInfo info( url, UrlInfo::directory ); - ReadMBox mbox( &info, this, hasMetaData( "onlynew" ), hasMetaData( "savetime" ) ); - - if( m_errorState ) - return; - - if( info.type() != UrlInfo::directory ) - { - error( TDEIO::ERR_DOES_NOT_EXIST, info.url() ); - return; - } - - while( !mbox.atEnd() && !m_errorState ) - { - entry = Stat::stat( mbox, info ); - if( mbox.inListing() ) - listEntry( entry, false ); - } - - listEntry( TDEIO::UDSEntry(), true ); - finished(); -} - -void MBoxProtocol::stat( const KURL& url ) -{ - UrlInfo info( url ); - if( info.type() == UrlInfo::invalid ) - { - error( TDEIO::ERR_DOES_NOT_EXIST, url.path() ); - return; - } else - { - statEntry( Stat::stat( info ) ); - } - finished(); -} - -void MBoxProtocol::mimetype( const KURL& url ) -{ - m_errorState = false; - - UrlInfo info( url ); - - if( m_errorState ) - return; - - if( info.type() == UrlInfo::invalid ) - error( TDEIO::ERR_DOES_NOT_EXIST, i18n( "Invalid URL" ) ); - else - mimeType( info.mimetype() ); - finished(); -} - -void MBoxProtocol::emitError( int errno, const TQString& arg ) -{ - m_errorState = true; - error( errno, arg ); -} - diff --git a/kioslaves/mbox/mbox.h b/kioslaves/mbox/mbox.h deleted file mode 100644 index 159c4213..00000000 --- a/kioslaves/mbox/mbox.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This is a simple kioslave to handle mbox-files. - * Copyright (C) 2004 Mart Kelder (mart.kde@hccnet.nl) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -#ifndef MBOX_H -#define MBOX_H - -#include - -class TQCString; -class KURL; - -/** - * This class is the main class and implements all function - * which can be called through the user. - */ -class MBoxProtocol : public TDEIO::SlaveBase -{ -public: - /** - * Constructor, for the parameters, See TDEIO::SlaveBase - */ - MBoxProtocol( const TQCString&, const TQCString& ); - /** - * Empty destructor - */ - virtual ~MBoxProtocol(); - - /** - * This functions is used when an user or a program wants to - * get a file from a mbox-file - * @param url The url which points to the virtual file to get - */ - virtual void get( const KURL& url ); - - /** - * This functions gives a listing back. - * @param url The url to the mbox-file. - */ - virtual void listDir( const KURL& url ); - - /** - * This functions gives general properties about a mbox-file, - * or mbox-email back. - */ - virtual void stat( const KURL& url ); - - /** - * This functions determinate the mimetype of a given mbox-file or mbox-email. - * @param url The url to get the mimetype from - */ - virtual void mimetype( const KURL& url ); - - /** - * Through this functions, other class which have an instance to this - * class (classes which are part of kio_mbox) can emit an error with - * this function - * @param errno The error number to be thrown - * @param arg The argument of the error message of the error number. - */ - void emitError( int errno, const TQString& arg ); -private: - bool m_errorState; -}; - -#endif - diff --git a/kioslaves/mbox/mbox.protocol b/kioslaves/mbox/mbox.protocol deleted file mode 100644 index 8b6b412a..00000000 --- a/kioslaves/mbox/mbox.protocol +++ /dev/null @@ -1,14 +0,0 @@ -[Protocol] -exec=kio_mbox -protocol=mbox -input=none -output=filesystem -listing=Name,Type,Size -reading=true -writing=false -makedir=false -deleting=false -Icon=folder_inbox -maxInstances=2 -DocPath= -Class=:local diff --git a/kioslaves/mbox/mboxfile.cc b/kioslaves/mbox/mboxfile.cc deleted file mode 100644 index 271b7101..00000000 --- a/kioslaves/mbox/mboxfile.cc +++ /dev/null @@ -1,45 +0,0 @@ -/* - * This is a simple kioslave to handle mbox-files. - * Copyright (C) 2004 Mart Kelder (mart.kde@hccnet.nl) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -#include "mboxfile.h" - -#include - -MBoxFile::MBoxFile( const UrlInfo* info, MBoxProtocol* parent ) - : m_info( info ), - m_mbox( parent ) -{ - assert( m_info ); -} - -MBoxFile::~MBoxFile() -{ -} - -bool MBoxFile::lock() -{ - //Not implemented - return true; -} - -void MBoxFile::unlock() -{ - //Not implemented -} - - diff --git a/kioslaves/mbox/mboxfile.h b/kioslaves/mbox/mboxfile.h deleted file mode 100644 index b8a98973..00000000 --- a/kioslaves/mbox/mboxfile.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * This is a simple kioslave to handle mbox-files. - * Copyright (C) 2004 Mart Kelder (mart.kde@hccnet.nl) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -#ifndef MBOXFILE_H -#define MBOXFILE_H -class MBoxProtocol; -class UrlInfo; - -/** - * This class can be used to lock files when implemented. - * It is a base class for all classes that needs locking and/ir - * an UrlInfo*. - */ -class MBoxFile -{ -public: - /** - * Constructor - * @param info The urlinfo which must be used - * @param parent The MBoxProtocol parent instance, used to throw errors. - */ - MBoxFile( const UrlInfo* info, MBoxProtocol* parent ); - - /** - * Empty destructor - */ - ~MBoxFile(); - -protected: - /** - * When implemented, this function handles the locking of the file. - * @return true if the locking was done succesfully. - */ - bool lock(); - - /** - * When implemented, this function unlocks the file. - */ - void unlock(); - -protected: - /** - * This can be used to get information about the file. - * The file specified here is the file that must be used. - */ - const UrlInfo* const m_info; - - /** - * A instance of the parent protocol, meant to throw errors if neccesairy. - */ - MBoxProtocol* const m_mbox; -}; -#endif diff --git a/kioslaves/mbox/readmbox.cc b/kioslaves/mbox/readmbox.cc deleted file mode 100644 index 3125fd74..00000000 --- a/kioslaves/mbox/readmbox.cc +++ /dev/null @@ -1,204 +0,0 @@ -/* - * This is a simple kioslave to handle mbox-files. - * Copyright (C) 2004 Mart Kelder (mart.kde@hccnet.nl) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -#include - -#include "readmbox.h" - -#include "mbox.h" -#include "urlinfo.h" - -#include -#include - -#include -#include -#include -#include - -#ifdef HAVE_SYS_TYPES_H -#include -#endif - -#include - -ReadMBox::ReadMBox( const UrlInfo* info, MBoxProtocol* parent, bool onlynew, bool savetime ) - : MBoxFile( info, parent ), - m_file( 0 ), - m_stream( 0 ), - m_current_line( new TQString( TQString() ) ), - m_current_id( new TQString( TQString() ) ), - m_atend( true ), - m_prev_time( 0 ), - m_only_new( onlynew ), - m_savetime( savetime ), - m_status( false ), - m_prev_status( false ), - m_header( true ) - -{ - if( m_info->type() == UrlInfo::invalid ) - m_mbox->emitError( TDEIO::ERR_DOES_NOT_EXIST, info->url() ); - - if( !open( savetime ) ) - m_mbox->emitError( TDEIO::ERR_CANNOT_OPEN_FOR_READING, info->url() ); - - if( m_info->type() == UrlInfo::message ) - if( !searchMessage( m_info->id() ) ) - m_mbox->emitError( TDEIO::ERR_DOES_NOT_EXIST, info->url() ); -} - -ReadMBox::~ReadMBox() -{ - delete m_current_line; - close(); -} - -TQString ReadMBox::currentLine() const -{ - return *m_current_line; -} - -TQString ReadMBox::currentID() const -{ - return *m_current_id; -} - -bool ReadMBox::nextLine() -{ - if( !m_stream ) - return true; - - *m_current_line = m_stream->readLine(); - m_atend = m_current_line->isNull(); - if( m_atend ) // Cursor was at EOF - { - *m_current_id = TQString(); - m_prev_status = m_status; - return true; - } - - //New message - if( m_current_line->left( 5 ) == "From " ) - { - *m_current_id = *m_current_line; - m_prev_status = m_status; - m_status = true; - m_header = true; - return true; - } else if( m_only_new ) - { - if( m_header && m_current_line->left( 7 ) == "Status:" && - ! m_current_line->contains( "U" ) && ! m_current_line->contains( "N" ) ) - { - m_status = false; - } - } - - if( m_current_line->stripWhiteSpace().isEmpty() ) - m_header = false; - - return false; -} - -bool ReadMBox::searchMessage( const TQString& id ) -{ - if( !m_stream ) - return false; - - while( !m_atend && *m_current_id != id ) - nextLine(); - - return *m_current_id == id; -} - -unsigned int ReadMBox::skipMessage() -{ - unsigned int result = m_current_line->length(); - - if( !m_stream ) - return 0; - - while( !nextLine() ) - result += m_current_line->length(); - - return result; -} - -void ReadMBox::rewind() -{ - if( !m_stream ) - return; //Rewinding not possible - - m_stream->device()->reset(); - m_atend = m_stream->atEnd(); -} - -bool ReadMBox::atEnd() const -{ - if( !m_stream ) - return true; - - return m_atend || ( m_info->type() == UrlInfo::message && *m_current_id != m_info->id() ); -} - -bool ReadMBox::inListing() const -{ - return !m_only_new || m_prev_status; -} - -bool ReadMBox::open( bool savetime ) -{ - if( savetime ) - { - TQFileInfo info( m_info->filename() ); - - m_prev_time = new utimbuf; - m_prev_time->actime = info.lastRead().toTime_t(); - m_prev_time->modtime = info.lastModified().toTime_t(); - } - - if( m_file ) - return false; //File already open - - m_file = new TQFile( m_info->filename() ); - if( !m_file->open( IO_ReadOnly ) ) - { - delete m_file; - m_file = 0; - return false; - } - m_stream = new TQTextStream( m_file ); - skipMessage(); - - return true; -} - -void ReadMBox::close() -{ - if( !m_stream ) - return; - - delete m_stream; m_stream = 0; - m_file->close(); - delete m_file; m_file = 0; - - if( m_prev_time ) - utime( TQFile::encodeName( m_info->filename() ), m_prev_time ); -} - diff --git a/kioslaves/mbox/readmbox.h b/kioslaves/mbox/readmbox.h deleted file mode 100644 index 046767be..00000000 --- a/kioslaves/mbox/readmbox.h +++ /dev/null @@ -1,132 +0,0 @@ -/* - * This is a simple kioslave to handle mbox-files. - * Copyright (C) 2004 Mart Kelder (mart.kde@hccnet.nl) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -#ifndef READMBOX_H -#define READMBOX_H - -#include "mboxfile.h" - -class UrlInfo; -class MBox; - -class TQFile; -class TQString; -class TQTextStream; - -struct utimbuf; - -/** - * This class handels reading from a mbox-file. - */ -class ReadMBox : public MBoxFile -{ -public: - /** - * Constructor - * - * @param info The information of the file to read - * @param parent The instance of the parent MBoxProtocol. - * @param onlynew Only read new messages from the MBox file. - * @param savetime If true, the atime of the mbox-file is preserved (note that this touch the ctime). - */ - ReadMBox( const UrlInfo* info, MBoxProtocol* parent, bool onlynew = false, bool savetime = false ); - - /** - * Destructor - */ - ~ReadMBox(); - - /** - * This functions return the current line - * @return The line last read, or TQString() if there wasn't such last line - */ - TQString currentLine() const; - - /** - * This function returns the current id. The id is the first line of an email, - * and is used in filenaming. The id normally starts with "From ". - * @return The current ID, or TQString() if no id was found yet. - */ - TQString currentID() const; - - /** - * This function reads the next line. The next line can be read by the currentLine() - * function call. - * - * @return true if succesfull, otherwise false. - */ - bool nextLine(); - - /** - * This function search the file for a certain id. - * If not found, the position is EOF. - * @param id The id of the message to be found. - * @return true if the message was found, false otherwise. - */ - bool searchMessage( const TQString& id ); - - /** - * Skips all lines which belongs to the current message. The cursor is on the first line - * of a new message message at the end of this function, or at EOF if the cursor was already - * on the last message. - * @return The number of bytes read while skipping the message. - */ - unsigned int skipMessage(); - - /** - * Sets the cursor back to the beginning of the file - */ - void rewind(); - - /** - * Returns true if the cursor is at EOF. - * @return true if and only if the cursor is at EOF. - */ - bool atEnd() const; - - /** - * Return true if the message is a new message, or all messages are listed - * @return true if it must be listed - */ - bool inListing() const; -private: - /** - * Opens a file - * @return true Returns true if opening was succesful. - */ - bool open( bool savetime ); - - /** - * Closes a file. - */ - void close(); - -private: - TQFile* m_file; - TQTextStream* m_stream; - TQString* m_current_line; - TQString* m_current_id; - bool m_atend; - - struct utimbuf* m_prev_time; - - bool m_only_new, m_savetime; - - bool m_status, m_prev_status, m_header; -}; -#endif diff --git a/kioslaves/mbox/stat.cc b/kioslaves/mbox/stat.cc deleted file mode 100644 index c5d9a3bd..00000000 --- a/kioslaves/mbox/stat.cc +++ /dev/null @@ -1,115 +0,0 @@ -/* - * This is a simple kioslave to handle mbox-files. - * Copyright (C) 2004 Mart Kelder (mart.kde@hccnet.nl) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -#include "stat.h" - -#include "readmbox.h" -#include "urlinfo.h" - -#include -#include - -#include - -TDEIO::UDSEntry Stat::stat( const UrlInfo& info ) -{ - if( info.type() == UrlInfo::message ) - return Stat::statMessage( info ); - else if( info.type() == UrlInfo::directory ) - return Stat::statDirectory( info ); - else - return TDEIO::UDSEntry(); -} - -TDEIO::UDSEntry Stat::stat( ReadMBox& mbox, const UrlInfo& info ) -{ - kdDebug() << "Stat::stat()" << endl; - TDEIO::UDSEntry entry; - TQString url; - - if( info.type() == UrlInfo::invalid ) - return entry; - else if( info.type() == UrlInfo::message ) - mbox.searchMessage( info.id() ); - - Stat::addAtom( entry, TDEIO::UDS_FILE_TYPE, S_IFREG ); - Stat::addAtom( entry, TDEIO::UDS_MIME_TYPE, "message/rfc822" ); - - url = TQString( "mbox:%1/%2" ).arg( info.filename(), mbox.currentID() ); - Stat::addAtom( entry, TDEIO::UDS_URL, url ); - if( mbox.currentID().isEmpty() ) - Stat::addAtom( entry, TDEIO::UDS_NAME, "foobar" ); - else - Stat::addAtom( entry, TDEIO::UDS_NAME, mbox.currentID() ); - - - Stat::addAtom( entry, TDEIO::UDS_SIZE, mbox.skipMessage() ); - - return entry; -} - -TDEIO::UDSEntry Stat::statDirectory( const UrlInfo& info ) -{ - kdDebug() << "statDirectory()" << endl; - TDEIO::UDSEntry entry; - - //Specific things for a directory - Stat::addAtom( entry, TDEIO::UDS_FILE_TYPE, S_IFDIR ); - Stat::addAtom( entry, TDEIO::UDS_NAME, info.filename() ); - - return entry; -} - -TDEIO::UDSEntry Stat::statMessage( const UrlInfo& info ) -{ - kdDebug() << "statMessage( " << info.url() << " )" << endl; - TDEIO::UDSEntry entry; - TQString url = TQString( "mbox:%1" ).arg( info.url() ); - - //Specific things for a message - Stat::addAtom( entry, TDEIO::UDS_FILE_TYPE, S_IFREG ); - Stat::addAtom( entry, TDEIO::UDS_MIME_TYPE, "message/rfc822" ); - - Stat::addAtom( entry, TDEIO::UDS_URL, url ); - url = url.right( url.length() - url.findRev( "/" ) - 1 ); - Stat::addAtom( entry, TDEIO::UDS_NAME, url ); - - return entry; -} - -void Stat::addAtom( TDEIO::UDSEntry& entry, unsigned int uds, const TQString& str ) -{ - TDEIO::UDSAtom atom; - atom.m_uds = uds; - atom.m_str = str; - atom.m_long = 0; - - entry.append( atom ); -} - - -void Stat::addAtom( TDEIO::UDSEntry& entry, unsigned int uds, long lng ) -{ - TDEIO::UDSAtom atom; - atom.m_uds = uds; - atom.m_str = TQString(); - atom.m_long = lng; - - entry.append( atom ); -} - diff --git a/kioslaves/mbox/stat.h b/kioslaves/mbox/stat.h deleted file mode 100644 index 8ce593cc..00000000 --- a/kioslaves/mbox/stat.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This is a simple kioslave to handle mbox-files. - * Copyright (C) 2004 Mart Kelder (mart.kde@hccnet.nl) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -#ifndef STAT_H -#define STAT_H - -#include - -class ReadMBox; -class UrlInfo; - -class KURL; - -class TQString; - -/** - * This class is used to get the stats of a mbox-email or mbox-file. - * This class only uses static members. - */ -class Stat -{ -public: - /** - * Empty constructor - */ - Stat() {} - - /** - * Emtpy destructor - */ - ~Stat() {} - - /** - * This functions gives information with a given UrlInfo. - * @param info The file information - * @return The information of the file as destribed in UrlInfo. - */ - static TDEIO::UDSEntry stat( const UrlInfo& info ); - /** - * This function gives information with a given ReadMBox and UrlInfo. - * Through this, it is possible to ask the stats of the next message, - * without reopening the mbox-file. - * @param mbox The ReadMBox instance, used to search the mbox-email in. - * @param info The url information. - * @return The requesteds information. - */ - static TDEIO::UDSEntry stat( ReadMBox& mbox, const UrlInfo& info ); - - /** - * This function gets the stats of a given mbox-file in an UDSEntry. - * @param info The location of the mbox-file. - * @return A list of Atoms. - */ - static TDEIO::UDSEntry statDirectory( const UrlInfo& info ); - - /** - * This function gets the stats of a geven mbox-message in a UDSEntry. - * @param info The url of the mbox-message. - * @return Information shipped in an UDSEntry. - */ - static TDEIO::UDSEntry statMessage( const UrlInfo& info ); -private: - static void addAtom( TDEIO::UDSEntry& entry, unsigned int key, const TQString& value ); - static void addAtom( TDEIO::UDSEntry& entry, unsigned int key, const long value ); -}; - -#endif diff --git a/kioslaves/mbox/urlinfo.cc b/kioslaves/mbox/urlinfo.cc deleted file mode 100644 index d59c77ac..00000000 --- a/kioslaves/mbox/urlinfo.cc +++ /dev/null @@ -1,133 +0,0 @@ -/* - * This is a simple kioslave to handle mbox-files. - * Copyright (C) 2004 Mart Kelder (mart.kde@hccnet.nl) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -#include "urlinfo.h" - -#include -#include - -#include -#include - -UrlInfo::UrlInfo( const KURL& url, const UrlType type ) - : m_type( invalid ), - m_filename( new TQString ), - m_id( new TQString ) -{ - calculateInfo( url, type ); -} - -UrlInfo::~UrlInfo() -{ - delete m_filename; - delete m_id; -} - -TQString UrlInfo::mimetype() const -{ - switch( m_type ) - { - case message: - return "message/rfc822"; - case directory: - return "inode/directory"; - case invalid: - default: - return "invalid"; - } -} - -TQString UrlInfo::filename() const -{ - return *m_filename; -} - -TQString UrlInfo::id() const -{ - return *m_id; -} - -TQString UrlInfo::url() const -{ - return *m_filename + "/" + *m_id; -} - - -void UrlInfo::calculateInfo( const KURL& url, const UrlType type ) -{ - bool found = false; - - if( !found && type & UrlInfo::message ) - found = isMessage( url ); - if( !found && type & UrlInfo::directory ) - found = isDirectory( url ); - if( !found ) - { - m_type = invalid; - *m_filename = ""; - *m_id = ""; - } -} - -bool UrlInfo::isDirectory( const KURL& url ) -{ - //Check is url is in the form mbox://{filename} - TQString filename = url.path(); - TQFileInfo info; - - //Remove ending / - while( filename.length() > 1 && filename.right( 1 ) == "/" ) - filename.remove( filename.length()-2, 1 ); - - //Is this a directory? - info.setFile( filename ); - if( !info.isFile() ) - return false; - - //Setting paramaters - *m_filename = filename; - *m_id = TQString(); - m_type = directory; - kdDebug() << "urlInfo::isDirectory( " << url << " )" << endl; - return true; -} - -bool UrlInfo::isMessage( const KURL& url ) -{ - TQString path = url.path(); - TQFileInfo info; - int cutindex = path.findRev( '/' ); - - //Does it contain at least one /? - if( cutindex < 0 ) - return false; - - //Does the mbox-file exists? - info.setFile( path.left( cutindex ) ); - if( !info.isFile() ) - return false; - - //Settings parameters - kdDebug() << "urlInfo::isMessage( " << url << " )" << endl; - m_type = message; - *m_id = path.right( path.length() - cutindex - 1 ); - *m_filename = path.left( cutindex ); - - return true; -} - diff --git a/kioslaves/mbox/urlinfo.h b/kioslaves/mbox/urlinfo.h deleted file mode 100644 index 96882d1d..00000000 --- a/kioslaves/mbox/urlinfo.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This is a simple kioslave to handle mbox-files. - * Copyright (C) 2004 Mart Kelder (mart.kde@hccnet.nl) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -#ifndef URLINFO_H -#define URLINFO_H -class KURL; - -class TQString; - -class UrlInfo -{ -public: - /** - * This enum is used to determe the url type. - */ - enum UrlType { invalid = 0, message = 1, directory = 2 }; - - /** - * Constructor - * - * @param url The url: this url is used to split the location data off. - * @param type The possible types of the url - */ - UrlInfo( const KURL &url, const UrlType type = (UrlType)( message | directory ) ); - - /** - * Destructor - */ - ~UrlInfo(); - - /** - * Returns the type of the url - * @return the type of the url - */ - UrlType type() const { return m_type; } - - /** - * @return the mimetype of the url - */ - TQString mimetype() const; - - /** - * @return The location of the mbox-file - */ - TQString filename() const; - /** - * @return The id given in the url. - */ - TQString id() const; - - /** - * @return the while url as TQString - */ - TQString url() const; -private: - void calculateInfo( const KURL& url, const UrlType type ); - - bool isDirectory( const KURL& url ); - bool isMessage( const KURL& url ); - -private: - UrlType m_type; - TQString *m_filename; - TQString *m_id; -}; - -#endif diff --git a/kioslaves/opengroupware/Makefile.am b/kioslaves/opengroupware/Makefile.am deleted file mode 100644 index 007d74c3..00000000 --- a/kioslaves/opengroupware/Makefile.am +++ /dev/null @@ -1,17 +0,0 @@ -INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tderesources/opengroupware/soap \ - $(all_includes) - -noinst_HEADERS = opengroupware.h - -METASOURCES = AUTO - -kdelnkdir = $(kde_servicesdir) -kdelnk_DATA = opengroupware.protocol opengroupwares.protocol - -kde_module_LTLIBRARIES = kio_opengroupware.la - -kio_opengroupware_la_SOURCES = opengroupware.cpp webdavhandler.cpp -kio_opengroupware_la_LIBADD = $(top_builddir)/libkcal/libkcal.la \ - $(top_builddir)/libtdepim/libtdepim.la $(LIB_KIO) -kio_opengroupware_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) - diff --git a/kioslaves/opengroupware/opengroupware.cpp b/kioslaves/opengroupware/opengroupware.cpp deleted file mode 100644 index b4c19b71..00000000 --- a/kioslaves/opengroupware/opengroupware.cpp +++ /dev/null @@ -1,250 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2004 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -#include "opengroupware.h" -#include "webdavhandler.h" - -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include - -#include - -#include -#include -#include -#include - -#include -#include -#include - -#include - -namespace KABC { - -class ResourceMemory : public ResourceCached -{ - public: - ResourceMemory() : ResourceCached( 0 ) {} - - Ticket *requestSaveTicket() { return 0; } - bool load() { return true; } - bool save( Ticket * ) { return true; } - void releaseSaveTicket( Ticket * ) {} -}; - -} - - -extern "C" { -KDE_EXPORT int kdemain( int argc, char **argv ); -} - -int kdemain( int argc, char **argv ) -{ - TDEInstance instance( "kio_OpenGroupware" ); - - kdDebug(7000) << "Starting kio_OpenGroupware(pid: " << getpid() << ")" << endl; - - if (argc != 4) { - fprintf( stderr, "Usage: kio_OpenGroupware protocol domain-socket1 domain-socket2\n"); - exit( -1 ); - } - - OpenGroupware slave( argv[1], argv[2], argv[3] ); - slave.dispatchLoop(); - - return 0; -} - -OpenGroupware::OpenGroupware( const TQCString &protocol, const TQCString &pool, - const TQCString &app ) - : SlaveBase( protocol, pool, app ) -{ -} - -void OpenGroupware::get( const KURL &url ) -{ - kdDebug(7000) << "OpenGroupware::get()" << endl; - kdDebug(7000) << " URL: " << url.url() << endl; - #if 1 - kdDebug(7000) << " Path: " << url.path() << endl; - kdDebug(7000) << " Query: " << url.query() << endl; - kdDebug(7000) << " Protocol: " << url.protocol() << endl; - kdDebug(7000) << " Filename: " << url.filename() << endl; - #endif - - mimeType( "text/plain" ); - - TQString path = url.path(); - debugMessage( "Path: " + path ); - - if ( path.startsWith( "/freebusy/" ) ) { - getFreeBusy( url ); - } else if ( path.startsWith( "/calendar/" ) ) { - getCalendar( url ); - } else if ( path.startsWith( "/addressbook/" ) ) { - getAddressbook( url ); - } else { - TQString error = i18n("Unknown path. Known paths are '/freebusy/', " - "'/calendar/' and '/addressbook/'."); - errorMessage( error ); - } - - kdDebug(7000) << "OpenGroupwareCgiProtocol::get() done" << endl; -} - -void OpenGroupware::getFreeBusy( const KURL &url ) -{ - TQString file = url.filename(); - if ( file.right( 4 ) != ".ifb" ) { - TQString error = i18n("Illegal filename. File has to have '.ifb' suffix."); - errorMessage( error ); - } else { - TQString email = file.left( file.length() - 4 ); - debugMessage( "Email: " + email ); - - TQString user = url.user(); - TQString pass = url.pass(); - - debugMessage( "URL: " ); - debugMessage( "User: " + user ); - debugMessage( "Password: " + pass ); - - KCal::FreeBusy *fb = new KCal::FreeBusy; - - if ( user.isEmpty() || pass.isEmpty() ) { - errorMessage( i18n("Need username and password.") ); - } else { - // FIXME get from server - - // FIXME: Read range from configuration or URL parameters. - TQDate start = TQDate::currentDate().addDays( -3 ); - TQDate end = TQDate::currentDate().addDays( 60 ); - - fb->setDtStart( start ); - fb->setDtEnd( end ); - - kdDebug() << "Login" << endl; - - } - -#if 0 - TQDateTime s = TQDateTime( TQDate( 2004, 9, 27 ), TQTime( 10, 0 ) ); - TQDateTime e = TQDateTime( TQDate( 2004, 9, 27 ), TQTime( 11, 0 ) ); - - fb->addPeriod( s, e ); -#endif - - KCal::ICalFormat format; - - TQString ical = format.createScheduleMessage( fb, KCal::Scheduler::Publish ); - - data( ical.utf8() ); - - finished(); - } -} - - -void OpenGroupware::getCalendar( const KURL &_url ) -{ - - KURL url( _url ); // we'll be changing it - TQString user = url.user(); - TQString pass = url.pass(); - - TQDomDocument props = WebdavHandler::createAllPropsRequest(); - - debugMessage( "URL: " ); - debugMessage( "User: " + user ); - debugMessage( "Password: " + pass ); - - url.setProtocol( "webdav" ); - url.setPath ( "/zidestore/dav/till/" ); - - kdDebug(7000) << "getCalendar: " << url.prettyURL() << endl; - - // FIXME do progress handling - mListEventsJob = TDEIO::davPropFind( url, props, "0", false ); - connect( mListEventsJob, TQT_SIGNAL( result( TDEIO::Job * ) ), - TQT_SLOT( slotGetCalendarListingResult( TDEIO::Job * ) ) ); -} - -void OpenGroupware::getAddressbook( const KURL &url ) -{ - -} - -void OpenGroupware::errorMessage( const TQString &msg ) -{ - error( TDEIO::ERR_SLAVE_DEFINED, msg ); -} - -void OpenGroupware::debugMessage( const TQString &msg ) -{ -#if 0 - data( ( msg + "\n" ).utf8() ); -#else - Q_UNUSED( msg ); -#endif -} - - -void OpenGroupware::slotGetCalendarListingResult( TDEIO::Job *job ) -{ - - kdDebug(7000) << k_funcinfo << endl; - - if ( job->error() ) { - job->showErrorDialog( 0 ); - } else { - kdDebug() << "ResourceSlox::slotResult() success" << endl; - - TQDomDocument doc = mListEventsJob->response(); - - } - KCal::ICalFormat format; - KCal::CalendarLocal calendar; - - TQString ical = format.toString( &calendar ); - - data( ical.utf8() ); - - finished(); -} - - -void OpenGroupware::slotGetCalendarResult( TDEIO::Job *job ) -{ - Q_UNUSED( job ); -} -#include "opengroupware.moc" - diff --git a/kioslaves/opengroupware/opengroupware.h b/kioslaves/opengroupware/opengroupware.h deleted file mode 100644 index da104c8c..00000000 --- a/kioslaves/opengroupware/opengroupware.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2004 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ -#ifndef GROUPWISE_H -#define GROUPWISE_H - -#include - -#include - -namespace TDEIO { - class Job; - class DavJob; -} - - -class OpenGroupware : public TQObject, public TDEIO::SlaveBase -{ - Q_OBJECT - - public: - OpenGroupware( const TQCString &protocol, const TQCString &pool, - const TQCString &app ); - - void get( const KURL &url ); - - protected: - void debugMessage( const TQString & ); - void errorMessage( const TQString & ); - - void getFreeBusy( const KURL &url ); - void getCalendar( const KURL &url ); - void getAddressbook( const KURL &url ); - protected slots: - void slotGetCalendarListingResult( TDEIO::Job* ); - void slotGetCalendarResult( TDEIO::Job* ); - private: - TDEIO::DavJob *mListEventsJob; -}; - -#endif diff --git a/kioslaves/opengroupware/opengroupware.protocol b/kioslaves/opengroupware/opengroupware.protocol deleted file mode 100644 index 89c0b9ea..00000000 --- a/kioslaves/opengroupware/opengroupware.protocol +++ /dev/null @@ -1,7 +0,0 @@ -[Protocol] -DocPath=kioslave/opengroupware.html -exec=kio_opengroupware -input=none -output=filesystem -protocol=opengroupware -reading=true diff --git a/kioslaves/opengroupware/opengroupwares.protocol b/kioslaves/opengroupware/opengroupwares.protocol deleted file mode 100644 index 595057b2..00000000 --- a/kioslaves/opengroupware/opengroupwares.protocol +++ /dev/null @@ -1,7 +0,0 @@ -[Protocol] -DocPath=kioslave/opengroupware.html -exec=kio_opengroupware -input=none -output=filesystem -protocol=opengroupwares -reading=true diff --git a/kioslaves/opengroupware/webdavhandler.cpp b/kioslaves/opengroupware/webdavhandler.cpp deleted file mode 100644 index 2f98d915..00000000 --- a/kioslaves/opengroupware/webdavhandler.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - This file is part of tdepim. - - Copyright (c) 2004 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -#include - -#include "webdavhandler.h" - -#include - -#include - -#include -#include - -#include - - -WebdavHandler::WebdavHandler() -{ -} - - -TQDomElement WebdavHandler::addElement( TQDomDocument &doc, TQDomNode &node, - const TQString &tag ) -{ - TQDomElement el = doc.createElement( tag ); - node.appendChild( el ); - return el; -} - -TQDomElement WebdavHandler::addDavElement( TQDomDocument &doc, TQDomNode &node, - const TQString &tag ) -{ - TQDomElement el = doc.createElementNS( "DAV", tag ); - node.appendChild( el ); - return el; -} - -TQDomElement WebdavHandler::addSloxElement( TQDomDocument &doc, TQDomNode &node, - const TQString &tag, - const TQString &text ) -{ - TQDomElement el = doc.createElementNS( "SLOX", tag ); - if ( !text.isEmpty() ) { - TQDomText textnode = doc.createTextNode( text ); - el.appendChild( textnode ); - } - node.appendChild( el ); - return el; -} - -TQDomDocument WebdavHandler::createAllPropsRequest() -{ - TQDomDocument doc; - - TQDomElement root = WebdavHandler::addDavElement( doc, doc, "propfind" ); - TQDomElement prop = WebdavHandler::addDavElement( doc, root, "prop" ); - WebdavHandler::addDavElement( doc, prop, "getcontentlength"); - WebdavHandler::addDavElement( doc, prop, "getlastmodified" ); - WebdavHandler::addDavElement( doc, prop, "displayname" ); - WebdavHandler::addDavElement( doc, prop, "resourcetype" ); - prop.appendChild( doc.createElementNS( "http://apache.org/dav/props/", "executable" ) ); - return doc; -} diff --git a/kioslaves/opengroupware/webdavhandler.h b/kioslaves/opengroupware/webdavhandler.h deleted file mode 100644 index a86332a3..00000000 --- a/kioslaves/opengroupware/webdavhandler.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - This file is part of tdepim. - - Copyright (c) 2004 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ -#ifndef WEBDAVHANDLER_H -#define WEBDAVHANDLER_H - -#include -#include -#include -#include - -class WebdavHandler -{ - public: - WebdavHandler(); - - - static TQDomElement addElement( TQDomDocument &, TQDomNode &, - const TQString &tag ); - static TQDomElement addDavElement( TQDomDocument &, TQDomNode &, - const TQString &tag ); - static TQDomElement addSloxElement( TQDomDocument &, TQDomNode &, - const TQString &tag, - const TQString &text = TQString() ); - static TQDomDocument createAllPropsRequest(); -}; - -#endif diff --git a/kioslaves/sieve/CMakeLists.txt b/kioslaves/sieve/CMakeLists.txt deleted file mode 100644 index f0297bac..00000000 --- a/kioslaves/sieve/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -################################################# -# -# (C) 2010-2011 Serghei Amelian -# serghei (DOT) amelian (AT) gmail.com -# -# Improvements and feedback are welcome -# -# This file is released under GPL >= 2 -# -################################################# - -include_directories( - ${CMAKE_BINARY_DIR} - ${CMAKE_SOURCE_DIR}/libtdepim - ${TDE_INCLUDE_DIR} - ${TQT_INCLUDE_DIRS} -) - -link_directories( - ${TQT_LIBRARY_DIRS} -) - - -##### other data ################################ - -install( FILES sieve.protocol DESTINATION ${SERVICES_INSTALL_DIR} ) - - -##### kio_sieve (module) ######################## - -tde_add_kpart( kio_sieve - SOURCES sieve.cpp - LINK kio-shared ${SASL_LIBRARY} - DESTINATION ${PLUGIN_INSTALL_DIR} -) diff --git a/kioslaves/sieve/Makefile.am b/kioslaves/sieve/Makefile.am deleted file mode 100644 index fffffea7..00000000 --- a/kioslaves/sieve/Makefile.am +++ /dev/null @@ -1,15 +0,0 @@ -INCLUDES= -I$(srcdir)/../.. -I$(srcdir)/.. $(all_includes) - -kde_module_LTLIBRARIES = kio_sieve.la - -kio_sieve_la_SOURCES = sieve.cpp -kio_sieve_la_LIBADD = $(LIB_KIO) $(SASL2_LIBS) $(LIB_QT) $(LIB_TDECORE) -kio_sieve_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) - -noinst_HEADERS = sieve.h - -kdelnk_DATA = sieve.protocol -kdelnkdir = $(kde_servicesdir) - -messages: - $(XGETTEXT) *.cpp -o $(podir)/kio_sieve.pot diff --git a/kioslaves/sieve/configure.in.in b/kioslaves/sieve/configure.in.in deleted file mode 100644 index ffc1b4b7..00000000 --- a/kioslaves/sieve/configure.in.in +++ /dev/null @@ -1,18 +0,0 @@ -AC_MSG_CHECKING(if we need to talk to broken timsieved's) -AC_ARG_ENABLE(broken-timsieved-workaround, -[AC_HELP_STRING([--enable-broken-timsieved-workaround], - [versions <= 1.1.0 of the timsieved (part of the Cyrus - IMAP suite) do not interpret the HAVESPACE command of - the sieve protocol. This option makes the sieve - TDEIO::Slave simply omit that command.])], -[case "${enableval}" in - yes) AC_MSG_RESULT(yes) - need_broken_timsieved_support="yes" ;; - no) AC_MSG_RESULT(no) ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-broken-timsieved-workaround]) ;; -esac],[AC_MSG_RESULT(no)]) - -if test "$need_broken_timsieved_support" = "yes"; then - AC_SUBST(HAVE_BROKEN_TIMSIEVED) - AC_DEFINE(HAVE_BROKEN_TIMSIEVED,1,[Define if the sieve TDEIO::Slave must be able to talk to timsieved <= 1.1.0]) -fi diff --git a/kioslaves/sieve/draft-daboo-sieve-include.txt b/kioslaves/sieve/draft-daboo-sieve-include.txt deleted file mode 100644 index 83a08dfb..00000000 --- a/kioslaves/sieve/draft-daboo-sieve-include.txt +++ /dev/null @@ -1 +0,0 @@ -http://ktown.kde.org/~dirk/sieve/draft-daboo-sieve-include.txt diff --git a/kioslaves/sieve/draft-daboo-sieve-spamtest.txt b/kioslaves/sieve/draft-daboo-sieve-spamtest.txt deleted file mode 100644 index 8f22e560..00000000 --- a/kioslaves/sieve/draft-daboo-sieve-spamtest.txt +++ /dev/null @@ -1 +0,0 @@ -http://ktown.kde.org/~dirk/sieve/draft-daboo-sieve-spamtest.txt diff --git a/kioslaves/sieve/draft-degener-sieve-body-00.txt b/kioslaves/sieve/draft-degener-sieve-body-00.txt deleted file mode 100644 index 7b1ee844..00000000 --- a/kioslaves/sieve/draft-degener-sieve-body-00.txt +++ /dev/null @@ -1 +0,0 @@ -http://ktown.kde.org/~dirk/sieve/draft-degener-sieve-body-00.txt diff --git a/kioslaves/sieve/draft-degener-sieve-copy.txt b/kioslaves/sieve/draft-degener-sieve-copy.txt deleted file mode 100644 index 8c23855c..00000000 --- a/kioslaves/sieve/draft-degener-sieve-copy.txt +++ /dev/null @@ -1 +0,0 @@ -http://ktown.kde.org/~dirk/sieve/draft-degener-sieve-copy.txt diff --git a/kioslaves/sieve/draft-degener-sieve-editheader.txt b/kioslaves/sieve/draft-degener-sieve-editheader.txt deleted file mode 100644 index 6e9674f9..00000000 --- a/kioslaves/sieve/draft-degener-sieve-editheader.txt +++ /dev/null @@ -1 +0,0 @@ -http://ktown.kde.org/~dirk/sieve/draft-degener-sieve-editheader.txt diff --git a/kioslaves/sieve/draft-degener-sieve-multiscript.txt b/kioslaves/sieve/draft-degener-sieve-multiscript.txt deleted file mode 100644 index 53a83822..00000000 --- a/kioslaves/sieve/draft-degener-sieve-multiscript.txt +++ /dev/null @@ -1 +0,0 @@ -http://ktown.kde.org/~dirk/sieve/draft-degener-sieve-multiscript.txt diff --git a/kioslaves/sieve/draft-homme-sieve-variables.txt b/kioslaves/sieve/draft-homme-sieve-variables.txt deleted file mode 100644 index cccaa59c..00000000 --- a/kioslaves/sieve/draft-homme-sieve-variables.txt +++ /dev/null @@ -1 +0,0 @@ -http://ktown.kde.org/~dirk/sieve/draft-homme-sieve-variables.txt diff --git a/kioslaves/sieve/draft-martin-managesieve-04.txt b/kioslaves/sieve/draft-martin-managesieve-04.txt deleted file mode 100644 index 82684ad5..00000000 --- a/kioslaves/sieve/draft-martin-managesieve-04.txt +++ /dev/null @@ -1 +0,0 @@ -http://ktown.kde.org/~dirk/sieve/draft-martin-managesieve-04.txt diff --git a/kioslaves/sieve/draft-martin-sieve-notify-01.txt b/kioslaves/sieve/draft-martin-sieve-notify-01.txt deleted file mode 100644 index 6eb1cac3..00000000 --- a/kioslaves/sieve/draft-martin-sieve-notify-01.txt +++ /dev/null @@ -1 +0,0 @@ -http://ktown.kde.org/~dirk/sieve/draft-martin-sieve-notify-01.txt diff --git a/kioslaves/sieve/draft-melnikov-sieve-imapflags.txt b/kioslaves/sieve/draft-melnikov-sieve-imapflags.txt deleted file mode 100644 index 71cfbb3c..00000000 --- a/kioslaves/sieve/draft-melnikov-sieve-imapflags.txt +++ /dev/null @@ -1 +0,0 @@ -http://ktown.kde.org/~dirk/sieve/draft-melnikov-sieve-imapflags.txt diff --git a/kioslaves/sieve/draft-murchison-sieve-regex-06.txt b/kioslaves/sieve/draft-murchison-sieve-regex-06.txt deleted file mode 100644 index b3e922ee..00000000 --- a/kioslaves/sieve/draft-murchison-sieve-regex-06.txt +++ /dev/null @@ -1 +0,0 @@ -http://ktown.kde.org/~dirk/sieve/draft-murchison-sieve-regex-06.txt diff --git a/kioslaves/sieve/draft-murchison-sieve-subaddress-05.txt b/kioslaves/sieve/draft-murchison-sieve-subaddress-05.txt deleted file mode 100644 index 95cea85a..00000000 --- a/kioslaves/sieve/draft-murchison-sieve-subaddress-05.txt +++ /dev/null @@ -1 +0,0 @@ -http://ktown.kde.org/~dirk/sieve/draft-murchison-sieve-subaddress-05.txt diff --git a/kioslaves/sieve/draft-showalter-sieve-vacation-04.txt b/kioslaves/sieve/draft-showalter-sieve-vacation-04.txt deleted file mode 100644 index bd2d3359..00000000 --- a/kioslaves/sieve/draft-showalter-sieve-vacation-04.txt +++ /dev/null @@ -1 +0,0 @@ -http://ktown.kde.org/~dirk/sieve/draft-showalter-sieve-vacation-04.txt diff --git a/kioslaves/sieve/rfc3028.txt b/kioslaves/sieve/rfc3028.txt deleted file mode 100644 index b861e2e1..00000000 --- a/kioslaves/sieve/rfc3028.txt +++ /dev/null @@ -1 +0,0 @@ -http://ktown.kde.org/~dirk/sieve/rfc3028.txt diff --git a/kioslaves/sieve/rfc3431.txt b/kioslaves/sieve/rfc3431.txt deleted file mode 100644 index 3f11c325..00000000 --- a/kioslaves/sieve/rfc3431.txt +++ /dev/null @@ -1 +0,0 @@ -http://ktown.kde.org/~dirk/sieve/rfc3431.txt diff --git a/kioslaves/sieve/sieve.cpp b/kioslaves/sieve/sieve.cpp deleted file mode 100644 index 9d373c2a..00000000 --- a/kioslaves/sieve/sieve.cpp +++ /dev/null @@ -1,1343 +0,0 @@ -/*************************************************************************** - sieve.cpp - description - ------------------- - begin : Thu Dec 20 18:47:08 EST 2001 - copyright : (C) 2001 by Hamish Rodda - email : meddie@yoyo.cc.monash.edu.au - ***************************************************************************/ - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License version 2 as * - * published by the Free Software Foundation. * - * * - ***************************************************************************/ - -/** - * Portions adapted from the SMTP ioslave. - * Copyright (c) 2000, 2001 Alex Zepeda - * Copyright (c) 2001 Michael Häckel - * All rights reserved. - * - * Policy: the function where the error occurs calls error(). A result of - * false, where it signifies an error, thus doesn't need to call error() itself. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -extern "C" { -#include -} -#include "sieve.h" - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -using std::exit; -#include -#include - -#include - -static const int debugArea = 7122; - -static inline -#ifdef NDEBUG - kndbgstream ksDebug() { return kdDebug( debugArea ); } - kndbgstream ksDebug( bool cond ) { return kdDebug( cond, debugArea ); } -#else - kdbgstream ksDebug() { return kdDebug( debugArea ); } - kdbgstream ksDebug( bool cond ) { return kdDebug( cond, debugArea ); } -#endif - -#define SIEVE_DEFAULT_PORT 2000 - -static sasl_callback_t callbacks[] = { - { SASL_CB_ECHOPROMPT, NULL, NULL }, - { SASL_CB_NOECHOPROMPT, NULL, NULL }, - { SASL_CB_GETREALM, NULL, NULL }, - { SASL_CB_USER, NULL, NULL }, - { SASL_CB_AUTHNAME, NULL, NULL }, - { SASL_CB_PASS, NULL, NULL }, - { SASL_CB_CANON_USER, NULL, NULL }, - { SASL_CB_LIST_END, NULL, NULL } -}; - -static const unsigned int SIEVE_DEFAULT_RECIEVE_BUFFER = 512; - -using namespace TDEIO; -extern "C" -{ - KDE_EXPORT int kdemain(int argc, char **argv) - { - TDEInstance instance("kio_sieve" ); - - ksDebug() << "*** Starting kio_sieve " << endl; - - if (argc != 4) { - ksDebug() << "Usage: kio_sieve protocol domain-socket1 domain-socket2" << endl; - exit(-1); - } - - if ( sasl_client_init( NULL ) != SASL_OK ) { - fprintf(stderr, "SASL library initialization failed!\n"); - ::exit (-1); - } - - kio_sieveProtocol slave(argv[2], argv[3]); - slave.dispatchLoop(); - - sasl_done(); - - ksDebug() << "*** kio_sieve Done" << endl; - return 0; - } -} - -/* ---------------------------------------------------------------------------------- */ -kio_sieveResponse::kio_sieveResponse() -{ - clear(); -} - -/* ---------------------------------------------------------------------------------- */ -const uint& kio_sieveResponse::getType() const -{ - return rType; -} - -/* ---------------------------------------------------------------------------------- */ -const uint kio_sieveResponse::getQuantity() const -{ - return quantity; -} - -/* ---------------------------------------------------------------------------------- */ -const TQCString& kio_sieveResponse::getAction() const -{ - return key; -} - -/* ---------------------------------------------------------------------------------- */ -const TQCString& kio_sieveResponse::getKey() const -{ - return key; -} - -/* ---------------------------------------------------------------------------------- */ -const TQCString& kio_sieveResponse::getVal() const -{ - return val; -} - -/* ---------------------------------------------------------------------------------- */ -const TQCString& kio_sieveResponse::getExtra() const -{ - return extra; -} - -/* ---------------------------------------------------------------------------------- */ -void kio_sieveResponse::setQuantity(const uint& newTQty) -{ - rType = QUANTITY; - quantity = newTQty; -} - -/* ---------------------------------------------------------------------------------- */ -void kio_sieveResponse::setAction(const TQCString& newAction) -{ - rType = ACTION; - key = newAction.copy(); -} - -/* ---------------------------------------------------------------------------------- */ -void kio_sieveResponse::setKey(const TQCString& newKey) -{ - rType = KEY_VAL_PAIR; - key = newKey.copy(); -} - -/* ---------------------------------------------------------------------------------- */ -void kio_sieveResponse::setVal(const TQCString& newVal) -{ - val = newVal.copy(); -} - -/* ---------------------------------------------------------------------------------- */ -void kio_sieveResponse::setExtra(const TQCString& newExtra) -{ - extra = newExtra.copy(); -} - -/* ---------------------------------------------------------------------------------- */ -void kio_sieveResponse::clear() -{ - rType = NONE; - extra = key = val = TQCString(""); - quantity = 0; -} - -/* ---------------------------------------------------------------------------------- */ -kio_sieveProtocol::kio_sieveProtocol(const TQCString &pool_socket, const TQCString &app_socket) - : TCPSlaveBase( SIEVE_DEFAULT_PORT, "sieve", pool_socket, app_socket, false) - , m_connMode(NORMAL) - , m_supportsTLS(false) - , m_shouldBeConnected(false) - , m_allowUnencrypted(false) -{ -} - -/* ---------------------------------------------------------------------------------- */ -kio_sieveProtocol::~kio_sieveProtocol() -{ - if ( isConnectionValid() ) - disconnect(); -} - -/* ---------------------------------------------------------------------------------- */ -void kio_sieveProtocol::setHost (const TQString &host, int port, const TQString &user, const TQString &pass) -{ - if ( isConnectionValid() && - ( m_sServer != host || - m_iPort != port || - m_sUser != user || - m_sPass != pass ) ) { - disconnect(); - } - m_sServer = host; - m_iPort = port ? port : m_iDefaultPort; - m_sUser = user; - m_sPass = pass; - m_supportsTLS = false; -} - -/* ---------------------------------------------------------------------------------- */ -void kio_sieveProtocol::openConnection() -{ - m_connMode = CONNECTION_ORIENTED; - connect(); -} - -bool kio_sieveProtocol::parseCapabilities(bool requestCapabilities/* = false*/) -{ - ksDebug() << k_funcinfo << endl; - - // Setup... - bool ret = false; - - if (requestCapabilities) { - sendData("CAPABILITY"); - } - - while (receiveData()) { - ksDebug() << "Looping receive" << endl; - - if (r.getType() == kio_sieveResponse::ACTION) { - if ( r.getAction().contains("ok", false) != -1 ) { - ksDebug() << "Sieve server ready & awaiting authentication." << endl; - break; - } else - ksDebug() << "Unknown action " << r.getAction() << "." << endl; - - } else if (r.getKey() == "IMPLEMENTATION") { - if (r.getVal().contains("sieve", false) != -1) { - ksDebug() << "Connected to Sieve server: " << r.getVal() << endl; - ret = true; - setMetaData("implementation", r.getVal()); - m_implementation = r.getVal(); - } - - } else if (r.getKey() == "SASL") { - // Save list of available SASL methods - m_sasl_caps = TQStringList::split(' ', r.getVal()); - ksDebug() << "Server SASL authentication methods: " << m_sasl_caps.join(", ") << endl; - setMetaData("saslMethods", r.getVal()); - - } else if (r.getKey() == "SIEVE") { - // Save script capabilities; report back as meta data: - ksDebug() << "Server script capabilities: " << TQStringList::split(' ', r.getVal()).join(", ") << endl; - setMetaData("sieveExtensions", r.getVal()); - - } else if (r.getKey() == "STARTTLS") { - // The server supports TLS - ksDebug() << "Server supports TLS" << endl; - m_supportsTLS = true; - setMetaData("tlsSupported", "true"); - - } else { - ksDebug() << "Unrecognised key." << endl; - } - } - - if (!m_supportsTLS) { - setMetaData("tlsSupported", "false"); - } - - return ret; -} - - -/* ---------------------------------------------------------------------------------- */ -/** - * Checks if connection parameters have changed. - * If it it, close the current connection - */ -void kio_sieveProtocol::changeCheck( const KURL &url ) -{ - TQString auth; - - if (!metaData("sasl").isEmpty()) - auth = metaData("sasl").upper(); - else { - TQString query = url.query(); - if ( query.startsWith("?") ) query.remove( 0, 1 ); - TQStringList q = TQStringList::split( ",", query ); - TQStringList::iterator it; - - for ( it = q.begin(); it != q.end(); ++it ) { - if ( TQString( (*it).section('=',0,0) ).lower() == "x-mech" ) { - auth = TQString( (*it).section('=',1) ).upper(); - break; - } - } - } - ksDebug() << "auth: " << auth << " m_sAuth: " << m_sAuth << endl; - if ( m_sAuth != auth ) { - m_sAuth = auth; - if ( isConnectionValid() ) - disconnect(); - } - - // For TLS, only disconnect if we are unencrypted and are - // no longer allowed (otherwise, it's still fine): - const bool allowUnencryptedNow = url.queryItem("x-allow-unencrypted") == "true" ; - if ( m_allowUnencrypted && !allowUnencryptedNow ) - if ( isConnectionValid() ) - disconnect(); - m_allowUnencrypted = allowUnencryptedNow; -} - -/* ---------------------------------------------------------------------------------- */ -/** - * Connects to the server. - * returns false and calls error() if an error occurred. - */ -bool kio_sieveProtocol::connect(bool useTLSIfAvailable) -{ - ksDebug() << k_funcinfo << endl; - - if (isConnectionValid()) return true; - - infoMessage(i18n("Connecting to %1...").arg( m_sServer)); - - if (m_connMode == CONNECTION_ORIENTED && m_shouldBeConnected) { - error(ERR_CONNECTION_BROKEN, i18n("The connection to the server was lost.")); - return false; - } - - setBlockConnection(true); - - if (!connectToHost(m_sServer, m_iPort, true)) { - return false; - } - - if (!parseCapabilities()) { - closeDescriptor(); - error(ERR_UNSUPPORTED_PROTOCOL, i18n("Server identification failed.")); - return false; - } - - // Attempt to start TLS - if ( !m_allowUnencrypted && !canUseTLS() ) { - error( ERR_SLAVE_DEFINED, i18n("Can not use TLS. Please enable TLS in the TDE cryptography setting.") ); - disconnect(); - return false; - } - - if ( !m_allowUnencrypted && useTLSIfAvailable && canUseTLS() && !m_supportsTLS && - messageBox( WarningContinueCancel, - i18n("TLS encryption was requested, but your Sieve server does not advertise TLS in its capabilities.\n" - "You can choose to try to initiate TLS negotiations nonetheless, or cancel the operation."), - i18n("Server Does Not Advertise TLS"), i18n("&Start TLS nonetheless"), i18n("&Cancel") ) != KMessageBox::Continue ) - { - error( ERR_USER_CANCELED, i18n("TLS encryption requested, but not supported by server.") ); - disconnect(); - return false; - } - - // FIXME find a test server and test that this works - if (useTLSIfAvailable && canUseTLS()) { - sendData("STARTTLS"); - if (operationSuccessful()) { - ksDebug() << "TLS has been accepted. Starting TLS..." << endl - << "WARNING this is untested and may fail." << endl; - int retval = startTLS(); - if (retval == 1) { - ksDebug() << "TLS enabled successfully." << endl; - // reparse capabilities: - parseCapabilities( requestCapabilitiesAfterStartTLS() ); - } else { - ksDebug() << "TLS initiation failed, code " << retval << endl; - if ( m_allowUnencrypted ) { - disconnect(true); - return connect(false); - } - if ( retval != -3 ) - messageBox( Information, - i18n("Your Sieve server claims to support TLS, " - "but negotiation was unsuccessful."), - i18n("Connection Failed") ); - disconnect(true); - return false; - } - } else if ( !m_allowUnencrypted ) { - ksDebug() << "Server incapable of TLS." << endl; - disconnect(); - error( ERR_SLAVE_DEFINED, i18n("The server does not seem to support TLS. " - "Disable TLS if you want to connect without encryption.") ); - return false; - } else - ksDebug() << "Server incapable of TLS. Transmitted documents will be unencrypted." << endl; - } else - ksDebug() << "We are incapable of TLS. Transmitted documents will be unencrypted." << endl; - - assert( m_allowUnencrypted || usingTLS() ); - - infoMessage(i18n("Authenticating user...")); - if (!authenticate()) { - disconnect(); - error(ERR_COULD_NOT_AUTHENTICATE, i18n("Authentication failed.")); - return false; - } - - m_shouldBeConnected = true; - return true; -} - -/* ---------------------------------------------------------------------------------- */ -void kio_sieveProtocol::closeConnection() -{ - m_connMode = CONNECTION_ORIENTED; - disconnect(); -} - -/* ---------------------------------------------------------------------------------- */ -void kio_sieveProtocol::disconnect(bool forcibly) -{ - if (!forcibly) { - sendData("LOGOUT"); - - // This crashes under certain conditions as described in - // http://intevation.de/roundup/kolab/issue2442 - // Fixing TDEIO::TCPSlaveBase::atEnd() for !fd would also work but 3.x is on life support. - //if (!operationSuccessful()) - // ksDebug() << "Server did not logout cleanly." << endl; - } - - closeDescriptor(); - m_shouldBeConnected = false; -} - -/* ---------------------------------------------------------------------------------- */ -/*void kio_sieveProtocol::slave_status() -{ - slaveStatus(isConnectionValid() ? m_sServer : "", isConnectionValid()); - - finished(); -}*/ - -/* ---------------------------------------------------------------------------------- */ -void kio_sieveProtocol::special(const TQByteArray &data) -{ - int tmp; - TQDataStream stream(data, IO_ReadOnly); - KURL url; - - stream >> tmp; - - switch (tmp) { - case 1: - stream >> url; - if (!activate(url)) - return; - break; - case 2: - if (!deactivate()) - return; - break; - case 3: - parseCapabilities(true); - break; - } - - infoMessage(i18n("Done.")); - - finished(); -} - -/* ---------------------------------------------------------------------------------- */ -bool kio_sieveProtocol::activate(const KURL& url) -{ - changeCheck( url ); - if (!connect()) - return false; - - infoMessage(i18n("Activating script...")); - - TQString filename = url.fileName(false); - - if (filename.isEmpty()) { - error(ERR_DOES_NOT_EXIST, url.prettyURL()); - return false; - } - - if (!sendData("SETACTIVE \"" + filename.utf8() + "\"")) - return false; - - if (operationSuccessful()) { - ksDebug() << "Script activation complete." << endl; - return true; - } else { - error(ERR_INTERNAL_SERVER, i18n("There was an error activating the script.")); - return false; - } -} - -/* ---------------------------------------------------------------------------------- */ -bool kio_sieveProtocol::deactivate() -{ - if (!connect()) - return false; - - if (!sendData("SETACTIVE \"\"")) - return false; - - if (operationSuccessful()) { - ksDebug() << "Script deactivation complete." << endl; - return true; - } else { - error(ERR_INTERNAL_SERVER, i18n("There was an error deactivating the script.")); - return false; - } -} - -static void append_lf2crlf( TQByteArray & out, const TQByteArray & in ) { - if ( in.isEmpty() ) - return; - const unsigned int oldOutSize = out.size(); - out.resize( oldOutSize + 2 * in.size() ); - const char * s = in.begin(); - const char * const end = in.end(); - char * d = out.begin() + oldOutSize; - char last = '\0'; - while ( s < end ) { - if ( *s == '\n' && last != '\r' ) - *d++ = '\r'; - *d++ = last = *s++; - } - out.resize( d - out.begin() ); -} - -void kio_sieveProtocol::put(const KURL& url, int /*permissions*/, bool /*overwrite*/, bool /*resume*/) -{ - changeCheck( url ); - if (!connect()) - return; - - infoMessage(i18n("Sending data...")); - - TQString filename = url.fileName(false); - - if (filename.isEmpty()) { - error(ERR_MALFORMED_URL, url.prettyURL()); - return; - } - - TQByteArray data; - for (;;) { - dataReq(); - TQByteArray buffer; - const int newSize = readData(buffer); - append_lf2crlf( data, buffer ); - if ( newSize < 0 ) { - // read error: network in unknown state so disconnect - error(ERR_COULD_NOT_READ, i18n("KIO data supply error.")); - return; - } - if ( newSize == 0 ) - break; - } - - // script size - int bufLen = (int)data.size(); - totalSize(bufLen); - - // timsieved 1.1.0: - // C: HAVESPACE "rejected" 74 - // S: NO "Number expected" - // C: HAVESPACE 74 - // S: NO "Missing script name" - // S: HAVESPACE "rejected" "74" - // C: NO "Number expected" - // => broken, we can't use it :-( - // (will be fixed in Cyrus 2.1.10) -#ifndef HAVE_BROKEN_TIMSIEVED - // first, check quota (it's a SHOULD in draft std) - if (!sendData("HAVESPACE \"" + filename.utf8() + "\" " - + TQCString().setNum( bufLen ))) - return; - - if (!operationSuccessful()) { - error(ERR_DISK_FULL, i18n("Quota exceeded")); - return; - } -#endif - - if (!sendData("PUTSCRIPT \"" + filename.utf8() + "\" {" - + TQCString().setNum( bufLen ) + "+}")) - return; - - // atEnd() lies so the code below doesn't work. - /*if (!atEnd()) { - // We are not expecting any data here, so if the server has responded - // with anything but OK we treat it as an error. - char * buf = new char[2]; - while (!atEnd()) { - ksDebug() << "Reading..." << endl; - read(buf, 1); - ksDebug() << "Trailing [" << buf[0] << "]" << endl; - } - ksDebug() << "End of data." << endl; - delete[] buf; - - if (!operationSuccessful()) { - error(ERR_UNSUPPORTED_PROTOCOL, i18n("A protocol error occurred " - "while trying to negotiate script uploading.\n" - "The server responded:\n%1") - .arg(r.getAction().right(r.getAction().length() - 3))); - return; - } - }*/ - - // upload data to the server - if (write(data, bufLen) != bufLen) { - error(ERR_COULD_NOT_WRITE, i18n("Network error.")); - disconnect(true); - return; - } - - // finishing CR/LF - if (!sendData("")) - return; - - processedSize(bufLen); - - infoMessage(i18n("Verifying upload completion...")); - - if (operationSuccessful()) - ksDebug() << "Script upload complete." << endl; - - else { - /* The managesieve server parses received scripts and rejects - * scripts which are not syntactically correct. Here we expect - * to receive a message detailing the error (only the first - * error is reported. */ - if (r.getAction().length() > 3) { - // make a copy of the extra info - TQCString extra = r.getAction().right(r.getAction().length() - 3); - - // send the extra message off for re-processing - receiveData(false, &extra); - - if (r.getType() == kio_sieveResponse::QUANTITY) { - // length of the error message - uint len = r.getQuantity(); - - TQCString errmsg(len + 1); - - read(errmsg.data(), len); - - error(ERR_INTERNAL_SERVER, - i18n("The script did not upload successfully.\n" - "This is probably due to errors in the script.\n" - "The server responded:\n%1").arg(TQString(errmsg))); - - // clear the rest of the incoming data - receiveData(); - } else if (r.getType() == kio_sieveResponse::KEY_VAL_PAIR) { - error(ERR_INTERNAL_SERVER, - i18n("The script did not upload successfully.\n" - "This is probably due to errors in the script.\n" - "The server responded:\n%1").arg(TQString(r.getKey()))); - } else - error(ERR_INTERNAL_SERVER, - i18n("The script did not upload successfully.\n" - "The script may contain errors.")); - } else - error(ERR_INTERNAL_SERVER, - i18n("The script did not upload successfully.\n" - "The script may contain errors.")); - } - - //if ( permissions != -1 ) - // chmod( url, permissions ); - - infoMessage(i18n("Done.")); - - finished(); -} - -static void inplace_crlf2lf( TQByteArray & in ) { - if ( in.isEmpty() ) - return; - TQByteArray & out = in; // inplace - const char * s = in.begin(); - const char * const end = in.end(); - char * d = out.begin(); - char last = '\0'; - while ( s < end ) { - if ( *s == '\n' && last == '\r' ) - --d; - *d++ = last = *s++; - } - out.resize( d - out.begin() ); -} - -/* ---------------------------------------------------------------------------------- */ -void kio_sieveProtocol::get(const KURL& url) -{ - changeCheck( url ); - if (!connect()) - return; - - infoMessage(i18n("Retrieving data...")); - - TQString filename = url.fileName(false); - - if (filename.isEmpty()) { - error(ERR_MALFORMED_URL, url.prettyURL()); - return; - } - - //SlaveBase::mimetype( TQString("text/plain") ); // "application/sieve"); - - if (!sendData("GETSCRIPT \"" + filename.utf8() + "\"")) - return; - - if (receiveData() && r.getType() == kio_sieveResponse::QUANTITY) { - // determine script size - ssize_t total_len = r.getQuantity(); - totalSize( total_len ); - - int recv_len = 0; - do { - // wait for data... - if ( !waitForResponse( 600 ) ) { - error( TDEIO::ERR_SERVER_TIMEOUT, m_sServer ); - disconnect( true ); - return; - } - - // ...read data... - // Only read as much as we need, otherwise we slurp in the OK that - // operationSuccessful() is expecting below. - TQByteArray dat( kMin( total_len - recv_len, ssize_t(64 * 1024 )) ); - ssize_t this_recv_len = read( dat.data(), dat.size() ); - - if ( this_recv_len < 1 && !isConnectionValid() ) { - error( TDEIO::ERR_CONNECTION_BROKEN, m_sServer ); - disconnect( true ); - return; - } - - dat.resize( this_recv_len ); - inplace_crlf2lf( dat ); - // send data to slaveinterface - data( dat ); - - recv_len += this_recv_len; - processedSize( recv_len ); - } while ( recv_len < total_len ); - - infoMessage(i18n("Finishing up...") ); - data(TQByteArray()); - - if (operationSuccessful()) - ksDebug() << "Script retrieval complete." << endl; - else - ksDebug() << "Script retrieval failed." << endl; - } else { - error(ERR_UNSUPPORTED_PROTOCOL, i18n("A protocol error occurred " - "while trying to negotiate script downloading.")); - return; - } - - infoMessage(i18n("Done.")); - finished(); -} - -void kio_sieveProtocol::del(const KURL &url, bool isfile) -{ - if (!isfile) { - error(ERR_INTERNAL, i18n("Folders are not supported.")); - return; - } - - changeCheck( url ); - if (!connect()) - return; - - infoMessage(i18n("Deleting file...")); - - TQString filename = url.fileName(false); - - if (filename.isEmpty()) { - error(ERR_MALFORMED_URL, url.prettyURL()); - return; - } - - if (!sendData("DELETESCRIPT \"" + filename.utf8() + "\"")) - return; - - if (operationSuccessful()) - ksDebug() << "Script deletion successful." << endl; - else { - error(ERR_INTERNAL_SERVER, i18n("The server would not delete the file.")); - return; - } - - infoMessage(i18n("Done.")); - - finished(); -} - -void kio_sieveProtocol::chmod(const KURL& url, int permissions) -{ - switch ( permissions ) { - case 0700: // activate - activate(url); - break; - case 0600: // deactivate - deactivate(); - break; - default: // unsupported - error(ERR_CANNOT_CHMOD, i18n("Cannot chmod to anything but 0700 (active) or 0600 (inactive script).")); - return; - } - - finished(); -} - -#if defined(_AIX) && defined(stat) -#undef stat -#endif - -void kio_sieveProtocol::stat(const KURL& url) -{ - changeCheck( url ); - if (!connect()) - return; - - UDSEntry entry; - - TQString filename = url.fileName(false); - - if (filename.isEmpty()) { - UDSAtom atom; - atom.m_uds = TDEIO::UDS_NAME; - atom.m_str = "/"; - entry.append(atom); - - atom.m_uds = TDEIO::UDS_FILE_TYPE; - atom.m_long = S_IFDIR; - entry.append(atom); - - atom.m_uds = TDEIO::UDS_ACCESS; - atom.m_long = 0700; - entry.append(atom); - - statEntry(entry); - - } else { - if (!sendData("LISTSCRIPTS")) - return; - - while(receiveData()) { - if (r.getType() == kio_sieveResponse::ACTION) { - if (r.getAction().contains("OK", false) == 1) - // Script list completed - break; - - } else - if (filename == TQString::fromUtf8(r.getKey())) { - entry.clear(); - - UDSAtom atom; - atom.m_uds = TDEIO::UDS_NAME; - atom.m_str = TQString::fromUtf8(r.getKey()); - entry.append(atom); - - atom.m_uds = TDEIO::UDS_FILE_TYPE; - atom.m_long = S_IFREG; - entry.append(atom); - - atom.m_uds = TDEIO::UDS_ACCESS; - if ( r.getExtra() == "ACTIVE" ) - atom.m_long = 0700; // mark exec'able - else - atom.m_long = 0600; - entry.append(atom); - - atom.m_uds = TDEIO::UDS_MIME_TYPE; - atom.m_str = "application/sieve"; - entry.append(atom); - - //setMetaData("active", (r.getExtra() == "ACTIVE") ? "yes" : "no"); - - statEntry(entry); - // cannot break here because we need to clear - // the rest of the incoming data. - } - } - } - - finished(); -} - -void kio_sieveProtocol::listDir(const KURL& url) -{ - changeCheck( url ); - if (!connect()) - return; - - if (!sendData("LISTSCRIPTS")) - return; - - UDSEntry entry; - - while(receiveData()) { - if (r.getType() == kio_sieveResponse::ACTION) { - if (r.getAction().contains("OK", false) == 1) - // Script list completed. - break; - - } else { - entry.clear(); - - UDSAtom atom; - atom.m_uds = TDEIO::UDS_NAME; - atom.m_str = TQString::fromUtf8(r.getKey()); - entry.append(atom); - - atom.m_uds = TDEIO::UDS_FILE_TYPE; - atom.m_long = S_IFREG; - entry.append(atom); - - atom.m_uds = TDEIO::UDS_ACCESS; - if ( r.getExtra() == "ACTIVE" ) - atom.m_long = 0700; // mark exec'able - else - atom.m_long = 0600; - entry.append(atom); - - atom.m_uds = TDEIO::UDS_MIME_TYPE; - atom.m_str = "application/sieve"; - entry.append(atom); - - //asetMetaData("active", (r.getExtra() == "ACTIVE") ? "true" : "false"); - - ksDebug() << "Listing script " << r.getKey() << endl; - listEntry(entry , false); - } - } - - listEntry(entry, true); - - finished(); -} - -/* ---------------------------------------------------------------------------------- */ -bool kio_sieveProtocol::saslInteract( void *in, AuthInfo &ai ) -{ - ksDebug() << "sasl_interact" << endl; - sasl_interact_t *interact = ( sasl_interact_t * ) in; - - //some mechanisms do not require username && pass, so it doesn't need a popup - //window for getting this info - for ( ; interact->id != SASL_CB_LIST_END; interact++ ) { - if ( interact->id == SASL_CB_AUTHNAME || - interact->id == SASL_CB_PASS ) { - - if (m_sUser.isEmpty() || m_sPass.isEmpty()) { - if (!openPassDlg(ai)) { - error(ERR_ABORTED, i18n("No authentication details supplied.")); - return false; - } - m_sUser = ai.username; - m_sPass = ai.password; - } - break; - } - } - - interact = ( sasl_interact_t * ) in; - while( interact->id != SASL_CB_LIST_END ) { - ksDebug() << "SASL_INTERACT id: " << interact->id << endl; - switch( interact->id ) { - case SASL_CB_USER: - case SASL_CB_AUTHNAME: - ksDebug() << "SASL_CB_[AUTHNAME|USER]: '" << m_sUser << "'" << endl; - interact->result = strdup( m_sUser.utf8() ); - interact->len = strlen( (const char *) interact->result ); - break; - case SASL_CB_PASS: - ksDebug() << "SASL_CB_PASS: [hidden] " << endl; - interact->result = strdup( m_sPass.utf8() ); - interact->len = strlen( (const char *) interact->result ); - break; - default: - interact->result = NULL; interact->len = 0; - break; - } - interact++; - } - return true; -} - -#define SASLERROR error(ERR_COULD_NOT_AUTHENTICATE, i18n("An error occurred during authentication: %1").arg( \ - TQString::fromUtf8( sasl_errdetail( conn ) ))); - -bool kio_sieveProtocol::authenticate() -{ - int result; - sasl_conn_t *conn = NULL; - sasl_interact_t *client_interact = NULL; - const char *out = NULL; - uint outlen; - const char *mechusing = NULL; - TQByteArray challenge, tmp; - - /* Retrieve authentication details from user. - * Note: should this require realm as well as user & pass details - * before it automatically skips the prompt? - * Note2: encoding issues with PLAIN login? */ - AuthInfo ai; - ai.url.setProtocol("sieve"); - ai.url.setHost(m_sServer); - ai.url.setPort(m_iPort); - ai.username = m_sUser; - ai.password = m_sPass; - ai.keepPassword = true; - ai.caption = i18n("Sieve Authentication Details"); - ai.comment = i18n("Please enter your authentication details for your sieve account " - "(usually the same as your email password):"); - - result = sasl_client_new( "sieve", - m_sServer.latin1(), - 0, 0, callbacks, 0, &conn ); - - if ( result != SASL_OK ) { - ksDebug() << "sasl_client_new failed with: " << result << endl; - SASLERROR - return false; - } - - TQStringList strList; -// strList.append("NTLM"); - - if ( !m_sAuth.isEmpty() ) - strList.append( m_sAuth ); - else - strList = m_sasl_caps; - - do { - result = sasl_client_start(conn, strList.join(" ").latin1(), &client_interact, - &out, &outlen, &mechusing); - - if (result == SASL_INTERACT) - if ( !saslInteract( client_interact, ai ) ) { - sasl_dispose( &conn ); - return false; - }; - } while ( result == SASL_INTERACT ); - - if ( result != SASL_CONTINUE && result != SASL_OK ) { - ksDebug() << "sasl_client_start failed with: " << result << endl; - SASLERROR - sasl_dispose( &conn ); - return false; - } - - ksDebug() << "Preferred authentication method is " << mechusing << "." << endl; - - TQString firstCommand = "AUTHENTICATE \"" + TQString::fromLatin1( mechusing ) + "\""; - tmp.setRawData( out, outlen ); - KCodecs::base64Encode( tmp, challenge ); - tmp.resetRawData( out, outlen ); - if ( !challenge.isEmpty() ) { - firstCommand += " \""; - firstCommand += TQString::fromLatin1( challenge.data(), challenge.size() ); - firstCommand += "\""; - } - - if (!sendData( firstCommand.latin1() )) - return false; - - TQCString command; - - do { - receiveData(); - - if (operationResult() != OTHER) - break; - - ksDebug() << "Challenge len " << r.getQuantity() << endl; - - if (r.getType() != kio_sieveResponse::QUANTITY) { - sasl_dispose( &conn ); - error(ERR_SLAVE_DEFINED, - i18n("A protocol error occurred during authentication.\n" - "Choose a different authentication method to %1.").arg(mechusing)); - return false; - } - - uint qty = r.getQuantity(); - - receiveData(); - - if (r.getType() != kio_sieveResponse::ACTION && r.getAction().length() != qty) { - sasl_dispose( &conn ); - error(ERR_UNSUPPORTED_PROTOCOL, - i18n("A protocol error occurred during authentication.\n" - "Choose a different authentication method to %1.").arg(mechusing)); - return false; - } - - tmp.setRawData( r.getAction().data(), qty ); - KCodecs::base64Decode( tmp, challenge ); - tmp.resetRawData( r.getAction().data(), qty ); -// ksDebug() << "S: [" << r.getAction() << "]." << endl; -// ksDebug() << "S-1: [" << TQCString(challenge.data(), challenge.size()+1) << "]." << endl; - - do { - result = sasl_client_step(conn, challenge.isEmpty() ? 0 : challenge.data(), - challenge.size(), - &client_interact, - &out, &outlen); - - if (result == SASL_INTERACT) - if ( !saslInteract( client_interact, ai ) ) { - sasl_dispose( &conn ); - return false; - }; - } while ( result == SASL_INTERACT ); - - ksDebug() << "sasl_client_step: " << result << endl; - if ( result != SASL_CONTINUE && result != SASL_OK ) { - ksDebug() << "sasl_client_step failed with: " << result << endl; - SASLERROR - sasl_dispose( &conn ); - return false; - } - - tmp.setRawData( out, outlen ); - KCodecs::base64Encode( tmp, challenge ); - tmp.resetRawData( out, outlen ); - sendData("\"" + TQCString( challenge.data(), challenge.size()+1 ) + "\""); -// ksDebug() << "C: [" << TQCString(challenge.data(), challenge.size()+1) << "]." << endl; -// ksDebug() << "C-1: [" << out << "]." << endl; - } while ( true ); - - ksDebug() << "Challenges finished." << endl; - sasl_dispose( &conn ); - - if (operationResult() == OK) { - // Authentication succeeded. - return true; - } else { - // Authentication failed. - error(ERR_COULD_NOT_AUTHENTICATE, i18n("Authentication failed.\nMost likely the password is wrong.\nThe server responded:\n%1").arg( TQString(r.getAction()) ) ); - return false; - } -} - -/* --------------------------------------------------------------------------- */ -void kio_sieveProtocol::mimetype(const KURL & url) -{ - ksDebug() << "Requesting mimetype for " << url.prettyURL() << endl; - - if (url.fileName(false).isEmpty()) - mimeType( "inode/directory" ); - else - mimeType( "application/sieve" ); - - finished(); -} - - -/* --------------------------------------------------------------------------- */ -bool kio_sieveProtocol::sendData(const TQCString &data) -{ - TQCString write_buf = data + "\r\n"; - - //ksDebug() << "C: " << data << endl; - - // Write the command - ssize_t write_buf_len = write_buf.length(); - if (write(write_buf.data(), write_buf_len) != write_buf_len) { - error(ERR_COULD_NOT_WRITE, i18n("Network error.")); - disconnect(true); - return false; - } - - return true; -} - -/* --------------------------------------------------------------------------- */ -bool kio_sieveProtocol::receiveData(bool waitForData, TQCString *reparse) -{ - TQCString interpret; - int start, end; - - if (!reparse) { - if (!waitForData) - // is there data waiting? - if (atEnd()) return false; - - // read data from the server - char buffer[SIEVE_DEFAULT_RECIEVE_BUFFER]; - readLine(buffer, SIEVE_DEFAULT_RECIEVE_BUFFER - 1); - buffer[SIEVE_DEFAULT_RECIEVE_BUFFER-1] = '\0'; - - // strip LF/CR - interpret = TQCString(buffer).left(tqstrlen(buffer) - 2); - - } else { - interpret = reparse->copy(); - } - - r.clear(); - - //ksDebug() << "S: " << interpret << endl; - - switch(interpret[0]) { - case '{': - { - // expecting {quantity} - start = 0; - end = interpret.find("+}", start + 1); - // some older versions of Cyrus enclose the literal size just in { } instead of { +} - if ( end == -1 ) - end = interpret.find('}', start + 1); - - bool ok = false; - r.setQuantity(interpret.mid(start + 1, end - start - 1).toUInt( &ok )); - if (!ok) { - disconnect(); - error(ERR_INTERNAL_SERVER, i18n("A protocol error occurred.")); - return false; - } - - return true; - } - case '"': - // expecting "key" "value" pairs - break; - default: - // expecting single string - r.setAction(interpret); - return true; - } - - start = 0; - - end = interpret.find(34, start + 1); - if (end == -1) { - ksDebug() << "Possible insufficient buffer size." << endl; - r.setKey(interpret.right(interpret.length() - start)); - return true; - } - - r.setKey(interpret.mid(start + 1, end - start - 1)); - - start = interpret.find(34, end + 1); - if (start == -1) { - if ((int)interpret.length() > end) - // skip " and space - r.setExtra(interpret.right(interpret.length() - end - 2)); - - return true; - } - - end = interpret.find(34, start + 1); - if (end == -1) { - ksDebug() << "Possible insufficient buffer size." << endl; - r.setVal(interpret.right(interpret.length() - start)); - return true; - } - - r.setVal(interpret.mid(start + 1, end - start - 1)); - return true; -} - -bool kio_sieveProtocol::operationSuccessful() -{ - while (receiveData(false)) { - if (r.getType() == kio_sieveResponse::ACTION) { - TQCString response = r.getAction().left(2); - if (response == "OK") { - return true; - } else if (response == "NO") { - return false; - } - } - } - return false; -} - -int kio_sieveProtocol::operationResult() -{ - if (r.getType() == kio_sieveResponse::ACTION) { - TQCString response = r.getAction().left(2); - if (response == "OK") { - return OK; - } else if (response == "NO") { - return NO; - } else if (response == "BY"/*E*/) { - return BYE; - } - } - - return OTHER; -} - -bool kio_sieveProtocol::requestCapabilitiesAfterStartTLS() const -{ - // Cyrus didn't send CAPABILITIES after STARTTLS until 2.3.11, which is - // not standard conform, but we need to support that anyway. - // m_implementation looks like this 'Cyrus timsieved v2.2.12' for Cyrus btw. - TQRegExp regExp( "Cyrus\\stimsieved\\sv(\\d+)\\.(\\d+)\\.(\\d+)([-\\w]*)", false ); - if ( regExp.search( m_implementation ) >= 0 ) { - const int major = regExp.cap( 1 ).toInt(); - const int minor = regExp.cap( 2 ).toInt(); - const int patch = regExp.cap( 3 ).toInt(); - const TQString vendor = regExp.cap( 4 ); - if ( major < 2 || (major == 2 && (minor < 3 || (minor == 3 && patch < 11))) || (vendor == "-kolab-nocaps") ) { - ksDebug() << k_funcinfo << "Enabling compat mode for Cyrus < 2.3.11 or Cyrus marked as \"kolab-nocaps\"" << endl; - return true; - } - } - return false; -} diff --git a/kioslaves/sieve/sieve.h b/kioslaves/sieve/sieve.h deleted file mode 100644 index 2168da72..00000000 --- a/kioslaves/sieve/sieve.h +++ /dev/null @@ -1,133 +0,0 @@ -/*************************************************************************** - sieve.h - description - ------------------- - begin : Thu Dec 20 18:47:08 EST 2001 - copyright : (C) 2001 by Hamish Rodda - email : meddie@yoyo.cc.monash.edu.au - ***************************************************************************/ - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License version 2 as * - * published by the Free Software Foundation. * - * * - ***************************************************************************/ -#ifndef __sieve_h__ -#define __sieve_h__ - -#include -#include - -#include -#include -#include - -class KDESasl; -class KURL; - - -class kio_sieveResponse -{ -public: - enum responses { NONE, KEY_VAL_PAIR, ACTION, QUANTITY }; - - kio_sieveResponse(); - - const uint& getType() const; - - const TQCString& getAction() const; - const uint getQuantity() const; - const TQCString& getKey() const; - const TQCString& getVal() const; - const TQCString& getExtra() const; - - void setQuantity(const uint& quantity); - void setAction(const TQCString& newAction); - void setKey(const TQCString& newKey); - void setVal(const TQCString& newVal); - void setExtra(const TQCString& newExtra); - - void clear(); - -protected: - uint rType; - uint quantity; - TQCString key; - TQCString val; - TQCString extra; -}; - -class kio_sieveProtocol : public TDEIO::TCPSlaveBase -{ - -public: - enum connectionModes { NORMAL, CONNECTION_ORIENTED }; - enum Results { OK, NO, BYE, OTHER }; - - kio_sieveProtocol(const TQCString &pool_socket, const TQCString &app_socket); - virtual ~kio_sieveProtocol(); - - virtual void mimetype(const KURL& url); - virtual void get(const KURL& url); - virtual void put(const KURL& url, int permissions, bool overwrite, bool resume); - virtual void del(const KURL &url, bool isfile); - - virtual void listDir(const KURL& url); - virtual void chmod(const KURL& url, int permissions); - virtual void stat(const KURL& url); - - virtual void setHost(const TQString &host, int port, const TQString &user, const TQString &pass); - virtual void openConnection(); - virtual void closeConnection(); - //virtual void slave_status(); - - /** - * Special commands supported by this slave: - * 1 - activate script - * 2 - deactivate (all - only one active at any one time) scripts - * 3 - request capabilities, returned as metadata - */ - virtual void special(const TQByteArray &data); - bool activate(const KURL& url); - bool deactivate(); - -protected: - bool connect(bool useTLSIfAvailable = true); - bool authenticate(); - void disconnect(bool forcibly = false); - void changeCheck( const KURL &url ); - - bool sendData(const TQCString &data); - bool receiveData(bool waitForData = true, TQCString *reparse = 0); - bool operationSuccessful(); - int operationResult(); - - bool parseCapabilities(bool requestCapabilities = false); - bool saslInteract( void *in, TDEIO::AuthInfo &ai ); - - // IOSlave global data - uint m_connMode; - - // Host-specific data - TQStringList m_sasl_caps; - bool m_supportsTLS; - - // Global server respose class - kio_sieveResponse r; - - // connection details - TQString m_sServer; - TQString m_sUser; - TQString m_sPass; - TQString m_sAuth; - bool m_shouldBeConnected; - bool m_allowUnencrypted; - -private: - bool requestCapabilitiesAfterStartTLS() const; - - TQString m_implementation; -}; - -#endif diff --git a/kioslaves/sieve/sieve.protocol b/kioslaves/sieve/sieve.protocol deleted file mode 100644 index 484d48da..00000000 --- a/kioslaves/sieve/sieve.protocol +++ /dev/null @@ -1,53 +0,0 @@ -[Protocol] -exec=kio_sieve -protocol=sieve -input=none -output=filesystem -listing=Name,Access,Type,MimeType, -reading=true -writing=true -makedir=false -deleting=true -linking=false -moving=false -Icon=remote -Description=An ioslave for the Sieve mail filtering protocol -Description[af]='n IOSlave vir die Sieve e-pos filter protokol -Description[ca]=Un ioslave pel protocol de filtrar de correu Sieve -Description[cs]=ioslave pro protokol filtrování zpráv Sieve -Description[da]=En ioslave for Sieve mail filtreringsprotokollen -Description[de]=Ein-/Ausgabemodul für das E-Mail-Filterprotokoll "Sieve" -Description[el]=Ένας ioslave για το Ï€Ïωτόκολλο φιλτÏαÏίσματος αλληλογÏαφίας Sieve -Description[es]=Un ioslave para el protocolo de filtrado de correo Sieve -Description[et]=Sieve e-kirjade filtreerimise protokolli IO-moodul -Description[eu]=Sieve posta iragazketa protokoloarentztko irteerako/sarrerako mendeko bat -Description[fa]=یک ioslave برای قرارداد پالایش نامۀ Sieve -Description[fi]=Siirräntätyöskentelijä Sieve-sähköpostiensuodatusyhteyskäytännölle -Description[fr]=Un ioslave pour le protocole de filtrage de messagerie Sieve -Description[fy]=In ioslave foar it Sieve-mailfilterprotokol -Description[gl]=Un esclavo io para o protocolo de filtraxe de correo Sieve -Description[hu]=KDE-protokoll a Sieve levélszűrÅ‘ protokollhoz -Description[is]=Ioslave fyrir Sieve tölvupóstsíu samskiptaregluna -Description[it]=Un ioslave per il protocollo di filtraggio posta Sieve -Description[ja]=Sieve メールフィルタプロトコル用 ioslave -Description[kk]=Sieve поштаны Ñүзгілеу протоколының ioslave модулі -Description[km]=ioslave សម្រាប់​ពិធីការ​ážáŸ’រង​សំបុážáŸ’ážš Sieve -Description[ms]=Hamba io untuk protokol tapisan mel saringan -Description[nb]=En i/u-slave for e-postfilterprotokollen Sieve -Description[nds]=In-/Utgaavmoduul för't Nettpostfilter-Protokoll Sieve -Description[ne]=मेल फिलà¥à¤Ÿà¤°à¤¿à¤™ पà¥à¤°à¥‹à¤Ÿà¥‹à¤•à¤² सिभ गरà¥à¤¨à¤•à¤¾ लागि à¤à¤‰à¤Ÿà¤¾ आइओसà¥à¤²à¥‡à¤­ -Description[nl]=Een ioslave voor het Sieve-mailfilterprotocol -Description[nn]=Ein i/u-slave for e-postfilterprotokollen Sieve -Description[pl]=Wtyczka protokoÅ‚u filtrowania poczty Sieve -Description[pt]=Um 'ioslave' para o protocolo de filtragem de correio Sieve -Description[pt_BR]=Um IO-Slave para o protocolo de filtragem de email Sieve -Description[ru]=Канал протокола фильтра почты Sieve -Description[sk]=ioslave pre protokol Sieve filtrovanie poÅ¡ty -Description[sl]=ioslave za protokol poÅ¡tnega filtriranja Sieve -Description[sr]=IOslave протокола за филтрирање поште Sieve -Description[sr@Latn]=IOslave protokola za filtriranje poÅ¡te Sieve -Description[sv]=En I/O-slav för brevfiltreringsprotokollet Sieve -Description[ta]=Sieve அஞà¯à®šà®²à¯ வடிகடà¯à®Ÿà¯à®®à¯ நெறிமà¯à®±à¯ˆà®•à¯à®•à®¾à®© ஒர௠ioslave -Description[tr]=Sieve e-posta filtreleme protokolü için bir ioslave -Description[uk]=Підлеглий Ð’/Ð’ Ð´Ð»Ñ Ð¿Ñ€Ð¾Ñ‚Ð¾ÐºÐ¾Ð»Ñƒ Ñ„Ñ–Ð»ÑŒÑ‚Ñ€ÑƒÐ²Ð°Ð½Ð½Ñ Ð¿Ð¾ÑˆÑ‚Ð¸ Sieve -Description[zh_CN]=邮件过滤å议仆人 diff --git a/kitchensync/src/configguievo2.cpp b/kitchensync/src/configguievo2.cpp index c313ce3a..4d5c2edc 100644 --- a/kitchensync/src/configguievo2.cpp +++ b/kitchensync/src/configguievo2.cpp @@ -28,7 +28,7 @@ #include #include -#include +#include #include #include diff --git a/kitchensync/src/configguisunbird.cpp b/kitchensync/src/configguisunbird.cpp index 99e86f3c..6a3b9aa6 100644 --- a/kitchensync/src/configguisunbird.cpp +++ b/kitchensync/src/configguisunbird.cpp @@ -38,7 +38,7 @@ #include #include #include -#include +#include ConfigGuiSunbird::ConfigGuiSunbird( const QSync::Member &member, TQWidget *parent ) : ConfigGui( member, parent ) diff --git a/kmail/ChangeLog b/kmail/ChangeLog index 1873a13d..2f263c27 100644 --- a/kmail/ChangeLog +++ b/kmail/ChangeLog @@ -557,7 +557,7 @@ Sun Sep 6 18:28:45 1998 Markus Wuebben stored again. * Composer: changed completion key from Ctrl-. to Ctrl-T - as kfile has. + as tdefile has. 1998-06-18 Mario Weilguni diff --git a/kmail/Makefile.am b/kmail/Makefile.am index 6fcc46de..5f8cc6e4 100644 --- a/kmail/Makefile.am +++ b/kmail/Makefile.am @@ -201,7 +201,7 @@ KDE_ICON = AUTO rcdir = $(kde_datadir)/kmail rc_DATA = kmcomposerui.rc kmmainwin.rc kmreadermainwin.rc eventsrc kmail_part.rc -updatedir = $(kde_datadir)/kconf_update +updatedir = $(kde_datadir)/tdeconf_update update_DATA = kmail.upd update_SCRIPTS = upgrade-transport.pl kmail-pgpidentity.pl \ upgrade-signature.pl kmail-upd-identities.pl \ diff --git a/kmail/accountdialog.cpp b/kmail/accountdialog.cpp index 8937fb48..73c3e3f0 100644 --- a/kmail/accountdialog.cpp +++ b/kmail/accountdialog.cpp @@ -36,7 +36,7 @@ #include #include -#include +#include #include #include #include @@ -365,7 +365,7 @@ void AccountDialog::makeLocalAccountPage() groupLayout->setSpacing( 6 ); groupLayout->setMargin( 11 ); - mLocal.lockProcmail = new TQRadioButton( i18n("Procmail loc&kfile:"), group); + mLocal.lockProcmail = new TQRadioButton( i18n("Procmail loc&tdefile:"), group); groupLayout->addWidget(mLocal.lockProcmail, 0, 0); mLocal.procmailLockFileName = new TQComboBox( true, group ); diff --git a/kmail/accountmanager.cpp b/kmail/accountmanager.cpp index a2bb384f..eeed8f66 100644 --- a/kmail/accountmanager.cpp +++ b/kmail/accountmanager.cpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include diff --git a/kmail/accountwizard.cpp b/kmail/accountwizard.cpp index 89861527..68ba83b9 100644 --- a/kmail/accountwizard.cpp +++ b/kmail/accountwizard.cpp @@ -27,7 +27,7 @@ *******************************************************************************/ #include -#include +#include #include #include #include diff --git a/kmail/acljobs.cpp b/kmail/acljobs.cpp index 2aa55b0c..4b5f54f6 100644 --- a/kmail/acljobs.cpp +++ b/kmail/acljobs.cpp @@ -29,7 +29,7 @@ * your version. */ #include "acljobs.h" -#include +#include #include using namespace KMail; diff --git a/kmail/acljobs.h b/kmail/acljobs.h index b4bfd0df..dd988343 100644 --- a/kmail/acljobs.h +++ b/kmail/acljobs.h @@ -32,7 +32,7 @@ #ifndef KMACLJOBS_H #define KMACLJOBS_H -#include +#include #include namespace KMail { diff --git a/kmail/actionscheduler.cpp b/kmail/actionscheduler.cpp index 6f8e43b0..738d6285 100644 --- a/kmail/actionscheduler.cpp +++ b/kmail/actionscheduler.cpp @@ -47,7 +47,7 @@ using KMail::AccountManager; #include -#include +#include #include using namespace KMail; diff --git a/kmail/annotationjobs.cpp b/kmail/annotationjobs.cpp index 6aa4d932..c2fd8267 100644 --- a/kmail/annotationjobs.cpp +++ b/kmail/annotationjobs.cpp @@ -29,7 +29,7 @@ * your version. */ #include "annotationjobs.h" -#include +#include #include using namespace KMail; diff --git a/kmail/annotationjobs.h b/kmail/annotationjobs.h index 8b50a025..2e7529f2 100644 --- a/kmail/annotationjobs.h +++ b/kmail/annotationjobs.h @@ -32,7 +32,7 @@ #ifndef ANNOTATIONJOBS_H #define ANNOTATIONJOBS_H -#include +#include #include namespace KMail { diff --git a/kmail/antispamconfig.cpp b/kmail/antispamconfig.cpp index 9a1c8347..2563e4ee 100644 --- a/kmail/antispamconfig.cpp +++ b/kmail/antispamconfig.cpp @@ -36,7 +36,7 @@ #include #include -#include +#include using namespace KMail; diff --git a/kmail/antispamwizard.h b/kmail/antispamwizard.h index ed9e4a3b..031a995a 100644 --- a/kmail/antispamwizard.h +++ b/kmail/antispamwizard.h @@ -31,7 +31,7 @@ #include "simplefoldertree.h" -#include +#include #include #include diff --git a/kmail/archivefolderdialog.cpp b/kmail/archivefolderdialog.cpp index 4f58f56c..49c9b1c3 100644 --- a/kmail/archivefolderdialog.cpp +++ b/kmail/archivefolderdialog.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include diff --git a/kmail/cachedimapjob.cpp b/kmail/cachedimapjob.cpp index 143c18c5..7b1fd517 100644 --- a/kmail/cachedimapjob.cpp +++ b/kmail/cachedimapjob.cpp @@ -47,8 +47,8 @@ #include "scalix.h" #include "util.h" -#include -#include +#include +#include #include #include diff --git a/kmail/cachedimapjob.h b/kmail/cachedimapjob.h index 592ba392..bdf64541 100644 --- a/kmail/cachedimapjob.h +++ b/kmail/cachedimapjob.h @@ -45,8 +45,8 @@ #define CACHEDIMAPJOB_H #include "folderjob.h" -#include -#include +#include +#include #include #include diff --git a/kmail/configure.in.in b/kmail/configure.in.in index 694a8359..55bf6b17 100644 --- a/kmail/configure.in.in +++ b/kmail/configure.in.in @@ -19,7 +19,7 @@ AM_CONDITIONAL(add_indexlib, test no = "$missing_indexlib") ]) -dnl The following test is taken from tdelibs/kio/kio +dnl The following test is taken from tdelibs/tdeio/tdeio dnl ------------------------------------------------------------------------ dnl Try to find if we have Linux Inode based Dir Notification dnl ------------------------------------------------------------------------ diff --git a/kmail/configuredialog.cpp b/kmail/configuredialog.cpp index 7b24e228..61e131b2 100644 --- a/kmail/configuredialog.cpp +++ b/kmail/configuredialog.cpp @@ -96,7 +96,7 @@ using KMime::DateFormatter; #include #include #include -#include +#include #include #include #include diff --git a/kmail/csshelper.cpp b/kmail/csshelper.cpp index 61bdbdd1..e5bfb7bf 100644 --- a/kmail/csshelper.cpp +++ b/kmail/csshelper.cpp @@ -34,7 +34,7 @@ #include "globalsettings.h" -#include +#include #include #include diff --git a/kmail/editorwatcher.cpp b/kmail/editorwatcher.cpp index 06368967..da78a64d 100644 --- a/kmail/editorwatcher.cpp +++ b/kmail/editorwatcher.cpp @@ -31,7 +31,7 @@ #include -// inotify stuff taken from tdelibs/kio/kio/kdirwatch.cpp +// inotify stuff taken from tdelibs/tdeio/tdeio/kdirwatch.cpp #ifdef HAVE_SYS_INOTIFY #include #include diff --git a/kmail/favoritefolderview.cpp b/kmail/favoritefolderview.cpp index 8b629f83..24a32bb0 100644 --- a/kmail/favoritefolderview.cpp +++ b/kmail/favoritefolderview.cpp @@ -40,7 +40,7 @@ #include #include #include -#include +#include #include #include diff --git a/kmail/filterimporterexporter.cpp b/kmail/filterimporterexporter.cpp index 3f6208d6..1aee8fa9 100644 --- a/kmail/filterimporterexporter.cpp +++ b/kmail/filterimporterexporter.cpp @@ -33,9 +33,9 @@ #include "kmfilteraction.h" #include "util.h" -#include +#include #include -#include +#include #include #include #include diff --git a/kmail/filterlogdlg.cpp b/kmail/filterlogdlg.cpp index 911f85a4..25fb7d5c 100644 --- a/kmail/filterlogdlg.cpp +++ b/kmail/filterlogdlg.cpp @@ -32,7 +32,7 @@ #include #include -#include +#include #include #include diff --git a/kmail/folderdiaquotatab_p.cpp b/kmail/folderdiaquotatab_p.cpp index 1faf61a1..103d961e 100644 --- a/kmail/folderdiaquotatab_p.cpp +++ b/kmail/folderdiaquotatab_p.cpp @@ -41,7 +41,7 @@ #include "kmkernel.h" #include "klocale.h" -#include "kconfig.h" +#include "tdeconfig.h" #include "kdebug.h" #include "kdialog.h" #include "globalsettings.h" diff --git a/kmail/folderjob.cpp b/kmail/folderjob.cpp index 852082a9..657d1a9b 100644 --- a/kmail/folderjob.cpp +++ b/kmail/folderjob.cpp @@ -38,7 +38,7 @@ #include "folderstorage.h" #include -#include +#include namespace KMail { diff --git a/kmail/folderstorage.cpp b/kmail/folderstorage.cpp index 00368e6d..7be5c26a 100644 --- a/kmail/folderstorage.cpp +++ b/kmail/folderstorage.cpp @@ -49,7 +49,7 @@ using KMail::ListJob; #include "globalsettings.h" #include -#include +#include #include #include diff --git a/kmail/foldertreebase.cpp b/kmail/foldertreebase.cpp index b2f82ad9..e51eaecf 100644 --- a/kmail/foldertreebase.cpp +++ b/kmail/foldertreebase.cpp @@ -31,7 +31,7 @@ using KPIM::MailList; using KPIM::MailListDrag; -#include +#include #include #include diff --git a/kmail/headeritem.cpp b/kmail/headeritem.cpp index 3dbb2b9f..26f5957c 100644 --- a/kmail/headeritem.cpp +++ b/kmail/headeritem.cpp @@ -32,7 +32,7 @@ #include #include -#include +#include #include "headeritem.h" #include "kmheaders.h" diff --git a/kmail/headerstrategy.cpp b/kmail/headerstrategy.cpp index 4bd06811..afa581a1 100644 --- a/kmail/headerstrategy.cpp +++ b/kmail/headerstrategy.cpp @@ -38,7 +38,7 @@ #include "kmkernel.h" #include -#include +#include namespace KMail { diff --git a/kmail/htmlstatusbar.cpp b/kmail/htmlstatusbar.cpp index d2c35b42..fb382e15 100644 --- a/kmail/htmlstatusbar.cpp +++ b/kmail/htmlstatusbar.cpp @@ -43,7 +43,7 @@ #endif #include -#include +#include #include #include diff --git a/kmail/identitydialog.cpp b/kmail/identitydialog.cpp index f180d61d..0e4e3c14 100644 --- a/kmail/identitydialog.cpp +++ b/kmail/identitydialog.cpp @@ -63,8 +63,8 @@ using KMail::FolderRequester; // other KDE headers: #include #include -#include -#include +#include +#include #include #include #include diff --git a/kmail/imapaccountbase.cpp b/kmail/imapaccountbase.cpp index e97a260e..f464f087 100644 --- a/kmail/imapaccountbase.cpp +++ b/kmail/imapaccountbase.cpp @@ -52,14 +52,14 @@ using KPIM::ProgressManager; #include #include -#include +#include #include #include using TDEIO::MetaData; -#include +#include using TDEIO::PasswordDialog; -#include -#include +#include +#include #include #include #include diff --git a/kmail/imapaccountbase.h b/kmail/imapaccountbase.h index ec08ea5f..f1bf03f0 100644 --- a/kmail/imapaccountbase.h +++ b/kmail/imapaccountbase.h @@ -30,7 +30,7 @@ #include #include -#include +#include class AccountManager; class KMFolder; @@ -103,7 +103,7 @@ namespace KMail { virtual void writeConfig( TDEConfig& config ); /** - * The state of the kioslave connection + * The state of the tdeioslave connection */ enum ConnectionState { Error = 0, Connected, Connecting }; diff --git a/kmail/imapjob.cpp b/kmail/imapjob.cpp index 2fee6acf..52a11083 100644 --- a/kmail/imapjob.cpp +++ b/kmail/imapjob.cpp @@ -42,7 +42,7 @@ using KPIM::ProgressManager; #include "util.h" #include -#include +#include #include #include #include diff --git a/kmail/imapjob.h b/kmail/imapjob.h index 2f7a0401..c8e00e14 100644 --- a/kmail/imapjob.h +++ b/kmail/imapjob.h @@ -32,8 +32,8 @@ #ifndef IMAPJOB_H #define IMAPJOB_H -#include -#include +#include +#include #include "folderjob.h" diff --git a/kmail/kmaccount.cpp b/kmail/kmaccount.cpp index 64f13d76..f89b7870 100644 --- a/kmail/kmaccount.cpp +++ b/kmail/kmaccount.cpp @@ -28,7 +28,7 @@ using KMail::FolderJob; #include #include #include -#include +#include #include diff --git a/kmail/kmacctcachedimap.cpp b/kmail/kmacctcachedimap.cpp index 473b0b99..de22e7f6 100644 --- a/kmail/kmacctcachedimap.cpp +++ b/kmail/kmacctcachedimap.cpp @@ -45,13 +45,13 @@ using KMail::SieveConfig; using KMail::AccountManager; #include "progressmanager.h" -#include -#include -#include +#include +#include +#include #include #include #include -#include +#include #include diff --git a/kmail/kmacctimap.cpp b/kmail/kmacctimap.cpp index a70091e7..70a5f0ca 100644 --- a/kmail/kmacctimap.cpp +++ b/kmail/kmacctimap.cpp @@ -45,8 +45,8 @@ using KMail::ImapAccountBase; #include "progressmanager.h" using KPIM::ProgressItem; using KPIM::ProgressManager; -#include -#include +#include +#include #include #include diff --git a/kmail/kmacctlocal.cpp b/kmail/kmacctlocal.cpp index 813d180c..0e941b42 100644 --- a/kmail/kmacctlocal.cpp +++ b/kmail/kmacctlocal.cpp @@ -18,7 +18,7 @@ using KPIM::ProgressManager; #include #include #include -#include +#include #include #include diff --git a/kmail/kmacctmaildir.cpp b/kmail/kmacctmaildir.cpp index 5a203c2d..226d99a5 100644 --- a/kmail/kmacctmaildir.cpp +++ b/kmail/kmacctmaildir.cpp @@ -17,7 +17,7 @@ using KPIM::ProgressManager; #include #include #include -#include +#include #include diff --git a/kmail/kmail.upd b/kmail/kmail.upd index 150393ba..3300b258 100644 --- a/kmail/kmail.upd +++ b/kmail/kmail.upd @@ -76,7 +76,7 @@ Id=3.2-misc ########## W A R N I N G #### W A R N I N G #### W A R N I N G ####### # collection of small adjustments. Since updates will be added to this # script during the pre-3.2 development, HEAD users should regularly -# remove the "3.2-{misc,moves}-xx" keys from their kmailrc and kconf_updaterc. +# remove the "3.2-{misc,moves}-xx" keys from their kmailrc and tdeconf_updaterc. # For this to work, the script MUST be idempotent, ie. be robust # against being run multiple times. ###################################################################### @@ -124,7 +124,7 @@ Id=3.3-misc ########## W A R N I N G #### W A R N I N G #### W A R N I N G ####### # collection of small adjustments. Since updates will be added to this # script during the pre-3.3 development, HEAD users should regularly -# remove the "3.3-{misc,moves}-xx" keys from their kmailrc and kconf_updaterc. +# remove the "3.3-{misc,moves}-xx" keys from their kmailrc and tdeconf_updaterc. # For this to work, the script MUST be idempotent, ie. be robust # against being run multiple times. ###################################################################### diff --git a/kmail/kmailicalifaceimpl.cpp b/kmail/kmailicalifaceimpl.cpp index fbafbc1b..b747be68 100644 --- a/kmail/kmailicalifaceimpl.cpp +++ b/kmail/kmailicalifaceimpl.cpp @@ -70,7 +70,7 @@ using KMail::AccountManager; #include #include #include -#include +#include #include #include diff --git a/kmail/kmcommands.cpp b/kmail/kmcommands.cpp index 023c887d..95d6108b 100644 --- a/kmail/kmcommands.cpp +++ b/kmail/kmcommands.cpp @@ -61,7 +61,7 @@ #include #include #include -#include +#include #include #include #include @@ -76,8 +76,8 @@ #include #include // KIO headers -#include -#include +#include +#include #include @@ -120,7 +120,7 @@ using KMail::RedirectDialog; #include "broadcaststatus.h" #include "globalsettings.h" -#include +#include #include "kcalendariface_stub.h" #include "progressmanager.h" diff --git a/kmail/kmcommands.h b/kmail/kmcommands.h index 3bb20988..dab733cc 100644 --- a/kmail/kmcommands.h +++ b/kmail/kmcommands.h @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include "kmmsgbase.h" // for KMMsgStatus #include #include diff --git a/kmail/kmcomposewin.cpp b/kmail/kmcomposewin.cpp index d635b647..fe145b82 100644 --- a/kmail/kmcomposewin.cpp +++ b/kmail/kmcomposewin.cpp @@ -58,7 +58,7 @@ using KRecentAddress::RecentAddresses; #include #include #include -#include +#include #include #include #include @@ -69,7 +69,7 @@ using KRecentAddress::RecentAddresses; #include #include -#include +#include #include "klistboxdialog.h" @@ -85,12 +85,12 @@ using KRecentAddress::RecentAddresses; #include #include #include -#include +#include #include #include #include #include -#include +#include #include #include #include diff --git a/kmail/kmcomposewin.h b/kmail/kmcomposewin.h index 840d3434..eb108b06 100644 --- a/kmail/kmcomposewin.h +++ b/kmail/kmcomposewin.h @@ -28,7 +28,7 @@ #include #include -#include +#include #include #include #include diff --git a/kmail/kmedit.cpp b/kmail/kmedit.cpp index 8301a12c..6f03e87d 100644 --- a/kmail/kmedit.cpp +++ b/kmail/kmedit.cpp @@ -18,7 +18,7 @@ #include using KPIM::MailListDrag; -#include +#include #include #include diff --git a/kmail/kmfawidgets.cpp b/kmail/kmfawidgets.cpp index 0183cf88..f5fa9f9a 100644 --- a/kmail/kmfawidgets.cpp +++ b/kmail/kmfawidgets.cpp @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include diff --git a/kmail/kmfilter.cpp b/kmail/kmfilter.cpp index e9e9f379..2898990d 100644 --- a/kmail/kmfilter.cpp +++ b/kmail/kmfilter.cpp @@ -34,7 +34,7 @@ using KMail::FilterLog; #include #include #include -#include +#include #include diff --git a/kmail/kmfilteraction.cpp b/kmail/kmfilteraction.cpp index 06dbb56e..1fce0df5 100644 --- a/kmail/kmfilteraction.cpp +++ b/kmail/kmfilteraction.cpp @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include using KPIM::CollectingProcess; #include diff --git a/kmail/kmfilterdlg.cpp b/kmail/kmfilterdlg.cpp index fd00a3cc..b5010cc3 100644 --- a/kmail/kmfilterdlg.cpp +++ b/kmail/kmfilterdlg.cpp @@ -26,7 +26,7 @@ using KMail::FilterImporterExporter; #include #include #include -#include +#include #include #include #include diff --git a/kmail/kmfiltermgr.cpp b/kmail/kmfiltermgr.cpp index 1f5d9ad5..ac2915e7 100644 --- a/kmail/kmfiltermgr.cpp +++ b/kmail/kmfiltermgr.cpp @@ -23,7 +23,7 @@ using KMail::MessageProperty; // other KDE headers #include #include -#include +#include // other TQt headers #include diff --git a/kmail/kmfolder.cpp b/kmail/kmfolder.cpp index 5c4af405..88338a05 100644 --- a/kmail/kmfolder.cpp +++ b/kmail/kmfolder.cpp @@ -715,7 +715,7 @@ TQString KMFolder::idString() const if (!relativePath.isEmpty()) relativePath = relativePath.right( relativePath.length() - 1 ) + "/"; TQString escapedName = name(); - /* Escape [ and ] as they are disallowed for kconfig sections and that is + /* Escape [ and ] as they are disallowed for tdeconfig sections and that is what the idString is primarily used for. */ escapedName.replace( "[", "%(" ); escapedName.replace( "]", "%)" ); diff --git a/kmail/kmfoldercachedimap.cpp b/kmail/kmfoldercachedimap.cpp index 4ce92cb1..ab66c95f 100644 --- a/kmail/kmfoldercachedimap.cpp +++ b/kmail/kmfoldercachedimap.cpp @@ -66,9 +66,9 @@ using KMail::ListJob; #include #include #include -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/kmail/kmfolderdia.cpp b/kmail/kmfolderdia.cpp index 3f7208a9..ad13ac2e 100644 --- a/kmail/kmfolderdia.cpp +++ b/kmail/kmfolderdia.cpp @@ -55,7 +55,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kmail/kmfolderimap.cpp b/kmail/kmfolderimap.cpp index 07a52c5c..ead0a943 100644 --- a/kmail/kmfolderimap.cpp +++ b/kmail/kmfolderimap.cpp @@ -52,8 +52,8 @@ using KMail::RenameJob; #include "acljobs.h" #include -#include -#include +#include +#include #include #include diff --git a/kmail/kmfolderimap.h b/kmail/kmfolderimap.h index 490b13a6..5f454c59 100644 --- a/kmail/kmfolderimap.h +++ b/kmail/kmfolderimap.h @@ -29,8 +29,8 @@ #include "kmfoldermbox.h" #include "kmmsgbase.h" -#include "kio/job.h" -#include "kio/global.h" +#include "tdeio/job.h" +#include "tdeio/global.h" #include diff --git a/kmail/kmfoldermaildir.cpp b/kmail/kmfoldermaildir.cpp index c6fa7be2..6f291f41 100644 --- a/kmail/kmfoldermaildir.cpp +++ b/kmail/kmfoldermaildir.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include "kmfoldermaildir.h" #include "kmfoldermgr.h" #include "kmfolder.h" diff --git a/kmail/kmfoldermaildir.h b/kmail/kmfoldermaildir.h index fc199031..b4bdb3c5 100644 --- a/kmail/kmfoldermaildir.h +++ b/kmail/kmfoldermaildir.h @@ -3,7 +3,7 @@ #include "kmfolderindex.h" -#include +#include #include diff --git a/kmail/kmfoldermbox.cpp b/kmail/kmfoldermbox.cpp index 13799680..1579db0c 100644 --- a/kmail/kmfoldermbox.cpp +++ b/kmail/kmfoldermbox.cpp @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include diff --git a/kmail/kmfoldermgr.cpp b/kmail/kmfoldermgr.cpp index 2c3d10a5..44d2a153 100644 --- a/kmail/kmfoldermgr.cpp +++ b/kmail/kmfoldermgr.cpp @@ -20,7 +20,7 @@ #include #include -#include +#include #include #include diff --git a/kmail/kmfoldersearch.cpp b/kmail/kmfoldersearch.cpp index fa34f5b9..038ddbe1 100644 --- a/kmail/kmfoldersearch.cpp +++ b/kmail/kmfoldersearch.cpp @@ -30,7 +30,7 @@ #include #include -#include +#include #include #include diff --git a/kmail/kmfoldertree.cpp b/kmail/kmfoldertree.cpp index 9d259f56..9a7cd477 100644 --- a/kmail/kmfoldertree.cpp +++ b/kmail/kmfoldertree.cpp @@ -34,7 +34,7 @@ using namespace KPIM; #include #include #include -#include +#include #include #include diff --git a/kmail/kmheaders.cpp b/kmail/kmheaders.cpp index 2ed379c9..6910ad6e 100644 --- a/kmail/kmheaders.cpp +++ b/kmail/kmheaders.cpp @@ -38,7 +38,7 @@ using namespace KPIM; #include #include #include -#include +#include #include #include diff --git a/kmail/kmkernel.cpp b/kmail/kmkernel.cpp index 354fe768..1761a762 100644 --- a/kmail/kmkernel.cpp +++ b/kmail/kmkernel.cpp @@ -30,7 +30,7 @@ using KPIM::BroadcastStatus; #include "undostack.h" #include "accountmanager.h" using KMail::AccountManager; -#include +#include #include "kmversion.h" #include "kmreaderwin.h" #include "kmmainwidget.h" @@ -61,14 +61,14 @@ using KMail::FolderIface; #include #include #include -#include +#include #include #include #include #include #include #include -#include +#include #include using KWallet::Wallet; #include "actionscheduler.h" diff --git a/kmail/kmkernel.h b/kmail/kmkernel.h index 9d2b5070..5d80d659 100644 --- a/kmail/kmkernel.h +++ b/kmail/kmkernel.h @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include #include diff --git a/kmail/kmlineeditspell.cpp b/kmail/kmlineeditspell.cpp index acf0b0c0..7916c1be 100644 --- a/kmail/kmlineeditspell.cpp +++ b/kmail/kmlineeditspell.cpp @@ -14,7 +14,7 @@ #include #include -#include +#include #include #include diff --git a/kmail/kmmainwidget.cpp b/kmail/kmmainwidget.cpp index 14ccaba0..8681ff9e 100644 --- a/kmail/kmmainwidget.cpp +++ b/kmail/kmmainwidget.cpp @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kmail/kmmainwin.cpp b/kmail/kmmainwin.cpp index 8e14e984..ee785801 100644 --- a/kmail/kmmainwin.cpp +++ b/kmail/kmmainwin.cpp @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kmail/kmmessage.cpp b/kmail/kmmessage.cpp index aabc14bc..5b4f8cf9 100644 --- a/kmail/kmmessage.cpp +++ b/kmail/kmmessage.cpp @@ -37,7 +37,7 @@ using KMail::HeaderStrategy; #include #include #include -#include +#include #include #include #include diff --git a/kmail/kmmimeparttree.cpp b/kmail/kmmimeparttree.cpp index 74cbe62e..48456824 100644 --- a/kmail/kmmimeparttree.cpp +++ b/kmail/kmmimeparttree.cpp @@ -42,7 +42,7 @@ #include #include -#include +#include #include #include diff --git a/kmail/kmmimeparttree.h b/kmail/kmmimeparttree.h index a5634b09..606c515f 100644 --- a/kmail/kmmimeparttree.h +++ b/kmail/kmmimeparttree.h @@ -36,7 +36,7 @@ #define KMMIMEPARTTREE_H #include -#include +#include #include diff --git a/kmail/kmmsgpart.h b/kmail/kmmsgpart.h index 9d69f87c..b49b5a30 100644 --- a/kmail/kmmsgpart.h +++ b/kmail/kmmsgpart.h @@ -224,7 +224,7 @@ public: /** Set to true if the headers should be loaded */ void setLoadHeaders( bool load ) { mLoadHeaders = load; } - /** Returns true if the part itself (as returned by kioslave) should be loaded */ + /** Returns true if the part itself (as returned by tdeioslave) should be loaded */ bool loadPart() { return mLoadPart; } /** Set to true if the part itself should be loaded */ diff --git a/kmail/kmmsgpartdlg.h b/kmail/kmmsgpartdlg.h index 78588eb1..0132be01 100644 --- a/kmail/kmmsgpartdlg.h +++ b/kmail/kmmsgpartdlg.h @@ -21,7 +21,7 @@ #define kmmsgpartdlg_h #include -#include +#include class KMMessagePart; class TQPushButton; diff --git a/kmail/kmpopfiltercnfrmdlg.cpp b/kmail/kmpopfiltercnfrmdlg.cpp index 5cbbacda..fa9faafb 100644 --- a/kmail/kmpopfiltercnfrmdlg.cpp +++ b/kmail/kmpopfiltercnfrmdlg.cpp @@ -20,7 +20,7 @@ #include #include -#include +#include #include diff --git a/kmail/kmreaderwin.cpp b/kmail/kmreaderwin.cpp index 0568035b..2405a3e5 100644 --- a/kmail/kmreaderwin.cpp +++ b/kmail/kmreaderwin.cpp @@ -14,7 +14,7 @@ #include "kmversion.h" #include "kmmainwidget.h" #include "kmreadermainwin.h" -#include +#include #include "kmfolderindex.h" #include "kmcommands.h" #include "kmmsgpartdlg.h" @@ -97,7 +97,7 @@ using KMail::TeeHtmlWriter; #include // Sven's : for access and getpid #include #include -#include +#include #include #include #include diff --git a/kmail/kmsearchpattern.cpp b/kmail/kmsearchpattern.cpp index 0d94c149..1ab6381e 100644 --- a/kmail/kmsearchpattern.cpp +++ b/kmail/kmsearchpattern.cpp @@ -19,7 +19,7 @@ using KMail::FilterLog; #include #include #include -#include +#include #include diff --git a/kmail/kmsender.cpp b/kmail/kmsender.cpp index d6a2f8ad..bf9a819c 100644 --- a/kmail/kmsender.cpp +++ b/kmail/kmsender.cpp @@ -10,14 +10,14 @@ #include using namespace KMime::Types; -#include -#include +#include +#include #include #include #include #include #include -#include +#include #include #include diff --git a/kmail/kmsender_p.h b/kmail/kmsender_p.h index f87fd2a3..d07dcf34 100644 --- a/kmail/kmsender_p.h +++ b/kmail/kmsender_p.h @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include class TDEProcess; diff --git a/kmail/kmservertest.cpp b/kmail/kmservertest.cpp index 8548670a..d2326394 100644 --- a/kmail/kmservertest.cpp +++ b/kmail/kmservertest.cpp @@ -39,10 +39,10 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include //----------------------------------------------------------------------------- KMServerTest::KMServerTest( const TQString & protocol, const TQString & host, int port ) diff --git a/kmail/kmtransport.cpp b/kmail/kmtransport.cpp index 2092376f..2432031b 100644 --- a/kmail/kmtransport.cpp +++ b/kmail/kmtransport.cpp @@ -33,7 +33,7 @@ #include #include -#include +#include #include #include #include diff --git a/kmail/listjob.cpp b/kmail/listjob.cpp index 79efe49c..d8ee1e10 100644 --- a/kmail/listjob.cpp +++ b/kmail/listjob.cpp @@ -39,9 +39,9 @@ using KPIM::ProgressManager; #include #include -#include -#include -#include +#include +#include +#include #include #include diff --git a/kmail/mailinglist-magic.cpp b/kmail/mailinglist-magic.cpp index e199e3d0..1f927084 100644 --- a/kmail/mailinglist-magic.cpp +++ b/kmail/mailinglist-magic.cpp @@ -7,7 +7,7 @@ #include "kmmessage.h" -#include +#include #include #include diff --git a/kmail/networkaccount.cpp b/kmail/networkaccount.cpp index 62581bf9..93693dd7 100644 --- a/kmail/networkaccount.cpp +++ b/kmail/networkaccount.cpp @@ -32,8 +32,8 @@ #include "kmkernel.h" #include "globalsettings.h" -#include -#include +#include +#include #include #include #include diff --git a/kmail/objecttreeparser.cpp b/kmail/objecttreeparser.cpp index 6ea48bf0..7051542b 100644 --- a/kmail/objecttreeparser.cpp +++ b/kmail/objecttreeparser.cpp @@ -40,7 +40,7 @@ #include "kmkernel.h" #include "kmreaderwin.h" #include "partNode.h" -#include +#include #include #include "partmetadata.h" #include "attachmentstrategy.h" diff --git a/kmail/partNode.h b/kmail/partNode.h index b764c9df..20328dde 100644 --- a/kmail/partNode.h +++ b/kmail/partNode.h @@ -42,7 +42,7 @@ #include #include -#include +#include #include #include diff --git a/kmail/popaccount.cpp b/kmail/popaccount.cpp index 0d6c6e75..e20b1f13 100644 --- a/kmail/popaccount.cpp +++ b/kmail/popaccount.cpp @@ -42,9 +42,9 @@ using KPIM::BroadcastStatus; #include #include #include -#include -#include -#include +#include +#include +#include using TDEIO::MetaData; #include diff --git a/kmail/quotajobs.cpp b/kmail/quotajobs.cpp index b08d7f91..f8272cac 100644 --- a/kmail/quotajobs.cpp +++ b/kmail/quotajobs.cpp @@ -29,7 +29,7 @@ * your version. */ #include "quotajobs.h" -#include +#include #include using namespace KMail; diff --git a/kmail/quotajobs.h b/kmail/quotajobs.h index 3e453b50..1749fe0e 100644 --- a/kmail/quotajobs.h +++ b/kmail/quotajobs.h @@ -34,7 +34,7 @@ #include -#include +#include #include #include diff --git a/kmail/renamejob.cpp b/kmail/renamejob.cpp index 5e2a43d3..7b1b80e3 100644 --- a/kmail/renamejob.cpp +++ b/kmail/renamejob.cpp @@ -41,9 +41,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include diff --git a/kmail/searchjob.cpp b/kmail/searchjob.cpp index 6e3040bd..f7af79c2 100644 --- a/kmail/searchjob.cpp +++ b/kmail/searchjob.cpp @@ -40,9 +40,9 @@ using KPIM::ProgressManager; #include #include -#include -#include -#include +#include +#include +#include #include #include @@ -98,7 +98,7 @@ void SearchJob::searchCompleteFolder() TQT_SLOT( slotSearchResult( TDEIO::Job * ) ) ); } else - { // for the "/ folder" of an imap account, searching blocks the kioslave + { // for the "/ folder" of an imap account, searching blocks the tdeioslave slotSearchData( job, TQString() ); slotSearchResult( job ); } diff --git a/kmail/searchwindow.cpp b/kmail/searchwindow.cpp index 15bf5f07..849cba8b 100644 --- a/kmail/searchwindow.cpp +++ b/kmail/searchwindow.cpp @@ -39,7 +39,7 @@ #include #include #include -#include +#include #include #include diff --git a/kmail/sieveconfig.cpp b/kmail/sieveconfig.cpp index 8e185f3a..61ebc7a6 100644 --- a/kmail/sieveconfig.cpp +++ b/kmail/sieveconfig.cpp @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include diff --git a/kmail/sievejob.cpp b/kmail/sievejob.cpp index 3e823a7a..96f0a608 100644 --- a/kmail/sievejob.cpp +++ b/kmail/sievejob.cpp @@ -18,9 +18,9 @@ #include "sievejob.h" -#include +#include using TDEIO::Job; -// +// using TDEIO::UDSAtomTypes; using TDEIO::UDSEntryList; using TDEIO::UDSEntry; diff --git a/kmail/sievejob.h b/kmail/sievejob.h index 84e31614..fb1d3a90 100644 --- a/kmail/sievejob.h +++ b/kmail/sievejob.h @@ -22,7 +22,7 @@ #include #include -#include +#include class TQTextDecoder; namespace TDEIO { diff --git a/kmail/snippetwidget.cpp b/kmail/snippetwidget.cpp index 4997386e..b7ba16f1 100644 --- a/kmail/snippetwidget.cpp +++ b/kmail/snippetwidget.cpp @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kmail/transportmanager.cpp b/kmail/transportmanager.cpp index ced8f771..158d9abb 100644 --- a/kmail/transportmanager.cpp +++ b/kmail/transportmanager.cpp @@ -21,7 +21,7 @@ #include "kmtransport.h" #include "kmkernel.h" #include -#include +#include namespace KMail { diff --git a/kmail/util.h b/kmail/util.h index 30b01cba..aa4aac28 100644 --- a/kmail/util.h +++ b/kmail/util.h @@ -43,7 +43,7 @@ #include #include -#include +#include #include #include diff --git a/kmail/xfaceconfigurator.cpp b/kmail/xfaceconfigurator.cpp index 5a279b92..e35b2e0e 100644 --- a/kmail/xfaceconfigurator.cpp +++ b/kmail/xfaceconfigurator.cpp @@ -38,13 +38,13 @@ #include #include -#include +#include #include #include #include #include #include -#include +#include using namespace TDEIO; #include using namespace KPIM; diff --git a/kmailcvt/CMakeLists.txt b/kmailcvt/CMakeLists.txt index 26b2ce6b..9a566690 100644 --- a/kmailcvt/CMakeLists.txt +++ b/kmailcvt/CMakeLists.txt @@ -44,6 +44,6 @@ tde_add_executable( kmailcvt AUTOMOC filter_opera.cxx filter_thunderbird.cxx filter_kmail_maildir.cxx filter_sylpheed.cxx filter_thebat.cxx filter_lnotes.cxx filter_kmail_archive.cxx - LINK kio-shared + LINK tdeio-shared DESTINATION ${BIN_INSTALL_DIR} ) diff --git a/kmailcvt/filter_evolution.cxx b/kmailcvt/filter_evolution.cxx index 900b134b..017385d4 100644 --- a/kmailcvt/filter_evolution.cxx +++ b/kmailcvt/filter_evolution.cxx @@ -22,7 +22,7 @@ #include #include -#include +#include #include diff --git a/kmailcvt/filter_evolution_v2.cxx b/kmailcvt/filter_evolution_v2.cxx index d6095319..34192f6a 100644 --- a/kmailcvt/filter_evolution_v2.cxx +++ b/kmailcvt/filter_evolution_v2.cxx @@ -20,7 +20,7 @@ #include #include -#include +#include #include @@ -56,7 +56,7 @@ void FilterEvolution_v2::import(FilterInfo *info) //TQString mailDir = KFileDialog::getExistingDirectory(TQDir::homeDirPath(), info->parent()); KFileDialog *kfd; - kfd = new KFileDialog( evolDir, "", 0, "kfiledialog", true ); + kfd = new KFileDialog( evolDir, "", 0, "tdefiledialog", true ); kfd->setMode(KFile::Directory | KFile::LocalOnly); kfd->exec(); mailDir = kfd->selectedFile(); diff --git a/kmailcvt/filter_kmail_maildir.cxx b/kmailcvt/filter_kmail_maildir.cxx index 594313ae..9305e644 100644 --- a/kmailcvt/filter_kmail_maildir.cxx +++ b/kmailcvt/filter_kmail_maildir.cxx @@ -19,7 +19,7 @@ #include #include -#include +#include /** Default constructor. */ FilterKMail_maildir::FilterKMail_maildir( void ) : @@ -47,7 +47,7 @@ void FilterKMail_maildir::import( FilterInfo *info ) TQString _homeDir = TQDir::homeDirPath(); KFileDialog *kfd; - kfd = new KFileDialog( _homeDir, "", 0, "kfiledialog", true ); + kfd = new KFileDialog( _homeDir, "", 0, "tdefiledialog", true ); kfd->setMode( KFile::Directory | KFile::LocalOnly ); kfd->exec(); mailDir = kfd->selectedFile(); diff --git a/kmailcvt/filter_lnotes.cxx b/kmailcvt/filter_lnotes.cxx index 4bd3c423..8d987d0d 100644 --- a/kmailcvt/filter_lnotes.cxx +++ b/kmailcvt/filter_lnotes.cxx @@ -3,7 +3,7 @@ ------------------- begin : Wed Feb 16, 2005 copyright : (C) 2005 by Robert Rockers - email : kconfigure@rockerssoft.com + email : tdeconfigure@rockerssoft.com ***************************************************************************/ /*************************************************************************** @@ -18,7 +18,7 @@ #include #include -#include +#include #include #include #include diff --git a/kmailcvt/filter_lnotes.hxx b/kmailcvt/filter_lnotes.hxx index 709fa6ce..430ae83e 100644 --- a/kmailcvt/filter_lnotes.hxx +++ b/kmailcvt/filter_lnotes.hxx @@ -3,7 +3,7 @@ ------------------- begin : Wed Feb 16, 2005 copyright : (C) 2005 by Robert Rockers - email : kconfigure@rockerssoft.com + email : tdeconfigure@rockerssoft.com ***************************************************************************/ /*************************************************************************** diff --git a/kmailcvt/filter_mailapp.cxx b/kmailcvt/filter_mailapp.cxx index 90e05aff..51df3235 100644 --- a/kmailcvt/filter_mailapp.cxx +++ b/kmailcvt/filter_mailapp.cxx @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include diff --git a/kmailcvt/filter_mbox.cxx b/kmailcvt/filter_mbox.cxx index 1ecc6c79..78bfec07 100644 --- a/kmailcvt/filter_mbox.cxx +++ b/kmailcvt/filter_mbox.cxx @@ -17,7 +17,7 @@ #include #include -#include +#include #include #include diff --git a/kmailcvt/filter_oe.cxx b/kmailcvt/filter_oe.cxx index a87ee39a..22c7a615 100644 --- a/kmailcvt/filter_oe.cxx +++ b/kmailcvt/filter_oe.cxx @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include diff --git a/kmailcvt/filter_opera.cxx b/kmailcvt/filter_opera.cxx index 65e2eae4..784c0b10 100644 --- a/kmailcvt/filter_opera.cxx +++ b/kmailcvt/filter_opera.cxx @@ -17,7 +17,7 @@ #include #include -#include +#include #include #include @@ -50,7 +50,7 @@ void FilterOpera::import(FilterInfo *info) //TQString mailDir = KFileDialog::getExistingDirectory(TQDir::homeDirPath(), info->parent()); KFileDialog *kfd; - kfd = new KFileDialog( startdir, "", 0, "kfiledialog", true ); + kfd = new KFileDialog( startdir, "", 0, "tdefiledialog", true ); kfd->setMode(KFile::Directory | KFile::LocalOnly); kfd->exec(); TQString operaDir = kfd->selectedFile(); diff --git a/kmailcvt/filter_outlook.cxx b/kmailcvt/filter_outlook.cxx index a5a9f407..63d2848b 100644 --- a/kmailcvt/filter_outlook.cxx +++ b/kmailcvt/filter_outlook.cxx @@ -18,7 +18,7 @@ #include #include -#include +#include #include #include diff --git a/kmailcvt/filter_plain.cxx b/kmailcvt/filter_plain.cxx index 04abea3d..b29d1338 100644 --- a/kmailcvt/filter_plain.cxx +++ b/kmailcvt/filter_plain.cxx @@ -17,7 +17,7 @@ #include #include -#include +#include #include #include "filter_plain.hxx" diff --git a/kmailcvt/filter_pmail.cxx b/kmailcvt/filter_pmail.cxx index 699e3adb..d79c8f4b 100644 --- a/kmailcvt/filter_pmail.cxx +++ b/kmailcvt/filter_pmail.cxx @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include #include @@ -46,7 +46,7 @@ void FilterPMail::import(FilterInfo *info) // Select directory from where I have to import files KFileDialog *kfd; - kfd = new KFileDialog( TQDir::homeDirPath(), "", 0, "kfiledialog", true ); + kfd = new KFileDialog( TQDir::homeDirPath(), "", 0, "tdefiledialog", true ); kfd->setMode(KFile::Directory | KFile::LocalOnly); kfd->exec(); chosenDir = kfd->selectedFile(); diff --git a/kmailcvt/filter_sylpheed.cxx b/kmailcvt/filter_sylpheed.cxx index 2174c681..af03a099 100644 --- a/kmailcvt/filter_sylpheed.cxx +++ b/kmailcvt/filter_sylpheed.cxx @@ -19,7 +19,7 @@ #include #include -#include +#include #include /** Default constructor. */ @@ -46,7 +46,7 @@ void FilterSylpheed::import( FilterInfo *info ) TQString _homeDir = TQDir::homeDirPath(); KFileDialog *kfd; - kfd = new KFileDialog( _homeDir, "", 0, "kfiledialog", true ); + kfd = new KFileDialog( _homeDir, "", 0, "tdefiledialog", true ); kfd->setMode( KFile::Directory | KFile::LocalOnly ); kfd->exec(); mailDir = kfd->selectedFile(); diff --git a/kmailcvt/filter_thebat.cxx b/kmailcvt/filter_thebat.cxx index 52cd9858..499caedb 100644 --- a/kmailcvt/filter_thebat.cxx +++ b/kmailcvt/filter_thebat.cxx @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include @@ -52,7 +52,7 @@ void FilterTheBat::import( FilterInfo *info ) TQString _homeDir = TQDir::homeDirPath(); KFileDialog *kfd; - kfd = new KFileDialog( _homeDir, "", 0, "kfiledialog", true ); + kfd = new KFileDialog( _homeDir, "", 0, "tdefiledialog", true ); kfd->setMode( KFile::Directory | KFile::LocalOnly ); kfd->exec(); mailDir = kfd->selectedFile(); diff --git a/kmailcvt/filter_thunderbird.cxx b/kmailcvt/filter_thunderbird.cxx index ea739dac..d92e7efd 100644 --- a/kmailcvt/filter_thunderbird.cxx +++ b/kmailcvt/filter_thunderbird.cxx @@ -19,7 +19,7 @@ #include #include -#include +#include #include @@ -55,7 +55,7 @@ void FilterThunderbird::import(FilterInfo *info) } KFileDialog *kfd; - kfd = new KFileDialog( thunderDir, "", 0, "kfiledialog", true ); + kfd = new KFileDialog( thunderDir, "", 0, "tdefiledialog", true ); kfd->setMode(KFile::Directory | KFile::LocalOnly); kfd->exec(); mailDir = kfd->selectedFile(); diff --git a/kmobile/DESIGN b/kmobile/DESIGN index 287a3d9a..90ea509e 100644 --- a/kmobile/DESIGN +++ b/kmobile/DESIGN @@ -63,7 +63,7 @@ makes accessing mobile devices completely transparent to the application. One sample program which uses the client library is the kmobile -kioslave. In Konqueror you might access any mobile device directly +tdeioslave. In Konqueror you might access any mobile device directly by giving "mobile:/" as the URL. @@ -72,8 +72,8 @@ by giving "mobile:/" as the URL. HINTS FOR DRIVER DEVELOPERS: ---------------------------- -- KMobile device drivers are very similiar to kioslaves. Refer - at the kioslave documentation if needed. +- KMobile device drivers are very similiar to tdeioslaves. Refer + at the tdeioslave documentation if needed. - derive your driver only from the KMobileDevice class (#include ) and reimplement the functions which you really need diff --git a/kmobile/Makefile.am b/kmobile/Makefile.am index 69f90bd9..91fab181 100644 --- a/kmobile/Makefile.am +++ b/kmobile/Makefile.am @@ -1,6 +1,6 @@ ## Makefile.am for kmobile -SUBDIRS = . devices # kioslave +SUBDIRS = . devices # tdeioslave bin_PROGRAMS = kmobile diff --git a/kmobile/TODO b/kmobile/TODO index 457393bb..33b60b83 100644 --- a/kmobile/TODO +++ b/kmobile/TODO @@ -1,9 +1,9 @@ DONE: ----- -- devices:/ kioslave integration +- devices:/ tdeioslave integration - show per-device icons in konqueror (same as in the kmobile view) - fix mimetypes and their location under /share/mimelnk -- kioslaves: cellphone:/, organizer:/, pda:/, (camera:/ not activated) +- tdeioslaves: cellphone:/, organizer:/, pda:/, (camera:/ not activated) - system tray plugin - serial/IRDA/(USB?) locking features (acording to standards - done, but untested !!) diff --git a/kmobile/devices/gnokii/gnokii_mobile.cpp b/kmobile/devices/gnokii/gnokii_mobile.cpp index 95a014a6..1f33996e 100644 --- a/kmobile/devices/gnokii/gnokii_mobile.cpp +++ b/kmobile/devices/gnokii/gnokii_mobile.cpp @@ -26,10 +26,10 @@ #include #include -#include +#include #include #include -#include +#include #include #include diff --git a/kmobile/devices/skeleton/skeleton.cpp b/kmobile/devices/skeleton/skeleton.cpp index 3a7c77b0..564681cd 100644 --- a/kmobile/devices/skeleton/skeleton.cpp +++ b/kmobile/devices/skeleton/skeleton.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include diff --git a/kmobile/kioslave/Makefile.am b/kmobile/kioslave/Makefile.am deleted file mode 100644 index 6f9d2420..00000000 --- a/kmobile/kioslave/Makefile.am +++ /dev/null @@ -1,18 +0,0 @@ -SUBDIRS = mimetypes - -INCLUDES = -I$(top_srcdir)/kmobile -I$(top_srcdir) $(all_includes) - -kde_module_LTLIBRARIES = kio_mobile.la - -kio_mobile_la_SOURCES = kio_mobile.cpp -kio_mobile_la_LIBADD = $(LIB_KIO) ../libkmobileclient.la -kio_mobile_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) -module $(KDE_PLUGIN) - -kde_services_DATA = mobile.protocol cellphone.protocol \ - organizer.protocol pda.protocol -# do not install the camera protocol now - we already have a -# camera kioslave !! -# phonecamera.protocol - -messages: - $(XGETTEXT) *.cpp -o $(podir)/kio_mobile.pot diff --git a/kmobile/kioslave/cellphone.protocol b/kmobile/kioslave/cellphone.protocol deleted file mode 100644 index 5f37df78..00000000 --- a/kmobile/kioslave/cellphone.protocol +++ /dev/null @@ -1,18 +0,0 @@ -[Protocol] -exec=kio_mobile -protocol=cellphone -input=none -output=filesystem -# listing=Name -listing=Name,Type,URL,MimeType -reading=true -source=true -writing=true -makedir=true -deleting=true -# linking=true -# moving=true -# mimetype=text/plain -# determineMimetypeFromExtension=true -DocPath=kioslave/mobile.html -Icon=mobile_phone diff --git a/kmobile/kioslave/kio_mobile.cpp b/kmobile/kioslave/kio_mobile.cpp deleted file mode 100644 index e8cff4fa..00000000 --- a/kmobile/kioslave/kio_mobile.cpp +++ /dev/null @@ -1,636 +0,0 @@ -/* This file is part of the KDE KMobile library - Copyright (C) 2003 Helge Deller - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include -#include - -#include -#include -#include - -#include - -#include -#include -#include -#include - -#include "kio_mobile.h" - -#include - -using namespace TDEIO; - -#define KIO_MOBILE_DEBUG_AREA 7126 -#define PRINT_DEBUG kdDebug(KIO_MOBILE_DEBUG_AREA) << "kio_mobile: " - -extern "C" { KDE_EXPORT int kdemain(int argc, char **argv); } - -/** - * The main program. - */ -int kdemain(int argc, char **argv) -{ - TDEInstance instance( "kio_mobile" ); - - PRINT_DEBUG << "Starting " << getpid() << endl; - - if (argc != 4) { - fprintf(stderr, "Usage kio_mobile protocol pool app\n"); - return -1; - } - // let the protocol class do its work - KMobileProtocol slave(argv[2], argv[3]); - - slave.dispatchLoop(); - - PRINT_DEBUG << "Done" << endl; - return 0; -} - - -/** - * Initialize the mobile slave - */ -KMobileProtocol::KMobileProtocol(const TQCString &pool, const TQCString &app) - : SlaveBase( "mobile", pool, app) -{ -} - -KMobileProtocol::~KMobileProtocol() -{ -} - -/* - * getDeviceAndRessource("mobile:///...") - split - */ -int KMobileProtocol::getDeviceAndRessource(const TQString &_path, - TQString &devName, TQString &resource, TQString &devPath, - KMobileDevice::Capabilities &devCaps) -{ -// PRINT_DEBUG << TQString("###getDeviceAndRessource### %1\n").arg(_path); - TQStringList path = TQStringList::split('/', _path, false); - - devName = resource = devPath = TQString(); - devCaps = KMobileDevice::hasNothing; - - if (path.count() >= 1) { devName = path[0]; path.pop_front(); }; - if (path.count() >= 1) { resource = path[0]; path.pop_front(); }; - if (path.count() >= 1) devPath = path.join("/"); - - if (devName.isEmpty()) - return 0; - - int _caps = m_dev.capabilities(devName); - - if (resource.isEmpty()) { - devCaps = (KMobileDevice::Capabilities) _caps; - return 0; - } - - for (int i=0; i<31; i++) { - int cap = 1UL << i; - if ((_caps & cap) == 0) - continue; - TQString capname = m_dev.nameForCap(devName,cap); - if (capname != resource) - continue; - devCaps = (KMobileDevice::Capabilities) cap; - return 0; - } - - return TDEIO::ERR_DOES_NOT_EXIST; -} - - -static -void addAtom(TDEIO::UDSEntry& entry, unsigned int ID, long l, const TQString& s = TQString()) -{ - TDEIO::UDSAtom atom; - atom.m_uds = ID; - atom.m_long = l; - atom.m_str = s; - entry.append(atom); -} - -static -void createDirEntry(TDEIO::UDSEntry& entry, const TQString& name, const TQString& url, const TQString& mime) -{ - entry.clear(); - addAtom(entry, TDEIO::UDS_NAME, 0, name); - addAtom(entry, TDEIO::UDS_FILE_TYPE, S_IFDIR); - addAtom(entry, TDEIO::UDS_ACCESS, 0500); - addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, mime); - addAtom(entry, TDEIO::UDS_URL, 0, url); - addAtom(entry, TDEIO::UDS_USER, 0, getenv("USER")); - addAtom(entry, TDEIO::UDS_GROUP, 0, getenv("USER")); - PRINT_DEBUG << TQString("createDirEntry: File: %1 MIME: %2 URL: %3\n").arg(name).arg(mime).arg(url); -// addAtom(entry, TDEIO::UDS_SIZE, 0); - addAtom(entry, TDEIO::UDS_GUESSED_MIME_TYPE, 0, mime); -} - -static -void createFileEntry(TDEIO::UDSEntry& entry, const TQString& name, const TQString& url, const TQString& mime, - const unsigned long size = 0) -{ - entry.clear(); - addAtom(entry, TDEIO::UDS_NAME, 0, name); - addAtom(entry, TDEIO::UDS_FILE_TYPE, S_IFREG); - addAtom(entry, TDEIO::UDS_URL, 0, url); - addAtom(entry, TDEIO::UDS_ACCESS, 0400); - addAtom(entry, TDEIO::UDS_USER, 0, getenv("USER")); - addAtom(entry, TDEIO::UDS_GROUP, 0, getenv("USER")); - addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, mime); - if (size) addAtom(entry, TDEIO::UDS_SIZE, size); - addAtom(entry, TDEIO::UDS_GUESSED_MIME_TYPE, 0, mime); - PRINT_DEBUG << TQString("createFileEntry: File: %1, Size: %2, MIME: %3\n").arg(name).arg(size).arg(mime); -} - - -/** - * Get the information contained in the URL. - */ -void KMobileProtocol::get(const KURL &url) -{ - PRINT_DEBUG << "###############################\n"; - PRINT_DEBUG << TQString("get(%1)\n").arg(url.path()); - - KMobileDevice::Capabilities devCaps; - TQString devName, resource, devPath; - - int err = getDeviceAndRessource(url.path(), devName, resource, devPath, devCaps); - if (err) { - error(err, url.path()); - return; - } - - if (devName.isEmpty() || resource.isEmpty()) { - error(TDEIO::ERR_DOES_NOT_EXIST, url.path()); - return; - } - - // collect the result - TQCString result; - TQString mime; - switch (devCaps) { - case KMobileDevice::hasAddressBook: err = getVCard(devName, result, mime, devPath); - break; - case KMobileDevice::hasCalendar: err = getCalendar(devName, result, mime, devPath); - break; - case KMobileDevice::hasNotes: err = getNote(devName, result, mime, devPath); - break; - case KMobileDevice::hasFileStorage: err = getFileStorage(devName, result, mime, devPath); - break; - default: err = TDEIO::ERR_CANNOT_ENTER_DIRECTORY; /* TODO */ - } - - if (err) { - error(err, url.path()); - return; - } - - // tell the mimetype - mimeType(mime); - - // tell the length - TDEIO::filesize_t processed_size = result.length(); - totalSize(processed_size); - - // tell the contents of the URL - TQByteArray array; - array.setRawData( result.data(), result.length() ); - data(array); - array.resetRawData( result.data(), result.length() ); - processedSize( processed_size ); - // tell we are finished - data(TQByteArray()); - - // tell we are finished - finished(); -} - - -/* - * listRoot() - gives listing of all devices - */ -void KMobileProtocol::listRoot(const KURL& url) -{ - PRINT_DEBUG << TQString("########## listRoot(%1) for %2:/\n").arg(url.path()).arg(url.protocol()); - - TDEIO::UDSEntry entry; - - TQStringList deviceNames = m_dev.deviceNames(); - unsigned int dirs = deviceNames.count(); - totalSize(dirs); - - int classMask = KMobileDevice::Unclassified; - /* handle all possible protocols here and just add a .protocol file */ - if (url.protocol() == "cellphone") // cellphone:/ - classMask = KMobileDevice::Phone; - if (url.protocol() == "organizer" || // organizer:/ - url.protocol() == "pda") // pda:/ - classMask = KMobileDevice::Organizer; - if (url.protocol() == "phonecamera") // camera:/ - classMask = KMobileDevice::Camera; - - for (unsigned int i=0; i") - sub-directory of a devices - */ - -void KMobileProtocol::listTopDeviceDir(const TQString &devName) -{ - PRINT_DEBUG << TQString("listTopDeviceDir(%1)\n").arg(devName); - - TDEIO::UDSEntry entry; - unsigned int caps = m_dev.capabilities(devName); - - for (int i=0; i<31; i++) { - unsigned int cap = 1UL</") - resources of a device - */ -void KMobileProtocol::listEntries(const TQString &devName, - const TQString &resource, const TQString &devPath, - const KMobileDevice::Capabilities devCaps) -{ - PRINT_DEBUG << TQString("listEntries(%1,%2,%3)\n").arg(devName).arg(resource).arg(devPath); - switch (devCaps) { - case KMobileDevice::hasAddressBook: listAddressBook(devName, resource); - break; - case KMobileDevice::hasCalendar: listCalendar(devName, resource); - break; - case KMobileDevice::hasNotes: listNotes(devName, resource); - break; - case KMobileDevice::hasFileStorage: listFileStorage(devName, resource, devPath); - break; - default: error( ERR_CANNOT_ENTER_DIRECTORY, - TQString("/%1/%2").arg(devName).arg(resource) ); - } -} - -/* - * listAddressBook("mobile://Addressbook) - list the addressbook - */ -void KMobileProtocol::listAddressBook(const TQString &devName, const TQString &resource) -{ - PRINT_DEBUG << TQString("listAddressBook(%1)\n").arg(devName); - - TDEIO::UDSEntry entry; - - int fieldwidth; - int entries = m_dev.numAddresses(devName); - if (entries>=1000) fieldwidth=4; else - if (entries>=100) fieldwidth=3; else - if (entries>=10) fieldwidth=2; else fieldwidth=1; - totalSize(entries); -// TQRegExp rx; rx.setPattern( ".*FN:([\\w\\s]*)[\\n\\r]{2}.*" ); - TQString name; - for (int i=0; i0) - index = path.left(index).toInt(); - if (index<0 || index>=m_dev.numAddresses(devName)) - return TDEIO::ERR_DOES_NOT_EXIST; - - TQString str = m_dev.readAddress(devName, index); - if (str.isEmpty()) - return TDEIO::ERR_INTERNAL; - result = str.utf8(); - mime = entryMimeType(KMobileDevice::hasAddressBook); -// setMetaData("plugin", "const TQString &key, const TQString &value); - return 0; -} - -/* - * listCalendar("mobile://Calendar) - list the calendar entries - */ -void KMobileProtocol::listCalendar( const TQString &devName, const TQString &resource) -{ - PRINT_DEBUG << TQString("listCalendar(%1)\n").arg(devName); - - TDEIO::UDSEntry entry; - - int entries = m_dev.numCalendarEntries(devName); - totalSize(entries); - for (int i=0; i/Notes) - list the notes - */ -void KMobileProtocol::listNotes( const TQString &devName, const TQString &resource) -{ - PRINT_DEBUG << TQString("listNotes(%1)\n").arg(devName); - - TDEIO::UDSEntry entry; - - int entries = m_dev.numNotes(devName); - totalSize(entries); - for (int i=0; i0) - index = path.left(index).toInt(); - if (index<0 || index>=m_dev.numNotes(devName)) - return TDEIO::ERR_DOES_NOT_EXIST; - - TQString note = m_dev.readNote(devName, index); - if (note.isEmpty()) - return TDEIO::ERR_DOES_NOT_EXIST; - - result = note.utf8(); - mime = entryMimeType(KMobileDevice::hasNotes); - return 0; -} - -/* - * listFileStorage("mobile://Files) - list the files on the device - */ -void KMobileProtocol::listFileStorage(const TQString &devName, const TQString &resource, const TQString &devPath) -{ - PRINT_DEBUG << TQString("listFileStorage(%1,%2)\n").arg(devName).arg(devPath); - - /* TODO */ - error( TDEIO::ERR_DOES_NOT_EXIST, TQString("/%1/%2/%3").arg(devName).arg(resource).arg(devPath) ); -} - -/* - * getFileStorage() - gives the file contents of the given file - */ -int KMobileProtocol::getFileStorage(const TQString &devName, TQCString &result, TQString &mime, const TQString &path) -{ - PRINT_DEBUG << TQString("getFileStorage(%1)\n").arg(path); - - /* TODO */ - Q_UNUSED(devName); - Q_UNUSED(result); - Q_UNUSED(mime); - return TDEIO::ERR_CANNOT_ENTER_DIRECTORY; -} - - -/** - * Test if the url contains a directory or a file. - */ -void KMobileProtocol::stat( const KURL &url ) -{ - PRINT_DEBUG << "###############################\n"; - PRINT_DEBUG << TQString("stat(%1)\n").arg(url.path()); - - KMobileDevice::Capabilities devCaps; - TQString devName, resource, devPath; - - int err = getDeviceAndRessource(url.path(), devName, resource, devPath, devCaps); - if (err) { - error(err, url.path()); - return; - } - - TQStringList path = TQStringList::split('/', url.path(), false); - TQString filename = (path.count()>0) ? path[path.count()-1] : "/"; - TQString fullPath = path.join("/"); - TQString fullUrl = TQString("mobile:/%1").arg(fullPath); - - UDSEntry entry; - - bool isDir = devPath.isEmpty(); - - if (isDir) { - createDirEntry(entry, filename, fullUrl, folderMimeType(devCaps)); - } else { - createFileEntry(entry, filename, fullUrl, entryMimeType(devCaps)); - } - - statEntry(entry); - finished(); -} - -/** - * Get the mimetype. - */ -void KMobileProtocol::mimetype(const KURL &url) -{ - PRINT_DEBUG << "###############################\n"; - PRINT_DEBUG << TQString("mimetype(%1)\n").arg(url.path()); - - KMobileDevice::Capabilities devCaps; - TQString devName, resource, devPath; - - int err = getDeviceAndRessource(url.path(), devName, resource, devPath, devCaps); - if (err) { - error(err, url.path()); - return; - } - - // tell the mimetype - mimeType(entryMimeType(devCaps)); - finished(); -} - -/** - * List the contents of a directory. - */ -void KMobileProtocol::listDir(const KURL &url) -{ - PRINT_DEBUG << "###############################\n"; - PRINT_DEBUG << TQString("listDir(%1)\n").arg(url.path()); - - if (!m_dev.isKMobileAvailable()) { - error( TDEIO::ERR_CONNECTION_BROKEN, i18n("TDE Mobile Device Manager") ); - return; - } - - KMobileDevice::Capabilities devCaps; - TQString devName, resource, devPath; - - int err = getDeviceAndRessource(url.path(), devName, resource, devPath, devCaps); - if (err) { - error(err, url.path()); - return; - } - - if (devName.isEmpty()) { - listRoot(url); - return; - } - -#if 0 - if (!dev) { - error( TDEIO::ERR_DOES_NOT_EXIST, TQString("/%1").arg(devName) ); - return; - } -#endif - - if (resource.isEmpty()) { - listTopDeviceDir(devName); - return; - } - - listEntries(devName, resource, devPath, devCaps); -} diff --git a/kmobile/kioslave/kio_mobile.h b/kmobile/kioslave/kio_mobile.h deleted file mode 100644 index f534514f..00000000 --- a/kmobile/kioslave/kio_mobile.h +++ /dev/null @@ -1,70 +0,0 @@ -/* This file is part of the KDE mobile library. - Copyright (C) 2004 Helge Deller - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef __KIO_MOBILE_H__ -#define __KIO_MOBILE_H__ - -#include -#include - -#include -#include -#include - -class KMobileProtocol : public TDEIO::SlaveBase -{ -public: - KMobileProtocol( const TQCString &pool, const TQCString &app ); - ~KMobileProtocol(); - - void get( const KURL& url ); - void stat( const KURL& url ); - void mimetype( const KURL& url ); - void listDir( const KURL& url ); - -protected: - int getDeviceAndRessource(const TQString &_path, - TQString &devName, TQString &resource, TQString &devPath, - KMobileDevice::Capabilities &devCaps); - - TQString folderMimeType(int cap); - TQString entryMimeType(int cap); - - void listRoot(const KURL& url); - void listTopDeviceDir(const TQString &devName); - void listEntries(const TQString &devName, - const TQString &resource, const TQString &devPath, - const KMobileDevice::Capabilities devCaps); - - void listAddressBook(const TQString &devName, const TQString &resource); - int getVCard( const TQString &devName, TQCString &result, TQString &mime, const TQString &path ); - - void listCalendar(const TQString &devName, const TQString &resource); - int getCalendar( const TQString &devName, TQCString &result, TQString &mime, const TQString &path ); - - void listNotes(const TQString &devName, const TQString &resource); - int getNote( const TQString &devName, TQCString &result, TQString &mime, const TQString &path ); - - void listFileStorage(const TQString &devName, const TQString &resource, const TQString &devPath); - int getFileStorage( const TQString &devName, TQCString &result, TQString &mime, const TQString &path ); - -private: - KMobileClient m_dev; -}; - -#endif diff --git a/kmobile/kioslave/mimetypes/Makefile.am b/kmobile/kioslave/mimetypes/Makefile.am deleted file mode 100644 index 5105c51b..00000000 --- a/kmobile/kioslave/mimetypes/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -mimetype_DATA = \ - mobile_addressbook.desktop mobile_calendar.desktop mobile_notes.desktop \ - mobile_device.desktop -mimetypedir = $(kde_mimedir)/inode diff --git a/kmobile/kioslave/mimetypes/mobile_addressbook.desktop b/kmobile/kioslave/mimetypes/mobile_addressbook.desktop deleted file mode 100644 index cf56e024..00000000 --- a/kmobile/kioslave/mimetypes/mobile_addressbook.desktop +++ /dev/null @@ -1,60 +0,0 @@ -[Desktop Entry] -Comment=Contacts in Mobile Device -Comment[af]=Kontakte op die draagbare toestel -Comment[ar]=المراسلون ÙÙŠ الجهاز النقّال -Comment[be]=Кантакты Ñž мабільнай прыладзе -Comment[bg]=Контакти в мобилни уÑтройÑтва -Comment[bs]=Kontakti u mobilnom ureÄ‘aju -Comment[ca]=Contactes en el dispositiu mòbil -Comment[cs]=Kontakty na mobilním zařízení -Comment[cy]=Cysylltau yn y Dyfais Symudol -Comment[da]=Kontakter i mobil-enhed -Comment[de]=Kontakte im Mobilgerät -Comment[el]=Επαφές στη φοÏητή συσκευή -Comment[es]=Contactos del dispositivo móvil -Comment[et]=Mobiili kontaktid -Comment[eu]=Kontaktuak dispositibo mugikorrean -Comment[fa]=تماسها در دستگاه تلÙÙ† همراه -Comment[fi]=Mobiililaitteen yhteystiedot -Comment[fr]=Contacts dans le périphérique mobile -Comment[fy]=Kontaktpersoanen yn mobyl apparaat -Comment[ga]=Teagmhálacha i nGléas Móibíleach -Comment[gl]=Contactos no dispositivo móbil -Comment[he]=×נשי קשר בהתקן הנייד -Comment[hi]=मोबाइल उपकरण में समà¥à¤ªà¤°à¥à¤• -Comment[hu]=Címbejegyzések a mobiltelefonon -Comment[is]=Tengiliðir í farsíma eða lófatölvu -Comment[it]=Contatti nel dispositivo portatile -Comment[ja]=モãƒã‚¤ãƒ«æ©Ÿå™¨å†…ã®é€£çµ¡å…ˆ -Comment[kk]=Қалта құрылғыдағы контакттар -Comment[km]=ទំនាក់​ទំនង​ក្នុង​ឧបករណáŸâ€‹áž…áž›áŸáž -Comment[lt]=Kontaktai mobiliajame įrenginyje -Comment[mk]=Контакти од мобилен уред -Comment[ms]=Orang hubungan di dalam Peranti Mudah Alih -Comment[nb]=Kontaktliste i mobil enhet -Comment[nds]=Kontakten op de Mobilreedschap -Comment[ne]=मोबाइल यनà¥à¤¤à¥à¤°à¤®à¤¾ समà¥à¤ªà¤°à¥à¤• गरà¥à¤› -Comment[nl]=Contactpersonen in mobiel apparaat -Comment[nn]=Kontaktar i mobileiningar -Comment[pl]=Wizytówki w urzÄ…dzeniu przenoÅ›nym -Comment[pt]=Contactos no Dispositivo Móvel -Comment[pt_BR]=Contatos em Dispositivo Móvel -Comment[ro]=Contacte în dispozitiv mobil -Comment[ru]=Контакты на мобильном уÑтройÑтве -Comment[sk]=Kontakty v prenosnom zariadení -Comment[sl]=Stiki v prenosni napravi -Comment[sr]=Контакти у мобилном уређају -Comment[sr@Latn]=Kontakti u mobilnom ureÄ‘aju -Comment[sv]=Kontakter i mobilenhet -Comment[ta]=நடமாடà¯à®®à¯ சாதனதà¯à®¤à®¿à®©à¯ தொடரà¯à®ªà¯à®ªà¯à®•à®³à¯ -Comment[tg]=Ðлоқот дар даÑтгоҳи мобилӣ -Comment[tr]=Taşınabilir Aygıt BaÄŸlantıları -Comment[uk]=Контакти у мобільному приÑтрої -Comment[zh_CN]=移动设备中的è”系人 -Comment[zh_TW]=行動è£ç½®ä¸­çš„è¯çµ¡äºº -Icon=kaddressbook -Type=MimeType -MimeType=inode/addressbook -Patterns= - -X-TDE-AutoEmbed=true diff --git a/kmobile/kioslave/mimetypes/mobile_calendar.desktop b/kmobile/kioslave/mimetypes/mobile_calendar.desktop deleted file mode 100644 index 09d133ab..00000000 --- a/kmobile/kioslave/mimetypes/mobile_calendar.desktop +++ /dev/null @@ -1,60 +0,0 @@ -[Desktop Entry] -Comment=Calendar in Mobile Device -Comment[af]=Kalender op die draagbare toestel -Comment[be]=КалÑндар у мабільнай прыладзе -Comment[bg]=Календар в мобилни уÑтройÑтва -Comment[bs]=Kalendar u mobilnom ureÄ‘aju -Comment[ca]=Calendari en el dispositiu mòbil -Comment[cs]=Kalendář na mobilním zařízení -Comment[cy]=Calendr yn y Dyfais Symudol -Comment[da]=Kalender i mobil-enhed -Comment[de]=Kalender für Mobiltelefon -Comment[el]=ΗμεÏολόγιο στη φοÏητή συσκευή -Comment[eo]=Kalendaro en mobila aparato -Comment[es]=Calendario del dispositivo móvil -Comment[et]=Mobiili kalender -Comment[eu]=Egutegia dispositibo mugikorrean -Comment[fa]=تقویم در دستگاه تلÙÙ† همراه -Comment[fi]=Mobiililaitteen kalenteri -Comment[fr]=Calendrier dans un périphérique mobile -Comment[fy]=Aginda yn mobyl apparaat -Comment[ga]=Féilire i nGléas Móibíleach -Comment[gl]=Calendario no Dispositivo Móbil -Comment[he]=לוח שנה בהתקן הנייד -Comment[hi]=मोबाइल उपकरण में कैलेनà¥à¤¡à¤° -Comment[hu]=Naptár a mobiltelefonon -Comment[is]=Dagatal í farsíma eða lófatölvu -Comment[it]=Calendari nel dispositivo portatile -Comment[ja]=モãƒã‚¤ãƒ«æ©Ÿå™¨å†…ã®ã‚«ãƒ¬ãƒ³ãƒ€ãƒ¼ -Comment[kk]=Қалта құрылғыдағы күнтізбе -Comment[km]=ប្រážáž·áž‘ិន​ក្នុង​ឧបករណáŸâ€‹áž…áž›áŸáž -Comment[lt]=Kalendorius mobiliajame įrenginyje -Comment[mk]=Календар од мобилен уред -Comment[ms]=Kalendar dalam Peranti Mudah Alih -Comment[nb]=Kalender i mobil enhet -Comment[nds]=Kalenner op Mobilreedschap -Comment[ne]=मोबाइल यनà¥à¤¤à¥à¤°à¤•à¥‹ कà¥à¤¯à¤¾à¤²à¥‡à¤¨à¥à¤¡à¤° -Comment[nl]=Agenda in mobiel apparaat -Comment[nn]=Kalender i mobileiningar -Comment[pl]=Kalendarz w urzÄ…dzeniu przenoÅ›nym -Comment[pt]=Calendário no Dispositivo Móvel -Comment[pt_BR]=Calendário em Dispositivo Móvel -Comment[ro]=Calendar în dispozitiv mobil -Comment[ru]=Календарь на мобильном уÑтройÑтве -Comment[sk]=Kalendár v prenosnom zariadení -Comment[sl]=Koledar v prenosni napravi -Comment[sr]=Календар у мобилном уређају -Comment[sr@Latn]=Kalendar u mobilnom ureÄ‘aju -Comment[sv]=Kalender i mobilenhet -Comment[ta]=நடமாடà¯à®®à¯ சாதனதà¯à®¤à®¿à®²à¯ உளà¯à®³ நாளà¯à®•à®¾à®Ÿà¯à®Ÿà®¿ -Comment[tg]=Тақвим дар даÑтгоҳи мобилӣ -Comment[tr]=Cep Telefonu Takvimi -Comment[uk]=Календар у мобільному приÑтрої -Comment[zh_CN]=移动设备中的日历 -Comment[zh_TW]=行動è£ç½®ä¸­çš„行事曆 -Icon=korganizer -Type=MimeType -MimeType=inode/calendar -Patterns= - -X-TDE-AutoEmbed=true diff --git a/kmobile/kioslave/mimetypes/mobile_device.desktop b/kmobile/kioslave/mimetypes/mobile_device.desktop deleted file mode 100644 index 2f59d2de..00000000 --- a/kmobile/kioslave/mimetypes/mobile_device.desktop +++ /dev/null @@ -1,64 +0,0 @@ -[Desktop Entry] -Comment=Mobile Device -Comment[af]=Draagbare Toestel -Comment[ar]=الجهاز النقّال -Comment[be]=ÐœÐ°Ð±Ñ–Ð»ÑŒÐ½Ð°Ñ Ð¿Ñ€Ñ‹Ð»Ð°Ð´Ð° -Comment[bg]=Мобилни уÑтройÑтва -Comment[br]=Trobarzhell lem-laka -Comment[bs]=Mobilni ureÄ‘aj -Comment[ca]=Dispositiu mòbil -Comment[cs]=Mobilní zařízení -Comment[cy]=Dyfais Symudol -Comment[da]=Mobil-enhed -Comment[de]=Mobilgerät -Comment[el]=ΦοÏητή συσκευή -Comment[eo]=Mobila aparato -Comment[es]=Dispositivo móvil -Comment[et]=Mobiil -Comment[eu]=Dispositibo mugikorra -Comment[fa]=دستگاه تلÙÙ† همراه -Comment[fi]=Mobiililaite -Comment[fr]=Périphérique mobile -Comment[fy]=Mobyl apparaat -Comment[ga]=Gléas Móibíleach -Comment[gl]=Dispositivo Móbil -Comment[he]=התקן נייד -Comment[hi]=मोबाइल उपकरण -Comment[hu]=Mobil eszköz -Comment[is]=Farsími eða lófatölva -Comment[it]=Dispositivo portatile -Comment[ja]=モãƒã‚¤ãƒ«æ©Ÿå™¨ -Comment[kk]=Қалта құрылғыÑÑ‹ -Comment[km]=ឧបករណáŸâ€‹áž…áž›áŸáž -Comment[lt]=Mobilusis įrenginys -Comment[mk]=Мобилен уред -Comment[ms]=Peranti Mudah Alih -Comment[nb]=Mobil enhet -Comment[nds]=Mobilreedschap -Comment[ne]=मोबाइल यनà¥à¤¤à¥à¤° -Comment[nl]=Mobiel apparaat -Comment[nn]=Mobileining -Comment[pa]=ਮੋਬਾਇਲ ਜੰਤਰ -Comment[pl]=UrzÄ…dzenie przenoÅ›ne -Comment[pt]=Dispositivo Móvel -Comment[pt_BR]=Dispositivo Móvel -Comment[ro]=Dispozitiv mobil -Comment[ru]=Мобильное уÑтройÑтво -Comment[se]=Mobilovttadat -Comment[sk]=Prenosné zariadenie -Comment[sl]=Mobilna naprava -Comment[sr]=Мобилни уређај -Comment[sr@Latn]=Mobilni ureÄ‘aj -Comment[sv]=Mobilenhet -Comment[ta]= நடமாடà¯à®®à¯ சாதனம௠-Comment[tg]=ДаÑтгоҳи мобилӣ -Comment[tr]=Taşınabilir Aygıt -Comment[uk]=Мобільний приÑтрій -Comment[zh_CN]=移动设备 -Comment[zh_TW]=行動è£ç½® -Icon=kmobile -Type=MimeType -MimeType=kdedevice/mobiledevice -Patterns= - -X-TDE-AutoEmbed=true diff --git a/kmobile/kioslave/mimetypes/mobile_notes.desktop b/kmobile/kioslave/mimetypes/mobile_notes.desktop deleted file mode 100644 index 7878c13d..00000000 --- a/kmobile/kioslave/mimetypes/mobile_notes.desktop +++ /dev/null @@ -1,58 +0,0 @@ -[Desktop Entry] -Comment=Notes in Mobile Device -Comment[af]=Notas op die draagbare toestel -Comment[be]=Ðататкі Ñž мабільнай прыладзе -Comment[bg]=Бележки в мобилни уÑтройÑтва -Comment[bs]=BiljeÅ¡ke u mobilnom ureÄ‘aju -Comment[ca]=Notes en el dispositiu mòbil -Comment[cs]=Poznámky na mobilním zařízení -Comment[cy]=Nodiadau yn y Dyfais Symudol -Comment[da]=Noter i mobil-enhed -Comment[de]=Notizen im Mobilgerät -Comment[el]=Σημειώσεις στη φοÏητή συσκευή -Comment[es]=Notas del dispositivo móvil -Comment[et]=Mobiili märkmed (Notes) -Comment[eu]=Oharrak dispositibo mugikorrean -Comment[fa]=یادداشتها در دستگاه تلÙÙ† همراه -Comment[fi]=Mobiililaitteen muistio -Comment[fr]=Notes dans un périphérique mobile -Comment[fy]=Notysjes yn mobyl apparaat -Comment[ga]=Nótaí i nGléas Móibíleach -Comment[gl]=Notas no Dispositivo Móbil -Comment[he]=×¤×ª×§×™× ×‘×”×ª×§×Ÿ הנייד -Comment[hi]=मोबाइल उपकरण में टीप -Comment[hu]=Feljegyzések a mobiltelefonon -Comment[is]=Ãminningar í farsíma eða lófatölvu -Comment[it]=Note nel dispositivo portatile -Comment[ja]=モãƒã‚¤ãƒ«æ©Ÿå™¨å†…ã®ãƒ¡ãƒ¢ -Comment[kk]=Қалта құрылғыдағы жазбалар -Comment[km]=ចំណាំ​ក្នុង​ឧបករណáŸâ€‹áž…áž›áŸáž -Comment[lt]=UžraÅ¡ai mobiliajame įrenginyje -Comment[mk]=Белешки од мобилен уред -Comment[ms]=Nota dalam Peranti Mudah Alih -Comment[nb]=Notater i mobil enhet -Comment[nds]=Notizen op Mobilreedschap -Comment[ne]=मोबाइल यनà¥à¤¤à¥à¤° भितà¥à¤°à¤•à¤¾ टिपोट -Comment[nl]=Notities in mobiel apparaat -Comment[nn]=Notat i mobileiningar -Comment[pl]=Notatki w urzÄ…dzeniu przenoÅ›nym -Comment[pt]=Notas no Dispositivo Móvel -Comment[pt_BR]=Notas em Dispositivo Móvel -Comment[ru]=Заметки на мобильном уÑтройÑтве -Comment[sk]=Poznámky v prenosnom zariadení -Comment[sl]=Notice v prenosni napravi -Comment[sr]=Белешке у мобилном уређају -Comment[sr@Latn]=BeleÅ¡ke u mobilnom ureÄ‘aju -Comment[sv]=Anteckning i mobilenhet -Comment[ta]=நடமாடà¯à®®à¯ சாதனதà¯à®¤à®¿à®©à¯ கà¯à®±à®¿à®ªà¯à®ªà¯à®•à®³à¯ -Comment[tg]=Хабарҳо дар даÑтгоҳи мобилӣ -Comment[tr]=Cep Telefonu Notları -Comment[uk]=Ðотатки у мобільному приÑтрої -Comment[zh_CN]=移动电è¯ä¸­çš„便笺 -Comment[zh_TW]=行動è£ç½®ä¸­çš„備忘錄 -Icon=knotes -Type=MimeType -MimeType=inode/notes -Patterns= - -X-TDE-AutoEmbed=true diff --git a/kmobile/kioslave/mobile.protocol b/kmobile/kioslave/mobile.protocol deleted file mode 100644 index 7b8385f8..00000000 --- a/kmobile/kioslave/mobile.protocol +++ /dev/null @@ -1,18 +0,0 @@ -[Protocol] -exec=kio_mobile -protocol=mobile -input=none -output=filesystem -# listing=Name -listing=Name,Type,Size,Date,AccessDate,Access,URL,MimeType -reading=true -source=true -writing=true -makedir=true -deleting=true -# linking=true -# moving=true -# mimetype=text/plain -# determineMimetypeFromExtension=true -DocPath=kioslave/mobile.html -Icon=kaddressbook diff --git a/kmobile/kioslave/organizer.protocol b/kmobile/kioslave/organizer.protocol deleted file mode 100644 index b211a74f..00000000 --- a/kmobile/kioslave/organizer.protocol +++ /dev/null @@ -1,18 +0,0 @@ -[Protocol] -exec=kio_mobile -protocol=organizer -input=none -output=filesystem -# listing=Name -listing=Name,Type,Size,Date,AccessDate,Access,URL,MimeType -reading=true -source=true -writing=true -makedir=true -deleting=true -# linking=true -# moving=true -# mimetype=text/plain -# determineMimetypeFromExtension=true -DocPath=kioslave/mobile.html -Icon=mobile_organizer diff --git a/kmobile/kioslave/pda.protocol b/kmobile/kioslave/pda.protocol deleted file mode 100644 index cbab2e03..00000000 --- a/kmobile/kioslave/pda.protocol +++ /dev/null @@ -1,18 +0,0 @@ -[Protocol] -exec=kio_mobile -protocol=pda -input=none -output=filesystem -# listing=Name -listing=Name,Type,Size,Date,AccessDate,Access,URL,MimeType -reading=true -source=true -writing=true -makedir=true -deleting=true -# linking=true -# moving=true -# mimetype=text/plain -# determineMimetypeFromExtension=true -DocPath=kioslave/mobile.html -Icon=mobile_organizer diff --git a/kmobile/kioslave/phonecamera.protocol b/kmobile/kioslave/phonecamera.protocol deleted file mode 100644 index 7a0b341f..00000000 --- a/kmobile/kioslave/phonecamera.protocol +++ /dev/null @@ -1,18 +0,0 @@ -[Protocol] -exec=kio_mobile -protocol=camera -input=none -output=filesystem -# listing=Name -listing=Name,Type,URL,MimeType -reading=true -source=true -writing=true -makedir=true -deleting=true -# linking=true -# moving=true -# mimetype=text/plain -# determineMimetypeFromExtension=true -DocPath=kioslave/mobile.html -Icon=mobile_camera diff --git a/kmobile/kmobile.cpp b/kmobile/kmobile.cpp index 2453b3ba..3e2663b5 100644 --- a/kmobile/kmobile.cpp +++ b/kmobile/kmobile.cpp @@ -29,10 +29,10 @@ #include #include #include -#include -#include +#include +#include #include -#include +#include #include diff --git a/kmobile/kmobileclient.cpp b/kmobile/kmobileclient.cpp index 9c95efe8..2eef7c53 100644 --- a/kmobile/kmobileclient.cpp +++ b/kmobile/kmobileclient.cpp @@ -72,8 +72,8 @@ bool KMobileClient::startKMobileApplication() arg << TQString("kmobile") << params; TQCString replyType; TQByteArray replyData; - bool ok = call("klauncher", "klauncher", "tdeinit_exec_wait(TQString,TQStringList)", data, replyType, replyData); - PRINT_DEBUG << TQString("DCOP-CALL to klauncher: %1\n").arg(ok?"ok.":"failed."); + bool ok = call("tdelauncher", "tdelauncher", "tdeinit_exec_wait(TQString,TQStringList)", data, replyType, replyData); + PRINT_DEBUG << TQString("DCOP-CALL to tdelauncher: %1\n").arg(ok?"ok.":"failed."); return ok; } diff --git a/kmobile/kmobiledevice.cpp b/kmobile/kmobiledevice.cpp index d1e03132..3c970ab1 100644 --- a/kmobile/kmobiledevice.cpp +++ b/kmobile/kmobiledevice.cpp @@ -34,9 +34,9 @@ #include #include "kmobiledevice.h" #include -#include +#include -#include +#include #include #include diff --git a/kmobile/kmobiledevice.h b/kmobile/kmobiledevice.h index 111a26e5..ffd568ea 100644 --- a/kmobile/kmobiledevice.h +++ b/kmobile/kmobiledevice.h @@ -30,8 +30,8 @@ #include #include -#include -#include +#include +#include #include @@ -202,7 +202,7 @@ public: ********************** * FILE STORAGE SUPPORT ********************** - * mostly compatible to the kioslave base class + * mostly compatible to the tdeioslave base class */ /** @@ -435,7 +435,7 @@ signals: /** * Call this to show a message box from the slave (it will in fact be handled - * by kio_uiserver, so that the progress info dialog for the slave is hidden + * by tdeio_uiserver, so that the progress info dialog for the slave is hidden * while this message box is shown) * @param type type of message box: QuestionYesNo, WarningYesNo, WarningContinueCancel... * @param text Message string. May contain newlines. diff --git a/kmobile/kmobileiface.h b/kmobile/kmobileiface.h index 60974b26..bac1a9ae 100644 --- a/kmobile/kmobileiface.h +++ b/kmobile/kmobileiface.h @@ -46,7 +46,7 @@ k_dcop: virtual bool storeNote( TQString deviceName, int index, TQString note ) = 0; /* - * DCOP functions for the devices:/ kioslave + * DCOP functions for the devices:/ tdeioslave */ k_dcop: virtual TQStringList kio_devices_deviceInfo(TQString deviceName) = 0; diff --git a/kmobile/kmobileitem.cpp b/kmobile/kmobileitem.cpp index dec9924a..e7e97854 100644 --- a/kmobile/kmobileitem.cpp +++ b/kmobile/kmobileitem.cpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include "kmobileitem.h" diff --git a/kmobile/kmobileview.cpp b/kmobile/kmobileview.cpp index 0080b57a..f90c9adf 100644 --- a/kmobile/kmobileview.cpp +++ b/kmobile/kmobileview.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include "kmobileview.h" #include "kmobileitem.h" @@ -392,17 +392,17 @@ bool KMobileView::storeNote( TQString deviceName, int index, TQString note ) /* - * DCOP Implementation for the devices:/ kioslave + * DCOP Implementation for the devices:/ tdeioslave */ /* * returns the information for the given deviceName for usage in the - * the devices kioslave. The TQStringList returned is comparable to the - * format of /etc/fstab file. Please refer to the devices kioslave for + * the devices tdeioslave. The TQStringList returned is comparable to the + * format of /etc/fstab file. Please refer to the devices tdeioslave for * further information. * If deviceName is empty, this functions returns information for all * active mobile devices. - * (function is only used by the devices kioslave - don't use elsewhere !) + * (function is only used by the devices tdeioslave - don't use elsewhere !) */ TQStringList KMobileView::kio_devices_deviceInfo(TQString deviceName) { diff --git a/kmobile/kmobileview.h b/kmobile/kmobileview.h index 39e2a53e..4672349f 100644 --- a/kmobile/kmobileview.h +++ b/kmobile/kmobileview.h @@ -63,7 +63,7 @@ public: TQString readNote( TQString deviceName, int index ); bool storeNote( TQString deviceName, int index, TQString note ); - /* devices kioslave support: */ + /* devices tdeioslave support: */ TQStringList kio_devices_deviceInfo(TQString deviceName); public: diff --git a/kmobile/tdeioslave/Makefile.am b/kmobile/tdeioslave/Makefile.am new file mode 100644 index 00000000..df5288ec --- /dev/null +++ b/kmobile/tdeioslave/Makefile.am @@ -0,0 +1,18 @@ +SUBDIRS = mimetypes + +INCLUDES = -I$(top_srcdir)/kmobile -I$(top_srcdir) $(all_includes) + +kde_module_LTLIBRARIES = kio_mobile.la + +kio_mobile_la_SOURCES = kio_mobile.cpp +kio_mobile_la_LIBADD = $(LIB_KIO) ../libkmobileclient.la +kio_mobile_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) -module $(KDE_PLUGIN) + +kde_services_DATA = mobile.protocol cellphone.protocol \ + organizer.protocol pda.protocol +# do not install the camera protocol now - we already have a +# camera tdeioslave !! +# phonecamera.protocol + +messages: + $(XGETTEXT) *.cpp -o $(podir)/tdeio_mobile.pot diff --git a/kmobile/tdeioslave/cellphone.protocol b/kmobile/tdeioslave/cellphone.protocol new file mode 100644 index 00000000..c47e2547 --- /dev/null +++ b/kmobile/tdeioslave/cellphone.protocol @@ -0,0 +1,18 @@ +[Protocol] +exec=kio_mobile +protocol=cellphone +input=none +output=filesystem +# listing=Name +listing=Name,Type,URL,MimeType +reading=true +source=true +writing=true +makedir=true +deleting=true +# linking=true +# moving=true +# mimetype=text/plain +# determineMimetypeFromExtension=true +DocPath=tdeioslave/mobile.html +Icon=mobile_phone diff --git a/kmobile/tdeioslave/kio_mobile.cpp b/kmobile/tdeioslave/kio_mobile.cpp new file mode 100644 index 00000000..e8cff4fa --- /dev/null +++ b/kmobile/tdeioslave/kio_mobile.cpp @@ -0,0 +1,636 @@ +/* This file is part of the KDE KMobile library + Copyright (C) 2003 Helge Deller + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + +*/ + +#include +#include + +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include "kio_mobile.h" + +#include + +using namespace TDEIO; + +#define KIO_MOBILE_DEBUG_AREA 7126 +#define PRINT_DEBUG kdDebug(KIO_MOBILE_DEBUG_AREA) << "kio_mobile: " + +extern "C" { KDE_EXPORT int kdemain(int argc, char **argv); } + +/** + * The main program. + */ +int kdemain(int argc, char **argv) +{ + TDEInstance instance( "kio_mobile" ); + + PRINT_DEBUG << "Starting " << getpid() << endl; + + if (argc != 4) { + fprintf(stderr, "Usage kio_mobile protocol pool app\n"); + return -1; + } + // let the protocol class do its work + KMobileProtocol slave(argv[2], argv[3]); + + slave.dispatchLoop(); + + PRINT_DEBUG << "Done" << endl; + return 0; +} + + +/** + * Initialize the mobile slave + */ +KMobileProtocol::KMobileProtocol(const TQCString &pool, const TQCString &app) + : SlaveBase( "mobile", pool, app) +{ +} + +KMobileProtocol::~KMobileProtocol() +{ +} + +/* + * getDeviceAndRessource("mobile:///...") - split + */ +int KMobileProtocol::getDeviceAndRessource(const TQString &_path, + TQString &devName, TQString &resource, TQString &devPath, + KMobileDevice::Capabilities &devCaps) +{ +// PRINT_DEBUG << TQString("###getDeviceAndRessource### %1\n").arg(_path); + TQStringList path = TQStringList::split('/', _path, false); + + devName = resource = devPath = TQString(); + devCaps = KMobileDevice::hasNothing; + + if (path.count() >= 1) { devName = path[0]; path.pop_front(); }; + if (path.count() >= 1) { resource = path[0]; path.pop_front(); }; + if (path.count() >= 1) devPath = path.join("/"); + + if (devName.isEmpty()) + return 0; + + int _caps = m_dev.capabilities(devName); + + if (resource.isEmpty()) { + devCaps = (KMobileDevice::Capabilities) _caps; + return 0; + } + + for (int i=0; i<31; i++) { + int cap = 1UL << i; + if ((_caps & cap) == 0) + continue; + TQString capname = m_dev.nameForCap(devName,cap); + if (capname != resource) + continue; + devCaps = (KMobileDevice::Capabilities) cap; + return 0; + } + + return TDEIO::ERR_DOES_NOT_EXIST; +} + + +static +void addAtom(TDEIO::UDSEntry& entry, unsigned int ID, long l, const TQString& s = TQString()) +{ + TDEIO::UDSAtom atom; + atom.m_uds = ID; + atom.m_long = l; + atom.m_str = s; + entry.append(atom); +} + +static +void createDirEntry(TDEIO::UDSEntry& entry, const TQString& name, const TQString& url, const TQString& mime) +{ + entry.clear(); + addAtom(entry, TDEIO::UDS_NAME, 0, name); + addAtom(entry, TDEIO::UDS_FILE_TYPE, S_IFDIR); + addAtom(entry, TDEIO::UDS_ACCESS, 0500); + addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, mime); + addAtom(entry, TDEIO::UDS_URL, 0, url); + addAtom(entry, TDEIO::UDS_USER, 0, getenv("USER")); + addAtom(entry, TDEIO::UDS_GROUP, 0, getenv("USER")); + PRINT_DEBUG << TQString("createDirEntry: File: %1 MIME: %2 URL: %3\n").arg(name).arg(mime).arg(url); +// addAtom(entry, TDEIO::UDS_SIZE, 0); + addAtom(entry, TDEIO::UDS_GUESSED_MIME_TYPE, 0, mime); +} + +static +void createFileEntry(TDEIO::UDSEntry& entry, const TQString& name, const TQString& url, const TQString& mime, + const unsigned long size = 0) +{ + entry.clear(); + addAtom(entry, TDEIO::UDS_NAME, 0, name); + addAtom(entry, TDEIO::UDS_FILE_TYPE, S_IFREG); + addAtom(entry, TDEIO::UDS_URL, 0, url); + addAtom(entry, TDEIO::UDS_ACCESS, 0400); + addAtom(entry, TDEIO::UDS_USER, 0, getenv("USER")); + addAtom(entry, TDEIO::UDS_GROUP, 0, getenv("USER")); + addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, mime); + if (size) addAtom(entry, TDEIO::UDS_SIZE, size); + addAtom(entry, TDEIO::UDS_GUESSED_MIME_TYPE, 0, mime); + PRINT_DEBUG << TQString("createFileEntry: File: %1, Size: %2, MIME: %3\n").arg(name).arg(size).arg(mime); +} + + +/** + * Get the information contained in the URL. + */ +void KMobileProtocol::get(const KURL &url) +{ + PRINT_DEBUG << "###############################\n"; + PRINT_DEBUG << TQString("get(%1)\n").arg(url.path()); + + KMobileDevice::Capabilities devCaps; + TQString devName, resource, devPath; + + int err = getDeviceAndRessource(url.path(), devName, resource, devPath, devCaps); + if (err) { + error(err, url.path()); + return; + } + + if (devName.isEmpty() || resource.isEmpty()) { + error(TDEIO::ERR_DOES_NOT_EXIST, url.path()); + return; + } + + // collect the result + TQCString result; + TQString mime; + switch (devCaps) { + case KMobileDevice::hasAddressBook: err = getVCard(devName, result, mime, devPath); + break; + case KMobileDevice::hasCalendar: err = getCalendar(devName, result, mime, devPath); + break; + case KMobileDevice::hasNotes: err = getNote(devName, result, mime, devPath); + break; + case KMobileDevice::hasFileStorage: err = getFileStorage(devName, result, mime, devPath); + break; + default: err = TDEIO::ERR_CANNOT_ENTER_DIRECTORY; /* TODO */ + } + + if (err) { + error(err, url.path()); + return; + } + + // tell the mimetype + mimeType(mime); + + // tell the length + TDEIO::filesize_t processed_size = result.length(); + totalSize(processed_size); + + // tell the contents of the URL + TQByteArray array; + array.setRawData( result.data(), result.length() ); + data(array); + array.resetRawData( result.data(), result.length() ); + processedSize( processed_size ); + // tell we are finished + data(TQByteArray()); + + // tell we are finished + finished(); +} + + +/* + * listRoot() - gives listing of all devices + */ +void KMobileProtocol::listRoot(const KURL& url) +{ + PRINT_DEBUG << TQString("########## listRoot(%1) for %2:/\n").arg(url.path()).arg(url.protocol()); + + TDEIO::UDSEntry entry; + + TQStringList deviceNames = m_dev.deviceNames(); + unsigned int dirs = deviceNames.count(); + totalSize(dirs); + + int classMask = KMobileDevice::Unclassified; + /* handle all possible protocols here and just add a .protocol file */ + if (url.protocol() == "cellphone") // cellphone:/ + classMask = KMobileDevice::Phone; + if (url.protocol() == "organizer" || // organizer:/ + url.protocol() == "pda") // pda:/ + classMask = KMobileDevice::Organizer; + if (url.protocol() == "phonecamera") // camera:/ + classMask = KMobileDevice::Camera; + + for (unsigned int i=0; i") - sub-directory of a devices + */ + +void KMobileProtocol::listTopDeviceDir(const TQString &devName) +{ + PRINT_DEBUG << TQString("listTopDeviceDir(%1)\n").arg(devName); + + TDEIO::UDSEntry entry; + unsigned int caps = m_dev.capabilities(devName); + + for (int i=0; i<31; i++) { + unsigned int cap = 1UL</") - resources of a device + */ +void KMobileProtocol::listEntries(const TQString &devName, + const TQString &resource, const TQString &devPath, + const KMobileDevice::Capabilities devCaps) +{ + PRINT_DEBUG << TQString("listEntries(%1,%2,%3)\n").arg(devName).arg(resource).arg(devPath); + switch (devCaps) { + case KMobileDevice::hasAddressBook: listAddressBook(devName, resource); + break; + case KMobileDevice::hasCalendar: listCalendar(devName, resource); + break; + case KMobileDevice::hasNotes: listNotes(devName, resource); + break; + case KMobileDevice::hasFileStorage: listFileStorage(devName, resource, devPath); + break; + default: error( ERR_CANNOT_ENTER_DIRECTORY, + TQString("/%1/%2").arg(devName).arg(resource) ); + } +} + +/* + * listAddressBook("mobile://Addressbook) - list the addressbook + */ +void KMobileProtocol::listAddressBook(const TQString &devName, const TQString &resource) +{ + PRINT_DEBUG << TQString("listAddressBook(%1)\n").arg(devName); + + TDEIO::UDSEntry entry; + + int fieldwidth; + int entries = m_dev.numAddresses(devName); + if (entries>=1000) fieldwidth=4; else + if (entries>=100) fieldwidth=3; else + if (entries>=10) fieldwidth=2; else fieldwidth=1; + totalSize(entries); +// TQRegExp rx; rx.setPattern( ".*FN:([\\w\\s]*)[\\n\\r]{2}.*" ); + TQString name; + for (int i=0; i0) + index = path.left(index).toInt(); + if (index<0 || index>=m_dev.numAddresses(devName)) + return TDEIO::ERR_DOES_NOT_EXIST; + + TQString str = m_dev.readAddress(devName, index); + if (str.isEmpty()) + return TDEIO::ERR_INTERNAL; + result = str.utf8(); + mime = entryMimeType(KMobileDevice::hasAddressBook); +// setMetaData("plugin", "const TQString &key, const TQString &value); + return 0; +} + +/* + * listCalendar("mobile://Calendar) - list the calendar entries + */ +void KMobileProtocol::listCalendar( const TQString &devName, const TQString &resource) +{ + PRINT_DEBUG << TQString("listCalendar(%1)\n").arg(devName); + + TDEIO::UDSEntry entry; + + int entries = m_dev.numCalendarEntries(devName); + totalSize(entries); + for (int i=0; i/Notes) - list the notes + */ +void KMobileProtocol::listNotes( const TQString &devName, const TQString &resource) +{ + PRINT_DEBUG << TQString("listNotes(%1)\n").arg(devName); + + TDEIO::UDSEntry entry; + + int entries = m_dev.numNotes(devName); + totalSize(entries); + for (int i=0; i0) + index = path.left(index).toInt(); + if (index<0 || index>=m_dev.numNotes(devName)) + return TDEIO::ERR_DOES_NOT_EXIST; + + TQString note = m_dev.readNote(devName, index); + if (note.isEmpty()) + return TDEIO::ERR_DOES_NOT_EXIST; + + result = note.utf8(); + mime = entryMimeType(KMobileDevice::hasNotes); + return 0; +} + +/* + * listFileStorage("mobile://Files) - list the files on the device + */ +void KMobileProtocol::listFileStorage(const TQString &devName, const TQString &resource, const TQString &devPath) +{ + PRINT_DEBUG << TQString("listFileStorage(%1,%2)\n").arg(devName).arg(devPath); + + /* TODO */ + error( TDEIO::ERR_DOES_NOT_EXIST, TQString("/%1/%2/%3").arg(devName).arg(resource).arg(devPath) ); +} + +/* + * getFileStorage() - gives the file contents of the given file + */ +int KMobileProtocol::getFileStorage(const TQString &devName, TQCString &result, TQString &mime, const TQString &path) +{ + PRINT_DEBUG << TQString("getFileStorage(%1)\n").arg(path); + + /* TODO */ + Q_UNUSED(devName); + Q_UNUSED(result); + Q_UNUSED(mime); + return TDEIO::ERR_CANNOT_ENTER_DIRECTORY; +} + + +/** + * Test if the url contains a directory or a file. + */ +void KMobileProtocol::stat( const KURL &url ) +{ + PRINT_DEBUG << "###############################\n"; + PRINT_DEBUG << TQString("stat(%1)\n").arg(url.path()); + + KMobileDevice::Capabilities devCaps; + TQString devName, resource, devPath; + + int err = getDeviceAndRessource(url.path(), devName, resource, devPath, devCaps); + if (err) { + error(err, url.path()); + return; + } + + TQStringList path = TQStringList::split('/', url.path(), false); + TQString filename = (path.count()>0) ? path[path.count()-1] : "/"; + TQString fullPath = path.join("/"); + TQString fullUrl = TQString("mobile:/%1").arg(fullPath); + + UDSEntry entry; + + bool isDir = devPath.isEmpty(); + + if (isDir) { + createDirEntry(entry, filename, fullUrl, folderMimeType(devCaps)); + } else { + createFileEntry(entry, filename, fullUrl, entryMimeType(devCaps)); + } + + statEntry(entry); + finished(); +} + +/** + * Get the mimetype. + */ +void KMobileProtocol::mimetype(const KURL &url) +{ + PRINT_DEBUG << "###############################\n"; + PRINT_DEBUG << TQString("mimetype(%1)\n").arg(url.path()); + + KMobileDevice::Capabilities devCaps; + TQString devName, resource, devPath; + + int err = getDeviceAndRessource(url.path(), devName, resource, devPath, devCaps); + if (err) { + error(err, url.path()); + return; + } + + // tell the mimetype + mimeType(entryMimeType(devCaps)); + finished(); +} + +/** + * List the contents of a directory. + */ +void KMobileProtocol::listDir(const KURL &url) +{ + PRINT_DEBUG << "###############################\n"; + PRINT_DEBUG << TQString("listDir(%1)\n").arg(url.path()); + + if (!m_dev.isKMobileAvailable()) { + error( TDEIO::ERR_CONNECTION_BROKEN, i18n("TDE Mobile Device Manager") ); + return; + } + + KMobileDevice::Capabilities devCaps; + TQString devName, resource, devPath; + + int err = getDeviceAndRessource(url.path(), devName, resource, devPath, devCaps); + if (err) { + error(err, url.path()); + return; + } + + if (devName.isEmpty()) { + listRoot(url); + return; + } + +#if 0 + if (!dev) { + error( TDEIO::ERR_DOES_NOT_EXIST, TQString("/%1").arg(devName) ); + return; + } +#endif + + if (resource.isEmpty()) { + listTopDeviceDir(devName); + return; + } + + listEntries(devName, resource, devPath, devCaps); +} diff --git a/kmobile/tdeioslave/kio_mobile.h b/kmobile/tdeioslave/kio_mobile.h new file mode 100644 index 00000000..05a30a22 --- /dev/null +++ b/kmobile/tdeioslave/kio_mobile.h @@ -0,0 +1,70 @@ +/* This file is part of the KDE mobile library. + Copyright (C) 2004 Helge Deller + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef __KIO_MOBILE_H__ +#define __KIO_MOBILE_H__ + +#include +#include + +#include +#include +#include + +class KMobileProtocol : public TDEIO::SlaveBase +{ +public: + KMobileProtocol( const TQCString &pool, const TQCString &app ); + ~KMobileProtocol(); + + void get( const KURL& url ); + void stat( const KURL& url ); + void mimetype( const KURL& url ); + void listDir( const KURL& url ); + +protected: + int getDeviceAndRessource(const TQString &_path, + TQString &devName, TQString &resource, TQString &devPath, + KMobileDevice::Capabilities &devCaps); + + TQString folderMimeType(int cap); + TQString entryMimeType(int cap); + + void listRoot(const KURL& url); + void listTopDeviceDir(const TQString &devName); + void listEntries(const TQString &devName, + const TQString &resource, const TQString &devPath, + const KMobileDevice::Capabilities devCaps); + + void listAddressBook(const TQString &devName, const TQString &resource); + int getVCard( const TQString &devName, TQCString &result, TQString &mime, const TQString &path ); + + void listCalendar(const TQString &devName, const TQString &resource); + int getCalendar( const TQString &devName, TQCString &result, TQString &mime, const TQString &path ); + + void listNotes(const TQString &devName, const TQString &resource); + int getNote( const TQString &devName, TQCString &result, TQString &mime, const TQString &path ); + + void listFileStorage(const TQString &devName, const TQString &resource, const TQString &devPath); + int getFileStorage( const TQString &devName, TQCString &result, TQString &mime, const TQString &path ); + +private: + KMobileClient m_dev; +}; + +#endif diff --git a/kmobile/tdeioslave/mimetypes/Makefile.am b/kmobile/tdeioslave/mimetypes/Makefile.am new file mode 100644 index 00000000..5105c51b --- /dev/null +++ b/kmobile/tdeioslave/mimetypes/Makefile.am @@ -0,0 +1,4 @@ +mimetype_DATA = \ + mobile_addressbook.desktop mobile_calendar.desktop mobile_notes.desktop \ + mobile_device.desktop +mimetypedir = $(kde_mimedir)/inode diff --git a/kmobile/tdeioslave/mimetypes/mobile_addressbook.desktop b/kmobile/tdeioslave/mimetypes/mobile_addressbook.desktop new file mode 100644 index 00000000..cf56e024 --- /dev/null +++ b/kmobile/tdeioslave/mimetypes/mobile_addressbook.desktop @@ -0,0 +1,60 @@ +[Desktop Entry] +Comment=Contacts in Mobile Device +Comment[af]=Kontakte op die draagbare toestel +Comment[ar]=المراسلون ÙÙŠ الجهاز النقّال +Comment[be]=Кантакты Ñž мабільнай прыладзе +Comment[bg]=Контакти в мобилни уÑтройÑтва +Comment[bs]=Kontakti u mobilnom ureÄ‘aju +Comment[ca]=Contactes en el dispositiu mòbil +Comment[cs]=Kontakty na mobilním zařízení +Comment[cy]=Cysylltau yn y Dyfais Symudol +Comment[da]=Kontakter i mobil-enhed +Comment[de]=Kontakte im Mobilgerät +Comment[el]=Επαφές στη φοÏητή συσκευή +Comment[es]=Contactos del dispositivo móvil +Comment[et]=Mobiili kontaktid +Comment[eu]=Kontaktuak dispositibo mugikorrean +Comment[fa]=تماسها در دستگاه تلÙÙ† همراه +Comment[fi]=Mobiililaitteen yhteystiedot +Comment[fr]=Contacts dans le périphérique mobile +Comment[fy]=Kontaktpersoanen yn mobyl apparaat +Comment[ga]=Teagmhálacha i nGléas Móibíleach +Comment[gl]=Contactos no dispositivo móbil +Comment[he]=×נשי קשר בהתקן הנייד +Comment[hi]=मोबाइल उपकरण में समà¥à¤ªà¤°à¥à¤• +Comment[hu]=Címbejegyzések a mobiltelefonon +Comment[is]=Tengiliðir í farsíma eða lófatölvu +Comment[it]=Contatti nel dispositivo portatile +Comment[ja]=モãƒã‚¤ãƒ«æ©Ÿå™¨å†…ã®é€£çµ¡å…ˆ +Comment[kk]=Қалта құрылғыдағы контакттар +Comment[km]=ទំនាក់​ទំនង​ក្នុង​ឧបករណáŸâ€‹áž…áž›áŸáž +Comment[lt]=Kontaktai mobiliajame įrenginyje +Comment[mk]=Контакти од мобилен уред +Comment[ms]=Orang hubungan di dalam Peranti Mudah Alih +Comment[nb]=Kontaktliste i mobil enhet +Comment[nds]=Kontakten op de Mobilreedschap +Comment[ne]=मोबाइल यनà¥à¤¤à¥à¤°à¤®à¤¾ समà¥à¤ªà¤°à¥à¤• गरà¥à¤› +Comment[nl]=Contactpersonen in mobiel apparaat +Comment[nn]=Kontaktar i mobileiningar +Comment[pl]=Wizytówki w urzÄ…dzeniu przenoÅ›nym +Comment[pt]=Contactos no Dispositivo Móvel +Comment[pt_BR]=Contatos em Dispositivo Móvel +Comment[ro]=Contacte în dispozitiv mobil +Comment[ru]=Контакты на мобильном уÑтройÑтве +Comment[sk]=Kontakty v prenosnom zariadení +Comment[sl]=Stiki v prenosni napravi +Comment[sr]=Контакти у мобилном уређају +Comment[sr@Latn]=Kontakti u mobilnom ureÄ‘aju +Comment[sv]=Kontakter i mobilenhet +Comment[ta]=நடமாடà¯à®®à¯ சாதனதà¯à®¤à®¿à®©à¯ தொடரà¯à®ªà¯à®ªà¯à®•à®³à¯ +Comment[tg]=Ðлоқот дар даÑтгоҳи мобилӣ +Comment[tr]=Taşınabilir Aygıt BaÄŸlantıları +Comment[uk]=Контакти у мобільному приÑтрої +Comment[zh_CN]=移动设备中的è”系人 +Comment[zh_TW]=行動è£ç½®ä¸­çš„è¯çµ¡äºº +Icon=kaddressbook +Type=MimeType +MimeType=inode/addressbook +Patterns= + +X-TDE-AutoEmbed=true diff --git a/kmobile/tdeioslave/mimetypes/mobile_calendar.desktop b/kmobile/tdeioslave/mimetypes/mobile_calendar.desktop new file mode 100644 index 00000000..09d133ab --- /dev/null +++ b/kmobile/tdeioslave/mimetypes/mobile_calendar.desktop @@ -0,0 +1,60 @@ +[Desktop Entry] +Comment=Calendar in Mobile Device +Comment[af]=Kalender op die draagbare toestel +Comment[be]=КалÑндар у мабільнай прыладзе +Comment[bg]=Календар в мобилни уÑтройÑтва +Comment[bs]=Kalendar u mobilnom ureÄ‘aju +Comment[ca]=Calendari en el dispositiu mòbil +Comment[cs]=Kalendář na mobilním zařízení +Comment[cy]=Calendr yn y Dyfais Symudol +Comment[da]=Kalender i mobil-enhed +Comment[de]=Kalender für Mobiltelefon +Comment[el]=ΗμεÏολόγιο στη φοÏητή συσκευή +Comment[eo]=Kalendaro en mobila aparato +Comment[es]=Calendario del dispositivo móvil +Comment[et]=Mobiili kalender +Comment[eu]=Egutegia dispositibo mugikorrean +Comment[fa]=تقویم در دستگاه تلÙÙ† همراه +Comment[fi]=Mobiililaitteen kalenteri +Comment[fr]=Calendrier dans un périphérique mobile +Comment[fy]=Aginda yn mobyl apparaat +Comment[ga]=Féilire i nGléas Móibíleach +Comment[gl]=Calendario no Dispositivo Móbil +Comment[he]=לוח שנה בהתקן הנייד +Comment[hi]=मोबाइल उपकरण में कैलेनà¥à¤¡à¤° +Comment[hu]=Naptár a mobiltelefonon +Comment[is]=Dagatal í farsíma eða lófatölvu +Comment[it]=Calendari nel dispositivo portatile +Comment[ja]=モãƒã‚¤ãƒ«æ©Ÿå™¨å†…ã®ã‚«ãƒ¬ãƒ³ãƒ€ãƒ¼ +Comment[kk]=Қалта құрылғыдағы күнтізбе +Comment[km]=ប្រážáž·áž‘ិន​ក្នុង​ឧបករណáŸâ€‹áž…áž›áŸáž +Comment[lt]=Kalendorius mobiliajame įrenginyje +Comment[mk]=Календар од мобилен уред +Comment[ms]=Kalendar dalam Peranti Mudah Alih +Comment[nb]=Kalender i mobil enhet +Comment[nds]=Kalenner op Mobilreedschap +Comment[ne]=मोबाइल यनà¥à¤¤à¥à¤°à¤•à¥‹ कà¥à¤¯à¤¾à¤²à¥‡à¤¨à¥à¤¡à¤° +Comment[nl]=Agenda in mobiel apparaat +Comment[nn]=Kalender i mobileiningar +Comment[pl]=Kalendarz w urzÄ…dzeniu przenoÅ›nym +Comment[pt]=Calendário no Dispositivo Móvel +Comment[pt_BR]=Calendário em Dispositivo Móvel +Comment[ro]=Calendar în dispozitiv mobil +Comment[ru]=Календарь на мобильном уÑтройÑтве +Comment[sk]=Kalendár v prenosnom zariadení +Comment[sl]=Koledar v prenosni napravi +Comment[sr]=Календар у мобилном уређају +Comment[sr@Latn]=Kalendar u mobilnom ureÄ‘aju +Comment[sv]=Kalender i mobilenhet +Comment[ta]=நடமாடà¯à®®à¯ சாதனதà¯à®¤à®¿à®²à¯ உளà¯à®³ நாளà¯à®•à®¾à®Ÿà¯à®Ÿà®¿ +Comment[tg]=Тақвим дар даÑтгоҳи мобилӣ +Comment[tr]=Cep Telefonu Takvimi +Comment[uk]=Календар у мобільному приÑтрої +Comment[zh_CN]=移动设备中的日历 +Comment[zh_TW]=行動è£ç½®ä¸­çš„行事曆 +Icon=korganizer +Type=MimeType +MimeType=inode/calendar +Patterns= + +X-TDE-AutoEmbed=true diff --git a/kmobile/tdeioslave/mimetypes/mobile_device.desktop b/kmobile/tdeioslave/mimetypes/mobile_device.desktop new file mode 100644 index 00000000..2f59d2de --- /dev/null +++ b/kmobile/tdeioslave/mimetypes/mobile_device.desktop @@ -0,0 +1,64 @@ +[Desktop Entry] +Comment=Mobile Device +Comment[af]=Draagbare Toestel +Comment[ar]=الجهاز النقّال +Comment[be]=ÐœÐ°Ð±Ñ–Ð»ÑŒÐ½Ð°Ñ Ð¿Ñ€Ñ‹Ð»Ð°Ð´Ð° +Comment[bg]=Мобилни уÑтройÑтва +Comment[br]=Trobarzhell lem-laka +Comment[bs]=Mobilni ureÄ‘aj +Comment[ca]=Dispositiu mòbil +Comment[cs]=Mobilní zařízení +Comment[cy]=Dyfais Symudol +Comment[da]=Mobil-enhed +Comment[de]=Mobilgerät +Comment[el]=ΦοÏητή συσκευή +Comment[eo]=Mobila aparato +Comment[es]=Dispositivo móvil +Comment[et]=Mobiil +Comment[eu]=Dispositibo mugikorra +Comment[fa]=دستگاه تلÙÙ† همراه +Comment[fi]=Mobiililaite +Comment[fr]=Périphérique mobile +Comment[fy]=Mobyl apparaat +Comment[ga]=Gléas Móibíleach +Comment[gl]=Dispositivo Móbil +Comment[he]=התקן נייד +Comment[hi]=मोबाइल उपकरण +Comment[hu]=Mobil eszköz +Comment[is]=Farsími eða lófatölva +Comment[it]=Dispositivo portatile +Comment[ja]=モãƒã‚¤ãƒ«æ©Ÿå™¨ +Comment[kk]=Қалта құрылғыÑÑ‹ +Comment[km]=ឧបករណáŸâ€‹áž…áž›áŸáž +Comment[lt]=Mobilusis įrenginys +Comment[mk]=Мобилен уред +Comment[ms]=Peranti Mudah Alih +Comment[nb]=Mobil enhet +Comment[nds]=Mobilreedschap +Comment[ne]=मोबाइल यनà¥à¤¤à¥à¤° +Comment[nl]=Mobiel apparaat +Comment[nn]=Mobileining +Comment[pa]=ਮੋਬਾਇਲ ਜੰਤਰ +Comment[pl]=UrzÄ…dzenie przenoÅ›ne +Comment[pt]=Dispositivo Móvel +Comment[pt_BR]=Dispositivo Móvel +Comment[ro]=Dispozitiv mobil +Comment[ru]=Мобильное уÑтройÑтво +Comment[se]=Mobilovttadat +Comment[sk]=Prenosné zariadenie +Comment[sl]=Mobilna naprava +Comment[sr]=Мобилни уређај +Comment[sr@Latn]=Mobilni ureÄ‘aj +Comment[sv]=Mobilenhet +Comment[ta]= நடமாடà¯à®®à¯ சாதனம௠+Comment[tg]=ДаÑтгоҳи мобилӣ +Comment[tr]=Taşınabilir Aygıt +Comment[uk]=Мобільний приÑтрій +Comment[zh_CN]=移动设备 +Comment[zh_TW]=行動è£ç½® +Icon=kmobile +Type=MimeType +MimeType=kdedevice/mobiledevice +Patterns= + +X-TDE-AutoEmbed=true diff --git a/kmobile/tdeioslave/mimetypes/mobile_notes.desktop b/kmobile/tdeioslave/mimetypes/mobile_notes.desktop new file mode 100644 index 00000000..7878c13d --- /dev/null +++ b/kmobile/tdeioslave/mimetypes/mobile_notes.desktop @@ -0,0 +1,58 @@ +[Desktop Entry] +Comment=Notes in Mobile Device +Comment[af]=Notas op die draagbare toestel +Comment[be]=Ðататкі Ñž мабільнай прыладзе +Comment[bg]=Бележки в мобилни уÑтройÑтва +Comment[bs]=BiljeÅ¡ke u mobilnom ureÄ‘aju +Comment[ca]=Notes en el dispositiu mòbil +Comment[cs]=Poznámky na mobilním zařízení +Comment[cy]=Nodiadau yn y Dyfais Symudol +Comment[da]=Noter i mobil-enhed +Comment[de]=Notizen im Mobilgerät +Comment[el]=Σημειώσεις στη φοÏητή συσκευή +Comment[es]=Notas del dispositivo móvil +Comment[et]=Mobiili märkmed (Notes) +Comment[eu]=Oharrak dispositibo mugikorrean +Comment[fa]=یادداشتها در دستگاه تلÙÙ† همراه +Comment[fi]=Mobiililaitteen muistio +Comment[fr]=Notes dans un périphérique mobile +Comment[fy]=Notysjes yn mobyl apparaat +Comment[ga]=Nótaí i nGléas Móibíleach +Comment[gl]=Notas no Dispositivo Móbil +Comment[he]=×¤×ª×§×™× ×‘×”×ª×§×Ÿ הנייד +Comment[hi]=मोबाइल उपकरण में टीप +Comment[hu]=Feljegyzések a mobiltelefonon +Comment[is]=Ãminningar í farsíma eða lófatölvu +Comment[it]=Note nel dispositivo portatile +Comment[ja]=モãƒã‚¤ãƒ«æ©Ÿå™¨å†…ã®ãƒ¡ãƒ¢ +Comment[kk]=Қалта құрылғыдағы жазбалар +Comment[km]=ចំណាំ​ក្នុង​ឧបករណáŸâ€‹áž…áž›áŸáž +Comment[lt]=UžraÅ¡ai mobiliajame įrenginyje +Comment[mk]=Белешки од мобилен уред +Comment[ms]=Nota dalam Peranti Mudah Alih +Comment[nb]=Notater i mobil enhet +Comment[nds]=Notizen op Mobilreedschap +Comment[ne]=मोबाइल यनà¥à¤¤à¥à¤° भितà¥à¤°à¤•à¤¾ टिपोट +Comment[nl]=Notities in mobiel apparaat +Comment[nn]=Notat i mobileiningar +Comment[pl]=Notatki w urzÄ…dzeniu przenoÅ›nym +Comment[pt]=Notas no Dispositivo Móvel +Comment[pt_BR]=Notas em Dispositivo Móvel +Comment[ru]=Заметки на мобильном уÑтройÑтве +Comment[sk]=Poznámky v prenosnom zariadení +Comment[sl]=Notice v prenosni napravi +Comment[sr]=Белешке у мобилном уређају +Comment[sr@Latn]=BeleÅ¡ke u mobilnom ureÄ‘aju +Comment[sv]=Anteckning i mobilenhet +Comment[ta]=நடமாடà¯à®®à¯ சாதனதà¯à®¤à®¿à®©à¯ கà¯à®±à®¿à®ªà¯à®ªà¯à®•à®³à¯ +Comment[tg]=Хабарҳо дар даÑтгоҳи мобилӣ +Comment[tr]=Cep Telefonu Notları +Comment[uk]=Ðотатки у мобільному приÑтрої +Comment[zh_CN]=移动电è¯ä¸­çš„便笺 +Comment[zh_TW]=行動è£ç½®ä¸­çš„備忘錄 +Icon=knotes +Type=MimeType +MimeType=inode/notes +Patterns= + +X-TDE-AutoEmbed=true diff --git a/kmobile/tdeioslave/mobile.protocol b/kmobile/tdeioslave/mobile.protocol new file mode 100644 index 00000000..e87d7154 --- /dev/null +++ b/kmobile/tdeioslave/mobile.protocol @@ -0,0 +1,18 @@ +[Protocol] +exec=kio_mobile +protocol=mobile +input=none +output=filesystem +# listing=Name +listing=Name,Type,Size,Date,AccessDate,Access,URL,MimeType +reading=true +source=true +writing=true +makedir=true +deleting=true +# linking=true +# moving=true +# mimetype=text/plain +# determineMimetypeFromExtension=true +DocPath=tdeioslave/mobile.html +Icon=kaddressbook diff --git a/kmobile/tdeioslave/organizer.protocol b/kmobile/tdeioslave/organizer.protocol new file mode 100644 index 00000000..3b83e002 --- /dev/null +++ b/kmobile/tdeioslave/organizer.protocol @@ -0,0 +1,18 @@ +[Protocol] +exec=kio_mobile +protocol=organizer +input=none +output=filesystem +# listing=Name +listing=Name,Type,Size,Date,AccessDate,Access,URL,MimeType +reading=true +source=true +writing=true +makedir=true +deleting=true +# linking=true +# moving=true +# mimetype=text/plain +# determineMimetypeFromExtension=true +DocPath=tdeioslave/mobile.html +Icon=mobile_organizer diff --git a/kmobile/tdeioslave/pda.protocol b/kmobile/tdeioslave/pda.protocol new file mode 100644 index 00000000..8113b5bf --- /dev/null +++ b/kmobile/tdeioslave/pda.protocol @@ -0,0 +1,18 @@ +[Protocol] +exec=kio_mobile +protocol=pda +input=none +output=filesystem +# listing=Name +listing=Name,Type,Size,Date,AccessDate,Access,URL,MimeType +reading=true +source=true +writing=true +makedir=true +deleting=true +# linking=true +# moving=true +# mimetype=text/plain +# determineMimetypeFromExtension=true +DocPath=tdeioslave/mobile.html +Icon=mobile_organizer diff --git a/kmobile/tdeioslave/phonecamera.protocol b/kmobile/tdeioslave/phonecamera.protocol new file mode 100644 index 00000000..296ebccb --- /dev/null +++ b/kmobile/tdeioslave/phonecamera.protocol @@ -0,0 +1,18 @@ +[Protocol] +exec=kio_mobile +protocol=camera +input=none +output=filesystem +# listing=Name +listing=Name,Type,URL,MimeType +reading=true +source=true +writing=true +makedir=true +deleting=true +# linking=true +# moving=true +# mimetype=text/plain +# determineMimetypeFromExtension=true +DocPath=tdeioslave/mobile.html +Icon=mobile_camera diff --git a/knode/articlewidget.cpp b/knode/articlewidget.cpp index b66b1a6f..ae4ab2cb 100644 --- a/knode/articlewidget.cpp +++ b/knode/articlewidget.cpp @@ -50,7 +50,7 @@ #include #include -#include +#include #include #include diff --git a/knode/knapplication.cpp b/knode/knapplication.cpp index d6bf44c9..b607da53 100644 --- a/knode/knapplication.cpp +++ b/knode/knapplication.cpp @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include "knode.h" #include "knapplication.h" diff --git a/knode/knarticlewindow.cpp b/knode/knarticlewindow.cpp index bf05ec11..a45cf773 100644 --- a/knode/knarticlewindow.cpp +++ b/knode/knarticlewindow.cpp @@ -16,7 +16,7 @@ #include #include -#include +#include #include #include diff --git a/knode/kncomposer.cpp b/knode/kncomposer.cpp index fa92c045..6a31f805 100644 --- a/knode/kncomposer.cpp +++ b/knode/kncomposer.cpp @@ -31,7 +31,7 @@ using KRecentAddress::RecentAddresses; #include #include #include -#include +#include #include #include #include diff --git a/knode/knconfig.h b/knode/knconfig.h index 17ee8a52..c8605049 100644 --- a/knode/knconfig.h +++ b/knode/knconfig.h @@ -22,7 +22,7 @@ #include #include -#include +#include #include diff --git a/knode/knconfigwidgets.cpp b/knode/knconfigwidgets.cpp index 9e80e1b8..8a1c3fbc 100644 --- a/knode/knconfigwidgets.cpp +++ b/knode/knconfigwidgets.cpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/knode/knconvert.cpp b/knode/knconvert.cpp index ba95e9a3..619833d7 100644 --- a/knode/knconvert.cpp +++ b/knode/knconvert.cpp @@ -18,7 +18,7 @@ #include #include -#include +#include #include #include #include diff --git a/knode/knewsservice.protocol b/knode/knewsservice.protocol index 6adc5e95..28a177fe 100644 --- a/knode/knewsservice.protocol +++ b/knode/knewsservice.protocol @@ -9,5 +9,5 @@ reading=false writing=false makedir=false deleting=false -DocPath=kioslave/news.html +DocPath=tdeioslave/news.html Icon=knode diff --git a/knode/knglobals.cpp b/knode/knglobals.cpp index bfed08e1..48a25716 100644 --- a/knode/knglobals.cpp +++ b/knode/knglobals.cpp @@ -17,7 +17,7 @@ #include "knglobals.h" -#include +#include #include #include "knconfigmanager.h" diff --git a/knode/knglobals.h b/knode/knglobals.h index 2b535ac8..a2bde078 100644 --- a/knode/knglobals.h +++ b/knode/knglobals.h @@ -17,7 +17,7 @@ #ifndef KNGLOBALS_H #define KNGLOBALS_H -#include +#include #include "resource.h" #include diff --git a/knode/knjobdata.cpp b/knode/knjobdata.cpp index b79b3199..0d626983 100644 --- a/knode/knjobdata.cpp +++ b/knode/knjobdata.cpp @@ -15,7 +15,7 @@ #include #include -#include +#include #include diff --git a/knode/knmainwidget.cpp b/knode/knmainwidget.cpp index f2728f8d..30edb5ed 100644 --- a/knode/knmainwidget.cpp +++ b/knode/knmainwidget.cpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/knode/knnetaccess.cpp b/knode/knnetaccess.cpp index b81ccfa9..59cc0455 100644 --- a/knode/knnetaccess.cpp +++ b/knode/knnetaccess.cpp @@ -20,8 +20,8 @@ #include #include #include -#include -#include +#include +#include #include #include diff --git a/knode/knserverinfo.cpp b/knode/knserverinfo.cpp index 307c72ff..6af554ce 100644 --- a/knode/knserverinfo.cpp +++ b/knode/knserverinfo.cpp @@ -14,7 +14,7 @@ #include -#include +#include #include #include #include diff --git a/knode/utilities.cpp b/knode/utilities.cpp index 31d36369..2274d2ef 100644 --- a/knode/utilities.cpp +++ b/knode/utilities.cpp @@ -21,9 +21,9 @@ #include #include #include -#include +#include #include -#include +#include #include "knwidgets.h" #include "knglobals.h" diff --git a/knotes/TODO b/knotes/TODO index 202f563d..70e3eb6a 100644 --- a/knotes/TODO +++ b/knotes/TODO @@ -34,7 +34,7 @@ TODO: => use the static KNotesGlobalConfig object and copy the important stuff over Disadv: some keys and defaults must be defined in both config files (and thus, TDEConfig XT specs) - => how about one kconfig Xt spec and inheriting from the TDEConfigSkeleton or make the + => how about one tdeconfig Xt spec and inheriting from the TDEConfigSkeleton or make the TDEConfigSkeleton inherit something? * global config dialog: use "Defaults" in the side bar and add a page with two tabs, Display and Editor, respectively diff --git a/knotes/knote.cpp b/knotes/knote.cpp index a90d891b..dd3940c8 100644 --- a/knotes/knote.cpp +++ b/knotes/knote.cpp @@ -51,8 +51,8 @@ #include #include #include -#include -#include +#include +#include #include diff --git a/knotes/knote.h b/knotes/knote.h index 880a85a4..cc12dcdc 100644 --- a/knotes/knote.h +++ b/knotes/knote.h @@ -27,7 +27,7 @@ #include #include -#include +#include #include class TQLabel; diff --git a/knotes/knoteconfigdlg.cpp b/knotes/knoteconfigdlg.cpp index f35ad9e9..6b01b7b8 100644 --- a/knotes/knoteconfigdlg.cpp +++ b/knotes/knoteconfigdlg.cpp @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include #include diff --git a/knotes/knoteconfigdlg.h b/knotes/knoteconfigdlg.h index 5d7118ca..a72859a1 100644 --- a/knotes/knoteconfigdlg.h +++ b/knotes/knoteconfigdlg.h @@ -21,7 +21,7 @@ #ifndef KNOTECONFIGDLG_H #define KNOTECONFIGDLG_H -#include +#include class TQString; class KNoteConfig; diff --git a/knotes/knoteslegacy.cpp b/knotes/knoteslegacy.cpp index 6c59f13e..fc8c71b4 100644 --- a/knotes/knoteslegacy.cpp +++ b/knotes/knoteslegacy.cpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include diff --git a/kode/kodemain.cpp b/kode/kodemain.cpp index 4f513757..288b9ac5 100644 --- a/kode/kodemain.cpp +++ b/kode/kodemain.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include #include @@ -52,7 +52,7 @@ static const KCmdLineOptions options[] = { "create-class", I18N_NOOP("Create class"), 0 }, { "d", 0, 0 }, { "create-dialog", I18N_NOOP("Create dialog"), 0 }, - { "create-kioslave", I18N_NOOP("Create kioslave"), 0 }, + { "create-tdeioslave", I18N_NOOP("Create tdeioslave"), 0 }, { "create-main", I18N_NOOP("Create main function template"), 0 }, { "y", 0, 0 }, { "codify", I18N_NOOP("Create generator code for given source"), 0 }, @@ -68,7 +68,7 @@ static const KCmdLineOptions options[] = { "warning", I18N_NOOP("Create warning about code generation"), 0 }, { "qt-exception", I18N_NOOP("Add TQt exception to GPL"), 0 }, { "singleton", I18N_NOOP("Create a singleton class"), 0 }, - { "protocol", I18N_NOOP("kioslave protocol"), 0 }, + { "protocol", I18N_NOOP("tdeioslave protocol"), 0 }, { "+[filename]", I18N_NOOP("Source code file name"), 0 }, KCmdLineLastOption }; @@ -325,7 +325,7 @@ int create( TDECmdLineArgs *args ) KODE::Printer p; if ( args->isSet( "warning" ) ) p.setCreationWarning( true ); - bool createKioslave = args->isSet( "create-kioslave" ); + bool createKioslave = args->isSet( "create-tdeioslave" ); bool createMain = args->isSet( "create-main" ); TQString filename = args->getOption( "filename" ); @@ -353,7 +353,7 @@ int create( TDECmdLineArgs *args ) if ( createKioslave ) { if ( !args->isSet( "protocol" ) ) { protocol = className.lower(); - kdWarning() << "Warning: No protocol for kioslave given. Assuming '" + kdWarning() << "Warning: No protocol for tdeioslave given. Assuming '" << protocol << "'" << endl; } else { protocol = args->getOption( "protocol" ); @@ -441,10 +441,10 @@ int create( TDECmdLineArgs *args ) c.addBaseClass( KODE::Class( "KDialogBase" ) ); c.addInclude( "kdialogbase.h" ); } else if ( createKioslave ) { - c.setDocs( "This class implements a kioslave for ..." ); + c.setDocs( "This class implements a tdeioslave for ..." ); c.addBaseClass( KODE::Class( "SlaveBase", "KIO" ) ); - c.addHeaderInclude( "kio/slavebase.h" ); + c.addHeaderInclude( "tdeio/slavebase.h" ); KODE::Function get( "get", "void" ); get.addArgument( "const KURL &url" ); @@ -599,7 +599,7 @@ int create( TDECmdLineArgs *args ) protocolFile.writeEntry( "input", "none" ); protocolFile.writeEntry( "output", "filesystem" ); protocolFile.writeEntry( "reading", "true" ); - protocolFile.writeEntry( "DocPath", "kioslave/" + protocol + ".html" ); + protocolFile.writeEntry( "DocPath", "tdeioslave/" + protocol + ".html" ); protocolFile.sync(); } @@ -620,7 +620,7 @@ int main(int argc,char **argv) TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); if ( args->isSet( "create-class" ) || args->isSet( "create-dialog" ) || - args->isSet( "create-kioslave" ) || args->isSet( "create-main" ) ) { + args->isSet( "create-tdeioslave" ) || args->isSet( "create-main" ) ) { return create( args ); } else if ( args->isSet( "codify" ) ) { return codify( args ); diff --git a/kode/kwsdl/converter.cpp b/kode/kwsdl/converter.cpp index 253b6bd2..f5d90478 100644 --- a/kode/kwsdl/converter.cpp +++ b/kode/kwsdl/converter.cpp @@ -907,7 +907,7 @@ void Converter::createTransportClass() KODE::Class transport( "Transport" ); transport.addBaseClass( mTQObject ); transport.addHeaderInclude( "tqobject.h" ); - transport.addHeaderInclude( "kio/job.h" ); + transport.addHeaderInclude( "tdeio/job.h" ); transport.addInclude( "kdebug.h" ); diff --git a/kode/kwsdl/kung/binaryinputfield.cpp b/kode/kwsdl/kung/binaryinputfield.cpp index 4512edbe..95ea292e 100644 --- a/kode/kwsdl/kung/binaryinputfield.cpp +++ b/kode/kwsdl/kung/binaryinputfield.cpp @@ -19,8 +19,8 @@ Boston, MA 02110-1301, USA. */ -#include -#include +#include +#include #include #include #include diff --git a/kode/kwsdl/kung/transport.h b/kode/kwsdl/kung/transport.h index 71c4fa9d..46355525 100644 --- a/kode/kwsdl/kung/transport.h +++ b/kode/kwsdl/kung/transport.h @@ -21,7 +21,7 @@ #define TRANSPORT_H #include -#include +#include class Transport : public TQObject { diff --git a/kode/kwsdl/schema/fileprovider.cpp b/kode/kwsdl/schema/fileprovider.cpp index d12d4eee..945f7261 100644 --- a/kode/kwsdl/schema/fileprovider.cpp +++ b/kode/kwsdl/schema/fileprovider.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include "fileprovider.h" diff --git a/kode/kwsdl/tests/google/transport.h b/kode/kwsdl/tests/google/transport.h index 0b5b49fa..a0873e26 100644 --- a/kode/kwsdl/tests/google/transport.h +++ b/kode/kwsdl/tests/google/transport.h @@ -25,7 +25,7 @@ #define TRANSPORT_H #include -#include +#include class Transport : public TQObject { diff --git a/kode/kxml_compiler/creator.cpp b/kode/kxml_compiler/creator.cpp index 3d4983f9..b297cc78 100644 --- a/kode/kxml_compiler/creator.cpp +++ b/kode/kxml_compiler/creator.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include diff --git a/kode/kxml_compiler/creator.h b/kode/kxml_compiler/creator.h index 2103f928..33ab410c 100644 --- a/kode/kxml_compiler/creator.h +++ b/kode/kxml_compiler/creator.h @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include diff --git a/kode/kxml_compiler/kxml_compiler.cpp b/kode/kxml_compiler/kxml_compiler.cpp index bb4b2425..4f3fe3ed 100644 --- a/kode/kxml_compiler/kxml_compiler.cpp +++ b/kode/kxml_compiler/kxml_compiler.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include diff --git a/kode/kxml_compiler/parser.cpp b/kode/kxml_compiler/parser.cpp index 9a123581..9881aff5 100644 --- a/kode/kxml_compiler/parser.cpp +++ b/kode/kxml_compiler/parser.cpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include diff --git a/kode/kxml_compiler/parser.h b/kode/kxml_compiler/parser.h index 6efd6f74..ce5d65e2 100644 --- a/kode/kxml_compiler/parser.h +++ b/kode/kxml_compiler/parser.h @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include diff --git a/konsolekalendar/konsolekalendarvariables.cpp b/konsolekalendar/konsolekalendarvariables.cpp index 122b8525..e5541e00 100644 --- a/konsolekalendar/konsolekalendarvariables.cpp +++ b/konsolekalendar/konsolekalendarvariables.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include diff --git a/konsolekalendar/main.cpp b/konsolekalendar/main.cpp index decdbb12..2904215f 100644 --- a/konsolekalendar/main.cpp +++ b/konsolekalendar/main.cpp @@ -49,7 +49,7 @@ #include #include #include -#include +#include #include #include diff --git a/konsolekalendar/stdcalendar.cpp b/konsolekalendar/stdcalendar.cpp index c353f28f..3c735df7 100644 --- a/konsolekalendar/stdcalendar.cpp +++ b/konsolekalendar/stdcalendar.cpp @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include #include diff --git a/kontact/plugins/kmail/kcmkmailsummary.cpp b/kontact/plugins/kmail/kcmkmailsummary.cpp index 72141a6f..eb8906d2 100644 --- a/kontact/plugins/kmail/kcmkmailsummary.cpp +++ b/kontact/plugins/kmail/kcmkmailsummary.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kontact/plugins/kmail/summarywidget.cpp b/kontact/plugins/kmail/summarywidget.cpp index 89e572bf..a67c0a59 100644 --- a/kontact/plugins/kmail/summarywidget.cpp +++ b/kontact/plugins/kmail/summarywidget.cpp @@ -27,7 +27,7 @@ #include #include -#include +#include #include #include #include diff --git a/kontact/plugins/korganizer/kcmkorgsummary.cpp b/kontact/plugins/korganizer/kcmkorgsummary.cpp index 203055d5..818f3c05 100644 --- a/kontact/plugins/korganizer/kcmkorgsummary.cpp +++ b/kontact/plugins/korganizer/kcmkorgsummary.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kontact/plugins/newsticker/kcmkontactknt.cpp b/kontact/plugins/newsticker/kcmkontactknt.cpp index 6e0efd0f..95895966 100644 --- a/kontact/plugins/newsticker/kcmkontactknt.cpp +++ b/kontact/plugins/newsticker/kcmkontactknt.cpp @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kontact/plugins/newsticker/summarywidget.cpp b/kontact/plugins/newsticker/summarywidget.cpp index 52bb8b6e..f0f7d746 100644 --- a/kontact/plugins/newsticker/summarywidget.cpp +++ b/kontact/plugins/newsticker/summarywidget.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kontact/plugins/specialdates/kcmsdsummary.cpp b/kontact/plugins/specialdates/kcmsdsummary.cpp index 193958b8..a15d1118 100644 --- a/kontact/plugins/specialdates/kcmsdsummary.cpp +++ b/kontact/plugins/specialdates/kcmsdsummary.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kontact/plugins/summary/kcmkontactsummary.cpp b/kontact/plugins/summary/kcmkontactsummary.cpp index d880f153..43f18f22 100644 --- a/kontact/plugins/summary/kcmkontactsummary.cpp +++ b/kontact/plugins/summary/kcmkontactsummary.cpp @@ -23,7 +23,7 @@ */ #include -#include +#include #include #include #include diff --git a/kontact/plugins/summary/summaryview_part.cpp b/kontact/plugins/summary/summaryview_part.cpp index de5902b0..27dac829 100644 --- a/kontact/plugins/summary/summaryview_part.cpp +++ b/kontact/plugins/summary/summaryview_part.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kontact/src/kontactconfig.desktop b/kontact/src/kontactconfig.desktop index 0c094d50..532e692c 100644 --- a/kontact/src/kontactconfig.desktop +++ b/kontact/src/kontactconfig.desktop @@ -1,5 +1,5 @@ [Desktop Entry] -Exec=kcmshell kontactconfig +Exec=tdecmshell kontactconfig Icon=kontact Type=Service ServiceTypes=TDECModule diff --git a/kontact/src/mainwindow.cpp b/kontact/src/mainwindow.cpp index d3642b6a..e914fe07 100644 --- a/kontact/src/mainwindow.cpp +++ b/kontact/src/mainwindow.cpp @@ -35,7 +35,7 @@ #include #include -#include +#include #include #include #include @@ -62,7 +62,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kontact/src/prefs.kcfgc b/kontact/src/prefs.kcfgc index 31e6e433..03eb7af7 100644 --- a/kontact/src/prefs.kcfgc +++ b/kontact/src/prefs.kcfgc @@ -1,4 +1,4 @@ -# Code generation options for kconfig_compiler +# Code generation options for tdeconfig_compiler File=kontact.kcfg NameSpace=Kontact ClassName=Prefs diff --git a/kontact/src/profiledialog.cpp b/kontact/src/profiledialog.cpp index 89e241be..e959ad86 100644 --- a/kontact/src/profiledialog.cpp +++ b/kontact/src/profiledialog.cpp @@ -25,7 +25,7 @@ #include "profiledialog.h" #include "profilemanager.h" -#include +#include #include #include #include diff --git a/kontact/src/profilemanager.cpp b/kontact/src/profilemanager.cpp index 295f4615..3b0a568c 100644 --- a/kontact/src/profilemanager.cpp +++ b/kontact/src/profilemanager.cpp @@ -24,10 +24,10 @@ #include "profilemanager.h" -#include +#include #include -#include +#include #include #include #include diff --git a/korganizer/Makefile.am b/korganizer/Makefile.am index a8667126..59daa828 100644 --- a/korganizer/Makefile.am +++ b/korganizer/Makefile.am @@ -196,7 +196,7 @@ kde_services_DATA = korganizer_configmain.desktop \ webcal.protocol update_DATA = korganizer.upd -updatedir = $(kde_datadir)/kconf_update +updatedir = $(kde_datadir)/tdeconf_update DOXYGEN_REFERENCES=libkcal tdeui include $(top_srcdir)/admin/Doxyfile.am diff --git a/korganizer/actionmanager.cpp b/korganizer/actionmanager.cpp index 68fd6b4d..e4c906fa 100644 --- a/korganizer/actionmanager.cpp +++ b/korganizer/actionmanager.cpp @@ -56,9 +56,9 @@ #include #include -#include +#include #include -#include +#include #include #include #include @@ -1038,7 +1038,7 @@ bool ActionManager::saveURL() void ActionManager::exportHTML() { HTMLExportSettings settings( "KOrganizer" ); - // Manually read in the config, because parametrized kconfigxt objects don't + // Manually read in the config, because parametrized tdeconfigxt objects don't // seem to load the config theirselves settings.readConfig(); @@ -1291,7 +1291,7 @@ void ActionManager::setDestinationPolicy() void ActionManager::configureDateTime() { TDEProcess *proc = new TDEProcess; - *proc << "kcmshell" << "language"; + *proc << "tdecmshell" << "language"; connect( proc,TQT_SIGNAL( processExited( TDEProcess * ) ), TQT_SLOT( configureDateTimeFinished( TDEProcess * ) ) ); diff --git a/korganizer/archivedialog.cpp b/korganizer/archivedialog.cpp index 6609b183..76985d1a 100644 --- a/korganizer/archivedialog.cpp +++ b/korganizer/archivedialog.cpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 77f8f80b..3ef70ea7 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -85,10 +85,10 @@ #include #include #include -#include +#include #include #include -#include +#include #include #include @@ -1798,7 +1798,7 @@ void CalendarView::exportWeb() { // FIXME: Get rid of the settings object. When can I delete it??? HTMLExportSettings *settings = new HTMLExportSettings( "KOrganizer" ); - // Manually read in the config, because parametrized kconfigxt objects don't + // Manually read in the config, because parametrized tdeconfigxt objects don't // seem to load the config theirselves if ( settings ) settings->readConfig(); ExportWebDialog *dlg = new ExportWebDialog( settings, this ); diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 3df3046e..469eddaf 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/korganizer/docprefs.cpp b/korganizer/docprefs.cpp index 8981255f..1ac91835 100644 --- a/korganizer/docprefs.cpp +++ b/korganizer/docprefs.cpp @@ -33,7 +33,7 @@ KSimpleConfig *DocPrefs::mConfig = 0; DocPrefs::DocPrefs( const TQString &type ) { if ( !mConfig ) { - mConfig = new KSimpleConfig( locateLocal( "data", "korganizer/docprefs." + type + ".kconfig" ) ); + mConfig = new KSimpleConfig( locateLocal( "data", "korganizer/docprefs." + type + ".tdeconfig" ) ); } } diff --git a/korganizer/eventarchiver.cpp b/korganizer/eventarchiver.cpp index d4afada2..739dc905 100644 --- a/korganizer/eventarchiver.cpp +++ b/korganizer/eventarchiver.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/korganizer/exportwebdialog.cpp b/korganizer/exportwebdialog.cpp index c5868f14..0cece663 100644 --- a/korganizer/exportwebdialog.cpp +++ b/korganizer/exportwebdialog.cpp @@ -38,15 +38,15 @@ #include #include -#include +#include #include #include -#include +#include #include -#include +#include #include "koglobals.h" #include -#include +#include #include #include #include diff --git a/korganizer/freebusymanager.cpp b/korganizer/freebusymanager.cpp index ee0c38a0..5d479e88 100644 --- a/korganizer/freebusymanager.cpp +++ b/korganizer/freebusymanager.cpp @@ -49,15 +49,15 @@ #include #include -#include +#include #include #include #include -#include -#include -#include +#include +#include +#include #include -#include +#include #include #include #include diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index c156b7a5..a1828671 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -44,7 +44,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/korganizer/koapp.cpp b/korganizer/koapp.cpp index eed2cd2c..49e2ec3a 100644 --- a/korganizer/koapp.cpp +++ b/korganizer/koapp.cpp @@ -29,7 +29,7 @@ #include #include -#include +#include #include #include #include diff --git a/korganizer/kocore.cpp b/korganizer/kocore.cpp index 0096b149..ace67c18 100644 --- a/korganizer/kocore.cpp +++ b/korganizer/kocore.cpp @@ -34,7 +34,7 @@ #include #include -#include +#include #include #include #include diff --git a/korganizer/koeditorattachments.cpp b/korganizer/koeditorattachments.cpp index 24cf5730..74e90888 100644 --- a/korganizer/koeditorattachments.cpp +++ b/korganizer/koeditorattachments.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include #include @@ -42,10 +42,10 @@ #include #include #include -#include +#include #include #include -#include +#include #include #include #include diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp index fb8b4bc5..0ab854a9 100644 --- a/korganizer/koeditorgeneral.cpp +++ b/korganizer/koeditorgeneral.cpp @@ -45,7 +45,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/korganizer/koeditorgeneralevent.cpp b/korganizer/koeditorgeneralevent.cpp index dc54a526..67c0654b 100644 --- a/korganizer/koeditorgeneralevent.cpp +++ b/korganizer/koeditorgeneralevent.cpp @@ -40,7 +40,7 @@ #include #include #include -#include +#include #include #include diff --git a/korganizer/koeditorgeneraltodo.cpp b/korganizer/koeditorgeneraltodo.cpp index 54822c83..22667c46 100644 --- a/korganizer/koeditorgeneraltodo.cpp +++ b/korganizer/koeditorgeneraltodo.cpp @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include #include diff --git a/korganizer/koeventviewer.h b/korganizer/koeventviewer.h index 9f9b816e..91fb0d4d 100644 --- a/korganizer/koeventviewer.h +++ b/korganizer/koeventviewer.h @@ -25,7 +25,7 @@ #define KOEVENTVIEWER_H #include -#include +#include #include namespace KCal { diff --git a/korganizer/koglobals.cpp b/korganizer/koglobals.cpp index a5f5a60f..b3fd073b 100644 --- a/korganizer/koglobals.cpp +++ b/korganizer/koglobals.cpp @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include #include diff --git a/korganizer/kogroupware.h b/korganizer/kogroupware.h index a9372b04..ce253dfc 100644 --- a/korganizer/kogroupware.h +++ b/korganizer/kogroupware.h @@ -43,7 +43,7 @@ #include #include -#include +#include #include diff --git a/korganizer/koincidenceeditor.cpp b/korganizer/koincidenceeditor.cpp index ea3f5e7e..74ad2855 100644 --- a/korganizer/koincidenceeditor.cpp +++ b/korganizer/koincidenceeditor.cpp @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index fb52f4b6..a741d7f2 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -40,7 +40,7 @@ #include #include #include -#include +#include #include #include diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index ead4f7e8..a8f6acc3 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp @@ -35,7 +35,7 @@ #include #include -#include +#include #include #include #include diff --git a/korganizer/koprefs_base.kcfgc b/korganizer/koprefs_base.kcfgc index c5f26759..8d59a50b 100644 --- a/korganizer/koprefs_base.kcfgc +++ b/korganizer/koprefs_base.kcfgc @@ -1,4 +1,4 @@ -# Code generation options for kconfig_compiler +# Code generation options for tdeconfig_compiler File=korganizer.kcfg ClassName=KOPrefsBase Singleton=false diff --git a/korganizer/korgac/alarmdialog.cpp b/korganizer/korgac/alarmdialog.cpp index fbf4cf95..e85f630e 100644 --- a/korganizer/korgac/alarmdialog.cpp +++ b/korganizer/korgac/alarmdialog.cpp @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/korganizer/korgac/alarmdockwindow.cpp b/korganizer/korgac/alarmdockwindow.cpp index d5d8dddb..051fe446 100644 --- a/korganizer/korgac/alarmdockwindow.cpp +++ b/korganizer/korgac/alarmdockwindow.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/korganizer/korgac/testalarmdlg.cpp b/korganizer/korgac/testalarmdlg.cpp index f3f6493d..8f21106a 100644 --- a/korganizer/korgac/testalarmdlg.cpp +++ b/korganizer/korgac/testalarmdlg.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include "alarmdialog.h" diff --git a/korganizer/korganizer.cpp b/korganizer/korganizer.cpp index f2ec01f2..89014c46 100644 --- a/korganizer/korganizer.cpp +++ b/korganizer/korganizer.cpp @@ -59,12 +59,12 @@ #include #include #include -#include +#include #include #include #include #include -#include +#include #include #include #include diff --git a/korganizer/korganizer_part.cpp b/korganizer/korganizer_part.cpp index 184e142c..22a6e3ec 100644 --- a/korganizer/korganizer_part.cpp +++ b/korganizer/korganizer_part.cpp @@ -47,7 +47,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index 9a308fcf..e69d61ad 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp @@ -28,7 +28,7 @@ #include #include -#include +#include #include #include "actionmanager.h" diff --git a/korganizer/plugins/datenums/configdialog.cpp b/korganizer/plugins/datenums/configdialog.cpp index 6b8746db..3fbf8410 100644 --- a/korganizer/plugins/datenums/configdialog.cpp +++ b/korganizer/plugins/datenums/configdialog.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include diff --git a/korganizer/plugins/datenums/datenums.cpp b/korganizer/plugins/datenums/datenums.cpp index 9ef6068b..468095a9 100644 --- a/korganizer/plugins/datenums/datenums.cpp +++ b/korganizer/plugins/datenums/datenums.cpp @@ -19,7 +19,7 @@ #include "datenums.h" #include "koglobals.h" -#include +#include #include #include "configdialog.h" diff --git a/korganizer/plugins/exchange/exchange.cpp b/korganizer/plugins/exchange/exchange.cpp index ca3c4c49..e84ae08b 100644 --- a/korganizer/plugins/exchange/exchange.cpp +++ b/korganizer/plugins/exchange/exchange.cpp @@ -20,7 +20,7 @@ #include #include -#include +#include #include #include diff --git a/korganizer/plugins/exchange/exchangeconfig.cpp b/korganizer/plugins/exchange/exchangeconfig.cpp index fe01324a..91e4670e 100644 --- a/korganizer/plugins/exchange/exchangeconfig.cpp +++ b/korganizer/plugins/exchange/exchangeconfig.cpp @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include #include diff --git a/korganizer/plugins/hebrew/configdialog.cpp b/korganizer/plugins/hebrew/configdialog.cpp index b580c2fe..668fad5a 100644 --- a/korganizer/plugins/hebrew/configdialog.cpp +++ b/korganizer/plugins/hebrew/configdialog.cpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include diff --git a/korganizer/plugins/hebrew/hebrew.cpp b/korganizer/plugins/hebrew/hebrew.cpp index c65691d3..06518853 100644 --- a/korganizer/plugins/hebrew/hebrew.cpp +++ b/korganizer/plugins/hebrew/hebrew.cpp @@ -18,7 +18,7 @@ */ #include -#include +#include #include #include #include diff --git a/korganizer/plugins/printing/journal/journalprint.cpp b/korganizer/plugins/printing/journal/journalprint.cpp index edf1fc93..5ff71e66 100644 --- a/korganizer/plugins/printing/journal/journalprint.cpp +++ b/korganizer/plugins/printing/journal/journalprint.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include diff --git a/korganizer/plugins/printing/list/listprint.cpp b/korganizer/plugins/printing/list/listprint.cpp index 9607de8e..e15939a1 100644 --- a/korganizer/plugins/printing/list/listprint.cpp +++ b/korganizer/plugins/printing/list/listprint.cpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include diff --git a/korganizer/plugins/printing/whatsnext/whatsnextprint.cpp b/korganizer/plugins/printing/whatsnext/whatsnextprint.cpp index 4f58eed0..57622716 100644 --- a/korganizer/plugins/printing/whatsnext/whatsnextprint.cpp +++ b/korganizer/plugins/printing/whatsnext/whatsnextprint.cpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include diff --git a/korganizer/plugins/printing/year/yearprint.cpp b/korganizer/plugins/printing/year/yearprint.cpp index f22e1b17..bf039d2d 100644 --- a/korganizer/plugins/printing/year/yearprint.cpp +++ b/korganizer/plugins/printing/year/yearprint.cpp @@ -29,7 +29,7 @@ #include -#include +#include #include #include #include diff --git a/korganizer/plugins/projectview/koprojectview.cpp b/korganizer/plugins/projectview/koprojectview.cpp index b65efde6..5847d0c2 100644 --- a/korganizer/plugins/projectview/koprojectview.cpp +++ b/korganizer/plugins/projectview/koprojectview.cpp @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include diff --git a/korganizer/plugins/projectview/projectview.cpp b/korganizer/plugins/projectview/projectview.cpp index da7d5f48..f7e35eff 100644 --- a/korganizer/plugins/projectview/projectview.cpp +++ b/korganizer/plugins/projectview/projectview.cpp @@ -20,7 +20,7 @@ #include #include -#include +#include #include #include #include diff --git a/korganizer/plugins/timespanview/kotimespanview.cpp b/korganizer/plugins/timespanview/kotimespanview.cpp index 4c43444f..8445edf4 100644 --- a/korganizer/plugins/timespanview/kotimespanview.cpp +++ b/korganizer/plugins/timespanview/kotimespanview.cpp @@ -24,9 +24,9 @@ #include -#include +#include #include -#include +#include #include #include "timespanwidget.h" diff --git a/korganizer/plugins/timespanview/timespanview.cpp b/korganizer/plugins/timespanview/timespanview.cpp index bd910677..d43cd8e6 100644 --- a/korganizer/plugins/timespanview/timespanview.cpp +++ b/korganizer/plugins/timespanview/timespanview.cpp @@ -20,7 +20,7 @@ #include #include -#include +#include #include #include #include diff --git a/korganizer/previewdialog.cpp b/korganizer/previewdialog.cpp index dd42e163..2753475f 100644 --- a/korganizer/previewdialog.cpp +++ b/korganizer/previewdialog.cpp @@ -37,9 +37,9 @@ #include #include -#include +#include #include -#include +#include #include #include diff --git a/korganizer/printing/CMakeLists.txt b/korganizer/printing/CMakeLists.txt index 67ff0485..bb4fce14 100644 --- a/korganizer/printing/CMakeLists.txt +++ b/korganizer/printing/CMakeLists.txt @@ -46,7 +46,7 @@ tde_add_library( korg_stdprinting SHARED AUTOMOC SOURCES calprinter.cpp calprintpluginbase.cpp calprintdefaultplugins.cpp calprintdayconfig_base.ui calprintmonthconfig_base.ui - calprinttodoconfig_base.ui calprintweekconfig_base.ui + calprinttodoconfig_base.ui calprintweetdeconfig_base.ui calprintincidenceconfig_base.ui VERSION 1.0.0 LINK kocorehelper-shared tdeprint-shared diff --git a/korganizer/printing/Makefile.am b/korganizer/printing/Makefile.am index 10170ca7..45fd37be 100644 --- a/korganizer/printing/Makefile.am +++ b/korganizer/printing/Makefile.am @@ -18,7 +18,7 @@ libkocorehelper_la_SOURCES = cellitem.cpp libkorg_stdprinting_la_SOURCES = calprinter.cpp calprintpluginbase.cpp \ calprintdefaultplugins.cpp \ calprintdayconfig_base.ui calprintmonthconfig_base.ui \ - calprinttodoconfig_base.ui calprintweekconfig_base.ui \ + calprinttodoconfig_base.ui calprintweetdeconfig_base.ui \ calprintincidenceconfig_base.ui libkorg_stdprinting_la_LDFLAGS = $(KDE_RPATH) $(all_libraries) \ -no-undefined -version-info 1:0 diff --git a/korganizer/printing/calprintdefaultplugins.cpp b/korganizer/printing/calprintdefaultplugins.cpp index e6701554..8ed37660 100644 --- a/korganizer/printing/calprintdefaultplugins.cpp +++ b/korganizer/printing/calprintdefaultplugins.cpp @@ -34,7 +34,7 @@ #include #include -#include +#include #include #include #include @@ -45,7 +45,7 @@ #include "calprintincidenceconfig_base.h" #include "calprintdayconfig_base.h" -#include "calprintweekconfig_base.h" +#include "calprintweetdeconfig_base.h" #include "calprintmonthconfig_base.h" #include "calprinttodoconfig_base.h" diff --git a/korganizer/printing/calprintpluginbase.cpp b/korganizer/printing/calprintpluginbase.cpp index 50b533bf..f754e52d 100644 --- a/korganizer/printing/calprintpluginbase.cpp +++ b/korganizer/printing/calprintpluginbase.cpp @@ -29,7 +29,7 @@ #include #include -#include +#include #include #include diff --git a/korganizer/printing/calprintweekconfig_base.ui b/korganizer/printing/calprintweekconfig_base.ui deleted file mode 100644 index 0be844ab..00000000 --- a/korganizer/printing/calprintweekconfig_base.ui +++ /dev/null @@ -1,300 +0,0 @@ - -CalPrintWeekConfig_Base -Configuration page for the print week mode. -Reinhold Kainhofer <reinhold@kainhofer.com> - - - CalPrintWeek_Base - - - - 0 - 0 - 386 - 262 - - - - CalPrintWeek_Base - - - - unnamed - - - 0 - - - - spacer3 - - - Vertical - - - Expanding - - - - 21 - 27 - - - - - - mDateRangeGroup - - - Date && Time Range - - - - unnamed - - - - spacer1 - - - Horizontal - - - Expanding - - - - 16 - 21 - - - - - - mFromDateLabel - - - &Start date: - - - mFromDate - - - Here you can choose which events should be printed based on their date. This check enables you to enter the start date of the date range. Use the <i>End date</i> to enter the end date of the daterange. - - - - - mFromDate - - - StrongFocus - - - Here you can choose which events should be printed based on their date. This check enables you to enter the start date of the date range. Use the <i>End date</i> to enter the end date of the daterange. - - - - - mToTimeLabel - - - End ti&me: - - - mToTime - - - All events which start later than the given time will not be printed. - - - - - spacer4 - - - Horizontal - - - Expanding - - - - 110 - 20 - - - - - - mToTime - - - - - - Minutes|Hours - - - All events which start later than the given time will not be printed. - - - - - mFromTimeLabel - - - Start &time: - - - mFromTime - - - All events which start earlier than the given time will not be printed. - - - - - mFromTime - - - - - - Minutes|Hours - - - All events which start earlier than the given time will not be printed. - - - - - mToDate - - - StrongFocus - - - Here you can choose which events should be printed based on their date. This check enables you to enter the end date of the date range. Use the <i>Start date</i> to enter the start date of the daterange. - - - - - mToDateLabel - - - &End date: - - - mToDate - - - Here you can choose which events should be printed based on their date. This check enables you to enter the end date of the date range. Use the <i>Start date</i> to enter the start date of the daterange. - - - - - - - mColors - - - &Use colors - - - The timetable view supports colors. If you want to make use of colors you should check this option. The category colors will be used. - - - - - mPrintType - - - Print Layout - - - - unnamed - - - - mPrintTypeButton1 - - - Print as &Filofax page - - - true - - - The Filofax view prints one week per page, so all days have a large surface. - - - - - mPrintTypeButton2 - - - Print as &timetable view - - - This view is similar to the weekview in KOrganizer. The week is printed in landscape layout. You can even use the same colors for the items if you check <i>Use Colors</i>. - - - - - mPrintTypeButton3 - - - Print as split week view - - - This view is similar to the week view in KOrganizer. The only difference with the timetable view is the page layout. Timetables are printed in landscape, the split week view in portrait. - - - - - - - mIncludeTodos - - - false - - - Include to-&dos that are due on the printed day(s) - - - Check this option if you want to have to-dos on the print, placed by their due date. - - - - - - - - mFromDate - mFromTime - mToDate - mToTime - mPrintTypeButton1 - mIncludeTodos - mColors - - - kdateedit.h - - - - libtdepim/kdateedit.h - libtdepim/kdateedit.h - - diff --git a/korganizer/printing/calprintweetdeconfig_base.ui b/korganizer/printing/calprintweetdeconfig_base.ui new file mode 100644 index 00000000..0be844ab --- /dev/null +++ b/korganizer/printing/calprintweetdeconfig_base.ui @@ -0,0 +1,300 @@ + +CalPrintWeekConfig_Base +Configuration page for the print week mode. +Reinhold Kainhofer <reinhold@kainhofer.com> + + + CalPrintWeek_Base + + + + 0 + 0 + 386 + 262 + + + + CalPrintWeek_Base + + + + unnamed + + + 0 + + + + spacer3 + + + Vertical + + + Expanding + + + + 21 + 27 + + + + + + mDateRangeGroup + + + Date && Time Range + + + + unnamed + + + + spacer1 + + + Horizontal + + + Expanding + + + + 16 + 21 + + + + + + mFromDateLabel + + + &Start date: + + + mFromDate + + + Here you can choose which events should be printed based on their date. This check enables you to enter the start date of the date range. Use the <i>End date</i> to enter the end date of the daterange. + + + + + mFromDate + + + StrongFocus + + + Here you can choose which events should be printed based on their date. This check enables you to enter the start date of the date range. Use the <i>End date</i> to enter the end date of the daterange. + + + + + mToTimeLabel + + + End ti&me: + + + mToTime + + + All events which start later than the given time will not be printed. + + + + + spacer4 + + + Horizontal + + + Expanding + + + + 110 + 20 + + + + + + mToTime + + + + + + Minutes|Hours + + + All events which start later than the given time will not be printed. + + + + + mFromTimeLabel + + + Start &time: + + + mFromTime + + + All events which start earlier than the given time will not be printed. + + + + + mFromTime + + + + + + Minutes|Hours + + + All events which start earlier than the given time will not be printed. + + + + + mToDate + + + StrongFocus + + + Here you can choose which events should be printed based on their date. This check enables you to enter the end date of the date range. Use the <i>Start date</i> to enter the start date of the daterange. + + + + + mToDateLabel + + + &End date: + + + mToDate + + + Here you can choose which events should be printed based on their date. This check enables you to enter the end date of the date range. Use the <i>Start date</i> to enter the start date of the daterange. + + + + + + + mColors + + + &Use colors + + + The timetable view supports colors. If you want to make use of colors you should check this option. The category colors will be used. + + + + + mPrintType + + + Print Layout + + + + unnamed + + + + mPrintTypeButton1 + + + Print as &Filofax page + + + true + + + The Filofax view prints one week per page, so all days have a large surface. + + + + + mPrintTypeButton2 + + + Print as &timetable view + + + This view is similar to the weekview in KOrganizer. The week is printed in landscape layout. You can even use the same colors for the items if you check <i>Use Colors</i>. + + + + + mPrintTypeButton3 + + + Print as split week view + + + This view is similar to the week view in KOrganizer. The only difference with the timetable view is the page layout. Timetables are printed in landscape, the split week view in portrait. + + + + + + + mIncludeTodos + + + false + + + Include to-&dos that are due on the printed day(s) + + + Check this option if you want to have to-dos on the print, placed by their due date. + + + + + + + + mFromDate + mFromTime + mToDate + mToTime + mPrintTypeButton1 + mIncludeTodos + mColors + + + kdateedit.h + + + + libtdepim/kdateedit.h + libtdepim/kdateedit.h + + diff --git a/korganizer/resourceview.cpp b/korganizer/resourceview.cpp index a325add5..c9291571 100644 --- a/korganizer/resourceview.cpp +++ b/korganizer/resourceview.cpp @@ -40,7 +40,7 @@ #include #include #include -#include +#include #include #include diff --git a/korganizer/stdcalendar.cpp b/korganizer/stdcalendar.cpp index 0d274869..a7fcd544 100644 --- a/korganizer/stdcalendar.cpp +++ b/korganizer/stdcalendar.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include #include diff --git a/korganizer/urihandler.cpp b/korganizer/urihandler.cpp index 6e4819a8..09edb36c 100644 --- a/korganizer/urihandler.cpp +++ b/korganizer/urihandler.cpp @@ -38,14 +38,14 @@ using namespace KCal; #include #include #include -#include +#include #include #include #include #include #include #include -#include +#include #include diff --git a/korn/CMakeLists.txt b/korn/CMakeLists.txt index 12d4e373..f3dd942b 100644 --- a/korn/CMakeLists.txt +++ b/korn/CMakeLists.txt @@ -13,7 +13,7 @@ tde_import( libkmime ) -add_subdirectory( kconf_update ) +add_subdirectory( tdeconf_update ) include_directories( ${CMAKE_CURRENT_BINARY_DIR} @@ -50,6 +50,6 @@ tde_add_executable( korn AUTOMOC sortedmailsubject.cpp korncfgimpl.cpp kornaccountcfgimpl.cpp kornboxcfgimpl.cpp kornaccountcfg.ui kornboxcfg.ui korncfg.ui password.cpp pop3_proto.cpp systemtray.cpp process_proto.cpp progress_dialog.ui qmail_proto.cpp label.cpp - LINK kmime-shared kio-shared + LINK kmime-shared tdeio-shared DESTINATION ${BIN_INSTALL_DIR} ) diff --git a/korn/Makefile.am b/korn/Makefile.am index 39cc8ae5..91bde672 100644 --- a/korn/Makefile.am +++ b/korn/Makefile.am @@ -121,4 +121,4 @@ KDE_ICON = korn xdg_apps_DATA = KOrn.desktop -SUBDIRS = kconf_update +SUBDIRS = tdeconf_update diff --git a/korn/accountmanager.cpp b/korn/accountmanager.cpp index 477bab2a..a31dd4c1 100644 --- a/korn/accountmanager.cpp +++ b/korn/accountmanager.cpp @@ -27,7 +27,7 @@ #include "subjectsdlg.h" #include -#include +#include #include #include diff --git a/korn/boxcontainer.cpp b/korn/boxcontainer.cpp index 5e17c947..d881b6c8 100644 --- a/korn/boxcontainer.cpp +++ b/korn/boxcontainer.cpp @@ -19,7 +19,7 @@ #include "boxcontainer.h" #include "boxcontaineritem.h" -#include +#include #include #include diff --git a/korn/boxcontaineritem.cpp b/korn/boxcontaineritem.cpp index 3fea65f3..50daf1d0 100644 --- a/korn/boxcontaineritem.cpp +++ b/korn/boxcontaineritem.cpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/korn/dcop_proto.cpp b/korn/dcop_proto.cpp index 41ab8c9d..d4a8bd3b 100644 --- a/korn/dcop_proto.cpp +++ b/korn/dcop_proto.cpp @@ -22,7 +22,7 @@ #include "account_input.h" #include "dcopdrop.h" -#include +#include #include #include diff --git a/korn/dcopdrop.cpp b/korn/dcopdrop.cpp index cdeccd6b..660bc849 100644 --- a/korn/dcopdrop.cpp +++ b/korn/dcopdrop.cpp @@ -23,7 +23,7 @@ #include "mailid.h" #include "mailsubject.h" -#include +#include #include #include diff --git a/korn/dockeditem.cpp b/korn/dockeditem.cpp index fac1cc47..474ffb28 100644 --- a/korn/dockeditem.cpp +++ b/korn/dockeditem.cpp @@ -21,7 +21,7 @@ #include "systemtray.h" #include -#include +#include #include #include #include diff --git a/korn/imap_proto.h b/korn/imap_proto.h index 3310da1b..f34f32a8 100644 --- a/korn/imap_proto.h +++ b/korn/imap_proto.h @@ -54,7 +54,7 @@ public: virtual bool connectionBased() const { return true; } /** - * This gives the two names for a kioslave: imaps if ssl is selected, imap if not. + * This gives the two names for a tdeioslave: imaps if ssl is selected, imap if not. * * @param ssl true if ssl is selected. * @return "imaps" if ssl is true, "imap" otherwise diff --git a/korn/kconf_update/CMakeLists.txt b/korn/kconf_update/CMakeLists.txt deleted file mode 100644 index 88c06088..00000000 --- a/korn/kconf_update/CMakeLists.txt +++ /dev/null @@ -1,38 +0,0 @@ -################################################# -# -# (C) 2010-2011 Serghei Amelian -# serghei (DOT) amelian (AT) gmail.com -# -# Improvements and feedback are welcome -# -# This file is released under GPL >= 2 -# -################################################# - -include_directories( - ${TQT_INCLUDE_DIRS} -) - -link_directories( - ${TQT_LIBRARY_DIRS} -) - - -##### other data ################################ - -install( FILES - korn-3-4-config_change.upd korn-3-5-update.upd - DESTINATION ${KCONF_UPDATE_INSTALL_DIR} ) - -install( PROGRAMS - korn-3-5-ssl-update.pl korn-3-5-metadata-update.pl - DESTINATION ${KCONF_UPDATE_INSTALL_DIR} ) - - -##### korn-3-4-config_change (executable) ####### - -tde_add_executable( korn-3-4-config_change - SOURCES korn-3-4-config_change.cpp - LINK ${TQT_LIBRARIES} - DESTINATION ${LIB_INSTALL_DIR}/kconf_update_bin -) diff --git a/korn/kconf_update/Makefile.am b/korn/kconf_update/Makefile.am deleted file mode 100644 index 74991a93..00000000 --- a/korn/kconf_update/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -INCLUDES=$(all_includes) - -update_DATA = korn-3-4-config_change.upd korn-3-5-update.upd -update_SCRIPTS = korn-3-5-ssl-update.pl korn-3-5-metadata-update.pl -updatedir = $(kde_datadir)/kconf_update - -kconf_PROGRAMS = korn-3-4-config_change -kconfdir = $(libdir)/kconf_update_bin - -korn_3_4_config_change_SOURCES = korn-3-4-config_change.cpp -korn_3_4_config_change_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor -korn_3_4_config_change_LDADD = $(LIB_QT) diff --git a/korn/kconf_update/korn-3-4-config_change.cpp b/korn/kconf_update/korn-3-4-config_change.cpp deleted file mode 100644 index 7eff3ad3..00000000 --- a/korn/kconf_update/korn-3-4-config_change.cpp +++ /dev/null @@ -1,261 +0,0 @@ -/* - * Copyright (C) 2004, Mart Kelder (mart.kde@hccnet.nl) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include -#include -#include - -#include - -TQString decodeString( const TQString &password ) -{ - unsigned int i, val; - unsigned int len = password.length(); - TQString result=""; - for ( i=0; i < len; i++ ) - { - val = password[i].latin1() - ' '; - val = (255-' ') - val; - result += (char)(val + ' '); - } - return result; -} - -void printToprint( TQTextStream &out, TQMap &to_printed, const TQString type ) -{ - out << "printToprint( " << type << " )" << endl; - - if( type == "mbox" ) - { - out << "mailbox=" << to_printed[ "file" ] << endl; - } - else if( type == "qmail" ) - { - out << "mailbox=" << to_printed[ "maildir" ] << endl; - } - else if( type == "pop3" ) - { - out << "host=" << to_printed[ "host" ] << endl; - out << "port=" << to_printed[ "port" ] << endl; - out << "username=" << to_printed[ "user" ] << endl; - if( to_printed[ "APOP" ] == "true" ) - out << "auth=APOP" << endl; - else - out << "auth=" << endl; - } - else if( type == "imap4" ) - { - out << "host=" << to_printed[ "host" ] << endl; - out << "port=" << to_printed[ "port" ] << endl; - out << "username=" << to_printed[ "user" ] << endl; - out << "mailbox=" << to_printed[ "mailbox" ] << endl; - } - else if( type == "nntp" ) - { - out << "host=" << to_printed[ "host" ] << endl; - out << "port=" << to_printed[ "port" ] << endl; - out << "mailbox=" << to_printed[ "group" ] << endl; - } - else if( type == "process" ) - { - out << "mailbox=" << to_printed[ "command" ] << endl; - } - else if( type == "kio" ) - { - out << "host=" << to_printed[ "host" ] << endl; - out << "port=" << to_printed[ "port" ] << endl; - out << "username=" << to_printed[ "username" ] << endl; - out << "mailbox=" << to_printed[ "mailbox" ] << endl; - out << "password=" << decodeString( to_printed[ "password" ] ) << endl; - } - - if( type == "pop3" || type == "imap4" ) - { - out << "password=" << to_printed[ "pass" ] << endl; - if( to_printed[ "pass" ].isEmpty() ) - out << "savepassword=false" << endl; - else - out << "savepassword=true" << endl; - } - - if( to_printed[ "resetcounter" ] != "-1" ) - out << "reset=" << to_printed[ "resetcounter" ] << endl; - else - out << "reset=0" << endl; - out << "interval=" << to_printed[ "poll" ] << endl; -} - -int main( int, char** ) -{ - TQString line = TQString(); - TQString currentGroup1 = TQString(); - TQString currentGroup2 = TQString(); - TQString type = TQString(); - TQString password = TQString(); - TQRegExp interesting_group( "^\\[box-(\\d+)\\]" ); - TQRegExp key_value( "^(\\w*)=(.*)$" ); - TQValueList tobe_deleted; - int numboxes = -1; - bool isKey = false; - - TQTextStream in( stdin, IO_ReadOnly ); - TQTextStream out( stdout, IO_WriteOnly ); - - in.setEncoding( TQTextStream::UnicodeUTF8 ); - out.setEncoding( TQTextStream::UnicodeUTF8 ); - - TQMap mapping1; - TQValueList mapping2; - TQMap to_printed; - - mapping1.insert( "caption", "name" ); - mapping1.insert( "onclick", "command" ); - mapping1.insert( "onnewmail", "newcommand" ); - mapping1.insert( "soundfile", "sound" ); - mapping1.insert( "passive_popup", "passivepopup" ); - mapping1.insert( "passive_data", "passivedata" ); - mapping1.insert( "reset", "reset" ); - mapping1.insert( "fgcolour", "normalfgcolour" ); - mapping1.insert( "bgcolour", "normalbgcolour" ); - mapping1.insert( "newmailfgcolour", "newfgcolour" ); - mapping1.insert( "newmailbgcolour", "newbgcolour" ); - mapping1.insert( "icon", "normalicon" ); - mapping1.insert( "newmailicon", "newicon" ); - - mapping2.append( "file" ); - mapping2.append( "maildir" ); - mapping2.append( "host" ); - mapping2.append( "port" ); - mapping2.append( "user" ); - mapping2.append( "APOP" ); - mapping2.append( "mailbox" ); - mapping2.append( "group" ); - mapping2.append( "command" ); - mapping2.append( "protocol" ); - mapping2.append( "pass" ); - mapping2.append( "password" ); - mapping2.append( "resetcounter" ); - mapping2.append( "poll" ); - - while( !in.atEnd() ) - { - line = in.readLine(); - - isKey = key_value.search( line ) >= 0; - - if( line.left( 1 ) == "[" ) - { - if( !currentGroup1.isNull() ) - { - out << currentGroup2 << endl; - printToprint( out, to_printed, type ); - } - - currentGroup1 = TQString(); - } - - if( interesting_group.search( line ) >= 0 ) - { - if( numboxes > -1 && interesting_group.cap( 1 ).toInt() < numboxes ) - { - currentGroup1 = TQString( "[korn-%1]" ).arg( interesting_group.cap( 1 ) ); - currentGroup2 = TQString( "[korn-%1-0]" ).arg( interesting_group.cap( 1 ) ); - } - tobe_deleted.append( line ); - continue; - } - else if( isKey && key_value.cap( 1 ) == "numboxes" ) - { - numboxes = key_value.cap( 2 ).toInt(); - continue; - } - else if( currentGroup1.isNull() || !isKey ) - continue; - if( mapping1.contains( key_value.cap( 1 ) ) ) - { - out << currentGroup1 << endl; - out << mapping1[ key_value.cap( 1 ) ] << "=" << key_value.cap( 2 ) << endl; - if( key_value.cap( 1 ) == "caption" ) - { - out << currentGroup2 << endl; - out << "name=" << key_value.cap( 2 ) << endl; - } - } - else if( mapping2.contains( key_value.cap( 1 ) ) ) - { - to_printed.insert( key_value.cap( 1 ), key_value.cap( 2 ) ); - } - else if( key_value.cap( 1 ) == "type" && key_value.cap( 2 ) != "kio" ) - { - out << currentGroup2 << endl; - if( key_value.cap( 2 ) == "imap4" ) - out << "protocol=imap" << endl; - else - out << "protocol=" << key_value.cap( 2 ) << endl; - type = key_value.cap( 2 ); - - } - else if( key_value.cap( 1 ) == "type" && key_value.cap( 2 ) == "kio" ) - { - type = "kio"; - } - else if( key_value.cap( 1 ) == "displaystyle" ) - { - out << currentGroup1 << endl; - if( key_value.cap( 2 ) == "2" ) - { - out << "hasnormalfgcolour=false" << endl; - out << "hasnormalbgcolour=false" << endl; - out << "hasnewfgcolour=false" << endl; - out << "hasnewbgcolour=false" << endl; - out << "hasnormalicon=true" << endl; - out << "hasnormalanim=false" << endl; - out << "hasnewicon=true" << endl; - out << "hasnewanim=false" << endl; - } - else - { - out << "hasnormalfgcolour=true" << endl; - out << "hasnormalbgcolour=true" << endl; - out << "hasnewfgcolour=true" << endl; - out << "hasnewbgcolour=true" << endl; - out << "hasnormalicon=false" << endl; - out << "hasnormalanim=false" << endl; - out << "hasnewicon=false" << endl; - out << "hasnewanim=false" << endl; - } - } - } - - if( !currentGroup1.isNull() ) - { - out << currentGroup2 << endl; - printToprint( out, to_printed, type ); - } - - TQValueList::Iterator it1 = tobe_deleted.begin(); - TQValueList::Iterator it1_end = tobe_deleted.end(); - - for( ; it1 != it1_end; ++it1 ) - out << "# DELETEGROUP " << *it1 << endl; - - return 0; -} - diff --git a/korn/kconf_update/korn-3-4-config_change.upd b/korn/kconf_update/korn-3-4-config_change.upd deleted file mode 100644 index 530304fa..00000000 --- a/korn/kconf_update/korn-3-4-config_change.upd +++ /dev/null @@ -1,3 +0,0 @@ -Id=korn_kde_3_4_config_change -File=kornrc -Script=korn-3-4-config_change diff --git a/korn/kconf_update/korn-3-5-metadata-update.pl b/korn/kconf_update/korn-3-5-metadata-update.pl deleted file mode 100644 index 95723c4e..00000000 --- a/korn/kconf_update/korn-3-5-metadata-update.pl +++ /dev/null @@ -1,43 +0,0 @@ -my $input; -my $group; -my $auth = ""; -my $tls = ""; -my $metadata = ""; - -while( $input = ) -{ - chop $input; - if( $input =~ /^\[.*\]$/ ) - { - if( $metadata ) - { - print "[$group]\n"; - print "metadata=$metadata\n"; - $metadata=""; - } - - if( $input =~ /^\[(korn-(\d+)-\d+)\]$/ ) - { - $group = $1; - } - else - { - $group = ""; - } - $auth=""; - $tls=""; - } - - if( $input =~ /^auth\=(.*)/ ) - { - $metadata=$tls ? "auth=$1,tls=$tls" : "auth=$1"; - $auth=$1; - print "# DELETE [$group]auth\n"; - } - elsif( $input =~ /^tls\=(.*)/ ) - { - $metadata=$auth ? "auth=$auth,tls=$1" : "tls=$1"; - $tls=$1; - print "# DELETE [$tls]tls\n"; - } -} diff --git a/korn/kconf_update/korn-3-5-ssl-update.pl b/korn/kconf_update/korn-3-5-ssl-update.pl deleted file mode 100644 index b44ce10f..00000000 --- a/korn/kconf_update/korn-3-5-ssl-update.pl +++ /dev/null @@ -1,39 +0,0 @@ -my $input; -my $group; -my $protocol; - -while( $input = ) -{ - chop $input; - if( $input =~ /^\[.*\]$/ ) - { - if( $input =~ /^\[(korn-(\d+)-\d+)\]$/ ) - { - $group = $1; - } - else - { - $group = ""; - } - } - - if( $input =~ /^protocol\=(.*)/ ) - { - $protocol=$1; - print "[$group]\n"; - if( $protocol eq "imaps" ) - { - print "protocol=imap\n"; - print "ssl=true\n"; - } - elsif( $protocol eq "pop3s" ) - { - print "protocol=pop3\n"; - print "ssl=true\n"; - } - else - { - print "ssl=false\n"; - } - } -} diff --git a/korn/kconf_update/korn-3-5-update.upd b/korn/kconf_update/korn-3-5-update.upd deleted file mode 100644 index d954d782..00000000 --- a/korn/kconf_update/korn-3-5-update.upd +++ /dev/null @@ -1,10 +0,0 @@ -Id=korn-3-5-ssl-update -File=kornrc -Options=overwrite -Script=korn-3-5-ssl-update.pl,perl - -Id=korn-3-5-metadata-update -File=kornrc -Options=overwrite -Script=korn-3-5-metadata-update.pl,perl - diff --git a/korn/keditlistboxman.cpp b/korn/keditlistboxman.cpp index 83b40203..440b2c83 100644 --- a/korn/keditlistboxman.cpp +++ b/korn/keditlistboxman.cpp @@ -18,7 +18,7 @@ #include "keditlistboxman.h" -#include +#include #include #include diff --git a/korn/kio.cpp b/korn/kio.cpp index 63a9dc68..f2ff37fa 100644 --- a/korn/kio.cpp +++ b/korn/kio.cpp @@ -40,8 +40,8 @@ //#include"dropdlg.h" #include "mailsubject.h" -#include -#include +#include +#include #include #include #include @@ -70,7 +70,7 @@ /* * The 'process' maildrop is a lot different than the other protocols: - * it haven't a kioslave and could not result in file list. To prevent + * it haven't a tdeioslave and could not result in file list. To prevent * trowing it away, that functionality is hacked in this file. */ diff --git a/korn/kio_count.cpp b/korn/kio_count.cpp index bea6bf19..1531a9b9 100644 --- a/korn/kio_count.cpp +++ b/korn/kio_count.cpp @@ -25,10 +25,10 @@ #include "sortedmailsubject.h" #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include @@ -275,7 +275,7 @@ void KIO_Count::entries( TDEIO::Job* job, const TDEIO::UDSEntryList &list ) else if( (*it2).m_uds == TDEIO::UDS_URL ) fileinfo.name = (*it2).m_str; else if( (*it2).m_uds == TDEIO::UDS_NAME ) - { //The file kioslave doesn't return UDS_URL. + { //The file tdeioslave doesn't return UDS_URL. kurl = *_kurl; metadata = *_metadata; _protocol->recheckKURL( kurl, metadata ); diff --git a/korn/kio_count.h b/korn/kio_count.h index 9b44e1ca..e575864e 100644 --- a/korn/kio_count.h +++ b/korn/kio_count.h @@ -25,7 +25,7 @@ #include "kio.h" //Alsewise, no access to KKioDrop::FileInfo (needed in template) -#include //FIXME: without this, moc-compiler fails. +#include //FIXME: without this, moc-compiler fails. class KIO_Protocol; class KIO_Single_Subject; diff --git a/korn/kio_delete.cpp b/korn/kio_delete.cpp index 17eec2f5..a73b0dd4 100644 --- a/korn/kio_delete.cpp +++ b/korn/kio_delete.cpp @@ -26,9 +26,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include diff --git a/korn/kio_proto.cpp b/korn/kio_proto.cpp index c6d2184d..e63a7166 100644 --- a/korn/kio_proto.cpp +++ b/korn/kio_proto.cpp @@ -19,7 +19,7 @@ #include "kio_proto.h" -#include +#include #include #include diff --git a/korn/kio_proto.h b/korn/kio_proto.h index e97b0112..510e97d3 100644 --- a/korn/kio_proto.h +++ b/korn/kio_proto.h @@ -27,7 +27,7 @@ */ class TQString; -#include +#include #include #include #include "protocol.h" diff --git a/korn/kio_read.cpp b/korn/kio_read.cpp index 0e77e1a7..f98669d8 100644 --- a/korn/kio_read.cpp +++ b/korn/kio_read.cpp @@ -26,9 +26,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include diff --git a/korn/kio_single_subject.cpp b/korn/kio_single_subject.cpp index 45ca047f..0c20b1ab 100644 --- a/korn/kio_single_subject.cpp +++ b/korn/kio_single_subject.cpp @@ -25,10 +25,10 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include diff --git a/korn/kio_subjects.cpp b/korn/kio_subjects.cpp index 3fda7e4c..f40a86f6 100644 --- a/korn/kio_subjects.cpp +++ b/korn/kio_subjects.cpp @@ -23,8 +23,8 @@ #include "kio_proto.h" #include "mailsubject.h" -#include -#include +#include +#include #include #include diff --git a/korn/kmail_proto.cpp b/korn/kmail_proto.cpp index 8f740c80..7be0555d 100644 --- a/korn/kmail_proto.cpp +++ b/korn/kmail_proto.cpp @@ -24,7 +24,7 @@ #include "password.h" #include "protocols.h" -#include +#include #include #include diff --git a/korn/kornaccountcfgimpl.cpp b/korn/kornaccountcfgimpl.cpp index a68ccefb..df6a0e50 100644 --- a/korn/kornaccountcfgimpl.cpp +++ b/korn/kornaccountcfgimpl.cpp @@ -24,7 +24,7 @@ #include "protocol.h" #include "protocols.h" -#include +#include #include #include #include diff --git a/korn/kornboxcfgimpl.cpp b/korn/kornboxcfgimpl.cpp index fc699c10..f7904b59 100644 --- a/korn/kornboxcfgimpl.cpp +++ b/korn/kornboxcfgimpl.cpp @@ -23,10 +23,10 @@ class TDEConfig; #include "kornaccountcfgimpl.h" #include "password.h" -#include +#include #include #include -#include +#include #include #include #include diff --git a/korn/korncfgimpl.cpp b/korn/korncfgimpl.cpp index b944087f..1d3ba736 100644 --- a/korn/korncfgimpl.cpp +++ b/korn/korncfgimpl.cpp @@ -22,7 +22,7 @@ #include "kornboxcfgimpl.h" #include "password.h" -#include +#include #include #include #include diff --git a/korn/kornshell.cpp b/korn/kornshell.cpp index 2e0cc091..5d075b65 100644 --- a/korn/kornshell.cpp +++ b/korn/kornshell.cpp @@ -25,7 +25,7 @@ #include "password.h" #include -#include +#include #include #include #include diff --git a/korn/maildrop.cpp b/korn/maildrop.cpp index 20b6dfe9..2224c74e 100644 --- a/korn/maildrop.cpp +++ b/korn/maildrop.cpp @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include"utils.h" diff --git a/korn/password.cpp b/korn/password.cpp index 50f31e8d..f9318319 100644 --- a/korn/password.cpp +++ b/korn/password.cpp @@ -19,7 +19,7 @@ #include "password.h" -#include +#include #include #include diff --git a/korn/polldrop.cpp b/korn/polldrop.cpp index bc4422ca..54d4eb62 100644 --- a/korn/polldrop.cpp +++ b/korn/polldrop.cpp @@ -6,7 +6,7 @@ */ -#include +#include #include"utils.h" #include"polldrop.h" diff --git a/korn/systemtray.cpp b/korn/systemtray.cpp index e7ca45f7..a0bd191d 100644 --- a/korn/systemtray.cpp +++ b/korn/systemtray.cpp @@ -19,7 +19,7 @@ #include "systemtray.h" #include -#include +#include #include #include diff --git a/korn/tdeconf_update/CMakeLists.txt b/korn/tdeconf_update/CMakeLists.txt new file mode 100644 index 00000000..22d4b6a8 --- /dev/null +++ b/korn/tdeconf_update/CMakeLists.txt @@ -0,0 +1,38 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include_directories( + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### other data ################################ + +install( FILES + korn-3-4-config_change.upd korn-3-5-update.upd + DESTINATION ${KCONF_UPDATE_INSTALL_DIR} ) + +install( PROGRAMS + korn-3-5-ssl-update.pl korn-3-5-metadata-update.pl + DESTINATION ${KCONF_UPDATE_INSTALL_DIR} ) + + +##### korn-3-4-config_change (executable) ####### + +tde_add_executable( korn-3-4-config_change + SOURCES korn-3-4-config_change.cpp + LINK ${TQT_LIBRARIES} + DESTINATION ${LIB_INSTALL_DIR}/tdeconf_update_bin +) diff --git a/korn/tdeconf_update/Makefile.am b/korn/tdeconf_update/Makefile.am new file mode 100644 index 00000000..214f0c81 --- /dev/null +++ b/korn/tdeconf_update/Makefile.am @@ -0,0 +1,12 @@ +INCLUDES=$(all_includes) + +update_DATA = korn-3-4-config_change.upd korn-3-5-update.upd +update_SCRIPTS = korn-3-5-ssl-update.pl korn-3-5-metadata-update.pl +updatedir = $(kde_datadir)/tdeconf_update + +tdeconf_PROGRAMS = korn-3-4-config_change +tdeconfdir = $(libdir)/tdeconf_update_bin + +korn_3_4_config_change_SOURCES = korn-3-4-config_change.cpp +korn_3_4_config_change_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor +korn_3_4_config_change_LDADD = $(LIB_QT) diff --git a/korn/tdeconf_update/korn-3-4-config_change.cpp b/korn/tdeconf_update/korn-3-4-config_change.cpp new file mode 100644 index 00000000..7eff3ad3 --- /dev/null +++ b/korn/tdeconf_update/korn-3-4-config_change.cpp @@ -0,0 +1,261 @@ +/* + * Copyright (C) 2004, Mart Kelder (mart.kde@hccnet.nl) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include +#include +#include + +#include + +TQString decodeString( const TQString &password ) +{ + unsigned int i, val; + unsigned int len = password.length(); + TQString result=""; + for ( i=0; i < len; i++ ) + { + val = password[i].latin1() - ' '; + val = (255-' ') - val; + result += (char)(val + ' '); + } + return result; +} + +void printToprint( TQTextStream &out, TQMap &to_printed, const TQString type ) +{ + out << "printToprint( " << type << " )" << endl; + + if( type == "mbox" ) + { + out << "mailbox=" << to_printed[ "file" ] << endl; + } + else if( type == "qmail" ) + { + out << "mailbox=" << to_printed[ "maildir" ] << endl; + } + else if( type == "pop3" ) + { + out << "host=" << to_printed[ "host" ] << endl; + out << "port=" << to_printed[ "port" ] << endl; + out << "username=" << to_printed[ "user" ] << endl; + if( to_printed[ "APOP" ] == "true" ) + out << "auth=APOP" << endl; + else + out << "auth=" << endl; + } + else if( type == "imap4" ) + { + out << "host=" << to_printed[ "host" ] << endl; + out << "port=" << to_printed[ "port" ] << endl; + out << "username=" << to_printed[ "user" ] << endl; + out << "mailbox=" << to_printed[ "mailbox" ] << endl; + } + else if( type == "nntp" ) + { + out << "host=" << to_printed[ "host" ] << endl; + out << "port=" << to_printed[ "port" ] << endl; + out << "mailbox=" << to_printed[ "group" ] << endl; + } + else if( type == "process" ) + { + out << "mailbox=" << to_printed[ "command" ] << endl; + } + else if( type == "kio" ) + { + out << "host=" << to_printed[ "host" ] << endl; + out << "port=" << to_printed[ "port" ] << endl; + out << "username=" << to_printed[ "username" ] << endl; + out << "mailbox=" << to_printed[ "mailbox" ] << endl; + out << "password=" << decodeString( to_printed[ "password" ] ) << endl; + } + + if( type == "pop3" || type == "imap4" ) + { + out << "password=" << to_printed[ "pass" ] << endl; + if( to_printed[ "pass" ].isEmpty() ) + out << "savepassword=false" << endl; + else + out << "savepassword=true" << endl; + } + + if( to_printed[ "resetcounter" ] != "-1" ) + out << "reset=" << to_printed[ "resetcounter" ] << endl; + else + out << "reset=0" << endl; + out << "interval=" << to_printed[ "poll" ] << endl; +} + +int main( int, char** ) +{ + TQString line = TQString(); + TQString currentGroup1 = TQString(); + TQString currentGroup2 = TQString(); + TQString type = TQString(); + TQString password = TQString(); + TQRegExp interesting_group( "^\\[box-(\\d+)\\]" ); + TQRegExp key_value( "^(\\w*)=(.*)$" ); + TQValueList tobe_deleted; + int numboxes = -1; + bool isKey = false; + + TQTextStream in( stdin, IO_ReadOnly ); + TQTextStream out( stdout, IO_WriteOnly ); + + in.setEncoding( TQTextStream::UnicodeUTF8 ); + out.setEncoding( TQTextStream::UnicodeUTF8 ); + + TQMap mapping1; + TQValueList mapping2; + TQMap to_printed; + + mapping1.insert( "caption", "name" ); + mapping1.insert( "onclick", "command" ); + mapping1.insert( "onnewmail", "newcommand" ); + mapping1.insert( "soundfile", "sound" ); + mapping1.insert( "passive_popup", "passivepopup" ); + mapping1.insert( "passive_data", "passivedata" ); + mapping1.insert( "reset", "reset" ); + mapping1.insert( "fgcolour", "normalfgcolour" ); + mapping1.insert( "bgcolour", "normalbgcolour" ); + mapping1.insert( "newmailfgcolour", "newfgcolour" ); + mapping1.insert( "newmailbgcolour", "newbgcolour" ); + mapping1.insert( "icon", "normalicon" ); + mapping1.insert( "newmailicon", "newicon" ); + + mapping2.append( "file" ); + mapping2.append( "maildir" ); + mapping2.append( "host" ); + mapping2.append( "port" ); + mapping2.append( "user" ); + mapping2.append( "APOP" ); + mapping2.append( "mailbox" ); + mapping2.append( "group" ); + mapping2.append( "command" ); + mapping2.append( "protocol" ); + mapping2.append( "pass" ); + mapping2.append( "password" ); + mapping2.append( "resetcounter" ); + mapping2.append( "poll" ); + + while( !in.atEnd() ) + { + line = in.readLine(); + + isKey = key_value.search( line ) >= 0; + + if( line.left( 1 ) == "[" ) + { + if( !currentGroup1.isNull() ) + { + out << currentGroup2 << endl; + printToprint( out, to_printed, type ); + } + + currentGroup1 = TQString(); + } + + if( interesting_group.search( line ) >= 0 ) + { + if( numboxes > -1 && interesting_group.cap( 1 ).toInt() < numboxes ) + { + currentGroup1 = TQString( "[korn-%1]" ).arg( interesting_group.cap( 1 ) ); + currentGroup2 = TQString( "[korn-%1-0]" ).arg( interesting_group.cap( 1 ) ); + } + tobe_deleted.append( line ); + continue; + } + else if( isKey && key_value.cap( 1 ) == "numboxes" ) + { + numboxes = key_value.cap( 2 ).toInt(); + continue; + } + else if( currentGroup1.isNull() || !isKey ) + continue; + if( mapping1.contains( key_value.cap( 1 ) ) ) + { + out << currentGroup1 << endl; + out << mapping1[ key_value.cap( 1 ) ] << "=" << key_value.cap( 2 ) << endl; + if( key_value.cap( 1 ) == "caption" ) + { + out << currentGroup2 << endl; + out << "name=" << key_value.cap( 2 ) << endl; + } + } + else if( mapping2.contains( key_value.cap( 1 ) ) ) + { + to_printed.insert( key_value.cap( 1 ), key_value.cap( 2 ) ); + } + else if( key_value.cap( 1 ) == "type" && key_value.cap( 2 ) != "kio" ) + { + out << currentGroup2 << endl; + if( key_value.cap( 2 ) == "imap4" ) + out << "protocol=imap" << endl; + else + out << "protocol=" << key_value.cap( 2 ) << endl; + type = key_value.cap( 2 ); + + } + else if( key_value.cap( 1 ) == "type" && key_value.cap( 2 ) == "kio" ) + { + type = "kio"; + } + else if( key_value.cap( 1 ) == "displaystyle" ) + { + out << currentGroup1 << endl; + if( key_value.cap( 2 ) == "2" ) + { + out << "hasnormalfgcolour=false" << endl; + out << "hasnormalbgcolour=false" << endl; + out << "hasnewfgcolour=false" << endl; + out << "hasnewbgcolour=false" << endl; + out << "hasnormalicon=true" << endl; + out << "hasnormalanim=false" << endl; + out << "hasnewicon=true" << endl; + out << "hasnewanim=false" << endl; + } + else + { + out << "hasnormalfgcolour=true" << endl; + out << "hasnormalbgcolour=true" << endl; + out << "hasnewfgcolour=true" << endl; + out << "hasnewbgcolour=true" << endl; + out << "hasnormalicon=false" << endl; + out << "hasnormalanim=false" << endl; + out << "hasnewicon=false" << endl; + out << "hasnewanim=false" << endl; + } + } + } + + if( !currentGroup1.isNull() ) + { + out << currentGroup2 << endl; + printToprint( out, to_printed, type ); + } + + TQValueList::Iterator it1 = tobe_deleted.begin(); + TQValueList::Iterator it1_end = tobe_deleted.end(); + + for( ; it1 != it1_end; ++it1 ) + out << "# DELETEGROUP " << *it1 << endl; + + return 0; +} + diff --git a/korn/tdeconf_update/korn-3-4-config_change.upd b/korn/tdeconf_update/korn-3-4-config_change.upd new file mode 100644 index 00000000..530304fa --- /dev/null +++ b/korn/tdeconf_update/korn-3-4-config_change.upd @@ -0,0 +1,3 @@ +Id=korn_kde_3_4_config_change +File=kornrc +Script=korn-3-4-config_change diff --git a/korn/tdeconf_update/korn-3-5-metadata-update.pl b/korn/tdeconf_update/korn-3-5-metadata-update.pl new file mode 100644 index 00000000..95723c4e --- /dev/null +++ b/korn/tdeconf_update/korn-3-5-metadata-update.pl @@ -0,0 +1,43 @@ +my $input; +my $group; +my $auth = ""; +my $tls = ""; +my $metadata = ""; + +while( $input = ) +{ + chop $input; + if( $input =~ /^\[.*\]$/ ) + { + if( $metadata ) + { + print "[$group]\n"; + print "metadata=$metadata\n"; + $metadata=""; + } + + if( $input =~ /^\[(korn-(\d+)-\d+)\]$/ ) + { + $group = $1; + } + else + { + $group = ""; + } + $auth=""; + $tls=""; + } + + if( $input =~ /^auth\=(.*)/ ) + { + $metadata=$tls ? "auth=$1,tls=$tls" : "auth=$1"; + $auth=$1; + print "# DELETE [$group]auth\n"; + } + elsif( $input =~ /^tls\=(.*)/ ) + { + $metadata=$auth ? "auth=$auth,tls=$1" : "tls=$1"; + $tls=$1; + print "# DELETE [$tls]tls\n"; + } +} diff --git a/korn/tdeconf_update/korn-3-5-ssl-update.pl b/korn/tdeconf_update/korn-3-5-ssl-update.pl new file mode 100644 index 00000000..b44ce10f --- /dev/null +++ b/korn/tdeconf_update/korn-3-5-ssl-update.pl @@ -0,0 +1,39 @@ +my $input; +my $group; +my $protocol; + +while( $input = ) +{ + chop $input; + if( $input =~ /^\[.*\]$/ ) + { + if( $input =~ /^\[(korn-(\d+)-\d+)\]$/ ) + { + $group = $1; + } + else + { + $group = ""; + } + } + + if( $input =~ /^protocol\=(.*)/ ) + { + $protocol=$1; + print "[$group]\n"; + if( $protocol eq "imaps" ) + { + print "protocol=imap\n"; + print "ssl=true\n"; + } + elsif( $protocol eq "pop3s" ) + { + print "protocol=pop3\n"; + print "ssl=true\n"; + } + else + { + print "ssl=false\n"; + } + } +} diff --git a/korn/tdeconf_update/korn-3-5-update.upd b/korn/tdeconf_update/korn-3-5-update.upd new file mode 100644 index 00000000..d954d782 --- /dev/null +++ b/korn/tdeconf_update/korn-3-5-update.upd @@ -0,0 +1,10 @@ +Id=korn-3-5-ssl-update +File=kornrc +Options=overwrite +Script=korn-3-5-ssl-update.pl,perl + +Id=korn-3-5-metadata-update +File=kornrc +Options=overwrite +Script=korn-3-5-metadata-update.pl,perl + diff --git a/ktnef/gui/attachpropertydialog.cpp b/ktnef/gui/attachpropertydialog.cpp index 564e3b71..222c3f1b 100644 --- a/ktnef/gui/attachpropertydialog.cpp +++ b/ktnef/gui/attachpropertydialog.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/ktnef/gui/ktnefmain.cpp b/ktnef/gui/ktnefmain.cpp index 837f01c3..8324b5de 100644 --- a/ktnef/gui/ktnefmain.cpp +++ b/ktnef/gui/ktnefmain.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/ktnef/lib/CMakeLists.txt b/ktnef/lib/CMakeLists.txt index 068fffff..8694d25f 100644 --- a/ktnef/lib/CMakeLists.txt +++ b/ktnef/lib/CMakeLists.txt @@ -30,6 +30,6 @@ tde_add_library( ktnef SHARED mapi.cpp ktnefpropertyset.cpp ktnefmessage.cpp ktnefwriter.cpp lzfu.cpp VERSION 1.0.0 - LINK kio-shared + LINK tdeio-shared DESTINATION ${LIB_INSTALL_DIR} ) diff --git a/libemailfunctions/networkstatus.cpp b/libemailfunctions/networkstatus.cpp index b07c2973..eb99bcff 100644 --- a/libemailfunctions/networkstatus.cpp +++ b/libemailfunctions/networkstatus.cpp @@ -19,7 +19,7 @@ Boston, MA 02110-1301, USA. */ -#include +#include #include #include diff --git a/libkcal/attachmenthandler.cpp b/libkcal/attachmenthandler.cpp index 20035bc5..9b492676 100644 --- a/libkcal/attachmenthandler.cpp +++ b/libkcal/attachmenthandler.cpp @@ -35,13 +35,13 @@ #include "scheduler.h" #include -#include +#include #include #include #include #include #include -#include +#include #include diff --git a/libkcal/convertqtopia.cpp b/libkcal/convertqtopia.cpp index a546de19..2467e83d 100644 --- a/libkcal/convertqtopia.cpp +++ b/libkcal/convertqtopia.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include diff --git a/libkcal/freebusyurlstore.cpp b/libkcal/freebusyurlstore.cpp index 62cf26e6..a4a42b5c 100644 --- a/libkcal/freebusyurlstore.cpp +++ b/libkcal/freebusyurlstore.cpp @@ -22,7 +22,7 @@ #include "freebusyurlstore.h" #include -#include +#include #include using namespace KCal; diff --git a/libkcal/htmlexportsettings.kcfgc b/libkcal/htmlexportsettings.kcfgc index 62c52615..db2360aa 100644 --- a/libkcal/htmlexportsettings.kcfgc +++ b/libkcal/htmlexportsettings.kcfgc @@ -1,4 +1,4 @@ -# Code generation options for kconfig_compiler +# Code generation options for tdeconfig_compiler File=htmlexportsettings.kcfg ClassName=HTMLExportSettings Singleton=false diff --git a/libkcal/resourcecached.h b/libkcal/resourcecached.h index 5f56e390..94c00ae4 100644 --- a/libkcal/resourcecached.h +++ b/libkcal/resourcecached.h @@ -27,7 +27,7 @@ #include "incidence.h" #include "calendarlocal.h" -#include +#include #include #include diff --git a/libkcal/resourcecalendar.cpp b/libkcal/resourcecalendar.cpp index 36a0932b..76f12ed1 100644 --- a/libkcal/resourcecalendar.cpp +++ b/libkcal/resourcecalendar.cpp @@ -22,7 +22,7 @@ Boston, MA 02110-1301, USA. */ -#include +#include #include #include diff --git a/libkcal/resourcecalendar.h b/libkcal/resourcecalendar.h index 5202563b..c8455483 100644 --- a/libkcal/resourcecalendar.h +++ b/libkcal/resourcecalendar.h @@ -29,7 +29,7 @@ #include #include -#include +#include #include "alarm.h" #include "todo.h" diff --git a/libkcal/resourcelocaldir.cpp b/libkcal/resourcelocaldir.cpp index 47b19d7c..5ca0518e 100644 --- a/libkcal/resourcelocaldir.cpp +++ b/libkcal/resourcelocaldir.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include "vcaldrag.h" diff --git a/libkcal/tests/runtestcase.pl b/libkcal/tests/runtestcase.pl index 4cad27cc..ce825479 100755 --- a/libkcal/tests/runtestcase.pl +++ b/libkcal/tests/runtestcase.pl @@ -61,11 +61,11 @@ if ( system( $cmd ) != 0 ) { exit 1; } -checkfile( $file, $outfile ); +chectdefile( $file, $outfile ); exit 0; -sub checkfile() +sub chectdefile() { my $file = shift; my $outfile = shift; diff --git a/libkcal/tests/testresource.cpp b/libkcal/tests/testresource.cpp index fbd42da6..31f8d9b1 100644 --- a/libkcal/tests/testresource.cpp +++ b/libkcal/tests/testresource.cpp @@ -24,8 +24,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/libkpgp/Makefile.am b/libkpgp/Makefile.am index e8b89f72..d17105bb 100644 --- a/libkpgp/Makefile.am +++ b/libkpgp/Makefile.am @@ -20,7 +20,7 @@ libkpgp_la_LIBADD = $(LIB_TDEUI) $(LIB_POLL) METASOURCES = AUTO -updatedir = $(kde_datadir)/kconf_update +updatedir = $(kde_datadir)/tdeconf_update update_DATA = kpgp.upd update_SCRIPTS = kpgp-3.1-upgrade-address-data.pl diff --git a/libkpgp/kpgp.cpp b/libkpgp/kpgp.cpp index 18060ec6..33aa8995 100644 --- a/libkpgp/kpgp.cpp +++ b/libkpgp/kpgp.cpp @@ -37,8 +37,8 @@ #include #include #include -#include -#include +#include +#include #include #include "kpgpbase.h" diff --git a/libkpgp/kpgpui.cpp b/libkpgp/kpgpui.cpp index 164225d1..f468cb92 100644 --- a/libkpgp/kpgpui.cpp +++ b/libkpgp/kpgpui.cpp @@ -38,8 +38,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/libkpimexchange/configure.in.in b/libkpimexchange/configure.in.in index 139073a4..a9f0c80c 100644 --- a/libkpimexchange/configure.in.in +++ b/libkpimexchange/configure.in.in @@ -6,7 +6,7 @@ kde_safe_cppflags=$CPPFLAGS CPPFLAGS="$CPPFLAGS $all_includes" AC_LANG_CPLUSPLUS AC_TRY_COMPILE( -[#include ], +[#include ], [ int method = (int) TDEIO::DAV_SUBSCRIBE; ], diff --git a/libkpimexchange/core/exchangeaccount.cpp b/libkpimexchange/core/exchangeaccount.cpp index 7b67a552..dc7d7daa 100644 --- a/libkpimexchange/core/exchangeaccount.cpp +++ b/libkpimexchange/core/exchangeaccount.cpp @@ -31,16 +31,16 @@ #include #include #include -#include +#include #include #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include "exchangeaccount.h" #include "utils.h" diff --git a/libkpimexchange/core/exchangeaccount.h b/libkpimexchange/core/exchangeaccount.h index 0d8bfcdf..e55b2243 100644 --- a/libkpimexchange/core/exchangeaccount.h +++ b/libkpimexchange/core/exchangeaccount.h @@ -28,7 +28,7 @@ #include #include -#include +#include namespace KPIM { diff --git a/libkpimexchange/core/exchangeclient.cpp b/libkpimexchange/core/exchangeclient.cpp index eadcc2be..c316a25a 100644 --- a/libkpimexchange/core/exchangeclient.cpp +++ b/libkpimexchange/core/exchangeclient.cpp @@ -25,8 +25,8 @@ #include // These for test() method -#include -#include +#include +#include // #include "libtdepim/resources/resourcemanager.h" // #include "libtdepim/resources/calendar/resourcecalendar.h" diff --git a/libkpimexchange/core/exchangedelete.cpp b/libkpimexchange/core/exchangedelete.cpp index b23e9527..094b3b5c 100644 --- a/libkpimexchange/core/exchangedelete.cpp +++ b/libkpimexchange/core/exchangedelete.cpp @@ -24,14 +24,14 @@ #include #include #include -#include -#include - -#include -#include -#include -#include -#include +#include +#include + +#include +#include +#include +#include +#include #include "exchangeclient.h" #include "exchangeprogress.h" diff --git a/libkpimexchange/core/exchangedelete.h b/libkpimexchange/core/exchangedelete.h index 151657e5..03b06690 100644 --- a/libkpimexchange/core/exchangedelete.h +++ b/libkpimexchange/core/exchangedelete.h @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include diff --git a/libkpimexchange/core/exchangedownload.cpp b/libkpimexchange/core/exchangedownload.cpp index 75b5f100..4fafacf9 100644 --- a/libkpimexchange/core/exchangedownload.cpp +++ b/libkpimexchange/core/exchangedownload.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include #include @@ -34,12 +34,12 @@ #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include diff --git a/libkpimexchange/core/exchangedownload.h b/libkpimexchange/core/exchangedownload.h index 33d13560..931d53bf 100644 --- a/libkpimexchange/core/exchangedownload.h +++ b/libkpimexchange/core/exchangedownload.h @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include diff --git a/libkpimexchange/core/exchangemonitor.cpp b/libkpimexchange/core/exchangemonitor.cpp index 531a2417..df52fdab 100644 --- a/libkpimexchange/core/exchangemonitor.cpp +++ b/libkpimexchange/core/exchangemonitor.cpp @@ -29,12 +29,12 @@ #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include diff --git a/libkpimexchange/core/exchangemonitor.h b/libkpimexchange/core/exchangemonitor.h index 15b4fa99..3ba96a39 100644 --- a/libkpimexchange/core/exchangemonitor.h +++ b/libkpimexchange/core/exchangemonitor.h @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include diff --git a/libkpimexchange/core/exchangeprogress.cpp b/libkpimexchange/core/exchangeprogress.cpp index bee71b57..2b6e0286 100644 --- a/libkpimexchange/core/exchangeprogress.cpp +++ b/libkpimexchange/core/exchangeprogress.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include diff --git a/libkpimexchange/core/exchangeupload.cpp b/libkpimexchange/core/exchangeupload.cpp index e553b40c..f134868f 100644 --- a/libkpimexchange/core/exchangeupload.cpp +++ b/libkpimexchange/core/exchangeupload.cpp @@ -24,13 +24,13 @@ #include #include #include -#include +#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include extern "C" { #include diff --git a/libkpimexchange/core/exchangeupload.h b/libkpimexchange/core/exchangeupload.h index e592c00f..85753b2c 100644 --- a/libkpimexchange/core/exchangeupload.h +++ b/libkpimexchange/core/exchangeupload.h @@ -22,7 +22,7 @@ #include #include -#include +#include #include diff --git a/libkpimidentities/identity.cpp b/libkpimidentities/identity.cpp index c467599a..9b4c9df6 100644 --- a/libkpimidentities/identity.cpp +++ b/libkpimidentities/identity.cpp @@ -8,13 +8,13 @@ #include "identity.h" -#include +#include #include #include #include #include -#include +#include #include #include diff --git a/libkpimidentities/identitymanager.cpp b/libkpimidentities/identitymanager.cpp index f6bc5def..d9d62615 100644 --- a/libkpimidentities/identitymanager.cpp +++ b/libkpimidentities/identitymanager.cpp @@ -45,7 +45,7 @@ static const char configKeyDefaultIdentity[] = "Default Identity"; #include #include #include -#include +#include #include #include @@ -74,7 +74,7 @@ IdentityManager::IdentityManager( bool readonly, TQObject * parent, const char * readConfig(mConfig); if ( mIdentities.isEmpty() ) { kdDebug(5006) << "emailidentities is empty -> convert from kmailrc" << endl; - // No emailidentities file, or an empty one due to broken conversion (kconf_update bug in tdelibs <= 3.2.2) + // No emailidentities file, or an empty one due to broken conversion (tdeconf_update bug in tdelibs <= 3.2.2) // => convert it, i.e. read settings from kmailrc TDEConfig kmailConf( "kmailrc", true ); readConfig( &kmailConf ); diff --git a/libtdepim/CMakeLists.txt b/libtdepim/CMakeLists.txt index 84f57a93..2c79e018 100644 --- a/libtdepim/CMakeLists.txt +++ b/libtdepim/CMakeLists.txt @@ -79,10 +79,10 @@ tde_add_library( tdepim SHARED AUTOMOC kimportdialog.cpp kvcarddrag.cpp sidebarextension.cpp infoextension.cpp addressesdialog.cpp addresspicker.ui addresseeview.cpp maillistdrag.cpp interfaces/MailTransportServiceIface.skel - interfaces/AddressBookServiceIface.skel kconfigpropagator.cpp kconfigwizard.cpp + interfaces/AddressBookServiceIface.skel tdeconfigpropagator.cpp tdeconfigwizard.cpp weaver.cpp weaverextensions.cpp weaverlogger.cpp pluginloaderbase.cpp addresseelineedit.cpp addresseelineedit.skel kdatepickerpopup.cpp - kfileio.cpp clicklineedit.cpp configmanager.cpp collectingprocess.cpp + tdefileio.cpp clicklineedit.cpp configmanager.cpp collectingprocess.cpp ldapclient.cpp overlaywidget.cpp progressmanager.cpp progressdialog.cpp statusbarprogresswidget.cpp ssllabel.cpp completionordereditor.cpp resourceabc.cpp diffalgo.cpp addresseediffalgo.cpp calendardiffalgo.cpp diff --git a/libtdepim/Makefile.am b/libtdepim/Makefile.am index 24942c72..7b690c8b 100644 --- a/libtdepim/Makefile.am +++ b/libtdepim/Makefile.am @@ -14,10 +14,10 @@ libtdepim_la_SOURCES = \ addressesdialog.cpp addresspicker.ui addresseeview.cpp \ maillistdrag.cpp MailTransportServiceIface.skel \ AddressBookServiceIface.skel \ - kconfigpropagator.cpp kconfigwizard.cpp \ + tdeconfigpropagator.cpp tdeconfigwizard.cpp \ weaver.cpp weaverextensions.cpp weaverlogger.cpp \ pluginloaderbase.cpp addresseelineedit.cpp addresseelineedit.skel \ - kdatepickerpopup.cpp kfileio.cpp \ + kdatepickerpopup.cpp tdefileio.cpp \ clicklineedit.cpp configmanager.cpp \ collectingprocess.cpp ldapclient.cpp \ overlaywidget.cpp progressmanager.cpp progressdialog.cpp \ diff --git a/libtdepim/addresseeview.cpp b/libtdepim/addresseeview.cpp index 559f0171..ef754e81 100644 --- a/libtdepim/addresseeview.cpp +++ b/libtdepim/addresseeview.cpp @@ -30,11 +30,11 @@ #include #include #include -#include +#include #include #include #include -#include +#include #include #include #include diff --git a/libtdepim/cfgc/README b/libtdepim/cfgc/README index 720ea212..05dcdf35 100644 --- a/libtdepim/cfgc/README +++ b/libtdepim/cfgc/README @@ -1,5 +1,5 @@ This directory contains text and example code for automatic creation of -configuration dialogs based on TDEConfigSkeleton, kconfig_compiler and +configuration dialogs based on TDEConfigSkeleton, tdeconfig_compiler and KPrefsDialog. If you have questions or comments please contact Cornelius Schumacher diff --git a/libtdepim/cfgc/autoexample.cpp b/libtdepim/cfgc/autoexample.cpp index 595d195b..8f5d08e8 100644 --- a/libtdepim/cfgc/autoexample.cpp +++ b/libtdepim/cfgc/autoexample.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include diff --git a/libtdepim/cfgc/example.cpp b/libtdepim/cfgc/example.cpp index 28c09378..d3f06879 100644 --- a/libtdepim/cfgc/example.cpp +++ b/libtdepim/cfgc/example.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include diff --git a/libtdepim/cfgc/exampleprefs_base.kcfgc b/libtdepim/cfgc/exampleprefs_base.kcfgc index 36e5ed4e..6cc9a923 100644 --- a/libtdepim/cfgc/exampleprefs_base.kcfgc +++ b/libtdepim/cfgc/exampleprefs_base.kcfgc @@ -1,4 +1,4 @@ -# Code generation options for kconfig_compiler +# Code generation options for tdeconfig_compiler File=exampleprefs_base.kcfg ClassName=ExamplePrefsBase Singleton=true diff --git a/libtdepim/completionordereditor.h b/libtdepim/completionordereditor.h index a755d173..e13ce313 100644 --- a/libtdepim/completionordereditor.h +++ b/libtdepim/completionordereditor.h @@ -32,7 +32,7 @@ #define COMPLETIONORDEREDITOR_H #include -#include +#include class KPushButton; class KListView; diff --git a/libtdepim/csshelper.cpp b/libtdepim/csshelper.cpp index 3c0ba38d..d2180e1a 100644 --- a/libtdepim/csshelper.cpp +++ b/libtdepim/csshelper.cpp @@ -31,7 +31,7 @@ #include "csshelper.h" -#include +#include #include #include #include diff --git a/libtdepim/groupwarejob.cpp b/libtdepim/groupwarejob.cpp index 22c9b7aa..bbe443fc 100644 --- a/libtdepim/groupwarejob.cpp +++ b/libtdepim/groupwarejob.cpp @@ -21,7 +21,7 @@ #include "groupwarejob.h" -#include +#include #include using namespace TDEIO; diff --git a/libtdepim/groupwarejob.h b/libtdepim/groupwarejob.h index 2fc2069b..17561b36 100644 --- a/libtdepim/groupwarejob.h +++ b/libtdepim/groupwarejob.h @@ -21,7 +21,7 @@ #ifndef KIO_GROUPWAREJOB_H #define KIO_GROUPWAREJOB_H -#include +#include namespace TDEIO { diff --git a/libtdepim/kaccount.cpp b/libtdepim/kaccount.cpp index f8fd61cf..86cf4cfc 100644 --- a/libtdepim/kaccount.cpp +++ b/libtdepim/kaccount.cpp @@ -32,7 +32,7 @@ #include "kaccount.h" -#include +#include KAccount::KAccount( const uint id, const TQString &name, const Type type ) : mId( id ), mName( name ), mType( type ) diff --git a/libtdepim/kcmdesignerfields.cpp b/libtdepim/kcmdesignerfields.cpp index bb870b11..72613f15 100644 --- a/libtdepim/kcmdesignerfields.cpp +++ b/libtdepim/kcmdesignerfields.cpp @@ -44,10 +44,10 @@ #include #include #include -#include +#include #include #include -#include +#include #include "kcmdesignerfields.h" diff --git a/libtdepim/kconfigpropagator.cpp b/libtdepim/kconfigpropagator.cpp deleted file mode 100644 index a231f963..00000000 --- a/libtdepim/kconfigpropagator.cpp +++ /dev/null @@ -1,289 +0,0 @@ -/* - This file is part of libtdepim. - - Copyright (c) 2003 Cornelius Schumacher - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "kconfigpropagator.h" - -#include -#include -#include -#include -#include -#include - -#include -#include - -TDEConfigPropagator::Change::~Change() -{ -} - -TDEConfigPropagator::ChangeConfig::ChangeConfig() - : TDEConfigPropagator::Change( i18n("Change Config Value") ), - hideValue( false ) -{ -} - -TQString TDEConfigPropagator::ChangeConfig::arg1() const -{ - return file + "/" + group + "/" + name; -} - -TQString TDEConfigPropagator::ChangeConfig::arg2() const -{ - if ( hideValue ) return "*"; - else return value; -} - -void TDEConfigPropagator::ChangeConfig::apply() -{ - TDEConfig cfg( file ); - cfg.setGroup( group ); - cfg.writeEntry( name, value ); - - cfg.sync(); -} - -TDEConfigPropagator::TDEConfigPropagator() - : mSkeleton( 0 ) -{ - init(); -} - -TDEConfigPropagator::TDEConfigPropagator( TDEConfigSkeleton *skeleton, - const TQString &kcfgFile ) - : mSkeleton( skeleton ), mKcfgFile( kcfgFile ) -{ - init(); - - readKcfgFile(); -} - -void TDEConfigPropagator::init() -{ - mChanges.setAutoDelete( true ); -} - -void TDEConfigPropagator::readKcfgFile() -{ - TQString filename = locate( "kcfg", mKcfgFile ); - if ( filename.isEmpty() ) { - kdError() << "Unable to find kcfg file '" << mKcfgFile << "'" << endl; - return; - } - - TQFile input( filename ); - TQDomDocument doc; - TQString errorMsg; - int errorRow; - int errorCol; - if ( !doc.setContent( &input, &errorMsg, &errorRow, &errorCol ) ) { - kdError() << "Parse error in " << mKcfgFile << ", line " << errorRow << ", col " << errorCol << ": " << errorMsg << endl; - return; - } - - TQDomElement cfgElement = doc.documentElement(); - - if ( cfgElement.isNull() ) { - kdError() << "No document in kcfg file" << endl; - return; - } - - mRules.clear(); - - TQDomNode n; - for ( n = cfgElement.firstChild(); !n.isNull(); n = n.nextSibling() ) { - TQDomElement e = n.toElement(); - - TQString tag = e.tagName(); - - if ( tag == "propagation" ) { - Rule rule = parsePropagation( e ); - mRules.append( rule ); - } else if ( tag == "condition" ) { - Condition condition = parseCondition( e ); - TQDomNode n2; - for( n2 = e.firstChild(); !n2.isNull(); n2 = n2.nextSibling() ) { - TQDomElement e2 = n2.toElement(); - if ( e2.tagName() == "propagation" ) { - Rule rule = parsePropagation( e2 ); - rule.condition = condition; - mRules.append( rule ); - } else { - kdError() << "Unknow tag: " << e2.tagName() << endl; - } - } - } - } -} - -TDEConfigPropagator::Rule TDEConfigPropagator::parsePropagation( const TQDomElement &e ) -{ - Rule r; - - TQString source = e.attribute( "source" ); - parseConfigEntryPath( source, r.sourceFile, r.sourceGroup, r.sourceEntry ); - - TQString target = e.attribute( "target" ); - parseConfigEntryPath( target, r.targetFile, r.targetGroup, r.targetEntry ); - - r.hideValue = e.hasAttribute( "hidevalue" ) && - e.attribute( "hidevalue" ) == "true"; - - return r; -} - -void TDEConfigPropagator::parseConfigEntryPath( const TQString &path, - TQString &file, - TQString &group, - TQString &entry ) -{ - TQStringList p = TQStringList::split( "/", path ); - - if ( p.count() != 3 ) { - kdError() << "Path has to be of form file/group/entry" << endl; - file = TQString(); - group = TQString(); - entry = TQString(); - return; - } - - file = p[ 0 ]; - group = p[ 1 ]; - entry = p[ 2 ]; - - return; -} - -TDEConfigPropagator::Condition TDEConfigPropagator::parseCondition( const TQDomElement &e ) -{ - Condition c; - - TQString key = e.attribute( "key" ); - - parseConfigEntryPath( key, c.file, c.group, c.key ); - - c.value = e.attribute( "value" ); - - c.isValid = true; - - return c; -} - -void TDEConfigPropagator::commit() -{ - updateChanges(); - - Change *c; - for( c = mChanges.first(); c; c = mChanges.next() ) { - c->apply(); - } -} - -TDEConfigSkeletonItem *TDEConfigPropagator::findItem( const TQString &group, - const TQString &name ) -{ -// kdDebug() << "TDEConfigPropagator::findItem()" << endl; - - if ( !mSkeleton ) return 0; - - TDEConfigSkeletonItem::List items = mSkeleton->items(); - TDEConfigSkeletonItem::List::ConstIterator it; - for( it = items.begin(); it != items.end(); ++it ) { -// kdDebug() << " Item: " << (*it)->name() << " Type: " -// << (*it)->property().typeName() << endl; - if ( (*it)->group() == group && (*it)->name() == name ) { - break; - } - } - if ( it == items.end() ) return 0; - else return *it; -} - -TQString TDEConfigPropagator::itemValueAsString( TDEConfigSkeletonItem *item ) -{ - TQVariant p = item->property(); - - if ( p.type() == TQVariant::Bool ) { - if ( p.toBool() ) return "true"; - else return "false"; - } - - return p.toString(); -} - -void TDEConfigPropagator::updateChanges() -{ - mChanges.clear(); - - Rule::List::ConstIterator it; - for( it = mRules.begin(); it != mRules.end(); ++it ) { - Rule r = *it; - Condition c = r.condition; - if ( c.isValid ) { - TDEConfigSkeletonItem *item = findItem( c.group, c.key ); - kdDebug() << "Item " << c.group << "/" << c.key << ":" << endl; - if ( !item ) { - kdError() << " Item not found." << endl; - } else { - TQString value = itemValueAsString( item ); - kdDebug() << " Value: " << value << endl; - if ( value != c.value ) { - continue; - } - } - } - - TDEConfigSkeletonItem *item = findItem( r.sourceGroup, r.sourceEntry ); - if ( !item ) { - kdError() << "Item " << r.sourceGroup << "/" << r.sourceEntry - << " not found." << endl; - continue; - } - TQString value = itemValueAsString( item ); - - TDEConfig target( r.targetFile ); - target.setGroup( r.targetGroup ); - TQString targetValue = target.readEntry( r.targetEntry ); - if ( r.hideValue ) targetValue = KStringHandler::obscure( targetValue ); - if ( targetValue != value ) { - ChangeConfig *change = new ChangeConfig(); - change->file = r.targetFile; - change->group = r.targetGroup; - change->name = r.targetEntry; - if ( r.hideValue ) value = KStringHandler::obscure( value ); - change->value = value; - change->hideValue = r.hideValue; - mChanges.append( change ); - } - } - - addCustomChanges( mChanges ); -} - -TDEConfigPropagator::Change::List TDEConfigPropagator::changes() -{ - return mChanges; -} - -TDEConfigPropagator::Rule::List TDEConfigPropagator::rules() -{ - return mRules; -} diff --git a/libtdepim/kconfigpropagator.h b/libtdepim/kconfigpropagator.h deleted file mode 100644 index 92f9565f..00000000 --- a/libtdepim/kconfigpropagator.h +++ /dev/null @@ -1,165 +0,0 @@ -/* - This file is part of libtdepim. - - Copyright (c) 2003 Cornelius Schumacher - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef KCONFIGPROPAGATOR_H -#define KCONFIGPROPAGATOR_H - -#include -#include -#include -#include - -#include - -class TDEConfigSkeleton; -class TDEConfigSkeletonItem; - -class KDE_EXPORT TDEConfigPropagator -{ - public: - - /** - Create TDEConfigPropagator object without associated source configuration. - */ - TDEConfigPropagator(); - /** - Create TDEConfigPropagator object. - - @param skeleton TDEConfigSkeleton object used as source for the propagation - @param kcfgFile file name of kcfg file containing the propagation rules - */ - TDEConfigPropagator( TDEConfigSkeleton *skeleton, const TQString &kcfgFile ); - virtual ~TDEConfigPropagator() {} - - TDEConfigSkeleton *skeleton() { return mSkeleton; } - - /* - Commit changes according to propagation rules. - */ - void commit(); - - class KDE_EXPORT Condition - { - public: - Condition() : isValid( false ) {} - - TQString file; - TQString group; - TQString key; - TQString value; - - bool isValid; - }; - - class KDE_EXPORT Rule - { - public: - typedef TQValueList List; - - Rule() : hideValue( false ) {} - - TQString sourceFile; - TQString sourceGroup; - TQString sourceEntry; - - TQString targetFile; - TQString targetGroup; - TQString targetEntry; - - Condition condition; - - bool hideValue; - }; - - class KDE_EXPORT Change - { - public: - typedef TQPtrList List; - - Change( const TQString &title ) : mTitle( title ) {} - virtual ~Change(); - - void setTitle( const TQString &title ) { mTitle = title; } - TQString title() const { return mTitle; } - - virtual TQString arg1() const { return TQString(); } - virtual TQString arg2() const { return TQString(); } - - virtual void apply() = 0; - - private: - TQString mTitle; - }; - - class KDE_EXPORT ChangeConfig : public Change - { - public: - ChangeConfig(); - ~ChangeConfig() {} - - TQString arg1() const; - TQString arg2() const; - - void apply(); - - TQString file; - TQString group; - TQString name; - TQString label; - TQString value; - bool hideValue; - }; - - void updateChanges(); - - Change::List changes(); - - Rule::List rules(); - - protected: - void init(); - - /** - Implement this function in a subclass if you want to add changes which - can't be expressed as propagations in the kcfg file. - */ - virtual void addCustomChanges( Change::List & ) {} - - TDEConfigSkeletonItem *findItem( const TQString &group, const TQString &name ); - - TQString itemValueAsString( TDEConfigSkeletonItem * ); - - void readKcfgFile(); - - Rule parsePropagation( const TQDomElement &e ); - Condition parseCondition( const TQDomElement &e ); - - void parseConfigEntryPath( const TQString &path, TQString &file, - TQString &group, TQString &entry ); - - private: - TDEConfigSkeleton *mSkeleton; - TQString mKcfgFile; - - Rule::List mRules; - Change::List mChanges; -}; - -#endif diff --git a/libtdepim/kconfigwizard.cpp b/libtdepim/kconfigwizard.cpp deleted file mode 100644 index c2baafcc..00000000 --- a/libtdepim/kconfigwizard.cpp +++ /dev/null @@ -1,197 +0,0 @@ -/* - This file is part of libtdepim. - - Copyright (c) 2003 Cornelius Schumacher - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "kconfigwizard.h" - -#include -#include -#include -#include -#include - -#include -#include -#include - -TDEConfigWizard::TDEConfigWizard( TQWidget *parent, - char *name, bool modal ) - : KDialogBase( TreeList, i18n("Configuration Wizard"), Ok|Cancel, Ok, parent, - name, modal ), - mPropagator( 0 ), mChangesPage( 0 ) -{ - init(); -} - -TDEConfigWizard::TDEConfigWizard( TDEConfigPropagator *propagator, TQWidget *parent, - char *name, bool modal ) - : KDialogBase( TreeList, i18n("Configuration Wizard"), Ok|Cancel, Ok, parent, - name, modal ), - mPropagator( propagator ), mChangesPage( 0 ) -{ - init(); -} - -TDEConfigWizard::~TDEConfigWizard() -{ - delete mPropagator; -} - -void TDEConfigWizard::init() -{ - connect( this, TQT_SIGNAL( aboutToShowPage( TQWidget * ) ), - TQT_SLOT( slotAboutToShowPage( TQWidget * ) ) ); - - TQTimer::singleShot( 0, this, TQT_SLOT( readConfig() ) ); -} - -void TDEConfigWizard::setPropagator( TDEConfigPropagator *p ) -{ - mPropagator = p; -} - -void TDEConfigWizard::slotAboutToShowPage( TQWidget *page ) -{ - if ( page == mChangesPage ) { - updateChanges(); - } -} - -TQFrame *TDEConfigWizard::createWizardPage( const TQString &title ) -{ - return addPage( title ); -} - -void TDEConfigWizard::setupRulesPage() -{ - TQFrame *topFrame = addPage( i18n("Rules") ); - TQVBoxLayout *topLayout = new TQVBoxLayout( topFrame ); - - mRuleView = new TQListView( topFrame ); - topLayout->addWidget( mRuleView ); - - mRuleView->addColumn( i18n("Source") ); - mRuleView->addColumn( i18n("Target") ); - mRuleView->addColumn( i18n("Condition") ); - - updateRules(); -} - -void TDEConfigWizard::updateRules() -{ - if ( !mPropagator ) { - kdError() << "TDEConfigWizard: No TDEConfigPropagator set." << endl; - return; - } - - mRuleView->clear(); - - TDEConfigPropagator::Rule::List rules = mPropagator->rules(); - TDEConfigPropagator::Rule::List::ConstIterator it; - for( it = rules.begin(); it != rules.end(); ++it ) { - TDEConfigPropagator::Rule r = *it; - TQString source = r.sourceFile + "/" + r.sourceGroup + "/" + - r.sourceEntry; - TQString target = r.targetFile + "/" + r.targetGroup + "/" + - r.targetEntry; - TQString condition; - TDEConfigPropagator::Condition c = r.condition; - if ( c.isValid ) { - condition = c.file + "/" + c.group + "/" + c.key + " = " + c.value; - } - new TQListViewItem( mRuleView, source, target, condition ); - } -} - -void TDEConfigWizard::setupChangesPage() -{ - TQFrame *topFrame = addPage( i18n("Changes") ); - TQVBoxLayout *topLayout = new TQVBoxLayout( topFrame ); - - mChangeView = new TQListView( topFrame ); - topLayout->addWidget( mChangeView ); - - mChangeView->addColumn( i18n("Action") ); - mChangeView->addColumn( i18n("Option") ); - mChangeView->addColumn( i18n("Value") ); - mChangeView->setSorting( -1 ); - - mChangesPage = topFrame; -} - -void TDEConfigWizard::updateChanges() -{ - kdDebug() << "TDEConfigWizard::updateChanges()" << endl; - - if ( !mPropagator ) { - kdError() << "TDEConfigWizard: No TDEConfigPropagator set." << endl; - return; - } - - usrWriteConfig(); - - mPropagator->updateChanges(); - - mChangeView->clear(); - - TDEConfigPropagator::Change::List changes = mPropagator->changes(); - TDEConfigPropagator::Change *c; - for( c = changes.first(); c; c = changes.next() ) { - new TQListViewItem( mChangeView, mChangeView->lastItem(), c->title(), c->arg1(), c->arg2() ); - } -} - -void TDEConfigWizard::readConfig() -{ - kdDebug() << "TDEConfigWizard::readConfig()" << endl; - - int result = KMessageBox::warningContinueCancel( this, - i18n("Please make sure that the programs which are " - "configured by the wizard do not run in parallel to the wizard; " - "otherwise, changes done by the wizard could be lost."), - i18n("Warning"), i18n("Run Wizard Now"), "warning_running_instances" ); - if ( result != KMessageBox::Continue ) kapp->quit(); - - usrReadConfig(); -} - -void TDEConfigWizard::slotOk() -{ - TQString error = validate(); - if ( error.isNull() ) { - usrWriteConfig(); - - if ( !mPropagator ) { - kdError() << "TDEConfigWizard: No TDEConfigPropagator set." << endl; - return; - } else { - if ( mPropagator->skeleton() ) { - mPropagator->skeleton()->writeConfig(); - } - mPropagator->commit(); - } - - accept(); - } else { - KMessageBox::sorry( this, error ); - } -} - -#include "kconfigwizard.moc" diff --git a/libtdepim/kconfigwizard.h b/libtdepim/kconfigwizard.h deleted file mode 100644 index a06849ec..00000000 --- a/libtdepim/kconfigwizard.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - This file is part of libtdepim. - - Copyright (c) 2003 Cornelius Schumacher - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef KCONFIGWIZARD_H -#define KCONFIGWIZARD_H - -#include -#include -#include - -class TQListView; - -/** - @short Configuration wizard base class -*/ -class KDE_EXPORT TDEConfigWizard : public KDialogBase -{ - Q_OBJECT - - public: - /** - Create wizard. You have to set a propgator with setPropagator() later. - */ - TDEConfigWizard( TQWidget *parent = 0, char *name = 0, bool modal = false ); - /** - Create wizard for given TDEConfigPropagator. The wizard takes ownership of - the propagator. - */ - TDEConfigWizard( TDEConfigPropagator *propagator, TQWidget *parent = 0, - char *name = 0, bool modal = false ); - /** - Destructor. - */ - virtual ~TDEConfigWizard(); - - /** - Set propagator the wizard operates on. - */ - void setPropagator( TDEConfigPropagator * ); - /** - Return propagator the wizard operates on. - */ - TDEConfigPropagator *propagator() { return mPropagator; } - - /** - Create wizard page with given title. - */ - TQFrame *createWizardPage( const TQString &title ); - - /** - Use this function to read the configuration from the TDEConfigSkeleton - object to the GUI. - */ - virtual void usrReadConfig() = 0; - - /** - This function is called when the wizard is finished. You have to save all - settings from the GUI to the TDEConfigSkeleton object here, so that the - TDEConfigPropagator can take them up from there. - */ - virtual void usrWriteConfig() = 0; - - /** - Validates the supplied data. Returns a appropiate error when some data - is invalid. Return TQString() if all data is valid. - */ - virtual TQString validate() { return TQString(); } - - protected slots: - void readConfig(); - - void slotOk(); - - void slotAboutToShowPage( TQWidget *page ); - - protected: - void init(); - - void setupRulesPage(); - void updateRules(); - void setupChangesPage(); - void updateChanges(); - - private: - TDEConfigPropagator *mPropagator; - - TQListView *mRuleView; - TQListView *mChangeView; - - TQWidget *mChangesPage; -}; - -#endif diff --git a/libtdepim/kfileio.cpp b/libtdepim/kfileio.cpp deleted file mode 100644 index fa963e16..00000000 --- a/libtdepim/kfileio.cpp +++ /dev/null @@ -1,390 +0,0 @@ -// kfileio.cpp -// Author: Stefan Taferner -// License: GPL - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include - -#include - -namespace KPIM { - -//----------------------------------------------------------------------------- -static void msgDialog(const TQString &msg) -{ - KMessageBox::sorry(0, msg, i18n("File I/O Error")); -} - - -//----------------------------------------------------------------------------- -KDE_EXPORT TQCString kFileToString(const TQString &aFileName, bool aEnsureNL, bool aVerbose) -{ - TQCString result; - TQFileInfo info(aFileName); - unsigned int readLen; - unsigned int len = info.size(); - TQFile file(aFileName); - - //assert(aFileName!=0); - if( aFileName.isEmpty() ) - return ""; - - if (!info.exists()) - { - if (aVerbose) - msgDialog(i18n("The specified file does not exist:\n%1").arg(aFileName)); - return TQCString(); - } - if (info.isDir()) - { - if (aVerbose) - msgDialog(i18n("This is a folder and not a file:\n%1").arg(aFileName)); - return TQCString(); - } - if (!info.isReadable()) - { - if (aVerbose) - msgDialog(i18n("You do not have read permissions " - "to the file:\n%1").arg(aFileName)); - return TQCString(); - } - if (len <= 0) return TQCString(); - - if (!file.open(IO_Raw|IO_ReadOnly)) - { - if (aVerbose) switch(file.status()) - { - case IO_ReadError: - msgDialog(i18n("Could not read file:\n%1").arg(aFileName)); - break; - case IO_OpenError: - msgDialog(i18n("Could not open file:\n%1").arg(aFileName)); - break; - default: - msgDialog(i18n("Error while reading file:\n%1").arg(aFileName)); - } - return TQCString(); - } - - result.resize(len + (int)aEnsureNL + 1); - readLen = file.readBlock(result.data(), len); - if (aEnsureNL && result[len-1]!='\n') - { - result[len++] = '\n'; - readLen++; - } - result[len] = '\0'; - - if (readLen < len) - { - TQString msg = i18n("Could only read %1 bytes of %2.") - .arg(readLen).arg(len); - msgDialog(msg); - return TQCString(); - } - - return result; -} - -//----------------------------------------------------------------------------- -#if 0 // unused -TQByteArray kFileToBytes(const TQString &aFileName, bool aVerbose) -{ - TQByteArray result; - TQFileInfo info(aFileName); - unsigned int readLen; - unsigned int len = info.size(); - TQFile file(aFileName); - - //assert(aFileName!=0); - if( aFileName.isEmpty() ) - return result; - - if (!info.exists()) - { - if (aVerbose) - msgDialog(i18n("The specified file does not exist:\n%1") - .arg(aFileName)); - return result; - } - if (info.isDir()) - { - if (aVerbose) - msgDialog(i18n("This is a folder and not a file:\n%1") - .arg(aFileName)); - return result; - } - if (!info.isReadable()) - { - if (aVerbose) - msgDialog(i18n("You do not have read permissions " - "to the file:\n%1").arg(aFileName)); - return result; - } - if (len <= 0) return result; - - if (!file.open(IO_Raw|IO_ReadOnly)) - { - if (aVerbose) switch(file.status()) - { - case IO_ReadError: - msgDialog(i18n("Could not read file:\n%1").arg(aFileName)); - break; - case IO_OpenError: - msgDialog(i18n("Could not open file:\n%1").arg(aFileName)); - break; - default: - msgDialog(i18n("Error while reading file:\n%1").arg(aFileName)); - } - return result; - } - - result.resize(len); - readLen = file.readBlock(result.data(), len); - kdDebug(5300) << TQString( "len %1" ).arg(len) << endl; - - if (readLen < len) - { - TQString msg; - msg = i18n("Could only read %1 bytes of %2.") - .arg(readLen).arg(len); - msgDialog(msg); - return result; - } - - return result; -} -#endif - -//----------------------------------------------------------------------------- -KDE_EXPORT bool kBytesToFile(const char* aBuffer, int len, - const TQString &aFileName, - bool aAskIfExists, bool aBackup, bool aVerbose) -{ - // TODO: use KSaveFile - TQFile file(aFileName); - int writeLen, rc; - - //assert(aFileName!=0); - if(aFileName.isEmpty()) - return FALSE; - - if (file.exists()) - { - if (aAskIfExists) - { - TQString str; - str = i18n("File %1 exists.\nDo you want to replace it?") - .arg(aFileName); - rc = KMessageBox::warningContinueCancel(0, - str, i18n("Save to File"), i18n("&Replace")); - if (rc != KMessageBox::Continue) return FALSE; - } - if (aBackup) - { - // make a backup copy - // TODO: use KSaveFile::backupFile() - TQString bakName = aFileName; - bakName += '~'; - TQFile::remove(bakName); - if( !TQDir::current().rename(aFileName, bakName) ) - { - // failed to rename file - if (!aVerbose) return FALSE; - rc = KMessageBox::warningContinueCancel(0, - i18n("Failed to make a backup copy of %1.\nContinue anyway?") - .arg(aFileName), - i18n("Save to File"), KStdGuiItem::save() ); - if (rc != KMessageBox::Continue) return FALSE; - } - } - } - - if (!file.open(IO_Raw|IO_WriteOnly|IO_Truncate)) - { - if (aVerbose) switch(file.status()) - { - case IO_WriteError: - msgDialog(i18n("Could not write to file:\n%1").arg(aFileName)); - break; - case IO_OpenError: - msgDialog(i18n("Could not open file for writing:\n%1") - .arg(aFileName)); - break; - default: - msgDialog(i18n("Error while writing file:\n%1").arg(aFileName)); - } - return FALSE; - } - - writeLen = file.writeBlock(aBuffer, len); - - if (writeLen < 0) - { - if (aVerbose) - msgDialog(i18n("Could not write to file:\n%1").arg(aFileName)); - return FALSE; - } - else if (writeLen < len) - { - TQString msg = i18n("Could only write %1 bytes of %2.") - .arg(writeLen).arg(len); - if (aVerbose) - msgDialog(msg); - return FALSE; - } - - return TRUE; -} - -KDE_EXPORT bool kCStringToFile(const TQCString& aBuffer, const TQString &aFileName, - bool aAskIfExists, bool aBackup, bool aVerbose) -{ - return kBytesToFile(aBuffer, aBuffer.length(), aFileName, aAskIfExists, - aBackup, aVerbose); -} - -KDE_EXPORT bool kByteArrayToFile(const TQByteArray& aBuffer, const TQString &aFileName, - bool aAskIfExists, bool aBackup, bool aVerbose) -{ - return kBytesToFile(aBuffer, aBuffer.size(), aFileName, aAskIfExists, - aBackup, aVerbose); -} - - -TQString checkAndCorrectPermissionsIfPossible( const TQString &toCheck, - const bool recursive, const bool wantItReadable, - const bool wantItWritable ) -{ - // First we have to find out which type the toCheck is. This can be - // a directory (follow if recursive) or a file (check permissions). - // Symlinks are followed as expected. - TQFileInfo fiToCheck(toCheck); - fiToCheck.setCaching(false); - TQCString toCheckEnc = TQFile::encodeName(toCheck); - TQString error; - struct stat statbuffer; - - if ( !fiToCheck.exists() ) { - error.append( i18n("%1 does not exist") - .arg(toCheck) + "\n"); - } - - // check the access bit of a folder. - if ( fiToCheck.isDir() ) { - if ( stat( toCheckEnc,&statbuffer ) != 0 ) { - kdDebug() << "wantItA: Can't read perms of " << toCheck << endl; - } - TQDir g( toCheck ); - if ( !g.isReadable() ) { - if ( chmod( toCheckEnc, statbuffer.st_mode + S_IXUSR ) != 0 ) { - error.append( i18n("%1 is not accessible and that is " - "unchangeable.").arg(toCheck) + "\n"); - } else { - kdDebug() << "Changed access bit for " << toCheck << endl; - } - } - } - - // For each file or folder we can check if the file is readable - // and writable, as requested. - if ( fiToCheck.isFile() || fiToCheck.isDir() ) { - - if ( !fiToCheck.isReadable() && wantItReadable ) { - // Get the current permissions. No need to do anything with an - // error, it will het added to errors anyhow, later on. - if ( stat(toCheckEnc,&statbuffer) != 0 ) { - kdDebug() << "wantItR: Can't read perms of " << toCheck << endl; - } - - // Lets try changing it. - if ( chmod( toCheckEnc, statbuffer.st_mode + S_IRUSR ) != 0 ) { - error.append( i18n("%1 is not readable and that is unchangeable.") - .arg(toCheck) + "\n"); - } else { - kdDebug() << "Changed the read bit for " << toCheck << endl; - } - } - - if ( !fiToCheck.isWritable() && wantItWritable ) { - // Gets the current persmissions. Needed because it can be changed - // curing previous operation. - if (stat(toCheckEnc,&statbuffer) != 0) { - kdDebug() << "wantItW: Can't read perms of " << toCheck << endl; - } - - // Lets try changing it. - if ( chmod (toCheckEnc, statbuffer.st_mode + S_IWUSR ) != 0 ) { - error.append( i18n("%1 is not writable and that is unchangeable.") - .arg(toCheck) + "\n"); - } else { - kdDebug() << "Changed the write bit for " << toCheck << endl; - } - } - } - - // If it is a folder and recursive is true, then we check the contents of - // the folder. - if ( fiToCheck.isDir() && recursive ){ - TQDir g(toCheck); - // First check if the folder is readable for us. If not, we get - // some ugly crashes. - if ( !g.isReadable() ){ - error.append(i18n("Folder %1 is inaccessible.").arg(toCheck) + "\n"); - } else { - const TQFileInfoList *list = g.entryInfoList(); - TQFileInfoListIterator it( *list ); - TQFileInfo *fi; - while ((fi = it.current()) != 0) { - TQString newToCheck = toCheck + "/" + fi->fileName(); - TQFileInfo fiNewToCheck(newToCheck); - if ( fi->fileName() != "." && fi->fileName() != ".." ) { - error.append ( checkAndCorrectPermissionsIfPossible( newToCheck, - recursive, wantItReadable, wantItWritable) ); - } - ++it; - } - } - } - return error; -} - -bool checkAndCorrectPermissionsIfPossibleWithErrorHandling( TQWidget *parent, - const TQString &toCheck, const bool recursive, const bool wantItReadable, - const bool wantItWritable ) -{ - TQString error = checkAndCorrectPermissionsIfPossible(toCheck, recursive, - wantItReadable, wantItWritable); - // There is no KMessageBox with Retry, Cancel and Details. - // so, I can't provide a functionality to recheck. So it now - // it is just a warning. - if ( !error.isEmpty() ) { - kdDebug() << "checkPermissions found:" << error << endl; - KMessageBox::detailedSorry(parent, - i18n("Some files or folders do not have " - "the right permissions, please correct them " - "manually."), - error, i18n("Permissions Check"), false); - return false; - } else { - return true; - } -} - -} diff --git a/libtdepim/kfileio.h b/libtdepim/kfileio.h deleted file mode 100644 index 15db0933..00000000 --- a/libtdepim/kfileio.h +++ /dev/null @@ -1,105 +0,0 @@ -/* Load / save entire (local) files with nice diagnostics dialog messages. - * These functions load/save the whole buffer in one i/o call, so they - * should be pretty efficient. - * - * Author: Stefan Taferner - * This code is under GPL. - */ -#ifndef kpim_kfileio_h -#define kpim_kfileio_h - -#include -#include - -#include - -class TQString; - -namespace KPIM { - -/** Load a file. Returns a pointer to the memory-block that contains - * the loaded file. Returns a null string if the file could not be loaded. - * If withDialogs is FALSE no warning dialogs are opened if there are - * problems. - * The string returned is always zero-terminated and therefore one - * byte longer than the file itself. - * If ensureNewline is TRUE the string will always have a trailing newline. - */ -TQCString kFileToString(const TQString &fileName, bool ensureNewline=true, - bool withDialogs=true) KDE_EXPORT; - -// unused -//TQByteArray kFileToBytes(const TQString &fileName, bool withDialogs=true); - - -/** Save a file. If withDialogs is FALSE no warning dialogs are opened if - * there are problems. Returns TRUE on success and FALSE on failure. - * Replaces existing files without warning if askIfExists==FALSE. - * Makes a copy if the file exists to filename~ if createBackup==TRUE. - */ -bool kBytesToFile(const char* aBuffer, int len, - const TQString &aFileName, - bool aAskIfExists, bool aBackup, bool aVerbose) KDE_EXPORT; - -bool kCStringToFile(const TQCString& buffer, const TQString &fileName, - bool askIfExists=false, bool createBackup=true, - bool withDialogs=true) KDE_EXPORT; -/** Does not stop at NUL */ -KDE_EXPORT bool kByteArrayToFile(const TQByteArray& buffer, const TQString &fileName, - bool askIfExists=false, bool createBackup=true, - bool withDialogs=true) KDE_EXPORT; - - - /** - * Checks and corrects the permissions of a file or folder, and if requested - * all files and folders below. It gives back a list of files which do not - * have the right permissions. This list can be used to show to the user. - * - * @param toCheck The file or folder of which the permissions should - * be checked. - * @param recursive Set to true, it will check the contents of a folder - * for the permissions recursively. If false only - * toCheck will be checked. - * @param wantItReadable Set to true, it will check for read permissions. - * If the read permissions are not available, there will - * be a attempt to correct this. - * @param wantItWritable Set to true, it will check for write permissions. - * If the write permissions are not available, there - * will be a attempt to correct this. - * @return It will return a string with all files and folders which do not - * have the right permissions. If empty, then all permissions are ok. - */ -TQString checkAndCorrectPermissionsIfPossible( const TQString &toCheck, - const bool recursive, const bool wantItReadable, - const bool wantItWritable ); - - /** - * Checks and corrects the permissions of a file or folder, and if requested - * all files and folders below. If the permissions are not ok, it tries to correct - * them. If that fails then a warning with detailled information is given. - * - * @param parent If parent is 0, then the message box becomes an - * application-global modal dialog box. If parent - * is a widget, the message box becomes modal - * relative to parent. - * @param toCheck The file or folder of which the permissions should - * be checked. - * @param recursive Set to true, it will check the contents of a folder - * for the permissions recursively. If false only - * toCheck will be checked. - * @param wantItReadable Set to true, it will check for read permissions. - * If the read permissions are not available, there will - * be a attempt to correct this. - * @param wantItWritable Set to true, it will check for write permissions. - * If the write permissions are not available, there - * will be a attempt to correct this. - * @return It will return true if all permissions in the end are ok. If false - * then the permissions are not ok and it was not possible to correct - * all errors. - */ -bool checkAndCorrectPermissionsIfPossibleWithErrorHandling( TQWidget *parent, - const TQString &toCheck, const bool recursive, const bool wantItReadable, - const bool wantItWritable ); -} - -#endif /*kpim_kfileio_h*/ diff --git a/libtdepim/kfoldertree.cpp b/libtdepim/kfoldertree.cpp index 5cad2365..58961ddc 100644 --- a/libtdepim/kfoldertree.cpp +++ b/libtdepim/kfoldertree.cpp @@ -2,7 +2,7 @@ #include "kfoldertree.h" #include -#include +#include #include #include #include diff --git a/libtdepim/kimportdialog.cpp b/libtdepim/kimportdialog.cpp index e07ef00a..df1181ed 100644 --- a/libtdepim/kimportdialog.cpp +++ b/libtdepim/kimportdialog.cpp @@ -46,7 +46,7 @@ #include #include #include -#include +#include #include "kimportdialog.h" #include "kimportdialog.moc" diff --git a/libtdepim/komposer/core/core.cpp b/libtdepim/komposer/core/core.cpp index 945c2231..a2f5fd00 100644 --- a/libtdepim/komposer/core/core.cpp +++ b/libtdepim/komposer/core/core.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/libtdepim/komposer/core/komposerconfig.desktop b/libtdepim/komposer/core/komposerconfig.desktop index 5ceb1258..ab5239b0 100644 --- a/libtdepim/komposer/core/komposerconfig.desktop +++ b/libtdepim/komposer/core/komposerconfig.desktop @@ -1,5 +1,5 @@ [Desktop Entry] -Exec=kcmshell komposerconfig +Exec=tdecmshell komposerconfig Icon=komposer Type=Application Terminal=false diff --git a/libtdepim/komposer/core/settings.kcfgc b/libtdepim/komposer/core/settings.kcfgc index fc98478a..a4c88100 100644 --- a/libtdepim/komposer/core/settings.kcfgc +++ b/libtdepim/komposer/core/settings.kcfgc @@ -1,4 +1,4 @@ -# Code generation options for kconfig_compiler +# Code generation options for tdeconfig_compiler File=komposer.kcfg NameSpace=Komposer ClassName=Config diff --git a/libtdepim/komposer/plugins/default/defaulteditor.cpp b/libtdepim/komposer/plugins/default/defaulteditor.cpp index 105650eb..426e4c01 100644 --- a/libtdepim/komposer/plugins/default/defaulteditor.cpp +++ b/libtdepim/komposer/plugins/default/defaulteditor.cpp @@ -29,7 +29,7 @@ #include #include -#include +#include #include #include #include diff --git a/libtdepim/kpimprefs.cpp b/libtdepim/kpimprefs.cpp index 9ae04cfa..02e39736 100644 --- a/libtdepim/kpimprefs.cpp +++ b/libtdepim/kpimprefs.cpp @@ -29,7 +29,7 @@ #include #include -#include +#include #include #include diff --git a/libtdepim/kpimprefs.h b/libtdepim/kpimprefs.h index 051b0f2f..dd180c97 100644 --- a/libtdepim/kpimprefs.h +++ b/libtdepim/kpimprefs.h @@ -23,7 +23,7 @@ #include -#include +#include #include class TQString; diff --git a/libtdepim/kprefsdialog.cpp b/libtdepim/kprefsdialog.cpp index 57769250..230962cb 100644 --- a/libtdepim/kprefsdialog.cpp +++ b/libtdepim/kprefsdialog.cpp @@ -40,7 +40,7 @@ #include #include #include -#include +#include #include #include "ktimeedit.h" #include "kdateedit.h" diff --git a/libtdepim/kprefsdialog.h b/libtdepim/kprefsdialog.h index 6774d96d..3e331b18 100644 --- a/libtdepim/kprefsdialog.h +++ b/libtdepim/kprefsdialog.h @@ -30,8 +30,8 @@ #include #include -#include -#include +#include +#include #include diff --git a/libtdepim/kresourceprefs.h b/libtdepim/kresourceprefs.h index 968d86a9..1954f19c 100644 --- a/libtdepim/kresourceprefs.h +++ b/libtdepim/kresourceprefs.h @@ -22,7 +22,7 @@ #ifndef KRESOURCEPREFS_H #define KRESOURCEPREFS_H -#include +#include #include class TQString; diff --git a/libtdepim/ldapclient.cpp b/libtdepim/ldapclient.cpp index 9f1a6fd8..32202b3d 100644 --- a/libtdepim/ldapclient.cpp +++ b/libtdepim/ldapclient.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/libtdepim/ldapclient.h b/libtdepim/ldapclient.h index 50293729..789b4605 100644 --- a/libtdepim/ldapclient.h +++ b/libtdepim/ldapclient.h @@ -31,9 +31,9 @@ #include #include -#include +#include #include -#include +#include #include diff --git a/libtdepim/ldapsearchdialog.cpp b/libtdepim/ldapsearchdialog.cpp index fe67137b..586e9011 100644 --- a/libtdepim/ldapsearchdialog.cpp +++ b/libtdepim/ldapsearchdialog.cpp @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/libtdepim/recentaddresses.cpp b/libtdepim/recentaddresses.cpp index bbd7d29a..eb4660a3 100644 --- a/libtdepim/recentaddresses.cpp +++ b/libtdepim/recentaddresses.cpp @@ -31,7 +31,7 @@ #include "libemailfunctions/email.h" #include -#include +#include #include #include diff --git a/libtdepim/tdeconfigpropagator.cpp b/libtdepim/tdeconfigpropagator.cpp new file mode 100644 index 00000000..f6f48240 --- /dev/null +++ b/libtdepim/tdeconfigpropagator.cpp @@ -0,0 +1,289 @@ +/* + This file is part of libtdepim. + + Copyright (c) 2003 Cornelius Schumacher + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "tdeconfigpropagator.h" + +#include +#include +#include +#include +#include +#include + +#include +#include + +TDEConfigPropagator::Change::~Change() +{ +} + +TDEConfigPropagator::ChangeConfig::ChangeConfig() + : TDEConfigPropagator::Change( i18n("Change Config Value") ), + hideValue( false ) +{ +} + +TQString TDEConfigPropagator::ChangeConfig::arg1() const +{ + return file + "/" + group + "/" + name; +} + +TQString TDEConfigPropagator::ChangeConfig::arg2() const +{ + if ( hideValue ) return "*"; + else return value; +} + +void TDEConfigPropagator::ChangeConfig::apply() +{ + TDEConfig cfg( file ); + cfg.setGroup( group ); + cfg.writeEntry( name, value ); + + cfg.sync(); +} + +TDEConfigPropagator::TDEConfigPropagator() + : mSkeleton( 0 ) +{ + init(); +} + +TDEConfigPropagator::TDEConfigPropagator( TDEConfigSkeleton *skeleton, + const TQString &kcfgFile ) + : mSkeleton( skeleton ), mKcfgFile( kcfgFile ) +{ + init(); + + readKcfgFile(); +} + +void TDEConfigPropagator::init() +{ + mChanges.setAutoDelete( true ); +} + +void TDEConfigPropagator::readKcfgFile() +{ + TQString filename = locate( "kcfg", mKcfgFile ); + if ( filename.isEmpty() ) { + kdError() << "Unable to find kcfg file '" << mKcfgFile << "'" << endl; + return; + } + + TQFile input( filename ); + TQDomDocument doc; + TQString errorMsg; + int errorRow; + int errorCol; + if ( !doc.setContent( &input, &errorMsg, &errorRow, &errorCol ) ) { + kdError() << "Parse error in " << mKcfgFile << ", line " << errorRow << ", col " << errorCol << ": " << errorMsg << endl; + return; + } + + TQDomElement cfgElement = doc.documentElement(); + + if ( cfgElement.isNull() ) { + kdError() << "No document in kcfg file" << endl; + return; + } + + mRules.clear(); + + TQDomNode n; + for ( n = cfgElement.firstChild(); !n.isNull(); n = n.nextSibling() ) { + TQDomElement e = n.toElement(); + + TQString tag = e.tagName(); + + if ( tag == "propagation" ) { + Rule rule = parsePropagation( e ); + mRules.append( rule ); + } else if ( tag == "condition" ) { + Condition condition = parseCondition( e ); + TQDomNode n2; + for( n2 = e.firstChild(); !n2.isNull(); n2 = n2.nextSibling() ) { + TQDomElement e2 = n2.toElement(); + if ( e2.tagName() == "propagation" ) { + Rule rule = parsePropagation( e2 ); + rule.condition = condition; + mRules.append( rule ); + } else { + kdError() << "Unknow tag: " << e2.tagName() << endl; + } + } + } + } +} + +TDEConfigPropagator::Rule TDEConfigPropagator::parsePropagation( const TQDomElement &e ) +{ + Rule r; + + TQString source = e.attribute( "source" ); + parseConfigEntryPath( source, r.sourceFile, r.sourceGroup, r.sourceEntry ); + + TQString target = e.attribute( "target" ); + parseConfigEntryPath( target, r.targetFile, r.targetGroup, r.targetEntry ); + + r.hideValue = e.hasAttribute( "hidevalue" ) && + e.attribute( "hidevalue" ) == "true"; + + return r; +} + +void TDEConfigPropagator::parseConfigEntryPath( const TQString &path, + TQString &file, + TQString &group, + TQString &entry ) +{ + TQStringList p = TQStringList::split( "/", path ); + + if ( p.count() != 3 ) { + kdError() << "Path has to be of form file/group/entry" << endl; + file = TQString(); + group = TQString(); + entry = TQString(); + return; + } + + file = p[ 0 ]; + group = p[ 1 ]; + entry = p[ 2 ]; + + return; +} + +TDEConfigPropagator::Condition TDEConfigPropagator::parseCondition( const TQDomElement &e ) +{ + Condition c; + + TQString key = e.attribute( "key" ); + + parseConfigEntryPath( key, c.file, c.group, c.key ); + + c.value = e.attribute( "value" ); + + c.isValid = true; + + return c; +} + +void TDEConfigPropagator::commit() +{ + updateChanges(); + + Change *c; + for( c = mChanges.first(); c; c = mChanges.next() ) { + c->apply(); + } +} + +TDEConfigSkeletonItem *TDEConfigPropagator::findItem( const TQString &group, + const TQString &name ) +{ +// kdDebug() << "TDEConfigPropagator::findItem()" << endl; + + if ( !mSkeleton ) return 0; + + TDEConfigSkeletonItem::List items = mSkeleton->items(); + TDEConfigSkeletonItem::List::ConstIterator it; + for( it = items.begin(); it != items.end(); ++it ) { +// kdDebug() << " Item: " << (*it)->name() << " Type: " +// << (*it)->property().typeName() << endl; + if ( (*it)->group() == group && (*it)->name() == name ) { + break; + } + } + if ( it == items.end() ) return 0; + else return *it; +} + +TQString TDEConfigPropagator::itemValueAsString( TDEConfigSkeletonItem *item ) +{ + TQVariant p = item->property(); + + if ( p.type() == TQVariant::Bool ) { + if ( p.toBool() ) return "true"; + else return "false"; + } + + return p.toString(); +} + +void TDEConfigPropagator::updateChanges() +{ + mChanges.clear(); + + Rule::List::ConstIterator it; + for( it = mRules.begin(); it != mRules.end(); ++it ) { + Rule r = *it; + Condition c = r.condition; + if ( c.isValid ) { + TDEConfigSkeletonItem *item = findItem( c.group, c.key ); + kdDebug() << "Item " << c.group << "/" << c.key << ":" << endl; + if ( !item ) { + kdError() << " Item not found." << endl; + } else { + TQString value = itemValueAsString( item ); + kdDebug() << " Value: " << value << endl; + if ( value != c.value ) { + continue; + } + } + } + + TDEConfigSkeletonItem *item = findItem( r.sourceGroup, r.sourceEntry ); + if ( !item ) { + kdError() << "Item " << r.sourceGroup << "/" << r.sourceEntry + << " not found." << endl; + continue; + } + TQString value = itemValueAsString( item ); + + TDEConfig target( r.targetFile ); + target.setGroup( r.targetGroup ); + TQString targetValue = target.readEntry( r.targetEntry ); + if ( r.hideValue ) targetValue = KStringHandler::obscure( targetValue ); + if ( targetValue != value ) { + ChangeConfig *change = new ChangeConfig(); + change->file = r.targetFile; + change->group = r.targetGroup; + change->name = r.targetEntry; + if ( r.hideValue ) value = KStringHandler::obscure( value ); + change->value = value; + change->hideValue = r.hideValue; + mChanges.append( change ); + } + } + + addCustomChanges( mChanges ); +} + +TDEConfigPropagator::Change::List TDEConfigPropagator::changes() +{ + return mChanges; +} + +TDEConfigPropagator::Rule::List TDEConfigPropagator::rules() +{ + return mRules; +} diff --git a/libtdepim/tdeconfigpropagator.h b/libtdepim/tdeconfigpropagator.h new file mode 100644 index 00000000..92f9565f --- /dev/null +++ b/libtdepim/tdeconfigpropagator.h @@ -0,0 +1,165 @@ +/* + This file is part of libtdepim. + + Copyright (c) 2003 Cornelius Schumacher + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#ifndef KCONFIGPROPAGATOR_H +#define KCONFIGPROPAGATOR_H + +#include +#include +#include +#include + +#include + +class TDEConfigSkeleton; +class TDEConfigSkeletonItem; + +class KDE_EXPORT TDEConfigPropagator +{ + public: + + /** + Create TDEConfigPropagator object without associated source configuration. + */ + TDEConfigPropagator(); + /** + Create TDEConfigPropagator object. + + @param skeleton TDEConfigSkeleton object used as source for the propagation + @param kcfgFile file name of kcfg file containing the propagation rules + */ + TDEConfigPropagator( TDEConfigSkeleton *skeleton, const TQString &kcfgFile ); + virtual ~TDEConfigPropagator() {} + + TDEConfigSkeleton *skeleton() { return mSkeleton; } + + /* + Commit changes according to propagation rules. + */ + void commit(); + + class KDE_EXPORT Condition + { + public: + Condition() : isValid( false ) {} + + TQString file; + TQString group; + TQString key; + TQString value; + + bool isValid; + }; + + class KDE_EXPORT Rule + { + public: + typedef TQValueList List; + + Rule() : hideValue( false ) {} + + TQString sourceFile; + TQString sourceGroup; + TQString sourceEntry; + + TQString targetFile; + TQString targetGroup; + TQString targetEntry; + + Condition condition; + + bool hideValue; + }; + + class KDE_EXPORT Change + { + public: + typedef TQPtrList List; + + Change( const TQString &title ) : mTitle( title ) {} + virtual ~Change(); + + void setTitle( const TQString &title ) { mTitle = title; } + TQString title() const { return mTitle; } + + virtual TQString arg1() const { return TQString(); } + virtual TQString arg2() const { return TQString(); } + + virtual void apply() = 0; + + private: + TQString mTitle; + }; + + class KDE_EXPORT ChangeConfig : public Change + { + public: + ChangeConfig(); + ~ChangeConfig() {} + + TQString arg1() const; + TQString arg2() const; + + void apply(); + + TQString file; + TQString group; + TQString name; + TQString label; + TQString value; + bool hideValue; + }; + + void updateChanges(); + + Change::List changes(); + + Rule::List rules(); + + protected: + void init(); + + /** + Implement this function in a subclass if you want to add changes which + can't be expressed as propagations in the kcfg file. + */ + virtual void addCustomChanges( Change::List & ) {} + + TDEConfigSkeletonItem *findItem( const TQString &group, const TQString &name ); + + TQString itemValueAsString( TDEConfigSkeletonItem * ); + + void readKcfgFile(); + + Rule parsePropagation( const TQDomElement &e ); + Condition parseCondition( const TQDomElement &e ); + + void parseConfigEntryPath( const TQString &path, TQString &file, + TQString &group, TQString &entry ); + + private: + TDEConfigSkeleton *mSkeleton; + TQString mKcfgFile; + + Rule::List mRules; + Change::List mChanges; +}; + +#endif diff --git a/libtdepim/tdeconfigwizard.cpp b/libtdepim/tdeconfigwizard.cpp new file mode 100644 index 00000000..026c8599 --- /dev/null +++ b/libtdepim/tdeconfigwizard.cpp @@ -0,0 +1,197 @@ +/* + This file is part of libtdepim. + + Copyright (c) 2003 Cornelius Schumacher + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "tdeconfigwizard.h" + +#include +#include +#include +#include +#include + +#include +#include +#include + +TDEConfigWizard::TDEConfigWizard( TQWidget *parent, + char *name, bool modal ) + : KDialogBase( TreeList, i18n("Configuration Wizard"), Ok|Cancel, Ok, parent, + name, modal ), + mPropagator( 0 ), mChangesPage( 0 ) +{ + init(); +} + +TDEConfigWizard::TDEConfigWizard( TDEConfigPropagator *propagator, TQWidget *parent, + char *name, bool modal ) + : KDialogBase( TreeList, i18n("Configuration Wizard"), Ok|Cancel, Ok, parent, + name, modal ), + mPropagator( propagator ), mChangesPage( 0 ) +{ + init(); +} + +TDEConfigWizard::~TDEConfigWizard() +{ + delete mPropagator; +} + +void TDEConfigWizard::init() +{ + connect( this, TQT_SIGNAL( aboutToShowPage( TQWidget * ) ), + TQT_SLOT( slotAboutToShowPage( TQWidget * ) ) ); + + TQTimer::singleShot( 0, this, TQT_SLOT( readConfig() ) ); +} + +void TDEConfigWizard::setPropagator( TDEConfigPropagator *p ) +{ + mPropagator = p; +} + +void TDEConfigWizard::slotAboutToShowPage( TQWidget *page ) +{ + if ( page == mChangesPage ) { + updateChanges(); + } +} + +TQFrame *TDEConfigWizard::createWizardPage( const TQString &title ) +{ + return addPage( title ); +} + +void TDEConfigWizard::setupRulesPage() +{ + TQFrame *topFrame = addPage( i18n("Rules") ); + TQVBoxLayout *topLayout = new TQVBoxLayout( topFrame ); + + mRuleView = new TQListView( topFrame ); + topLayout->addWidget( mRuleView ); + + mRuleView->addColumn( i18n("Source") ); + mRuleView->addColumn( i18n("Target") ); + mRuleView->addColumn( i18n("Condition") ); + + updateRules(); +} + +void TDEConfigWizard::updateRules() +{ + if ( !mPropagator ) { + kdError() << "TDEConfigWizard: No TDEConfigPropagator set." << endl; + return; + } + + mRuleView->clear(); + + TDEConfigPropagator::Rule::List rules = mPropagator->rules(); + TDEConfigPropagator::Rule::List::ConstIterator it; + for( it = rules.begin(); it != rules.end(); ++it ) { + TDEConfigPropagator::Rule r = *it; + TQString source = r.sourceFile + "/" + r.sourceGroup + "/" + + r.sourceEntry; + TQString target = r.targetFile + "/" + r.targetGroup + "/" + + r.targetEntry; + TQString condition; + TDEConfigPropagator::Condition c = r.condition; + if ( c.isValid ) { + condition = c.file + "/" + c.group + "/" + c.key + " = " + c.value; + } + new TQListViewItem( mRuleView, source, target, condition ); + } +} + +void TDEConfigWizard::setupChangesPage() +{ + TQFrame *topFrame = addPage( i18n("Changes") ); + TQVBoxLayout *topLayout = new TQVBoxLayout( topFrame ); + + mChangeView = new TQListView( topFrame ); + topLayout->addWidget( mChangeView ); + + mChangeView->addColumn( i18n("Action") ); + mChangeView->addColumn( i18n("Option") ); + mChangeView->addColumn( i18n("Value") ); + mChangeView->setSorting( -1 ); + + mChangesPage = topFrame; +} + +void TDEConfigWizard::updateChanges() +{ + kdDebug() << "TDEConfigWizard::updateChanges()" << endl; + + if ( !mPropagator ) { + kdError() << "TDEConfigWizard: No TDEConfigPropagator set." << endl; + return; + } + + usrWriteConfig(); + + mPropagator->updateChanges(); + + mChangeView->clear(); + + TDEConfigPropagator::Change::List changes = mPropagator->changes(); + TDEConfigPropagator::Change *c; + for( c = changes.first(); c; c = changes.next() ) { + new TQListViewItem( mChangeView, mChangeView->lastItem(), c->title(), c->arg1(), c->arg2() ); + } +} + +void TDEConfigWizard::readConfig() +{ + kdDebug() << "TDEConfigWizard::readConfig()" << endl; + + int result = KMessageBox::warningContinueCancel( this, + i18n("Please make sure that the programs which are " + "configured by the wizard do not run in parallel to the wizard; " + "otherwise, changes done by the wizard could be lost."), + i18n("Warning"), i18n("Run Wizard Now"), "warning_running_instances" ); + if ( result != KMessageBox::Continue ) kapp->quit(); + + usrReadConfig(); +} + +void TDEConfigWizard::slotOk() +{ + TQString error = validate(); + if ( error.isNull() ) { + usrWriteConfig(); + + if ( !mPropagator ) { + kdError() << "TDEConfigWizard: No TDEConfigPropagator set." << endl; + return; + } else { + if ( mPropagator->skeleton() ) { + mPropagator->skeleton()->writeConfig(); + } + mPropagator->commit(); + } + + accept(); + } else { + KMessageBox::sorry( this, error ); + } +} + +#include "tdeconfigwizard.moc" diff --git a/libtdepim/tdeconfigwizard.h b/libtdepim/tdeconfigwizard.h new file mode 100644 index 00000000..7eaaeda9 --- /dev/null +++ b/libtdepim/tdeconfigwizard.h @@ -0,0 +1,110 @@ +/* + This file is part of libtdepim. + + Copyright (c) 2003 Cornelius Schumacher + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#ifndef KCONFIGWIZARD_H +#define KCONFIGWIZARD_H + +#include +#include +#include + +class TQListView; + +/** + @short Configuration wizard base class +*/ +class KDE_EXPORT TDEConfigWizard : public KDialogBase +{ + Q_OBJECT + + public: + /** + Create wizard. You have to set a propgator with setPropagator() later. + */ + TDEConfigWizard( TQWidget *parent = 0, char *name = 0, bool modal = false ); + /** + Create wizard for given TDEConfigPropagator. The wizard takes ownership of + the propagator. + */ + TDEConfigWizard( TDEConfigPropagator *propagator, TQWidget *parent = 0, + char *name = 0, bool modal = false ); + /** + Destructor. + */ + virtual ~TDEConfigWizard(); + + /** + Set propagator the wizard operates on. + */ + void setPropagator( TDEConfigPropagator * ); + /** + Return propagator the wizard operates on. + */ + TDEConfigPropagator *propagator() { return mPropagator; } + + /** + Create wizard page with given title. + */ + TQFrame *createWizardPage( const TQString &title ); + + /** + Use this function to read the configuration from the TDEConfigSkeleton + object to the GUI. + */ + virtual void usrReadConfig() = 0; + + /** + This function is called when the wizard is finished. You have to save all + settings from the GUI to the TDEConfigSkeleton object here, so that the + TDEConfigPropagator can take them up from there. + */ + virtual void usrWriteConfig() = 0; + + /** + Validates the supplied data. Returns a appropiate error when some data + is invalid. Return TQString() if all data is valid. + */ + virtual TQString validate() { return TQString(); } + + protected slots: + void readConfig(); + + void slotOk(); + + void slotAboutToShowPage( TQWidget *page ); + + protected: + void init(); + + void setupRulesPage(); + void updateRules(); + void setupChangesPage(); + void updateChanges(); + + private: + TDEConfigPropagator *mPropagator; + + TQListView *mRuleView; + TQListView *mChangeView; + + TQWidget *mChangesPage; +}; + +#endif diff --git a/libtdepim/tdefileio.cpp b/libtdepim/tdefileio.cpp new file mode 100644 index 00000000..ad899351 --- /dev/null +++ b/libtdepim/tdefileio.cpp @@ -0,0 +1,390 @@ +// tdefileio.cpp +// Author: Stefan Taferner +// License: GPL + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include + +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include + +namespace KPIM { + +//----------------------------------------------------------------------------- +static void msgDialog(const TQString &msg) +{ + KMessageBox::sorry(0, msg, i18n("File I/O Error")); +} + + +//----------------------------------------------------------------------------- +KDE_EXPORT TQCString kFileToString(const TQString &aFileName, bool aEnsureNL, bool aVerbose) +{ + TQCString result; + TQFileInfo info(aFileName); + unsigned int readLen; + unsigned int len = info.size(); + TQFile file(aFileName); + + //assert(aFileName!=0); + if( aFileName.isEmpty() ) + return ""; + + if (!info.exists()) + { + if (aVerbose) + msgDialog(i18n("The specified file does not exist:\n%1").arg(aFileName)); + return TQCString(); + } + if (info.isDir()) + { + if (aVerbose) + msgDialog(i18n("This is a folder and not a file:\n%1").arg(aFileName)); + return TQCString(); + } + if (!info.isReadable()) + { + if (aVerbose) + msgDialog(i18n("You do not have read permissions " + "to the file:\n%1").arg(aFileName)); + return TQCString(); + } + if (len <= 0) return TQCString(); + + if (!file.open(IO_Raw|IO_ReadOnly)) + { + if (aVerbose) switch(file.status()) + { + case IO_ReadError: + msgDialog(i18n("Could not read file:\n%1").arg(aFileName)); + break; + case IO_OpenError: + msgDialog(i18n("Could not open file:\n%1").arg(aFileName)); + break; + default: + msgDialog(i18n("Error while reading file:\n%1").arg(aFileName)); + } + return TQCString(); + } + + result.resize(len + (int)aEnsureNL + 1); + readLen = file.readBlock(result.data(), len); + if (aEnsureNL && result[len-1]!='\n') + { + result[len++] = '\n'; + readLen++; + } + result[len] = '\0'; + + if (readLen < len) + { + TQString msg = i18n("Could only read %1 bytes of %2.") + .arg(readLen).arg(len); + msgDialog(msg); + return TQCString(); + } + + return result; +} + +//----------------------------------------------------------------------------- +#if 0 // unused +TQByteArray kFileToBytes(const TQString &aFileName, bool aVerbose) +{ + TQByteArray result; + TQFileInfo info(aFileName); + unsigned int readLen; + unsigned int len = info.size(); + TQFile file(aFileName); + + //assert(aFileName!=0); + if( aFileName.isEmpty() ) + return result; + + if (!info.exists()) + { + if (aVerbose) + msgDialog(i18n("The specified file does not exist:\n%1") + .arg(aFileName)); + return result; + } + if (info.isDir()) + { + if (aVerbose) + msgDialog(i18n("This is a folder and not a file:\n%1") + .arg(aFileName)); + return result; + } + if (!info.isReadable()) + { + if (aVerbose) + msgDialog(i18n("You do not have read permissions " + "to the file:\n%1").arg(aFileName)); + return result; + } + if (len <= 0) return result; + + if (!file.open(IO_Raw|IO_ReadOnly)) + { + if (aVerbose) switch(file.status()) + { + case IO_ReadError: + msgDialog(i18n("Could not read file:\n%1").arg(aFileName)); + break; + case IO_OpenError: + msgDialog(i18n("Could not open file:\n%1").arg(aFileName)); + break; + default: + msgDialog(i18n("Error while reading file:\n%1").arg(aFileName)); + } + return result; + } + + result.resize(len); + readLen = file.readBlock(result.data(), len); + kdDebug(5300) << TQString( "len %1" ).arg(len) << endl; + + if (readLen < len) + { + TQString msg; + msg = i18n("Could only read %1 bytes of %2.") + .arg(readLen).arg(len); + msgDialog(msg); + return result; + } + + return result; +} +#endif + +//----------------------------------------------------------------------------- +KDE_EXPORT bool kBytesToFile(const char* aBuffer, int len, + const TQString &aFileName, + bool aAskIfExists, bool aBackup, bool aVerbose) +{ + // TODO: use KSaveFile + TQFile file(aFileName); + int writeLen, rc; + + //assert(aFileName!=0); + if(aFileName.isEmpty()) + return FALSE; + + if (file.exists()) + { + if (aAskIfExists) + { + TQString str; + str = i18n("File %1 exists.\nDo you want to replace it?") + .arg(aFileName); + rc = KMessageBox::warningContinueCancel(0, + str, i18n("Save to File"), i18n("&Replace")); + if (rc != KMessageBox::Continue) return FALSE; + } + if (aBackup) + { + // make a backup copy + // TODO: use KSaveFile::backupFile() + TQString bakName = aFileName; + bakName += '~'; + TQFile::remove(bakName); + if( !TQDir::current().rename(aFileName, bakName) ) + { + // failed to rename file + if (!aVerbose) return FALSE; + rc = KMessageBox::warningContinueCancel(0, + i18n("Failed to make a backup copy of %1.\nContinue anyway?") + .arg(aFileName), + i18n("Save to File"), KStdGuiItem::save() ); + if (rc != KMessageBox::Continue) return FALSE; + } + } + } + + if (!file.open(IO_Raw|IO_WriteOnly|IO_Truncate)) + { + if (aVerbose) switch(file.status()) + { + case IO_WriteError: + msgDialog(i18n("Could not write to file:\n%1").arg(aFileName)); + break; + case IO_OpenError: + msgDialog(i18n("Could not open file for writing:\n%1") + .arg(aFileName)); + break; + default: + msgDialog(i18n("Error while writing file:\n%1").arg(aFileName)); + } + return FALSE; + } + + writeLen = file.writeBlock(aBuffer, len); + + if (writeLen < 0) + { + if (aVerbose) + msgDialog(i18n("Could not write to file:\n%1").arg(aFileName)); + return FALSE; + } + else if (writeLen < len) + { + TQString msg = i18n("Could only write %1 bytes of %2.") + .arg(writeLen).arg(len); + if (aVerbose) + msgDialog(msg); + return FALSE; + } + + return TRUE; +} + +KDE_EXPORT bool kCStringToFile(const TQCString& aBuffer, const TQString &aFileName, + bool aAskIfExists, bool aBackup, bool aVerbose) +{ + return kBytesToFile(aBuffer, aBuffer.length(), aFileName, aAskIfExists, + aBackup, aVerbose); +} + +KDE_EXPORT bool kByteArrayToFile(const TQByteArray& aBuffer, const TQString &aFileName, + bool aAskIfExists, bool aBackup, bool aVerbose) +{ + return kBytesToFile(aBuffer, aBuffer.size(), aFileName, aAskIfExists, + aBackup, aVerbose); +} + + +TQString checkAndCorrectPermissionsIfPossible( const TQString &toCheck, + const bool recursive, const bool wantItReadable, + const bool wantItWritable ) +{ + // First we have to find out which type the toCheck is. This can be + // a directory (follow if recursive) or a file (check permissions). + // Symlinks are followed as expected. + TQFileInfo fiToCheck(toCheck); + fiToCheck.setCaching(false); + TQCString toCheckEnc = TQFile::encodeName(toCheck); + TQString error; + struct stat statbuffer; + + if ( !fiToCheck.exists() ) { + error.append( i18n("%1 does not exist") + .arg(toCheck) + "\n"); + } + + // check the access bit of a folder. + if ( fiToCheck.isDir() ) { + if ( stat( toCheckEnc,&statbuffer ) != 0 ) { + kdDebug() << "wantItA: Can't read perms of " << toCheck << endl; + } + TQDir g( toCheck ); + if ( !g.isReadable() ) { + if ( chmod( toCheckEnc, statbuffer.st_mode + S_IXUSR ) != 0 ) { + error.append( i18n("%1 is not accessible and that is " + "unchangeable.").arg(toCheck) + "\n"); + } else { + kdDebug() << "Changed access bit for " << toCheck << endl; + } + } + } + + // For each file or folder we can check if the file is readable + // and writable, as requested. + if ( fiToCheck.isFile() || fiToCheck.isDir() ) { + + if ( !fiToCheck.isReadable() && wantItReadable ) { + // Get the current permissions. No need to do anything with an + // error, it will het added to errors anyhow, later on. + if ( stat(toCheckEnc,&statbuffer) != 0 ) { + kdDebug() << "wantItR: Can't read perms of " << toCheck << endl; + } + + // Lets try changing it. + if ( chmod( toCheckEnc, statbuffer.st_mode + S_IRUSR ) != 0 ) { + error.append( i18n("%1 is not readable and that is unchangeable.") + .arg(toCheck) + "\n"); + } else { + kdDebug() << "Changed the read bit for " << toCheck << endl; + } + } + + if ( !fiToCheck.isWritable() && wantItWritable ) { + // Gets the current persmissions. Needed because it can be changed + // curing previous operation. + if (stat(toCheckEnc,&statbuffer) != 0) { + kdDebug() << "wantItW: Can't read perms of " << toCheck << endl; + } + + // Lets try changing it. + if ( chmod (toCheckEnc, statbuffer.st_mode + S_IWUSR ) != 0 ) { + error.append( i18n("%1 is not writable and that is unchangeable.") + .arg(toCheck) + "\n"); + } else { + kdDebug() << "Changed the write bit for " << toCheck << endl; + } + } + } + + // If it is a folder and recursive is true, then we check the contents of + // the folder. + if ( fiToCheck.isDir() && recursive ){ + TQDir g(toCheck); + // First check if the folder is readable for us. If not, we get + // some ugly crashes. + if ( !g.isReadable() ){ + error.append(i18n("Folder %1 is inaccessible.").arg(toCheck) + "\n"); + } else { + const TQFileInfoList *list = g.entryInfoList(); + TQFileInfoListIterator it( *list ); + TQFileInfo *fi; + while ((fi = it.current()) != 0) { + TQString newToCheck = toCheck + "/" + fi->fileName(); + TQFileInfo fiNewToCheck(newToCheck); + if ( fi->fileName() != "." && fi->fileName() != ".." ) { + error.append ( checkAndCorrectPermissionsIfPossible( newToCheck, + recursive, wantItReadable, wantItWritable) ); + } + ++it; + } + } + } + return error; +} + +bool checkAndCorrectPermissionsIfPossibleWithErrorHandling( TQWidget *parent, + const TQString &toCheck, const bool recursive, const bool wantItReadable, + const bool wantItWritable ) +{ + TQString error = checkAndCorrectPermissionsIfPossible(toCheck, recursive, + wantItReadable, wantItWritable); + // There is no KMessageBox with Retry, Cancel and Details. + // so, I can't provide a functionality to recheck. So it now + // it is just a warning. + if ( !error.isEmpty() ) { + kdDebug() << "checkPermissions found:" << error << endl; + KMessageBox::detailedSorry(parent, + i18n("Some files or folders do not have " + "the right permissions, please correct them " + "manually."), + error, i18n("Permissions Check"), false); + return false; + } else { + return true; + } +} + +} diff --git a/libtdepim/tdefileio.h b/libtdepim/tdefileio.h new file mode 100644 index 00000000..e9045131 --- /dev/null +++ b/libtdepim/tdefileio.h @@ -0,0 +1,105 @@ +/* Load / save entire (local) files with nice diagnostics dialog messages. + * These functions load/save the whole buffer in one i/o call, so they + * should be pretty efficient. + * + * Author: Stefan Taferner + * This code is under GPL. + */ +#ifndef kpim_tdefileio_h +#define kpim_tdefileio_h + +#include +#include + +#include + +class TQString; + +namespace KPIM { + +/** Load a file. Returns a pointer to the memory-block that contains + * the loaded file. Returns a null string if the file could not be loaded. + * If withDialogs is FALSE no warning dialogs are opened if there are + * problems. + * The string returned is always zero-terminated and therefore one + * byte longer than the file itself. + * If ensureNewline is TRUE the string will always have a trailing newline. + */ +TQCString kFileToString(const TQString &fileName, bool ensureNewline=true, + bool withDialogs=true) KDE_EXPORT; + +// unused +//TQByteArray kFileToBytes(const TQString &fileName, bool withDialogs=true); + + +/** Save a file. If withDialogs is FALSE no warning dialogs are opened if + * there are problems. Returns TRUE on success and FALSE on failure. + * Replaces existing files without warning if askIfExists==FALSE. + * Makes a copy if the file exists to filename~ if createBackup==TRUE. + */ +bool kBytesToFile(const char* aBuffer, int len, + const TQString &aFileName, + bool aAskIfExists, bool aBackup, bool aVerbose) KDE_EXPORT; + +bool kCStringToFile(const TQCString& buffer, const TQString &fileName, + bool askIfExists=false, bool createBackup=true, + bool withDialogs=true) KDE_EXPORT; +/** Does not stop at NUL */ +KDE_EXPORT bool kByteArrayToFile(const TQByteArray& buffer, const TQString &fileName, + bool askIfExists=false, bool createBackup=true, + bool withDialogs=true) KDE_EXPORT; + + + /** + * Checks and corrects the permissions of a file or folder, and if requested + * all files and folders below. It gives back a list of files which do not + * have the right permissions. This list can be used to show to the user. + * + * @param toCheck The file or folder of which the permissions should + * be checked. + * @param recursive Set to true, it will check the contents of a folder + * for the permissions recursively. If false only + * toCheck will be checked. + * @param wantItReadable Set to true, it will check for read permissions. + * If the read permissions are not available, there will + * be a attempt to correct this. + * @param wantItWritable Set to true, it will check for write permissions. + * If the write permissions are not available, there + * will be a attempt to correct this. + * @return It will return a string with all files and folders which do not + * have the right permissions. If empty, then all permissions are ok. + */ +TQString checkAndCorrectPermissionsIfPossible( const TQString &toCheck, + const bool recursive, const bool wantItReadable, + const bool wantItWritable ); + + /** + * Checks and corrects the permissions of a file or folder, and if requested + * all files and folders below. If the permissions are not ok, it tries to correct + * them. If that fails then a warning with detailled information is given. + * + * @param parent If parent is 0, then the message box becomes an + * application-global modal dialog box. If parent + * is a widget, the message box becomes modal + * relative to parent. + * @param toCheck The file or folder of which the permissions should + * be checked. + * @param recursive Set to true, it will check the contents of a folder + * for the permissions recursively. If false only + * toCheck will be checked. + * @param wantItReadable Set to true, it will check for read permissions. + * If the read permissions are not available, there will + * be a attempt to correct this. + * @param wantItWritable Set to true, it will check for write permissions. + * If the write permissions are not available, there + * will be a attempt to correct this. + * @return It will return true if all permissions in the end are ok. If false + * then the permissions are not ok and it was not possible to correct + * all errors. + */ +bool checkAndCorrectPermissionsIfPossibleWithErrorHandling( TQWidget *parent, + const TQString &toCheck, const bool recursive, const bool wantItReadable, + const bool wantItWritable ); +} + +#endif /*kpim_tdefileio_h*/ diff --git a/libtdepim/tdepartsdesignerplugin/CMakeLists.txt b/libtdepim/tdepartsdesignerplugin/CMakeLists.txt index 01bba1d8..043d4526 100644 --- a/libtdepim/tdepartsdesignerplugin/CMakeLists.txt +++ b/libtdepim/tdepartsdesignerplugin/CMakeLists.txt @@ -27,6 +27,6 @@ link_directories( tde_add_kpart( tdepartsdesignerplugin AUTOMOC SOURCES tdepartsdesignerplugin.cpp - LINK tdeparts-shared kio-shared + LINK tdeparts-shared tdeio-shared DESTINATION ${PLUGIN_INSTALL_DIR}/plugins/designer ) diff --git a/libtdepim/tests/myconfig.kcfgc b/libtdepim/tests/myconfig.kcfgc index 35e26c99..451a9ec1 100644 --- a/libtdepim/tests/myconfig.kcfgc +++ b/libtdepim/tests/myconfig.kcfgc @@ -1,4 +1,4 @@ -# Code generation options for kconfig_compiler +# Code generation options for tdeconfig_compiler File=propagator_test.kcfg ClassName=MyConfig Singleton=true diff --git a/libtdepim/tests/testdistrlist.cpp b/libtdepim/tests/testdistrlist.cpp index 895dc537..75c4d557 100644 --- a/libtdepim/tests/testdistrlist.cpp +++ b/libtdepim/tests/testdistrlist.cpp @@ -26,8 +26,8 @@ using KPIM::DistributionList; #include #include #include -#include -#include +#include +#include #include #include diff --git a/libtdepim/tests/testwizard.cpp b/libtdepim/tests/testwizard.cpp index 1e404165..9858a092 100644 --- a/libtdepim/tests/testwizard.cpp +++ b/libtdepim/tests/testwizard.cpp @@ -21,7 +21,7 @@ #include "myconfig.h" -#include +#include #include #include diff --git a/plugins/kmail/bodypartformatter/text_calendar.cpp b/plugins/kmail/bodypartformatter/text_calendar.cpp index 1cb2a8f5..551f6117 100644 --- a/plugins/kmail/bodypartformatter/text_calendar.cpp +++ b/plugins/kmail/bodypartformatter/text_calendar.cpp @@ -38,7 +38,7 @@ #include #include -#include +#include #include #include @@ -58,7 +58,7 @@ #include #include -#include +#include #include #include #include @@ -74,7 +74,7 @@ #include #include #include -#include +#include #include #include diff --git a/plugins/kmail/bodypartformatter/text_vcard.cpp b/plugins/kmail/bodypartformatter/text_vcard.cpp index ce6d38a3..853f6cd4 100644 --- a/plugins/kmail/bodypartformatter/text_vcard.cpp +++ b/plugins/kmail/bodypartformatter/text_vcard.cpp @@ -37,11 +37,11 @@ #include #include #include -#include +#include #include #include #include -#include +#include #include diff --git a/tdefile-plugins/CMakeLists.txt b/tdefile-plugins/CMakeLists.txt new file mode 100644 index 00000000..3f9c0f47 --- /dev/null +++ b/tdefile-plugins/CMakeLists.txt @@ -0,0 +1,13 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +add_subdirectory( vcf ) +add_subdirectory( ics ) diff --git a/tdefile-plugins/Makefile.am b/tdefile-plugins/Makefile.am new file mode 100644 index 00000000..7ebdda70 --- /dev/null +++ b/tdefile-plugins/Makefile.am @@ -0,0 +1,6 @@ +if compile_kpilot +PILOTPLUGIN = palm-databases +endif + +SUBDIRS=vcf ics $(PILOTPLUGIN) + diff --git a/tdefile-plugins/RETURNED_ITEMS b/tdefile-plugins/RETURNED_ITEMS new file mode 100644 index 00000000..9985e36d --- /dev/null +++ b/tdefile-plugins/RETURNED_ITEMS @@ -0,0 +1,12 @@ +If you make a new plugin, please add the list of returned items to this list. + + +vcf plugin: +=========== + +type key W/A details +------------------------------------------------------------------------ +String Name -/- Name of person +String Email -/- Email address + + diff --git a/tdefile-plugins/ics/CMakeLists.txt b/tdefile-plugins/ics/CMakeLists.txt new file mode 100644 index 00000000..66c10071 --- /dev/null +++ b/tdefile-plugins/ics/CMakeLists.txt @@ -0,0 +1,40 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +tde_import( libkmime ) +tde_import( ktnef ) +tde_import( libkcal ) + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/libtdepim + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### other data ################################ + +install( FILES tdefile_ics.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) + + +##### tdefile_ics (module) ######################## + +tde_add_kpart( tdefile_ics AUTOMOC + SOURCES tdefile_ics.cpp + LINK kcal-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tdefile-plugins/ics/Makefile.am b/tdefile-plugins/ics/Makefile.am new file mode 100644 index 00000000..96a1a7f7 --- /dev/null +++ b/tdefile-plugins/ics/Makefile.am @@ -0,0 +1,24 @@ +# Makefile.am for ics file meta info plugin + +# set the include path for X, tdepim, qt and KDE +INCLUDES = \ + -I$(top_srcdir) \ + $(all_includes) + +# these are the headers for your project +noinst_HEADERS = tdefile_ics.h + +kde_module_LTLIBRARIES = tdefile_ics.la + +tdefile_ics_la_SOURCES = tdefile_ics.cpp +tdefile_ics_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) $(LIB_QT) -ltdecore +tdefile_ics_la_LIBADD = $(top_builddir)/libkcal/libkcal.la $(LIB_KSYCOCA) + + +METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) tdefile_ics.cpp -o $(podir)/tdefile_ics.pot + +services_DATA = tdefile_ics.desktop +servicesdir = $(kde_servicesdir) diff --git a/tdefile-plugins/ics/tdefile_ics.cpp b/tdefile-plugins/ics/tdefile_ics.cpp new file mode 100644 index 00000000..11a5384f --- /dev/null +++ b/tdefile-plugins/ics/tdefile_ics.cpp @@ -0,0 +1,96 @@ +/* This file is part of the KDE project + * Copyright (C) 2004 Bram Schoenmakers + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation version 2. + * + * This program is distributed in the hope that +t it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#include +#include + +#include +#include + +#include "tdefile_ics.h" + +#include + +using namespace KCal; + +typedef KGenericFactory ICSFactory; +K_EXPORT_COMPONENT_FACTORY(tdefile_ics, ICSFactory( "tdefile_ics" )) + +ICSPlugin::ICSPlugin( TQObject *parent, const char *name, const TQStringList& args ) + : KFilePlugin( parent, name, args ) +{ + KFileMimeTypeInfo* info = addMimeTypeInfo( "text/calendar" ); //TODO: vcs !! + + KFileMimeTypeInfo::GroupInfo* group = 0L; + group = addGroupInfo(info, "ICSInfo", i18n("Calendar Statistics")); + + addItemInfo( group, "ProductID", i18n("Product ID"), TQVariant::String ); + addItemInfo( group, "Events", i18n("Events"), TQVariant::Int ); + addItemInfo( group, "Todos", i18n("To-dos"), TQVariant::Int ); + addItemInfo( group, "TodoCompleted", i18n("Completed To-dos"), TQVariant::Int ); + addItemInfo( group, "TodoOverdue", i18n("Overdue To-dos"), TQVariant::Int ); + addItemInfo( group, "Journals", i18n("Journals"), TQVariant::Int ); +// addItemInfo( group, "Reminders", i18n("Reminders"), TQVariant::Int ); + +} + +/* +I chose to use libkcal instead of reading the calendar manually. It's easier to +maintain this way. +*/ +bool ICSPlugin::readInfo( KFileMetaInfo& info, uint /*what*/ ) +{ + KFileMetaInfoGroup group = appendGroup( info, "ICSInfo"); + + CalendarLocal cal ( TQString::fromLatin1( "UTC" ) ); + if( !cal.load( info.path() ) ) { + kdDebug() << "Could not load calendar" << endl; + return false; + } + + appendItem( group, "ProductID", TQVariant( cal.productId() ) ); + appendItem( group, "Events", TQVariant( int( cal.events().count() ) ) ); + appendItem( group, "Journals", TQVariant( int( cal.journals().count() ) ) ); + Todo::List todos = cal.todos(); + + // count completed and overdue + Todo::List::ConstIterator it = todos.begin(); + Todo::List::ConstIterator end = todos.end(); + + int completed = 0; + int overdue = 0; + for ( ; it != end ; ++it ) { + Todo *todo = *it; + if ( todo->isCompleted() ) + ++completed; + else if ( todo->hasDueDate() && todo->dtDue().date() < TQDate::currentDate() ) + ++overdue; + } + + appendItem( group, "Todos", TQVariant( int(todos.count() ) ) ); + appendItem( group, "TodoCompleted", TQVariant( completed ) ); + appendItem( group, "TodoOverdue", TQVariant( overdue ) ); + + cal.close(); + + return true; +} + +#include "tdefile_ics.moc" diff --git a/tdefile-plugins/ics/tdefile_ics.desktop b/tdefile-plugins/ics/tdefile_ics.desktop new file mode 100644 index 00000000..41d745aa --- /dev/null +++ b/tdefile-plugins/ics/tdefile_ics.desktop @@ -0,0 +1,56 @@ +[Desktop Entry] +Type=Service +Name=ICS information +Name[af]=ICS informasie +Name[be]=Ð†Ð½Ñ„Ð°Ñ€Ð¼Ð°Ñ†Ñ‹Ñ Ð°Ð± ICS +Name[bg]=ICS Ð¸Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ð¸Ñ +Name[br]=Titouroù ICS +Name[ca]=Informació ICS +Name[cs]=Informace o ICS +Name[da]=ICS-information +Name[de]=ICS-Information +Name[el]=ΠληÏοφοÏίες ICS +Name[eo]=ICS-Informo +Name[es]=Información ICS +Name[et]=ICS info +Name[eu]=ICS informazioa +Name[fa]=اطلاعات ICS +Name[fi]=ICS-tiedot +Name[fr]=Information sur ICS +Name[fy]=ICS-ynformaasje +Name[gl]=Información ICS +Name[he]=מידע של ICS +Name[hu]=ICS-jellemzÅ‘k +Name[is]=ICS upplýsingar +Name[it]=Informazioni ICS +Name[ja]=ICS 情報 +Name[kk]=ICS ақпараты +Name[km]=áž–áŸážáŸŒáž˜áž¶áž“ ICS +Name[lt]=ICS informacija +Name[mk]=Информација за ICS +Name[ms]=Maklumat ICS +Name[nb]=ICS-informasjon +Name[nds]=ICS-Informatschoon +Name[ne]=ICS सूचना +Name[nl]=ICS-informatie +Name[nn]=ICS-informasjon +Name[pa]=ICS ਜਾਣਕਾਰੀ +Name[pl]=Informacja ICS +Name[pt]=Informação ICS +Name[pt_BR]=Informações ICS +Name[ru]=Ð˜Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ð¸Ñ ICS +Name[sk]=Informácie o ICS +Name[sl]=Podatki ICS +Name[sr]=ICS информације +Name[sr@Latn]=ICS informacije +Name[sv]=ICS-information +Name[ta]=ICS தகவல௠+Name[tr]=ICS bilgisi +Name[uk]=Ð†Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ñ–Ñ Ð¿Ñ€Ð¾ ICS +Name[zh_CN]=ICS ä¿¡æ¯ +Name[zh_TW]=ICS 資訊 +ServiceTypes=KFilePlugin +X-TDE-Library=tdefile_ics +MimeType=text/calendar +PreferredGroups=ICSInfo +PreferredItems=Events,Todos,Journals diff --git a/tdefile-plugins/ics/tdefile_ics.h b/tdefile-plugins/ics/tdefile_ics.h new file mode 100644 index 00000000..9f4a897e --- /dev/null +++ b/tdefile-plugins/ics/tdefile_ics.h @@ -0,0 +1,37 @@ + /* This file is part of the KDE project + * Copyright (C) 2004 Bram Schoenmakers + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef KFILE_ICS_H +#define KFILE_ICS_H + +#include + +class TQStringList; + +class ICSPlugin : public KFilePlugin +{ + Q_OBJECT + +public: + ICSPlugin( TQObject *parent, const char *name, const TQStringList& args ); + + virtual bool readInfo( KFileMetaInfo& info, uint what ); +}; + +#endif diff --git a/tdefile-plugins/palm-databases/Makefile.am b/tdefile-plugins/palm-databases/Makefile.am new file mode 100644 index 00000000..552a2a4f --- /dev/null +++ b/tdefile-plugins/palm-databases/Makefile.am @@ -0,0 +1,22 @@ +## Makefile.am for palm database meta info plugin + +# set the include path for X, qt and KDE +INCLUDES = $(PISOCK_INCLUDE) $(all_includes) + +# these are the headers for your project +noinst_HEADERS = tdefile_palm.h + +kde_module_LTLIBRARIES = tdefile_palm.la + +tdefile_palm_la_SOURCES = tdefile_palm.cpp +tdefile_palm_la_LDFLAGS = $(PISOCK_LDFLAGS) $(all_libraries) -module $(KDE_PLUGIN) $(LIB_QT) -ltdecore +tdefile_palm_la_LIBADD = $(LIB_KSYCOCA) $(PISOCK_LIB) + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) tdefile_palm.cpp -o $(podir)/tdefile_palm.pot + +services_DATA = tdefile_palm.desktop +servicesdir = $(kde_servicesdir) diff --git a/tdefile-plugins/palm-databases/tdefile_palm.cpp b/tdefile-plugins/palm-databases/tdefile_palm.cpp new file mode 100644 index 00000000..3d4e20e9 --- /dev/null +++ b/tdefile-plugins/palm-databases/tdefile_palm.cpp @@ -0,0 +1,121 @@ +/* This file is part of the KDE project + * Copyright (C) 2004 Reinhold Kainhofer + * Based on the vcf plugin: + * Copyright (C) 2002 Shane Wright + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#include "tdefile_palm.h" + +#include +#include + +#include +#include +#include + + +typedef KGenericFactory PalmFactory; + +K_EXPORT_COMPONENT_FACTORY(tdefile_palm, PalmFactory( "tdefile_palm" )) + +KPalmPlugin::KPalmPlugin(TQObject *parent, const char *name, + const TQStringList &args) + + : KFilePlugin(parent, name, args) +{ + KFileMimeTypeInfo* info = addMimeTypeInfo( "application/vnd.palm" ); + + KFileMimeTypeInfo::GroupInfo* group; + KFileMimeTypeInfo::ItemInfo* item; + + group = addGroupInfo(info, "General", i18n("General Information")); + item = addItemInfo(group, "Name", i18n("Name"), TQVariant::String); + item = addItemInfo(group, "DBType", i18n("DB Type"), TQVariant::String); + item = addItemInfo(group, "TypeID", i18n("Type ID"), TQVariant::String); + item = addItemInfo(group, "CreatorID", i18n("Creator ID"), TQVariant::String); + item = addItemInfo(group, "NrRecords", i18n("# of Records"), TQVariant::Int); + + group = addGroupInfo(info, "TimeStamps", i18n("Time Stamps")); + item = addItemInfo(group, "CreationDate", i18n("Creation Date"), TQVariant::DateTime); + item = addItemInfo(group, "ModificationDate", i18n("Modification Date"), TQVariant::DateTime); + item = addItemInfo(group, "BackupDate", i18n("Backup Date"), TQVariant::DateTime); + + group = addGroupInfo(info, "Flags", i18n("Flags")); + item = addItemInfo(group, "ReadOnly", i18n("Read-Only"), TQVariant::String); + item = addItemInfo(group, "MakeBackup", i18n("Make Backup"), TQVariant::String); + item = addItemInfo(group, "CopyProtected", i18n("Copy Protected"), TQVariant::String); + item = addItemInfo(group, "Reset", i18n("Reset Handheld After Installing"), TQVariant::String); + item = addItemInfo(group, "ExcludeFromSync", i18n("Exclude From Sync"), TQVariant::String); +} + + +bool KPalmPlugin::readInfo( KFileMetaInfo& info, uint /*what*/ ) +{ + int nrRec; + TQString tempName = info.path(); + TQCString fileName = TQFile::encodeName(tempName); + pi_file *dbFile = pi_file_open(const_cast < char *>((const char *) fileName)); + if (dbFile == 0L) return false; + + struct DBInfo dBInfo; + pi_file_get_info( dbFile, &dBInfo ); + pi_file_get_entries( dbFile, &nrRec ); + pi_file_close(dbFile); + + KFileMetaInfoGroup generalGroup = appendGroup(info, "General"); + appendItem(generalGroup, "Name", dBInfo.name ); + appendItem(generalGroup, "DBType", (dBInfo.flags & dlpDBFlagResource)?i18n("PalmOS Application"):i18n("PalmOS Record Database") ); + + char buff[5]; + set_long(buff, dBInfo.type); + buff[4]='\0'; + appendItem(generalGroup, "TypeID", buff ); + + set_long(buff, dBInfo.creator); + buff[4]='\0'; + appendItem(generalGroup, "CreatorID", buff ); + appendItem(generalGroup, "NrRecords", nrRec ); + + + KFileMetaInfoGroup timeGroup = appendGroup(info, "TimeStamps"); + TQDateTime tm; + tm.setTime_t( dBInfo.createDate ); + appendItem(timeGroup, "CreationDate", tm); + tm.setTime_t( dBInfo.modifyDate ); + appendItem(timeGroup, "ModificationDate", tm); + tm.setTime_t( dBInfo.backupDate ); + appendItem(timeGroup, "BackupDate", tm); + + KFileMetaInfoGroup flagGroup = appendGroup(info, "Flags"); + appendItem(flagGroup, "ReadOnly", (dBInfo.flags & dlpDBFlagReadOnly)?i18n("Yes"):i18n("No") ); + appendItem(flagGroup, "MakeBackup", (dBInfo.flags & dlpDBFlagBackup)?i18n("Yes"):i18n("No") ); + appendItem(flagGroup, "CopyProtected", (dBInfo.flags & dlpDBFlagCopyPrevention)?i18n("Yes"):i18n("No") ); + appendItem(flagGroup, "Reset", (dBInfo.flags & dlpDBFlagReset)?i18n("Yes"):i18n("No") ); + appendItem(flagGroup, "ExcludeFromSync", (dBInfo.miscFlags & dlpDBMiscFlagExcludeFromSync)?i18n("Yes"):i18n("No") ); + + return true; +} + +/*bool KPalmPlugin::writeInfo( const KFileMetaInfo& info ) const +{ +// int pi_file_set_info((struct pi_file * pf, struct DBInfo * infop)); +//info["tuteTextTechnical"].value("An integer").toInt() +// Do the stuff with low-level functions. See lines 1119-1142 of pi-file.cc for writing, 244-273 for reading. +}*/ + +#include "tdefile_palm.moc" diff --git a/tdefile-plugins/palm-databases/tdefile_palm.desktop b/tdefile-plugins/palm-databases/tdefile_palm.desktop new file mode 100644 index 00000000..716944e1 --- /dev/null +++ b/tdefile-plugins/palm-databases/tdefile_palm.desktop @@ -0,0 +1,59 @@ +[Desktop Entry] +Type=Service +Name=PalmOS Database Info +Name[af]=PalmOS databasis informasie +Name[be]=Ð†Ð½Ñ„Ð°Ñ€Ð¼Ð°Ñ†Ñ‹Ñ Ð°Ð± базе дадзеных PalmOS +Name[bg]=Ð˜Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ð¸Ñ Ð·Ð° БД на PalmOS +Name[br]=Titouroù diwar-benn ar stlennvon PalmOS +Name[bs]=Informacije o PalmOS bazi podataka +Name[ca]=Informació de base de dades PalmOS +Name[cs]=Informace o databázi PalmOS +Name[da]=PalmOS database-info +Name[de]=PalmOS Datenbank-Informationen +Name[el]=ΠληÏοφοÏίες βάσης δεδομένων PalmOS +Name[eo]=PalmOS-Datumbazinformo +Name[es]=Info. de la base de datos de PalmOS +Name[et]=PalmOS andmebaasi info +Name[eu]=PalmOS datu-base informazioa +Name[fa]=اطلاعات دادگان PalmOS +Name[fi]=PalmOS-tietokannan tiedot +Name[fr]=Informations sur les bases de données PalmOS +Name[fy]=PalmOS-database ynformaasje +Name[ga]=Eolas faoin Bhunachar Sonraí PalmOS +Name[gl]=Información de Base de Datos de PalmOS +Name[he]=מידע ×ודות בסיס ×”× ×ª×•× ×™× ×©×œ PalmOS +Name[hu]=PalmOS adatbázis-jellemzÅ‘k +Name[is]=PalmOS gagnagrunnsupplýsingar +Name[it]=Informazioni database PalmOs +Name[ja]=PalmOS データベース 情報 +Name[kk]=PalmOS деректер қорының мәліметі +Name[km]=áž–áŸážáŸŒáž˜áž¶áž“​មូលដ្ឋាន​ទិន្ននáŸáž™ PalmOS +Name[lt]=PalmOS duomenų bazÄ—s info +Name[mk]=Информации за PalmOS-база на податоци +Name[ms]=Maklumat Pangkalan Data PalmOS +Name[nb]=PalmOS Database info +Name[nds]=PalmOS-Datenbank-Informatschonen +Name[ne]=PalmOS डाटाबेस सूचना +Name[nl]=PalmOS-database informatie +Name[nn]=PalmOS-databaseinfo +Name[pl]=Baza danych PalmOS +Name[pt]=Informações de Base de Dados PalmOS +Name[pt_BR]=Informações da Base de Dados do PalmOS +Name[ru]=Ð¡Ð²ÐµÐ´ÐµÐ½Ð¸Ñ Ð¾ базе данных PalmOS +Name[se]=PalmOS-diehtovuoÄ‘Ä‘odieÄ‘ut +Name[sk]=Informácie o databázach PalmOS +Name[sl]=Informacije zbirke podatkov za PalmOS +Name[sr]=Информације о PalmOS базама података +Name[sr@Latn]=Informacije o PalmOS bazama podataka +Name[sv]=PalmOS-databasinformation +Name[ta]=பாலà¯à®®à¯OS தரவà¯à®¤à¯à®¤à®³ தகவல௠+Name[tg]=Иттилоот дар бораи бонки додаҳои PalmOS +Name[tr]=PalmOS Veritabanı Bilgisi +Name[uk]=Ð†Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ñ–Ñ Ð¿Ñ€Ð¾ базу даних PalmOS +Name[zh_CN]=PalmOS æ•°æ®åº“ä¿¡æ¯ +Name[zh_TW]=PalmOS 資料庫資訊 +ServiceTypes=KFilePlugin +X-TDE-Library=tdefile_palm +MimeType=application/vnd.palm +PreferredGroups=General +PreferredItems=Name,DBType,TypeID,CreatorID,NrRecords,Size diff --git a/tdefile-plugins/palm-databases/tdefile_palm.h b/tdefile-plugins/palm-databases/tdefile_palm.h new file mode 100644 index 00000000..d566d5fc --- /dev/null +++ b/tdefile-plugins/palm-databases/tdefile_palm.h @@ -0,0 +1,41 @@ +/* This file is part of the KDE project + * Copyright (C) 2004 Reinhold Kainhofer + * Based on the vcf plugin: + * Copyright (C) 2002 Shane Wright + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef __KFILE_PALM_H__ +#define __KFILE_PALM_H__ + +#include + +class TQStringList; + +class KPalmPlugin: public KFilePlugin +{ + Q_OBJECT + + +public: + KPalmPlugin( TQObject *parent, const char *name, const TQStringList& args ); + + virtual bool readInfo( KFileMetaInfo& info, uint what); +// virtual bool writeInfo( const KFileMetaInfo& info ) const; +}; + +#endif diff --git a/tdefile-plugins/rfc822/Makefile.am b/tdefile-plugins/rfc822/Makefile.am new file mode 100644 index 00000000..f7cf8969 --- /dev/null +++ b/tdefile-plugins/rfc822/Makefile.am @@ -0,0 +1,22 @@ +## Makefile.am for rfc822 file meta info plugin + +# set the include path for X, qt and KDE +INCLUDES = $(all_includes) + +# these are the headers for your project +noinst_HEADERS = tdefile_rfc822.h + +kde_module_LTLIBRARIES = tdefile_rfc822.la + +tdefile_rfc822_la_SOURCES = tdefile_rfc822.cpp +tdefile_rfc822_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +tdefile_rfc822_la_LIBADD = $(LIB_KSYCOCA) + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) tdefile_rfc822.cpp -o $(podir)/tdefile_rfc822.pot + +services_DATA = tdefile_rfc822.desktop +servicesdir = $(kde_servicesdir) diff --git a/tdefile-plugins/rfc822/RETURNED_ITEMS b/tdefile-plugins/rfc822/RETURNED_ITEMS new file mode 100644 index 00000000..be8c9b7e --- /dev/null +++ b/tdefile-plugins/rfc822/RETURNED_ITEMS @@ -0,0 +1,14 @@ +If you make a new plugin, please add the list of returned items to this list. + + +rfc822 plugin: +=========== + +type key W/A details +------------------------------------------------------------------------ +String From -/- Name/email of sender +String To -/- Name/email of recipient +String Subject -/- Subject line of message +String Date -/- Date stamped in message +String Content-Type -/- Content type declared in headers + diff --git a/tdefile-plugins/rfc822/tdefile_rfc822.cpp b/tdefile-plugins/rfc822/tdefile_rfc822.cpp new file mode 100644 index 00000000..261f0835 --- /dev/null +++ b/tdefile-plugins/rfc822/tdefile_rfc822.cpp @@ -0,0 +1,161 @@ +/* This file is part of the KDE project + * Copyright (C) 2002 Shane Wright + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#include +#include "tdefile_rfc822.h" + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#if !defined(__osf__) +#include +#else +typedef unsigned short uint32_t; +#endif + +typedef KGenericFactory Rfc822Factory; + +K_EXPORT_COMPONENT_FACTORY(tdefile_rfc822, Rfc822Factory( "tdefile_rfc822" )) + +KRfc822Plugin::KRfc822Plugin(TQObject *parent, const char *name, + const TQStringList &args) + + : KFilePlugin(parent, name, args) +{ + KFileMimeTypeInfo* info = addMimeTypeInfo( "message/rfc822" ); + + KFileMimeTypeInfo::GroupInfo* group = 0L; + + group = addGroupInfo(info, "Technical", i18n("Technical Details")); + + KFileMimeTypeInfo::ItemInfo* item; + + item = addItemInfo(group, "From", i18n("From"), TQVariant::String); + item = addItemInfo(group, "To", i18n("To"), TQVariant::String); + item = addItemInfo(group, "Subject", i18n("Subject"), TQVariant::String); + item = addItemInfo(group, "Date", i18n("Date"), TQVariant::String); + item = addItemInfo(group, "Content-Type", i18n("Content-Type"), TQVariant::String); +} + + +bool KRfc822Plugin::readInfo( KFileMetaInfo& info, uint /*what*/ ) +{ + + TQFile file(info.path()); + + if (!file.open(IO_ReadOnly)) + { + kdDebug(7034) << "Couldn't open " << TQFile::encodeName(info.path()) << endl; + return false; + } + + /* + Note to self: probably should use TQCString for all this, but + what we're doing is simple and self-contained so never mind.. + */ + + char id_from[] = "From: "; + char id_to[] = "To: "; + char id_subject[] = "Subject: "; + char id_date[] = "Date: "; + char id_contenttype[] = "Content-Type: "; + + // we need a buffer for lines + char linebuf[4096]; + + // we need a buffer for other stuff + char buf_from[1000] = ""; + char buf_to[1000] = ""; + char buf_subject[1000] = ""; + char buf_date[1000] = ""; + char buf_contenttype[1000] = ""; + + memset(buf_from, 0, 999); + memset(buf_to, 0, 999); + memset(buf_subject, 0, 999); + memset(buf_date, 0, 999); + memset(buf_contenttype, 0, 999); + char * myptr; + + bool done=false; + while (!done) { + + // read a line + file.readLine(linebuf, sizeof( linebuf )); + + // have we got something useful? + if (memcmp(linebuf, id_from, 6) == 0) { + // we have a name + myptr = linebuf + 6; + strncpy(buf_from, myptr, sizeof( buf_from )); + buf_from[998]='\0'; + } else if (memcmp(linebuf, id_to, 4) == 0) { + // we have a name + myptr = linebuf + 4; + strncpy(buf_to, myptr, sizeof( buf_to )); + buf_to[998]='\0'; + } else if (memcmp(linebuf, id_subject, 9) == 0) { + // we have a name + myptr = linebuf + 9; + strncpy(buf_subject, myptr, sizeof( buf_subject )); + buf_subject[998]='\0'; + } else if (memcmp(linebuf, id_date, 6) == 0) { + // we have a name + myptr = linebuf + 6; + strncpy(buf_date, myptr, sizeof( buf_date )); + buf_date[998]='\0'; + } else if (memcmp(linebuf, id_contenttype, 14) == 0) { + // we have a name + myptr = linebuf + 14; + strncpy(buf_contenttype, myptr, sizeof( buf_contenttype )); + buf_contenttype[998]='\0'; + } + + // are we done yet? + if ( + ((strlen(buf_from) > 0) && (strlen(buf_to) > 0) && + (strlen(buf_subject) > 0) && (strlen(buf_date) > 0) && + (strlen(buf_contenttype) > 0)) || + (file.atEnd()) + ) + done = true; + + }; + + KFileMetaInfoGroup group = appendGroup(info, "Technical"); + + if (strlen(buf_from) > 0) appendItem(group, "From", buf_from); + if (strlen(buf_to) > 0) appendItem(group, "To", buf_to); + if (strlen(buf_subject) > 0) appendItem(group, "Subject", buf_subject); + if (strlen(buf_date) > 0) appendItem(group, "Date", buf_date); + if (strlen(buf_contenttype) > 0) appendItem(group, "Content-Type", buf_contenttype); + + return true; +} + +#include "tdefile_rfc822.moc" diff --git a/tdefile-plugins/rfc822/tdefile_rfc822.desktop b/tdefile-plugins/rfc822/tdefile_rfc822.desktop new file mode 100644 index 00000000..d030e1e5 --- /dev/null +++ b/tdefile-plugins/rfc822/tdefile_rfc822.desktop @@ -0,0 +1,62 @@ +[Desktop Entry] +Type=Service +Name=Email Info +Name[af]=E-pos informasie +Name[be]=Ð†Ð½Ñ„Ð°Ñ€Ð¼Ð°Ñ†Ñ‹Ñ Ð°Ð± паведамленні Ñлектроннай пошты +Name[bg]=Ð˜Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ð¸Ñ Ð·Ð° е-поща +Name[br]=Titouroù postel +Name[ca]=Informació de correu-e +Name[cs]=Informace o emailu +Name[cy]=Gwybodaeth Ebost +Name[da]=E-mail-info +Name[de]=E-Mail-Info +Name[el]=ΠληÏοφοÏίες Email +Name[eo]=RetpoÅt-informo +Name[es]=Info de correo electrónico +Name[et]=Kirja info +Name[eu]=E-posta informazioa +Name[fa]=اطلاعات رایانامه +Name[fi]=Sähköpostitiedot +Name[fr]=Informations sur le courrier électronique +Name[fy]=E-port-ynformaasje +Name[gl]=Información de Correo-e +Name[he]=מידע על דו×"ל +Name[hi]=ई-मेल जानकारी +Name[hr]=Email Informacije +Name[hu]=E-mail-jellemzÅ‘k +Name[is]=Tölvupóst upplýsingar +Name[it]=Informazioni di posta elettronica +Name[ja]=Eメール 情報 +Name[kk]=Эл.пошта мәліметі +Name[km]=áž–áŸážáŸŒáž˜áž¶áž“​អ៊ីមែល +Name[lt]=E. paÅ¡to info +Name[mk]=Информации за е-пошта +Name[ms]=Info Emel +Name[nb]=E-post-info +Name[nds]=Nettbreef-Informatschonen +Name[ne]=इमेल सूचना +Name[nl]=E-mail-informatie +Name[nn]=Epost-info +Name[pa]=ਈ-ਪੱਤਰ ਜਾਣਕਾਰੀ +Name[pl]=Informacja o e-mailu +Name[pt]=Informação do E-Mail +Name[pt_BR]=Informações sobre E-mail +Name[ro]=InformaÅ£ii e-mail +Name[ru]=Ð¡Ð²ÐµÐ´ÐµÐ½Ð¸Ñ Ð¾Ð± Ñлектронной почте +Name[se]=E-boastadieÄ‘ut +Name[sk]=Informácie o emaily +Name[sl]=Informacije o e-poÅ¡ti +Name[sr]=Е-поштанÑке информације +Name[sr@Latn]=E-poÅ¡tanske informacije +Name[sv]=E-postinformation +Name[ta]=மினà¯à®©à®žà¯à®šà®²à¯ தகவல௠+Name[tg]=Иттилоот дар бораи почтаи Ñлектронӣ +Name[tr]=E-Posta Bilgisi +Name[uk]=Ð†Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ñ–Ñ Ð¿Ñ€Ð¾ Ð¿Ð¾Ð²Ñ–Ð´Ð¾Ð¼Ð»ÐµÐ½Ð½Ñ ÐµÐ». пошти +Name[zh_CN]=电å­é‚®ä»¶ä¿¡æ¯ +Name[zh_TW]=é›»å­éƒµä»¶è³‡è¨Š +ServiceTypes=KFilePlugin +X-TDE-Library=tdefile_rfc822 +MimeType=message/rfc822 +PreferredGroups=Technical +PreferredItems=From,To,Subject,Date,Content-Type diff --git a/tdefile-plugins/rfc822/tdefile_rfc822.h b/tdefile-plugins/rfc822/tdefile_rfc822.h new file mode 100644 index 00000000..e43948a9 --- /dev/null +++ b/tdefile-plugins/rfc822/tdefile_rfc822.h @@ -0,0 +1,38 @@ +/* This file is part of the KDE project + * Copyright (C) 2002 Shane Wright + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef __KFILE_RFC822_H__ +#define __KFILE_RFC822_H__ + +#include + +class TQStringList; + +class KRfc822Plugin: public KFilePlugin +{ + Q_OBJECT + + +public: + KRfc822Plugin( TQObject *parent, const char *name, const TQStringList& args ); + + virtual bool readInfo( KFileMetaInfo& info, uint what); +}; + +#endif diff --git a/tdefile-plugins/vcf/CMakeLists.txt b/tdefile-plugins/vcf/CMakeLists.txt new file mode 100644 index 00000000..4cf771d2 --- /dev/null +++ b/tdefile-plugins/vcf/CMakeLists.txt @@ -0,0 +1,35 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR} + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### other data ################################ + +install( FILES tdefile_vcf.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) + + +##### tdefile_vcf (module) ######################## + +tde_add_kpart( tdefile_vcf AUTOMOC + SOURCES tdefile_vcf.cpp + LINK kabc-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tdefile-plugins/vcf/Makefile.am b/tdefile-plugins/vcf/Makefile.am new file mode 100644 index 00000000..61b306d5 --- /dev/null +++ b/tdefile-plugins/vcf/Makefile.am @@ -0,0 +1,22 @@ +## Makefile.am for vcf file meta info plugin + +# set the include path for X, qt and KDE +INCLUDES = $(all_includes) + +# these are the headers for your project +noinst_HEADERS = tdefile_vcf.h + +kde_module_LTLIBRARIES = tdefile_vcf.la + +tdefile_vcf_la_SOURCES = tdefile_vcf.cpp +tdefile_vcf_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) $(LIB_QT) -ltdecore +tdefile_vcf_la_LIBADD = $(LIB_KSYCOCA) $(LIB_KABC) + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) tdefile_vcf.cpp -o $(podir)/tdefile_vcf.pot + +services_DATA = tdefile_vcf.desktop +servicesdir = $(kde_servicesdir) diff --git a/tdefile-plugins/vcf/tdefile_vcf.cpp b/tdefile-plugins/vcf/tdefile_vcf.cpp new file mode 100644 index 00000000..e8746c56 --- /dev/null +++ b/tdefile-plugins/vcf/tdefile_vcf.cpp @@ -0,0 +1,103 @@ +/* This file is part of the KDE project + * Copyright (C) 2002 Shane Wright + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#include +#include +#include "tdefile_vcf.h" + +#include +#include +#include +#include + +#include +#include + +typedef KGenericFactory VcfFactory; + +K_EXPORT_COMPONENT_FACTORY(tdefile_vcf, VcfFactory( "tdefile_vcf" )) + +KVcfPlugin::KVcfPlugin(TQObject *parent, const char *name, + const TQStringList &args) + + : KFilePlugin(parent, name, args) +{ + KFileMimeTypeInfo* info = addMimeTypeInfo( "text/x-vcard" ); + + KFileMimeTypeInfo::GroupInfo* group = 0L; + + group = addGroupInfo(info, "Technical", i18n("Technical Details")); + + KFileMimeTypeInfo::ItemInfo* item; + + item = addItemInfo(group, "Name", i18n("Name"), TQVariant::String); + item = addItemInfo(group, "Email", i18n("Email"), TQVariant::String); + item = addItemInfo(group, "Telephone", i18n("Telephone"), TQVariant::String); +} + + +bool KVcfPlugin::readInfo( KFileMetaInfo& info, uint /*what*/ ) +{ + TQFile file(info.path()); + + if (!file.open(IO_ReadOnly)) + { + kdDebug(7034) << "Couldn't open " << TQString(TQFile::encodeName(info.path())) << endl; + return false; + } + + // even the vcard thumbnail TQString::fromUtf8(buf_name));creator reads the full file ... + // The following is partly copied from there + TQString contents = file.readAll(); + file.close(); + + KABC::VCardConverter converter; +#if defined(KABC_VCARD_ENCODING_FIX) + KABC::Addressee addr = converter.parseVCardRaw( contents.utf8() ); +#else + KABC::Addressee addr = converter.parseVCard( contents ); +#endif + KFileMetaInfoGroup group = appendGroup(info, "Technical"); + + // prepare the text + TQString name = addr.formattedName().simplifyWhiteSpace(); + if ( name.isEmpty() ) + name = addr.givenName() + " " + addr.familyName(); + name = name.simplifyWhiteSpace(); + + if ( ! name.isEmpty() ) + appendItem(group, "Name", name); + + if ( ! addr.preferredEmail().isEmpty() ) + appendItem(group, "Email", addr.preferredEmail()); + + KABC::PhoneNumber::List pnList = addr.phoneNumbers(); + TQStringList phoneNumbers; + for (unsigned int no=0; no + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef __KFILE_VCF_H__ +#define __KFILE_VCF_H__ + +#include + +class TQStringList; + +class KVcfPlugin: public KFilePlugin +{ + Q_OBJECT + + +public: + KVcfPlugin( TQObject *parent, const char *name, const TQStringList& args ); + + virtual bool readInfo( KFileMetaInfo& info, uint what); +}; + +#endif diff --git a/tdeioslaves/CMakeLists.txt b/tdeioslaves/CMakeLists.txt new file mode 100644 index 00000000..567a1434 --- /dev/null +++ b/tdeioslaves/CMakeLists.txt @@ -0,0 +1,21 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include( ConfigureChecks.cmake ) + +add_subdirectory( imap4 ) +add_subdirectory( mbox ) + +if( WITH_SASL ) + add_subdirectory( sieve ) +else( ) + message( "*** sieve tdeioslave will not be built (because lack of sasl support)" ) +endif( ) diff --git a/tdeioslaves/ConfigureChecks.cmake b/tdeioslaves/ConfigureChecks.cmake new file mode 100644 index 00000000..9cbd46c0 --- /dev/null +++ b/tdeioslaves/ConfigureChecks.cmake @@ -0,0 +1,22 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +if( WITH_SASL ) + check_include_file( sasl/sasl.h HAVE_SASL_SASL_H ) + if( HAVE_SASL_SASL_H ) + check_library_exists( sasl2 sasl_client_init "" HAVE_LIBSASL2 ) + endif( ) + if( HAVE_LIBSASL2 ) + set( SASL_LIBRARY sasl2 CACHE INTERNAL "" ) + else( ) + tde_message_fatal( "cyrus-sasl are requested, but not found on your system" ) + endif( ) +endif( ) diff --git a/tdeioslaves/Mainpage.dox b/tdeioslaves/Mainpage.dox new file mode 100644 index 00000000..24e1ca68 --- /dev/null +++ b/tdeioslaves/Mainpage.dox @@ -0,0 +1,9 @@ +/** @mainpage +* +* IO Slaves. +* +* KDE PIM contains a few KIOSlaves. The most important +* of these is the IMAP4Protocol slave which is used for IMAP operations. +* Similarly, the MBoxProtocol slave is used to access mbox files. +* +*/ diff --git a/tdeioslaves/Makefile.am b/tdeioslaves/Makefile.am new file mode 100644 index 00000000..89bd2cf6 --- /dev/null +++ b/tdeioslaves/Makefile.am @@ -0,0 +1,11 @@ +## $Id$ + +if compile_kio_sieve + SIEVE_SUBDIR = sieve +endif + +SUBDIRS = imap4 mbox $(SIEVE_SUBDIR) + +DOXYGEN_REFERENCES = tdeioslaves/imap4 tdeioslaves/mbox +include $(top_srcdir)/admin/Doxyfile.am + diff --git a/tdeioslaves/configure.in.bot b/tdeioslaves/configure.in.bot new file mode 100644 index 00000000..fdad4b63 --- /dev/null +++ b/tdeioslaves/configure.in.bot @@ -0,0 +1,6 @@ +if test "x$with_sasl" = xcheck && test -z "$SASL2_LIBS"; then + echo "" + echo "cyrus-sasl 2 library is missing. The sieve ioslave will not be built, and imap4 will lack of a lot of authentication methods." + echo "" + all_tests=bad +fi diff --git a/tdeioslaves/configure.in.in b/tdeioslaves/configure.in.in new file mode 100644 index 00000000..47b98682 --- /dev/null +++ b/tdeioslaves/configure.in.in @@ -0,0 +1,27 @@ +KDE_CHECK_SSL + +AC_ARG_WITH(sasl, + [AC_HELP_STRING(--with-sasl, + [enable support for authentication through cyrus-sasl @<:@default=check@:>@])], + [], with_sasl=check) + +sasl2_header="no" +SASL2_LIBS="" +if test "x$with_sasl" != xno; then + KDE_CHECK_HEADERS(sasl/sasl.h, sasl2_header="yes") + if test "$sasl2_header" = "yes" ; then + KDE_CHECK_LIB(sasl2, sasl_client_init, SASL2_LIBS="-lsasl2") + fi + + if test "x$SASL2_LIBS" != "x" ; then + AC_DEFINE_UNQUOTED(HAVE_LIBSASL2, 1, [Define if you have cyrus-sasl2 libraries]) + fi + + if test "x$with_sasl" != xcheck && test -z "$SASL2_LIBS"; then + AC_MSG_ERROR([--with-sasl was given, but test for cyrus-sasl failed]) + fi +fi + +AC_SUBST(SASL2_LIBS) + +AM_CONDITIONAL(compile_kio_sieve, test -n "$SASL2_LIBS") diff --git a/tdeioslaves/imap4/CMakeLists.txt b/tdeioslaves/imap4/CMakeLists.txt new file mode 100644 index 00000000..7cf5cace --- /dev/null +++ b/tdeioslaves/imap4/CMakeLists.txt @@ -0,0 +1,44 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +tde_import( libkmime ) + +include_directories( + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/libemailfunctions + ${CMAKE_SOURCE_DIR}/libkmime + ${CMAKE_SOURCE_DIR}/libtdepim + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### other data ################################ + +install( FILES + imap4.protocol imaps.protocol + DESTINATION ${SERVICES_INSTALL_DIR} ) + + +##### kio_imap4 (module) ######################## + +tde_add_kpart( kio_imap4 + SOURCES + imapcommand.cc imaplist.cc mailaddress.cc mimeheader.cc + rfcdecoder.cc imap4.cc imapinfo.cc imapparser.cc + mailheader.cc mimehdrline.cc mimeio.cc + LINK emailfunctions-static kmime-shared tdeio-shared ${SASL_LIBRARY} + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tdeioslaves/imap4/Makefile.am b/tdeioslaves/imap4/Makefile.am new file mode 100644 index 00000000..553b0c32 --- /dev/null +++ b/tdeioslaves/imap4/Makefile.am @@ -0,0 +1,26 @@ +INCLUDES= -I$(top_srcdir)/libkmime \ + -I$(srcdir)/.. $(SSL_INCLUDES) \ + -I$(top_srcdir)/libemailfunctions \ + $(all_includes) + +####### Files + +kde_module_LTLIBRARIES = kio_imap4.la + +kio_imap4_la_SOURCES = imapcommand.cc imaplist.cc mailaddress.cc \ + mimeheader.cc rfcdecoder.cc imap4.cc imapinfo.cc imapparser.cc mailheader.cc \ + mimehdrline.cc mimeio.cc +kio_imap4_la_LIBADD = $(LIB_KIO) $(SASL2_LIBS) ../../libkmime/libkmime.la \ + ../../libemailfunctions/libemailfunctions.la +kio_imap4_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) -module $(KDE_PLUGIN) + +noinst_HEADERS = imap4.h +EXTRA_DIST = README + +kdelnk_DATA = imap4.protocol imaps.protocol +kdelnkdir = $(kde_servicesdir) + +messages: + $(XGETTEXT) *.cc -o $(podir)/tdeio_imap4.pot + +include $(top_srcdir)/admin/Doxyfile.am diff --git a/tdeioslaves/imap4/PATCHING b/tdeioslaves/imap4/PATCHING new file mode 100644 index 00000000..39bcdce9 --- /dev/null +++ b/tdeioslaves/imap4/PATCHING @@ -0,0 +1,7 @@ +If you are patching this code, please be very sensitive to performance issues. +The parser is already very slow and resource intensive. Be careful not to add +any extra string iterations (copies, QCString.length(), etc), mallocs, or +implicit object creation/copies. Use calltree before and after your patch to +verify that it is not too expensive, along with cpu usage timing and even +wall clock time. + diff --git a/tdeioslaves/imap4/README b/tdeioslaves/imap4/README new file mode 100644 index 00000000..af8af8f0 --- /dev/null +++ b/tdeioslaves/imap4/README @@ -0,0 +1,48 @@ +This is s.carstens@gmx.de release of KDE 2.0 tdeioslave +for the IMAP protocol. + +It supports LOGIN, AUTHENTICATE LOGIN, AUTHENTICATE ANONYMOUS and +AUTHENTICATE CRAM-MD5. +It supports the rfc2192 URL naming convention. + +- UIDVALIDITY check is conditional +- put will check if the mailbox exists and create it + or will append the data to that mailbox + (no append after create) + use edit->new->textfile from konqueror +- move will try to guess the correct destination + as konqueror appends the source mailbox name to + the destination +- del will currently delete empty directories, + mark messages for deletion. + If deleting a directory konqueror does the following: + - list the box + - take the box url + file name and try to delete it + - delete the box + As the konqueror created urls are invalid we ignore them + at the moment. +- relative URL's are not supported because + konqueror will not handle them +- there are 2 additional section keywords + ENVELOPE will do a FETCH ENVELOPE + STRUCTURE will do a FETCH BODYSTRUCTURE + normal behaviour is FETCH BODY.PEEK[section] + +- the mime types delivered are not really consistent + with the returned data + - it will return inode/directory on list entries + which contain inferiors + - it will return message/digest on selectable mailboxes + with file type S_IFDIR + - type message/rfc822-imap on selected messages + and type S_IFREG + +In Konqueror set the mimetype message/rfc822 to use +the inline viewer. + +Try it: imap://user@host/ + imap://user;AUTH=*@host/ + imap://user;AUTH=LOGIN@host/ + imap://user;AUTH=CRAM-MD5@host/ + +comments to s.carstens@gmx.de diff --git a/tdeioslaves/imap4/configure.in.in b/tdeioslaves/imap4/configure.in.in new file mode 100644 index 00000000..680e26e0 --- /dev/null +++ b/tdeioslaves/imap4/configure.in.in @@ -0,0 +1 @@ +KDE_CHECK_SSL diff --git a/tdeioslaves/imap4/imap4.cc b/tdeioslaves/imap4/imap4.cc new file mode 100644 index 00000000..0069b22d --- /dev/null +++ b/tdeioslaves/imap4/imap4.cc @@ -0,0 +1,2734 @@ +/********************************************************************** + * + * imap4.cc - IMAP4rev1 KIOSlave + * Copyright (C) 2001-2002 Michael Haeckel + * Copyright (C) 1999 John Corey + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Send comments and bug fixes to jcorey@fruity.ath.cx + * + *********************************************************************/ + +/** + * @class IMAP4Protocol + * @note References: + * - RFC 2060 - Internet Message Access Protocol - Version 4rev1 - December 1996 + * - RFC 2192 - IMAP URL Scheme - September 1997 + * - RFC 1731 - IMAP Authentication Mechanisms - December 1994 + * (Discusses KERBEROSv4, GSSAPI, and S/Key) + * - RFC 2195 - IMAP/POP AUTHorize Extension for Simple Challenge/Response + * - September 1997 (CRAM-MD5 authentication method) + * - RFC 2104 - HMAC: Keyed-Hashing for Message Authentication - February 1997 + * - RFC 2086 - IMAP4 ACL extension - January 1997 + * - http://www.ietf.org/internet-drafts/draft-daboo-imap-annotatemore-05.txt + * IMAP ANNOTATEMORE draft - April 2004. + * + * + * Supported URLs: + * \verbatim +imap://server/ +imap://user:pass@server/ +imap://user;AUTH=method:pass@server/ +imap://server/folder/ + * \endverbatim + * These URLs cause the following actions (in order): + * - Prompt for user/pass, list all folders in home directory + * - Uses LOGIN to log in + * - Uses AUTHENTICATE to log in + * - List messages in folder + * + * @note API notes: + * Not receiving the required write access for a folder means + * ERR_CANNOT_OPEN_FOR_WRITING. + * ERR_DOES_NOT_EXIST is reserved for folders. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "imap4.h" + +#include "rfcdecoder.h" + +#include + +#include +#include +#include +#include +#include + +#ifdef HAVE_LIBSASL2 +extern "C" { +#include +} +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "tdepimmacros.h" + +#define IMAP_PROTOCOL "imap" +#define IMAP_SSL_PROTOCOL "imaps" + +using namespace TDEIO; + +extern "C" +{ + void sigalrm_handler (int); + KDE_EXPORT int kdemain (int argc, char **argv); +} + +int +kdemain (int argc, char **argv) +{ + kdDebug(7116) << "IMAP4::kdemain" << endl; + + TDEInstance instance ("kio_imap4"); + if (argc != 4) + { + fprintf(stderr, "Usage: kio_imap4 protocol domain-socket1 domain-socket2\n"); + ::exit (-1); + } + +#ifdef HAVE_LIBSASL2 + if ( sasl_client_init( NULL ) != SASL_OK ) { + fprintf(stderr, "SASL library initialization failed!\n"); + ::exit (-1); + } +#endif + + //set debug handler + + IMAP4Protocol *slave; + if (strcasecmp (argv[1], IMAP_SSL_PROTOCOL) == 0) + slave = new IMAP4Protocol (argv[2], argv[3], true); + else if (strcasecmp (argv[1], IMAP_PROTOCOL) == 0) + slave = new IMAP4Protocol (argv[2], argv[3], false); + else + abort (); + slave->dispatchLoop (); + delete slave; + +#ifdef HAVE_LIBSASL2 + sasl_done(); +#endif + + return 0; +} + +void +sigchld_handler (int signo) +{ + int pid, status; + + while (true && signo == SIGCHLD) + { + pid = waitpid (-1, &status, WNOHANG); + if (pid <= 0) + { + // Reinstall signal handler, since Linux resets to default after + // the signal occurred ( BSD handles it different, but it should do + // no harm ). + signal (SIGCHLD, sigchld_handler); + return; + } + } +} + +IMAP4Protocol::IMAP4Protocol (const TQCString & pool, const TQCString & app, bool isSSL):TCPSlaveBase ((isSSL ? 993 : 143), + (isSSL ? IMAP_SSL_PROTOCOL : IMAP_PROTOCOL), pool, + app, isSSL), imapParser (), mimeIO (), outputBuffer(outputCache) +{ + outputBufferIndex = 0; + mySSL = isSSL; + readBuffer[0] = 0x00; + relayEnabled = false; + readBufferLen = 0; + cacheOutput = false; + decodeContent = false; + mTimeOfLastNoop = TQDateTime(); +} + +IMAP4Protocol::~IMAP4Protocol () +{ + closeDescriptor(); + kdDebug(7116) << "IMAP4: Finishing" << endl; +} + +void +IMAP4Protocol::get (const KURL & _url) +{ + if (!makeLogin()) return; + kdDebug(7116) << "IMAP4::get - " << _url.prettyURL() << endl; + TQString aBox, aSequence, aType, aSection, aValidity, aDelimiter, aInfo; + enum IMAP_TYPE aEnum = + parseURL (_url, aBox, aSection, aType, aSequence, aValidity, aDelimiter, aInfo); + if (aEnum != ITYPE_ATTACH) + mimeType (getMimeType(aEnum)); + if (aInfo == "DECODE") + decodeContent = true; + + if (aSequence == "0:0" && getState() == ISTATE_SELECT) + { + imapCommand *cmd = doCommand (imapCommand::clientNoop()); + completeQueue.removeRef(cmd); + } + + if (aSequence.isEmpty ()) + { + aSequence = "1:*"; + } + + mProcessedSize = 0; + imapCommand *cmd = NULL; + if (!assureBox (aBox, true)) return; + +#ifdef USE_VALIDITY + if (selectInfo.uidValidityAvailable () && !aValidity.isEmpty () + && selectInfo.uidValidity () != aValidity.toULong ()) + { + // this url is stale + error (ERR_COULD_NOT_READ, _url.prettyURL()); + return; + } + else +#endif + { + // The "section" specified by the application can be: + // * empty (which means body, size and flags) + // * a known keyword, like STRUCTURE, ENVELOPE, HEADER, BODY.PEEK[...] + // (in which case the slave has some logic to add the necessary items) + // * Otherwise, it specifies the exact data items to request. In this case, all + // the logic is in the app. + + TQString aUpper = aSection.upper(); + if (aUpper.find ("STRUCTURE") != -1) + { + aSection = "BODYSTRUCTURE"; + } + else if (aUpper.find ("ENVELOPE") != -1) + { + aSection = "UID RFC822.SIZE FLAGS ENVELOPE"; + if (hasCapability("IMAP4rev1")) { + aSection += " BODY.PEEK[HEADER.FIELDS (REFERENCES)]"; + } else { + // imap4 does not know HEADER.FIELDS + aSection += " RFC822.HEADER.LINES (REFERENCES)"; + } + } + else if (aUpper == "HEADER") + { + aSection = "UID RFC822.HEADER RFC822.SIZE FLAGS"; + } + else if (aUpper.find ("BODY.PEEK[") != -1) + { + if (aUpper.find ("BODY.PEEK[]") != -1) + { + if (!hasCapability("IMAP4rev1")) // imap4 does not know BODY.PEEK[] + aSection.replace("BODY.PEEK[]", "RFC822.PEEK"); + } + aSection.prepend("UID RFC822.SIZE FLAGS "); + } + else if (aSection.isEmpty()) + { + aSection = "UID BODY[] RFC822.SIZE FLAGS"; + } + if (aEnum == ITYPE_BOX || aEnum == ITYPE_DIR_AND_BOX) + { + // write the digest header + cacheOutput = true; + outputLine + ("Content-Type: multipart/digest; boundary=\"IMAPDIGEST\"\r\n", 55); + if (selectInfo.recentAvailable ()) + outputLineStr ("X-Recent: " + + TQString::number(selectInfo.recent ()) + "\r\n"); + if (selectInfo.countAvailable ()) + outputLineStr ("X-Count: " + TQString::number(selectInfo.count ()) + + "\r\n"); + if (selectInfo.unseenAvailable ()) + outputLineStr ("X-Unseen: " + + TQString::number(selectInfo.unseen ()) + "\r\n"); + if (selectInfo.uidValidityAvailable ()) + outputLineStr ("X-uidValidity: " + + TQString::number(selectInfo.uidValidity ()) + + "\r\n"); + if (selectInfo.uidNextAvailable ()) + outputLineStr ("X-UidNext: " + + TQString::number(selectInfo.uidNext ()) + "\r\n"); + if (selectInfo.flagsAvailable ()) + outputLineStr ("X-Flags: " + TQString::number(selectInfo.flags ()) + + "\r\n"); + if (selectInfo.permanentFlagsAvailable ()) + outputLineStr ("X-PermanentFlags: " + + TQString::number(selectInfo.permanentFlags ()) + "\r\n"); + if (selectInfo.readWriteAvailable ()) { + if (selectInfo.readWrite()) { + outputLine ("X-Access: Read/Write\r\n", 22); + } else { + outputLine ("X-Access: Read only\r\n", 21); + } + } + outputLine ("\r\n", 2); + flushOutput(TQString()); + cacheOutput = false; + } + + if (aEnum == ITYPE_MSG || (aEnum == ITYPE_ATTACH && !decodeContent)) + relayEnabled = true; // normal mode, relay data + + if (aSequence != "0:0") + { + TQString contentEncoding; + if (aEnum == ITYPE_ATTACH && decodeContent) + { + // get the MIME header and fill getLastHandled() + TQString mySection = aSection; + mySection.replace("]", ".MIME]"); + cmd = sendCommand (imapCommand::clientFetch (aSequence, mySection)); + do + { + while (!parseLoop ()) ; + } + while (!cmd->isComplete ()); + completeQueue.removeRef (cmd); + // get the content encoding now because getLastHandled will be cleared + if (getLastHandled() && getLastHandled()->getHeader()) + contentEncoding = getLastHandled()->getHeader()->getEncoding(); + + // from here on collect the data + // it is send to the client in flushOutput in one go + // needed to decode the content + cacheOutput = true; + } + + cmd = sendCommand (imapCommand::clientFetch (aSequence, aSection)); + int res; + aUpper = aSection.upper(); + do + { + while (!(res = parseLoop())) ; + if (res == -1) break; + + mailHeader *lastone = 0; + imapCache *cache = getLastHandled (); + if (cache) + lastone = cache->getHeader (); + + if (cmd && !cmd->isComplete ()) + { + if ((aUpper.find ("BODYSTRUCTURE") != -1) + || (aUpper.find ("FLAGS") != -1) + || (aUpper.find ("UID") != -1) + || (aUpper.find ("ENVELOPE") != -1) + || (aUpper.find ("BODY.PEEK[0]") != -1 + && (aEnum == ITYPE_BOX || aEnum == ITYPE_DIR_AND_BOX))) + { + if (aEnum == ITYPE_BOX || aEnum == ITYPE_DIR_AND_BOX) + { + // write the mime header (default is here message/rfc822) + outputLine ("--IMAPDIGEST\r\n", 14); + cacheOutput = true; + if (cache && cache->getUid () != 0) + outputLineStr ("X-UID: " + + TQString::number(cache->getUid ()) + "\r\n"); + if (cache && cache->getSize () != 0) + outputLineStr ("X-Length: " + + TQString::number(cache->getSize ()) + "\r\n"); + if (cache && !cache->getDate ().isEmpty()) + outputLineStr ("X-Date: " + cache->getDate () + "\r\n"); + if (cache && cache->getFlags () != 0) + outputLineStr ("X-Flags: " + + TQString::number(cache->getFlags ()) + "\r\n"); + } else cacheOutput = true; + if ( lastone && !decodeContent ) + lastone->outputPart (*this); + cacheOutput = false; + flushOutput(contentEncoding); + } + } // if not complete + } + while (cmd && !cmd->isComplete ()); + if (aEnum == ITYPE_BOX || aEnum == ITYPE_DIR_AND_BOX) + { + // write the end boundary + outputLine ("--IMAPDIGEST--\r\n", 16); + } + + completeQueue.removeRef (cmd); + } + } + + // just to keep everybody happy when no data arrived + data (TQByteArray ()); + + finished (); + relayEnabled = false; + cacheOutput = false; + kdDebug(7116) << "IMAP4::get - finished" << endl; +} + +void +IMAP4Protocol::listDir (const KURL & _url) +{ + kdDebug(7116) << " IMAP4::listDir - " << _url.prettyURL() << endl; + + if (_url.path().isEmpty()) + { + KURL url = _url; + url.setPath("/"); + redirection( url ); + finished(); + return; + } + + TQString myBox, mySequence, myLType, mySection, myValidity, myDelimiter, myInfo; + // parseURL with caching + enum IMAP_TYPE myType = + parseURL (_url, myBox, mySection, myLType, mySequence, myValidity, + myDelimiter, myInfo, true); + + if (!makeLogin()) return; + + if (myType == ITYPE_DIR || myType == ITYPE_DIR_AND_BOX) + { + TQString listStr = myBox; + imapCommand *cmd; + + if (!listStr.isEmpty () && !listStr.endsWith(myDelimiter) && + mySection != "FOLDERONLY") + listStr += myDelimiter; + + if (mySection.isEmpty()) + { + listStr += "%"; + } else if (mySection == "COMPLETE") { + listStr += "*"; + } + kdDebug(7116) << "IMAP4Protocol::listDir - listStr=" << listStr << endl; + cmd = + doCommand (imapCommand::clientList ("", listStr, + (myLType == "LSUB" || myLType == "LSUBNOCHECK"))); + if (cmd->result () == "OK") + { + TQString mailboxName; + UDSEntry entry; + UDSAtom atom; + KURL aURL = _url; + if (aURL.path().find(';') != -1) + aURL.setPath(aURL.path().left(aURL.path().find(';'))); + + kdDebug(7116) << "IMAP4Protocol::listDir - got " << listResponses.count () << endl; + + if (myLType == "LSUB") + { + // fire the same command as LIST to check if the box really exists + TQValueList listResponsesSave = listResponses; + doCommand (imapCommand::clientList ("", listStr, false)); + for (TQValueListIterator < imapList > it = listResponsesSave.begin (); + it != listResponsesSave.end (); ++it) + { + bool boxOk = false; + for (TQValueListIterator < imapList > it2 = listResponses.begin (); + it2 != listResponses.end (); ++it2) + { + if ((*it2).name() == (*it).name()) + { + boxOk = true; + // copy the flags from the LIST-command + (*it) = (*it2); + break; + } + } + if (boxOk) + doListEntry (aURL, myBox, (*it), (mySection != "FOLDERONLY")); + else // this folder is dead + kdDebug(7116) << "IMAP4Protocol::listDir - suppress " << (*it).name() << endl; + } + listResponses = listResponsesSave; + } + else // LIST or LSUBNOCHECK + { + for (TQValueListIterator < imapList > it = listResponses.begin (); + it != listResponses.end (); ++it) + { + doListEntry (aURL, myBox, (*it), (mySection != "FOLDERONLY")); + } + } + entry.clear (); + listEntry (entry, true); + } + else + { + error (ERR_CANNOT_ENTER_DIRECTORY, _url.prettyURL()); + completeQueue.removeRef (cmd); + return; + } + completeQueue.removeRef (cmd); + } + if ((myType == ITYPE_BOX || myType == ITYPE_DIR_AND_BOX) + && myLType != "LIST" && myLType != "LSUB" && myLType != "LSUBNOCHECK") + { + KURL aURL = _url; + aURL.setQuery (TQString()); + const TQString encodedUrl = aURL.url(0, 106); // utf-8 + + if (!_url.query ().isEmpty ()) + { + TQString query = KURL::decode_string (_url.query ()); + query = query.right (query.length () - 1); + if (!query.isEmpty()) + { + imapCommand *cmd = NULL; + + if (!assureBox (myBox, true)) return; + + if (!selectInfo.countAvailable() || selectInfo.count()) + { + cmd = doCommand (imapCommand::clientSearch (query)); + if (cmd->result() != "OK") + { + error(ERR_UNSUPPORTED_ACTION, _url.prettyURL()); + completeQueue.removeRef (cmd); + return; + } + completeQueue.removeRef (cmd); + + TQStringList list = getResults (); + int stretch = 0; + + if (selectInfo.uidNextAvailable ()) + stretch = TQString::number(selectInfo.uidNext ()).length (); + UDSEntry entry; + imapCache fake; + + for (TQStringList::ConstIterator it = list.begin(); it != list.end(); + ++it) + { + fake.setUid((*it).toULong()); + doListEntry (encodedUrl, stretch, &fake); + } + entry.clear (); + listEntry (entry, true); + } + } + } + else + { + if (!assureBox (myBox, true)) return; + + kdDebug(7116) << "IMAP4: select returned:" << endl; + if (selectInfo.recentAvailable ()) + kdDebug(7116) << "Recent: " << selectInfo.recent () << "d" << endl; + if (selectInfo.countAvailable ()) + kdDebug(7116) << "Count: " << selectInfo.count () << "d" << endl; + if (selectInfo.unseenAvailable ()) + kdDebug(7116) << "Unseen: " << selectInfo.unseen () << "d" << endl; + if (selectInfo.uidValidityAvailable ()) + kdDebug(7116) << "uidValidity: " << selectInfo.uidValidity () << "d" << endl; + if (selectInfo.flagsAvailable ()) + kdDebug(7116) << "Flags: " << selectInfo.flags () << "d" << endl; + if (selectInfo.permanentFlagsAvailable ()) + kdDebug(7116) << "PermanentFlags: " << selectInfo.permanentFlags () << "d" << endl; + if (selectInfo.readWriteAvailable ()) + kdDebug(7116) << "Access: " << (selectInfo.readWrite ()? "Read/Write" : "Read only") << endl; + +#ifdef USE_VALIDITY + if (selectInfo.uidValidityAvailable () + && selectInfo.uidValidity () != myValidity.toULong ()) + { + //redirect + KURL newUrl = _url; + + newUrl.setPath ("/" + myBox + ";UIDVALIDITY=" + + TQString::number(selectInfo.uidValidity ())); + kdDebug(7116) << "IMAP4::listDir - redirecting to " << newUrl.prettyURL() << endl; + redirection (newUrl); + + + } + else +#endif + if (selectInfo.count () > 0) + { + int stretch = 0; + + if (selectInfo.uidNextAvailable ()) + stretch = TQString::number(selectInfo.uidNext ()).length (); + // kdDebug(7116) << selectInfo.uidNext() << "d used to stretch " << stretch << endl; + UDSEntry entry; + + if (mySequence.isEmpty()) mySequence = "1:*"; + + bool withSubject = mySection.isEmpty(); + if (mySection.isEmpty()) mySection = "UID RFC822.SIZE ENVELOPE"; + + bool withFlags = mySection.upper().find("FLAGS") != -1; + imapCommand *fetch = + sendCommand (imapCommand:: + clientFetch (mySequence, mySection)); + imapCache *cache; + do + { + while (!parseLoop ()) ; + + cache = getLastHandled (); + + if (cache && !fetch->isComplete()) + doListEntry (encodedUrl, stretch, cache, withFlags, withSubject); + } + while (!fetch->isComplete ()); + entry.clear (); + listEntry (entry, true); + } + } + } + if ( !selectInfo.alert().isNull() ) { + if ( !myBox.isEmpty() ) { + warning( i18n( "Message from %1 while processing '%2': %3" ).arg( myHost, myBox, selectInfo.alert() ) ); + } else { + warning( i18n( "Message from %1: %2" ).arg( myHost, TQString(selectInfo.alert()) ) ); + } + selectInfo.setAlert( 0 ); + } + + kdDebug(7116) << "IMAP4Protocol::listDir - Finishing listDir" << endl; + finished (); +} + +void +IMAP4Protocol::setHost (const TQString & _host, int _port, + const TQString & _user, const TQString & _pass) +{ + if (myHost != _host || myPort != _port || myUser != _user || myPass != _pass) + { // what's the point of doing 4 string compares to avoid 4 string copies? + // DF: I guess to avoid calling closeConnection() unnecessarily. + if (!myHost.isEmpty ()) + closeConnection (); + myHost = _host; + myPort = _port; + myUser = _user; + myPass = _pass; + } +} + +void +IMAP4Protocol::parseRelay (const TQByteArray & buffer) +{ + if (relayEnabled) { + // relay data immediately + data( buffer ); + mProcessedSize += buffer.size(); + processedSize( mProcessedSize ); + } else if (cacheOutput) + { + // collect data + if ( !outputBuffer.isOpen() ) { + outputBuffer.open(IO_WriteOnly); + } + outputBuffer.at(outputBufferIndex); + outputBuffer.writeBlock(buffer, buffer.size()); + outputBufferIndex += buffer.size(); + } +} + +void +IMAP4Protocol::parseRelay (ulong len) +{ + if (relayEnabled) + totalSize (len); +} + + +bool IMAP4Protocol::parseRead(TQByteArray & buffer, ulong len, ulong relay) +{ + char buf[8192]; + while (buffer.size() < len) + { + ssize_t readLen = myRead(buf, TQMIN(len - buffer.size(), sizeof(buf) - 1)); + if (readLen == 0) + { + kdDebug(7116) << "parseRead: readLen == 0 - connection broken" << endl; + error (ERR_CONNECTION_BROKEN, myHost); + setState(ISTATE_CONNECT); + closeConnection(); + return FALSE; + } + if (relay > buffer.size()) + { + TQByteArray relayData; + ssize_t relbuf = relay - buffer.size(); + int currentRelay = TQMIN(relbuf, readLen); + relayData.setRawData(buf, currentRelay); + parseRelay(relayData); + relayData.resetRawData(buf, currentRelay); + } + { + TQBuffer stream (buffer); + stream.open (IO_WriteOnly); + stream.at (buffer.size ()); + stream.writeBlock (buf, readLen); + stream.close (); + } + } + return (buffer.size() == len); +} + + +bool IMAP4Protocol::parseReadLine (TQByteArray & buffer, ulong relay) +{ + if (myHost.isEmpty()) return FALSE; + + while (true) { + ssize_t copyLen = 0; + if (readBufferLen > 0) + { + while (copyLen < readBufferLen && readBuffer[copyLen] != '\n') copyLen++; + if (copyLen < readBufferLen) copyLen++; + if (relay > 0) + { + TQByteArray relayData; + + if (copyLen < (ssize_t) relay) + relay = copyLen; + relayData.setRawData (readBuffer, relay); + parseRelay (relayData); + relayData.resetRawData (readBuffer, relay); +// kdDebug(7116) << "relayed : " << relay << "d" << endl; + } + // append to buffer + { + TQBuffer stream (buffer); + + stream.open (IO_WriteOnly); + stream.at (buffer.size ()); + stream.writeBlock (readBuffer, copyLen); + stream.close (); +// kdDebug(7116) << "appended " << copyLen << "d got now " << buffer.size() << endl; + } + + readBufferLen -= copyLen; + if (readBufferLen) + memmove(readBuffer, &readBuffer[copyLen], readBufferLen); + if (buffer[buffer.size() - 1] == '\n') return TRUE; + } + if (!isConnectionValid()) + { + kdDebug(7116) << "parseReadLine - connection broken" << endl; + error (ERR_CONNECTION_BROKEN, myHost); + setState(ISTATE_CONNECT); + closeConnection(); + return FALSE; + } + if (!waitForResponse( responseTimeout() )) + { + error(ERR_SERVER_TIMEOUT, myHost); + setState(ISTATE_CONNECT); + closeConnection(); + return FALSE; + } + readBufferLen = read(readBuffer, IMAP_BUFFER - 1); + if (readBufferLen == 0) + { + kdDebug(7116) << "parseReadLine: readBufferLen == 0 - connection broken" << endl; + error (ERR_CONNECTION_BROKEN, myHost); + setState(ISTATE_CONNECT); + closeConnection(); + return FALSE; + } + } +} + +void +IMAP4Protocol::setSubURL (const KURL & _url) +{ + kdDebug(7116) << "IMAP4::setSubURL - " << _url.prettyURL() << endl; + TDEIO::TCPSlaveBase::setSubURL (_url); +} + +void +IMAP4Protocol::put (const KURL & _url, int, bool, bool) +{ + kdDebug(7116) << "IMAP4::put - " << _url.prettyURL() << endl; +// TDEIO::TCPSlaveBase::put(_url,permissions,overwrite,resume); + TQString aBox, aSequence, aLType, aSection, aValidity, aDelimiter, aInfo; + enum IMAP_TYPE aType = + parseURL (_url, aBox, aSection, aLType, aSequence, aValidity, aDelimiter, aInfo); + + // see if it is a box + if (aType != ITYPE_BOX && aType != ITYPE_DIR_AND_BOX) + { + if (aBox[aBox.length () - 1] == '/') + aBox = aBox.right (aBox.length () - 1); + imapCommand *cmd = doCommand (imapCommand::clientCreate (aBox)); + + if (cmd->result () != "OK") { + error (ERR_COULD_NOT_WRITE, _url.prettyURL()); + completeQueue.removeRef (cmd); + return; + } + completeQueue.removeRef (cmd); + } + else + { + TQPtrList < TQByteArray > bufferList; + int length = 0; + + int result; + // Loop until we got 'dataEnd' + do + { + TQByteArray *buffer = new TQByteArray (); + dataReq (); // Request for data + result = readData (*buffer); + if (result > 0) + { + bufferList.append (buffer); + length += result; + } else { + delete buffer; + } + } + while (result > 0); + + if (result != 0) + { + error (ERR_ABORTED, _url.prettyURL()); + return; + } + + imapCommand *cmd = + sendCommand (imapCommand::clientAppend (aBox, aSection, length)); + while (!parseLoop ()) ; + + // see if server is waiting + if (!cmd->isComplete () && !getContinuation ().isEmpty ()) + { + bool sendOk = true; + ulong wrote = 0; + + TQByteArray *buffer; + // send data to server + while (!bufferList.isEmpty () && sendOk) + { + buffer = bufferList.take (0); + + sendOk = + (write (buffer->data (), buffer->size ()) == + (ssize_t) buffer->size ()); + wrote += buffer->size (); + processedSize(wrote); + delete buffer; + if (!sendOk) + { + error (ERR_CONNECTION_BROKEN, myHost); + completeQueue.removeRef (cmd); + setState(ISTATE_CONNECT); + closeConnection(); + return; + } + } + parseWriteLine (""); + // Wait until cmd is complete, or connection breaks. + while (!cmd->isComplete () && getState() != ISTATE_NO) + parseLoop (); + if ( getState() == ISTATE_NO ) { + // TODO KDE4: pass cmd->resultInfo() as third argument. + // ERR_CONNECTION_BROKEN expects a host, no way to pass details about the problem. + error( ERR_CONNECTION_BROKEN, myHost ); + completeQueue.removeRef (cmd); + closeConnection(); + return; + } + else if (cmd->result () != "OK") { + error( ERR_SLAVE_DEFINED, cmd->resultInfo() ); + completeQueue.removeRef (cmd); + return; + } + else + { + if (hasCapability("UIDPLUS")) + { + TQString uid = cmd->resultInfo(); + if (uid.find("APPENDUID") != -1) + { + uid = uid.section(" ", 2, 2); + uid.truncate(uid.length()-1); + infoMessage("UID "+uid); + } + } + // MUST reselect to get the new message + else if (aBox == getCurrentBox ()) + { + cmd = + doCommand (imapCommand:: + clientSelect (aBox, !selectInfo.readWrite ())); + completeQueue.removeRef (cmd); + } + } + } + else + { + //error (ERR_COULD_NOT_WRITE, myHost); + // Better ship the error message, e.g. "Over Quota" + error (ERR_SLAVE_DEFINED, cmd->resultInfo()); + completeQueue.removeRef (cmd); + return; + } + + completeQueue.removeRef (cmd); + } + + finished (); +} + +void +IMAP4Protocol::mkdir (const KURL & _url, int) +{ + kdDebug(7116) << "IMAP4::mkdir - " << _url.prettyURL() << endl; + TQString aBox, aSequence, aLType, aSection, aValidity, aDelimiter, aInfo; + parseURL(_url, aBox, aSection, aLType, aSequence, aValidity, aDelimiter, aInfo); + kdDebug(7116) << "IMAP4::mkdir - create " << aBox << endl; + imapCommand *cmd = doCommand (imapCommand::clientCreate(aBox)); + + if (cmd->result () != "OK") + { + kdDebug(7116) << "IMAP4::mkdir - " << cmd->resultInfo() << endl; + error (ERR_COULD_NOT_MKDIR, _url.prettyURL()); + completeQueue.removeRef (cmd); + return; + } + completeQueue.removeRef (cmd); + + // start a new listing to find the type of the folder + enum IMAP_TYPE type = + parseURL(_url, aBox, aSection, aLType, aSequence, aValidity, aDelimiter, aInfo); + if (type == ITYPE_BOX) + { + bool ask = ( aInfo.find( "ASKUSER" ) != -1 ); + if ( ask && + messageBox(QuestionYesNo, + i18n("The following folder will be created on the server: %1 " + "What do you want to store in this folder?").arg( aBox ), + i18n("Create Folder"), + i18n("&Messages"), i18n("&Subfolders")) == KMessageBox::No ) + { + cmd = doCommand(imapCommand::clientDelete(aBox)); + completeQueue.removeRef (cmd); + cmd = doCommand(imapCommand::clientCreate(aBox + aDelimiter)); + if (cmd->result () != "OK") + { + error (ERR_COULD_NOT_MKDIR, _url.prettyURL()); + completeQueue.removeRef (cmd); + return; + } + completeQueue.removeRef (cmd); + } + } + + cmd = doCommand(imapCommand::clientSubscribe(aBox)); + completeQueue.removeRef(cmd); + + finished (); +} + +void +IMAP4Protocol::copy (const KURL & src, const KURL & dest, int, bool overwrite) +{ + kdDebug(7116) << "IMAP4::copy - [" << (overwrite ? "Overwrite" : "NoOverwrite") << "] " << src.prettyURL() << " -> " << dest.prettyURL() << endl; + TQString sBox, sSequence, sLType, sSection, sValidity, sDelimiter, sInfo; + TQString dBox, dSequence, dLType, dSection, dValidity, dDelimiter, dInfo; + enum IMAP_TYPE sType = + parseURL (src, sBox, sSection, sLType, sSequence, sValidity, sDelimiter, sInfo); + enum IMAP_TYPE dType = + parseURL (dest, dBox, dSection, dLType, dSequence, dValidity, dDelimiter, dInfo); + + // see if we have to create anything + if (dType != ITYPE_BOX && dType != ITYPE_DIR_AND_BOX) + { + // this might be konqueror + int sub = dBox.find (sBox); + + // might be moving to upper folder + if (sub > 0) + { + KURL testDir = dest; + + TQString subDir = dBox.right (dBox.length () - dBox.findRev ('/')); + TQString topDir = dBox.left (sub); + testDir.setPath ("/" + topDir); + dType = + parseURL (testDir, topDir, dSection, dLType, dSequence, dValidity, + dDelimiter, dInfo); + + kdDebug(7116) << "IMAP4::copy - checking this destination " << topDir << endl; + // see if this is what the user wants + if (dType == ITYPE_BOX || dType == ITYPE_DIR_AND_BOX) + { + kdDebug(7116) << "IMAP4::copy - assuming this destination " << topDir << endl; + dBox = topDir; + } + else + { + + // maybe if we create a new mailbox + topDir = "/" + topDir + subDir; + testDir.setPath (topDir); + kdDebug(7116) << "IMAP4::copy - checking this destination " << topDir << endl; + dType = + parseURL (testDir, topDir, dSection, dLType, dSequence, dValidity, + dDelimiter, dInfo); + if (dType != ITYPE_BOX && dType != ITYPE_DIR_AND_BOX) + { + // ok then we'll create a mailbox + imapCommand *cmd = doCommand (imapCommand::clientCreate (topDir)); + + // on success we'll use it, else we'll just try to create the given dir + if (cmd->result () == "OK") + { + kdDebug(7116) << "IMAP4::copy - assuming this destination " << topDir << endl; + dType = ITYPE_BOX; + dBox = topDir; + } + else + { + completeQueue.removeRef (cmd); + cmd = doCommand (imapCommand::clientCreate (dBox)); + if (cmd->result () == "OK") + dType = ITYPE_BOX; + else + error (ERR_COULD_NOT_WRITE, dest.prettyURL()); + } + completeQueue.removeRef (cmd); + } + } + + } + } + if (sType == ITYPE_MSG || sType == ITYPE_BOX || sType == ITYPE_DIR_AND_BOX) + { + //select the source box + if (!assureBox(sBox, true)) return; + kdDebug(7116) << "IMAP4::copy - " << sBox << " -> " << dBox << endl; + + //issue copy command + imapCommand *cmd = + doCommand (imapCommand::clientCopy (dBox, sSequence)); + if (cmd->result () != "OK") + { + kdError(5006) << "IMAP4::copy - " << cmd->resultInfo() << endl; + error (ERR_COULD_NOT_WRITE, dest.prettyURL()); + completeQueue.removeRef (cmd); + return; + } else { + if (hasCapability("UIDPLUS")) + { + TQString uid = cmd->resultInfo(); + if (uid.find("COPYUID") != -1) + { + uid = uid.section(" ", 2, 3); + uid.truncate(uid.length()-1); + infoMessage("UID "+uid); + } + } + } + completeQueue.removeRef (cmd); + } + else + { + error (ERR_ACCESS_DENIED, src.prettyURL()); + return; + } + finished (); +} + +void +IMAP4Protocol::del (const KURL & _url, bool isFile) +{ + kdDebug(7116) << "IMAP4::del - [" << (isFile ? "File" : "NoFile") << "] " << _url.prettyURL() << endl; + TQString aBox, aSequence, aLType, aSection, aValidity, aDelimiter, aInfo; + enum IMAP_TYPE aType = + parseURL (_url, aBox, aSection, aLType, aSequence, aValidity, aDelimiter, aInfo); + + switch (aType) + { + case ITYPE_BOX: + case ITYPE_DIR_AND_BOX: + if (!aSequence.isEmpty ()) + { + if (aSequence == "*") + { + if (!assureBox (aBox, false)) return; + imapCommand *cmd = doCommand (imapCommand::clientExpunge ()); + if (cmd->result () != "OK") { + error (ERR_CANNOT_DELETE, _url.prettyURL()); + completeQueue.removeRef (cmd); + return; + } + completeQueue.removeRef (cmd); + } + else + { + // if open for read/write + if (!assureBox (aBox, false)) return; + imapCommand *cmd = + doCommand (imapCommand:: + clientStore (aSequence, "+FLAGS.SILENT", "\\DELETED")); + if (cmd->result () != "OK") { + error (ERR_CANNOT_DELETE, _url.prettyURL()); + completeQueue.removeRef (cmd); + return; + } + completeQueue.removeRef (cmd); + } + } + else + { + if (getCurrentBox() == aBox) + { + imapCommand *cmd = doCommand(imapCommand::clientClose()); + completeQueue.removeRef(cmd); + setState(ISTATE_LOGIN); + } + // We unsubscribe, otherwise we get ghost folders on UW-IMAP + imapCommand *cmd = doCommand(imapCommand::clientUnsubscribe(aBox)); + completeQueue.removeRef(cmd); + cmd = doCommand(imapCommand::clientDelete (aBox)); + // If this doesn't work, we try to empty the mailbox first + if (cmd->result () != "OK") + { + completeQueue.removeRef(cmd); + if (!assureBox(aBox, false)) return; + bool stillOk = true; + if (stillOk) + { + imapCommand *cmd = doCommand( + imapCommand::clientStore("1:*", "+FLAGS.SILENT", "\\DELETED")); + if (cmd->result () != "OK") stillOk = false; + completeQueue.removeRef(cmd); + } + if (stillOk) + { + imapCommand *cmd = doCommand(imapCommand::clientClose()); + if (cmd->result () != "OK") stillOk = false; + completeQueue.removeRef(cmd); + setState(ISTATE_LOGIN); + } + if (stillOk) + { + imapCommand *cmd = doCommand (imapCommand::clientDelete(aBox)); + if (cmd->result () != "OK") stillOk = false; + completeQueue.removeRef(cmd); + } + if (!stillOk) + { + error (ERR_COULD_NOT_RMDIR, _url.prettyURL()); + return; + } + } else { + completeQueue.removeRef (cmd); + } + } + break; + + case ITYPE_DIR: + { + imapCommand *cmd = doCommand (imapCommand::clientDelete (aBox)); + if (cmd->result () != "OK") { + error (ERR_COULD_NOT_RMDIR, _url.prettyURL()); + completeQueue.removeRef (cmd); + return; + } + completeQueue.removeRef (cmd); + } + break; + + case ITYPE_MSG: + { + // if open for read/write + if (!assureBox (aBox, false)) return; + imapCommand *cmd = + doCommand (imapCommand:: + clientStore (aSequence, "+FLAGS.SILENT", "\\DELETED")); + if (cmd->result () != "OK") { + error (ERR_CANNOT_DELETE, _url.prettyURL()); + completeQueue.removeRef (cmd); + return; + } + completeQueue.removeRef (cmd); + } + break; + + case ITYPE_UNKNOWN: + case ITYPE_ATTACH: + error (ERR_CANNOT_DELETE, _url.prettyURL()); + break; + } + finished (); +} + +/* + * Copy a mail: data = 'C' + srcURL (KURL) + destURL (KURL) + * Capabilities: data = 'c'. Result shipped in infoMessage() signal + * No-op: data = 'N' + * Namespace: data = 'n'. Result shipped in infoMessage() signal + * The format is: section=namespace=delimiter + * Note that the namespace can be empty + * Unsubscribe: data = 'U' + URL (KURL) + * Subscribe: data = 'u' + URL (KURL) + * Change the status: data = 'S' + URL (KURL) + Flags (TQCString) + * ACL commands: data = 'A' + command + URL (KURL) + command-dependent args + * AnnotateMore commands: data = 'M' + 'G'et/'S'et + URL + entry + command-dependent args + * Search: data = 'E' + URL (KURL) + * Quota commands: data = 'Q' + 'R'oot/'G'et/'S'et + URL + entry + command-dependent args + * Custom command: data = 'X' + 'N'ormal/'E'xtended + command + command-dependent args + */ +void +IMAP4Protocol::special (const TQByteArray & aData) +{ + kdDebug(7116) << "IMAP4Protocol::special" << endl; + if (!makeLogin()) return; + + TQDataStream stream(aData, IO_ReadOnly); + + int tmp; + stream >> tmp; + + switch (tmp) { + case 'C': + { + // copy + KURL src; + KURL dest; + stream >> src >> dest; + copy(src, dest, 0, FALSE); + break; + } + case 'c': + { + // capabilities + infoMessage(imapCapabilities.join(" ")); + finished(); + break; + } + case 'N': + { + // NOOP + imapCommand *cmd = doCommand(imapCommand::clientNoop()); + if (cmd->result () != "OK") + { + kdDebug(7116) << "NOOP did not succeed - connection broken" << endl; + completeQueue.removeRef (cmd); + error (ERR_CONNECTION_BROKEN, myHost); + return; + } + completeQueue.removeRef (cmd); + finished(); + break; + } + case 'n': + { + // namespace in the form "section=namespace=delimiter" + // entries are separated by , + infoMessage( imapNamespaces.join(",") ); + finished(); + break; + } + case 'U': + { + // unsubscribe + KURL _url; + stream >> _url; + TQString aBox, aSequence, aLType, aSection, aValidity, aDelimiter, aInfo; + parseURL (_url, aBox, aSection, aLType, aSequence, aValidity, aDelimiter, aInfo); + imapCommand *cmd = doCommand(imapCommand::clientUnsubscribe(aBox)); + if (cmd->result () != "OK") + { + completeQueue.removeRef (cmd); + error(ERR_SLAVE_DEFINED, i18n("Unsubscribe of folder %1 " + "failed. The server returned: %2") + .arg(_url.prettyURL()) + .arg(cmd->resultInfo())); + return; + } + completeQueue.removeRef (cmd); + finished(); + break; + } + case 'u': + { + // subscribe + KURL _url; + stream >> _url; + TQString aBox, aSequence, aLType, aSection, aValidity, aDelimiter, aInfo; + parseURL (_url, aBox, aSection, aLType, aSequence, aValidity, aDelimiter, aInfo); + imapCommand *cmd = doCommand(imapCommand::clientSubscribe(aBox)); + if (cmd->result () != "OK") + { + completeQueue.removeRef (cmd); + error(ERR_SLAVE_DEFINED, i18n("Subscribe of folder %1 " + "failed. The server returned: %2") + .arg(_url.prettyURL()) + .arg(cmd->resultInfo())); + return; + } + completeQueue.removeRef (cmd); + finished(); + break; + } + case 'A': + { + // acl + int cmd; + stream >> cmd; + if ( hasCapability( "ACL" ) ) { + specialACLCommand( cmd, stream ); + } else { + error( ERR_UNSUPPORTED_ACTION, "ACL" ); + } + break; + } + case 'M': + { + // annotatemore + int cmd; + stream >> cmd; + if ( hasCapability( "ANNOTATEMORE" ) ) { + specialAnnotateMoreCommand( cmd, stream ); + } else { + error( ERR_UNSUPPORTED_ACTION, "ANNOTATEMORE" ); + } + break; + } + case 'Q': + { + // quota + int cmd; + stream >> cmd; + if ( hasCapability( "QUOTA" ) ) { + specialQuotaCommand( cmd, stream ); + } else { + error( ERR_UNSUPPORTED_ACTION, "QUOTA" ); + } + break; + } + case 'S': + { + // status + KURL _url; + TQCString newFlags; + stream >> _url >> newFlags; + + TQString aBox, aSequence, aLType, aSection, aValidity, aDelimiter, aInfo; + parseURL (_url, aBox, aSection, aLType, aSequence, aValidity, aDelimiter, aInfo); + if (!assureBox(aBox, false)) return; + + // make sure we only touch flags we know + TQCString knownFlags = "\\SEEN \\ANSWERED \\FLAGGED \\DRAFT"; + const imapInfo info = getSelected(); + if ( info.permanentFlagsAvailable() && (info.permanentFlags() & imapInfo::User) ) { + knownFlags += " KMAILFORWARDED KMAILTODO KMAILWATCHED KMAILIGNORED $FORWARDED $TODO $WATCHED $IGNORED"; + } + + imapCommand *cmd = doCommand (imapCommand:: + clientStore (aSequence, "-FLAGS.SILENT", knownFlags)); + if (cmd->result () != "OK") + { + completeQueue.removeRef (cmd); + error(ERR_COULD_NOT_WRITE, i18n("Changing the flags of message %1 " + "failed.").arg(_url.prettyURL())); + return; + } + completeQueue.removeRef (cmd); + if (!newFlags.isEmpty()) + { + cmd = doCommand (imapCommand:: + clientStore (aSequence, "+FLAGS.SILENT", newFlags)); + if (cmd->result () != "OK") + { + completeQueue.removeRef (cmd); + error(ERR_COULD_NOT_WRITE, i18n("Changing the flags of message %1 " + "failed.").arg(_url.prettyURL())); + return; + } + completeQueue.removeRef (cmd); + } + finished(); + break; + } + case 's': + { + // seen + KURL _url; + bool seen; + TQCString newFlags; + stream >> _url >> seen; + + TQString aBox, aSequence, aLType, aSection, aValidity, aDelimiter, aInfo; + parseURL (_url, aBox, aSection, aLType, aSequence, aValidity, aDelimiter, aInfo); + if ( !assureBox(aBox, true) ) // read-only because changing SEEN should be possible even then + return; + + imapCommand *cmd; + if ( seen ) + cmd = doCommand( imapCommand::clientStore( aSequence, "+FLAGS.SILENT", "\\SEEN" ) ); + else + cmd = doCommand( imapCommand::clientStore( aSequence, "-FLAGS.SILENT", "\\SEEN" ) ); + + if (cmd->result () != "OK") + { + completeQueue.removeRef (cmd); + error(ERR_COULD_NOT_WRITE, i18n("Changing the flags of message %1 " + "failed.").arg(_url.prettyURL())); + return; + } + completeQueue.removeRef (cmd); + finished(); + break; + } + + case 'E': + { + // search + specialSearchCommand( stream ); + break; + } + case 'X': + { + // custom command + specialCustomCommand( stream ); + break; + } + default: + kdWarning(7116) << "Unknown command in special(): " << tmp << endl; + error( ERR_UNSUPPORTED_ACTION, TQString(TQChar(tmp)) ); + break; + } +} + +void +IMAP4Protocol::specialACLCommand( int command, TQDataStream& stream ) +{ + // All commands start with the URL to the box + KURL _url; + stream >> _url; + TQString aBox, aSequence, aLType, aSection, aValidity, aDelimiter, aInfo; + parseURL (_url, aBox, aSection, aLType, aSequence, aValidity, aDelimiter, aInfo); + + switch( command ) { + case 'S': // SETACL + { + TQString user, acl; + stream >> user >> acl; + kdDebug(7116) << "SETACL " << aBox << " " << user << " " << acl << endl; + imapCommand *cmd = doCommand(imapCommand::clientSetACL(aBox, user, acl)); + if (cmd->result () != "OK") + { + error(ERR_SLAVE_DEFINED, i18n("Setting the Access Control List on folder %1 " + "for user %2 failed. The server returned: %3") + .arg(_url.prettyURL()) + .arg(user) + .arg(cmd->resultInfo())); + return; + } + completeQueue.removeRef (cmd); + finished(); + break; + } + case 'D': // DELETEACL + { + TQString user; + stream >> user; + kdDebug(7116) << "DELETEACL " << aBox << " " << user << endl; + imapCommand *cmd = doCommand(imapCommand::clientDeleteACL(aBox, user)); + if (cmd->result () != "OK") + { + error(ERR_SLAVE_DEFINED, i18n("Deleting the Access Control List on folder %1 " + "for user %2 failed. The server returned: %3") + .arg(_url.prettyURL()) + .arg(user) + .arg(cmd->resultInfo())); + return; + } + completeQueue.removeRef (cmd); + finished(); + break; + } + case 'G': // GETACL + { + kdDebug(7116) << "GETACL " << aBox << endl; + imapCommand *cmd = doCommand(imapCommand::clientGetACL(aBox)); + if (cmd->result () != "OK") + { + error(ERR_SLAVE_DEFINED, i18n("Retrieving the Access Control List on folder %1 " + "failed. The server returned: %2") + .arg(_url.prettyURL()) + .arg(cmd->resultInfo())); + return; + } + // Returning information to the application from a special() command isn't easy. + // I'm reusing the infoMessage trick seen above (for capabilities), but this + // limits me to a string instead of a stringlist. Using DQUOTE as separator, + // because it's forbidden in userids by rfc3501 + kdDebug(7116) << getResults() << endl; + infoMessage(getResults().join( "\"" )); + finished(); + break; + } + case 'L': // LISTRIGHTS + { + // Do we need this one? It basically shows which rights are tied together, but that's all? + error( ERR_UNSUPPORTED_ACTION, TQString(TQChar(command)) ); + break; + } + case 'M': // MYRIGHTS + { + kdDebug(7116) << "MYRIGHTS " << aBox << endl; + imapCommand *cmd = doCommand(imapCommand::clientMyRights(aBox)); + if (cmd->result () != "OK") + { + error(ERR_SLAVE_DEFINED, i18n("Retrieving the Access Control List on folder %1 " + "failed. The server returned: %2") + .arg(_url.prettyURL()) + .arg(cmd->resultInfo())); + return; + } + TQStringList lst = getResults(); + kdDebug(7116) << "myrights results: " << lst << endl; + if ( !lst.isEmpty() ) { + Q_ASSERT( lst.count() == 1 ); + infoMessage( lst.first() ); + } + finished(); + break; + } + default: + kdWarning(7116) << "Unknown special ACL command:" << command << endl; + error( ERR_UNSUPPORTED_ACTION, TQString(TQChar(command)) ); + } +} + +void +IMAP4Protocol::specialSearchCommand( TQDataStream& stream ) +{ + kdDebug(7116) << "IMAP4Protocol::specialSearchCommand" << endl; + KURL _url; + stream >> _url; + TQString aBox, aSequence, aLType, aSection, aValidity, aDelimiter, aInfo; + parseURL (_url, aBox, aSection, aLType, aSequence, aValidity, aDelimiter, aInfo); + if (!assureBox(aBox, false)) return; + + imapCommand *cmd = doCommand (imapCommand::clientSearch( aSection )); + if (cmd->result () != "OK") + { + error(ERR_SLAVE_DEFINED, i18n("Searching of folder %1 " + "failed. The server returned: %2") + .arg(aBox) + .arg(cmd->resultInfo())); + return; + } + completeQueue.removeRef(cmd); + TQStringList lst = getResults(); + kdDebug(7116) << "IMAP4Protocol::specialSearchCommand '" << aSection << + "' returns " << lst << endl; + infoMessage( lst.join( " " ) ); + + finished(); +} + +void +IMAP4Protocol::specialCustomCommand( TQDataStream& stream ) +{ + kdDebug(7116) << "IMAP4Protocol::specialCustomCommand" << endl; + + TQString command, arguments; + int type; + stream >> type; + stream >> command >> arguments; + + /** + * In 'normal' mode we send the command with all information in one go + * and retrieve the result. + */ + if ( type == 'N' ) { + kdDebug(7116) << "IMAP4Protocol::specialCustomCommand: normal mode" << endl; + imapCommand *cmd = doCommand (imapCommand::clientCustom( command, arguments )); + if (cmd->result () != "OK") + { + error(ERR_SLAVE_DEFINED, i18n("Custom command %1:%2 " + "failed. The server returned: %3") + .arg(command) + .arg(arguments) + .arg(cmd->resultInfo())); + return; + } + completeQueue.removeRef(cmd); + TQStringList lst = getResults(); + kdDebug(7116) << "IMAP4Protocol::specialCustomCommand '" << command << + ":" << arguments << + "' returns " << lst << endl; + infoMessage( lst.join( " " ) ); + + finished(); + } else + /** + * In 'extended' mode we send a first header and push the data of the request in + * streaming mode. + */ + if ( type == 'E' ) { + kdDebug(7116) << "IMAP4Protocol::specialCustomCommand: extended mode" << endl; + imapCommand *cmd = sendCommand (imapCommand::clientCustom( command, TQString() )); + while ( !parseLoop () ) ; + + // see if server is waiting + if (!cmd->isComplete () && !getContinuation ().isEmpty ()) + { + const TQByteArray buffer = arguments.utf8(); + + // send data to server + bool sendOk = (write (buffer.data (), buffer.size ()) == (ssize_t)buffer.size ()); + processedSize( buffer.size() ); + + if ( !sendOk ) { + error ( ERR_CONNECTION_BROKEN, myHost ); + completeQueue.removeRef ( cmd ); + setState(ISTATE_CONNECT); + closeConnection(); + return; + } + } + parseWriteLine (""); + + do + { + while (!parseLoop ()) ; + } + while (!cmd->isComplete ()); + + completeQueue.removeRef (cmd); + + TQStringList lst = getResults(); + kdDebug(7116) << "IMAP4Protocol::specialCustomCommand: returns " << lst << endl; + infoMessage( lst.join( " " ) ); + + finished (); + } +} + +void +IMAP4Protocol::specialAnnotateMoreCommand( int command, TQDataStream& stream ) +{ + // All commands start with the URL to the box + KURL _url; + stream >> _url; + TQString aBox, aSequence, aLType, aSection, aValidity, aDelimiter, aInfo; + parseURL (_url, aBox, aSection, aLType, aSequence, aValidity, aDelimiter, aInfo); + + switch( command ) { + case 'S': // SETANNOTATION + { + // Params: + // KURL URL of the mailbox + // TQString entry (should be an actual entry name, no % or *; empty for server entries) + // TQMap attributes (name and value) + TQString entry; + TQMap attributes; + stream >> entry >> attributes; + kdDebug(7116) << "SETANNOTATION " << aBox << " " << entry << " " << attributes.count() << " attributes" << endl; + imapCommand *cmd = doCommand(imapCommand::clientSetAnnotation(aBox, entry, attributes)); + if (cmd->result () != "OK") + { + error(ERR_SLAVE_DEFINED, i18n("Setting the annotation %1 on folder %2 " + " failed. The server returned: %3") + .arg(entry) + .arg(_url.prettyURL()) + .arg(cmd->resultInfo())); + return; + } + completeQueue.removeRef (cmd); + finished(); + break; + } + case 'G': // GETANNOTATION. + { + // Params: + // KURL URL of the mailbox + // TQString entry (should be an actual entry name, no % or *; empty for server entries) + // TQStringList attributes (list of attributes to be retrieved, possibly with % or *) + TQString entry; + TQStringList attributeNames; + stream >> entry >> attributeNames; + kdDebug(7116) << "GETANNOTATION " << aBox << " " << entry << " " << attributeNames << endl; + imapCommand *cmd = doCommand(imapCommand::clientGetAnnotation(aBox, entry, attributeNames)); + if (cmd->result () != "OK") + { + error(ERR_SLAVE_DEFINED, i18n("Retrieving the annotation %1 on folder %2 " + "failed. The server returned: %3") + .arg(entry) + .arg(_url.prettyURL()) + .arg(cmd->resultInfo())); + return; + } + // Returning information to the application from a special() command isn't easy. + // I'm reusing the infoMessage trick seen above (for capabilities and acls), but this + // limits me to a string instead of a stringlist. Let's use \r as separator. + kdDebug(7116) << getResults() << endl; + infoMessage(getResults().join( "\r" )); + finished(); + break; + } + default: + kdWarning(7116) << "Unknown special annotate command:" << command << endl; + error( ERR_UNSUPPORTED_ACTION, TQString(TQChar(command)) ); + } +} + +void +IMAP4Protocol::specialQuotaCommand( int command, TQDataStream& stream ) +{ + // All commands start with the URL to the box + KURL _url; + stream >> _url; + TQString aBox, aSequence, aLType, aSection, aValidity, aDelimiter, aInfo; + parseURL (_url, aBox, aSection, aLType, aSequence, aValidity, aDelimiter, aInfo); + + switch( command ) { + case 'R': // GETQUOTAROOT + { + kdDebug(7116) << "QUOTAROOT " << aBox << endl; + imapCommand *cmd = doCommand(imapCommand::clientGetQuotaroot( aBox ) ); + if (cmd->result () != "OK") + { + error(ERR_SLAVE_DEFINED, i18n("Retrieving the quota root information on folder %1 " + "failed. The server returned: %2") + .arg(_url.prettyURL()) + .arg(cmd->resultInfo())); + return; + } + infoMessage(getResults().join( "\r" )); + finished(); + break; + } + case 'G': // GETQUOTA + { + kdDebug(7116) << "GETQUOTA command" << endl; + kdWarning(7116) << "UNIMPLEMENTED" << endl; + break; + } + case 'S': // SETQUOTA + { + kdDebug(7116) << "SETQUOTA command" << endl; + kdWarning(7116) << "UNIMPLEMENTED" << endl; + break; + } + default: + kdWarning(7116) << "Unknown special quota command:" << command << endl; + error( ERR_UNSUPPORTED_ACTION, TQString(TQChar(command)) ); + } +} + +void +IMAP4Protocol::rename (const KURL & src, const KURL & dest, bool overwrite) +{ + kdDebug(7116) << "IMAP4::rename - [" << (overwrite ? "Overwrite" : "NoOverwrite") << "] " << src.prettyURL() << " -> " << dest.prettyURL() << endl; + TQString sBox, sSequence, sLType, sSection, sValidity, sDelimiter, sInfo; + TQString dBox, dSequence, dLType, dSection, dValidity, dDelimiter, dInfo; + enum IMAP_TYPE sType = + parseURL (src, sBox, sSection, sLType, sSequence, sValidity, sDelimiter, sInfo, false); + enum IMAP_TYPE dType = + parseURL (dest, dBox, dSection, dLType, dSequence, dValidity, dDelimiter, dInfo, false); + + if (dType == ITYPE_UNKNOWN) + { + switch (sType) + { + case ITYPE_BOX: + case ITYPE_DIR: + case ITYPE_DIR_AND_BOX: + { + if (getState() == ISTATE_SELECT && sBox == getCurrentBox()) + { + kdDebug(7116) << "IMAP4::rename - close " << getCurrentBox() << endl; + // mailbox can only be renamed if it is closed + imapCommand *cmd = doCommand (imapCommand::clientClose()); + bool ok = cmd->result() == "OK"; + completeQueue.removeRef(cmd); + if (!ok) + { + kdWarning(7116) << "Unable to close mailbox!" << endl; + error(ERR_CANNOT_RENAME, src.path()); + return; + } + setState(ISTATE_LOGIN); + } + imapCommand *cmd = doCommand (imapCommand::clientRename (sBox, dBox)); + if (cmd->result () != "OK") { + error (ERR_CANNOT_RENAME, src.path()); + completeQueue.removeRef (cmd); + return; + } + completeQueue.removeRef (cmd); + } + break; + + case ITYPE_MSG: + case ITYPE_ATTACH: + case ITYPE_UNKNOWN: + error (ERR_CANNOT_RENAME, src.path()); + break; + } + } + else + { + error (ERR_CANNOT_RENAME, src.path()); + return; + } + finished (); +} + +void +IMAP4Protocol::slave_status () +{ + bool connected = (getState() != ISTATE_NO) && isConnectionValid(); + kdDebug(7116) << "IMAP4::slave_status " << connected << endl; + slaveStatus ( connected ? myHost : TQString(), connected ); +} + +void +IMAP4Protocol::dispatch (int command, const TQByteArray & data) +{ + kdDebug(7116) << "IMAP4::dispatch - command=" << command << endl; + TDEIO::TCPSlaveBase::dispatch (command, data); +} + +void +IMAP4Protocol::stat (const KURL & _url) +{ + kdDebug(7116) << "IMAP4::stat - " << _url.prettyURL() << endl; + TQString aBox, aSequence, aLType, aSection, aValidity, aDelimiter, aInfo; + // parseURL with caching + enum IMAP_TYPE aType = + parseURL (_url, aBox, aSection, aLType, aSequence, aValidity, aDelimiter, + aInfo, true); + + UDSEntry entry; + UDSAtom atom; + + atom.m_uds = UDS_NAME; + atom.m_str = aBox; + entry.append (atom); + + if (!aSection.isEmpty()) + { + if (getState() == ISTATE_SELECT && aBox == getCurrentBox()) + { + imapCommand *cmd = doCommand (imapCommand::clientClose()); + bool ok = cmd->result() == "OK"; + completeQueue.removeRef(cmd); + if (!ok) + { + error(ERR_COULD_NOT_STAT, aBox); + return; + } + setState(ISTATE_LOGIN); + } + bool ok = false; + TQString cmdInfo; + if (aType == ITYPE_MSG || aType == ITYPE_ATTACH) + ok = true; + else + { + imapCommand *cmd = doCommand(imapCommand::clienStatus(aBox, aSection)); + ok = cmd->result() == "OK"; + cmdInfo = cmd->resultInfo(); + completeQueue.removeRef(cmd); + } + if (!ok) + { + bool found = false; + imapCommand *cmd = doCommand (imapCommand::clientList ("", aBox)); + if (cmd->result () == "OK") + { + for (TQValueListIterator < imapList > it = listResponses.begin (); + it != listResponses.end (); ++it) + { + if (aBox == (*it).name ()) found = true; + } + } + completeQueue.removeRef (cmd); + if (found) + error(ERR_COULD_NOT_STAT, aBox); + else + error(TDEIO::ERR_DOES_NOT_EXIST, aBox); + return; + } + if ((aSection == "UIDNEXT" && geStatus().uidNextAvailable()) + || (aSection == "UNSEEN" && geStatus().unseenAvailable())) + { + atom.m_uds = UDS_SIZE; + atom.m_str = TQString(); + atom.m_long = (aSection == "UIDNEXT") ? geStatus().uidNext() + : geStatus().unseen(); + entry.append(atom); + } + } else + if (aType == ITYPE_BOX || aType == ITYPE_DIR_AND_BOX || aType == ITYPE_MSG || + aType == ITYPE_ATTACH) + { + ulong validity = 0; + // see if the box is already in select/examine state + if (aBox == getCurrentBox ()) + validity = selectInfo.uidValidity (); + else + { + // do a status lookup on the box + // only do this if the box is not selected + // the server might change the validity for new select/examine + imapCommand *cmd = + doCommand (imapCommand::clienStatus (aBox, "UIDVALIDITY")); + completeQueue.removeRef (cmd); + validity = geStatus ().uidValidity (); + } + validity = 0; // temporary + + if (aType == ITYPE_BOX || aType == ITYPE_DIR_AND_BOX) + { + // has no or an invalid uidvalidity + if (validity > 0 && validity != aValidity.toULong ()) + { + //redirect + KURL newUrl = _url; + + newUrl.setPath ("/" + aBox + ";UIDVALIDITY=" + + TQString::number(validity)); + kdDebug(7116) << "IMAP4::stat - redirecting to " << newUrl.prettyURL() << endl; + redirection (newUrl); + } + } + else if (aType == ITYPE_MSG || aType == ITYPE_ATTACH) + { + //must determine if this message exists + //cause konqueror will check this on paste operations + + // has an invalid uidvalidity + // or no messages in box + if (validity > 0 && validity != aValidity.toULong ()) + { + aType = ITYPE_UNKNOWN; + kdDebug(7116) << "IMAP4::stat - url has invalid validity [" << validity << "d] " << _url.prettyURL() << endl; + } + } + } + + atom.m_uds = UDS_MIME_TYPE; + atom.m_str = getMimeType (aType); + entry.append (atom); + + kdDebug(7116) << "IMAP4: stat: " << atom.m_str << endl; + switch (aType) + { + case ITYPE_DIR: + atom.m_uds = UDS_FILE_TYPE; + atom.m_str = TQString(); + atom.m_long = S_IFDIR; + entry.append (atom); + break; + + case ITYPE_BOX: + case ITYPE_DIR_AND_BOX: + atom.m_uds = UDS_FILE_TYPE; + atom.m_str = TQString(); + atom.m_long = S_IFDIR; + entry.append (atom); + break; + + case ITYPE_MSG: + case ITYPE_ATTACH: + atom.m_uds = UDS_FILE_TYPE; + atom.m_str = TQString(); + atom.m_long = S_IFREG; + entry.append (atom); + break; + + case ITYPE_UNKNOWN: + error (ERR_DOES_NOT_EXIST, _url.prettyURL()); + break; + } + + statEntry (entry); + kdDebug(7116) << "IMAP4::stat - Finishing stat" << endl; + finished (); +} + +void IMAP4Protocol::openConnection() +{ + if (makeLogin()) connected(); +} + +void IMAP4Protocol::closeConnection() +{ + if (getState() == ISTATE_NO) return; + if (getState() == ISTATE_SELECT && metaData("expunge") == "auto") + { + imapCommand *cmd = doCommand (imapCommand::clientExpunge()); + completeQueue.removeRef (cmd); + } + if (getState() != ISTATE_CONNECT) + { + imapCommand *cmd = doCommand (imapCommand::clientLogout()); + completeQueue.removeRef (cmd); + } + closeDescriptor(); + setState(ISTATE_NO); + completeQueue.clear(); + sentQueue.clear(); + lastHandled = 0; + currentBox = TQString(); + readBufferLen = 0; +} + +bool IMAP4Protocol::makeLogin () +{ + if (getState () == ISTATE_LOGIN || getState () == ISTATE_SELECT) + return true; + + kdDebug(7116) << "IMAP4::makeLogin - checking login" << endl; + bool alreadyConnected = getState() == ISTATE_CONNECT; + kdDebug(7116) << "IMAP4::makeLogin - alreadyConnected " << alreadyConnected << endl; + if (alreadyConnected || connectToHost (myHost.latin1(), myPort)) + { +// fcntl (m_iSock, F_SETFL, (fcntl (m_iSock, F_GETFL) | O_NDELAY)); + + setState(ISTATE_CONNECT); + + myAuth = metaData("auth"); + myTLS = metaData("tls"); + kdDebug(7116) << "myAuth: " << myAuth << endl; + + imapCommand *cmd; + + unhandled.clear (); + if (!alreadyConnected) while (!parseLoop ()) ; //get greeting + TQString greeting; + if (!unhandled.isEmpty()) greeting = unhandled.first().stripWhiteSpace(); + unhandled.clear (); //get rid of it + cmd = doCommand (new imapCommand ("CAPABILITY", "")); + + kdDebug(7116) << "IMAP4: setHost: capability" << endl; + for (TQStringList::Iterator it = imapCapabilities.begin (); + it != imapCapabilities.end (); ++it) + { + kdDebug(7116) << "'" << (*it) << "'" << endl; + } + completeQueue.removeRef (cmd); + + if (!hasCapability("IMAP4") && !hasCapability("IMAP4rev1")) + { + error(ERR_COULD_NOT_LOGIN, i18n("The server %1 supports neither " + "IMAP4 nor IMAP4rev1.\nIt identified itself with: %2") + .arg(myHost).arg(greeting)); + closeConnection(); + return false; + } + + if (metaData("nologin") == "on") return TRUE; + + if (myTLS == "on" && !hasCapability(TQString("STARTTLS"))) + { + error(ERR_COULD_NOT_LOGIN, i18n("The server does not support TLS.\n" + "Disable this security feature to connect unencrypted.")); + closeConnection(); + return false; + } + if ((myTLS == "on" || (canUseTLS() && myTLS != "off")) && + hasCapability(TQString("STARTTLS"))) + { + imapCommand *cmd = doCommand (imapCommand::clientStartTLS()); + if (cmd->result () == "OK") + { + completeQueue.removeRef(cmd); + int tlsrc = startTLS(); + if (tlsrc == 1) + { + kdDebug(7116) << "TLS mode has been enabled." << endl; + imapCommand *cmd2 = doCommand (new imapCommand ("CAPABILITY", "")); + for (TQStringList::Iterator it = imapCapabilities.begin (); + it != imapCapabilities.end (); ++it) + { + kdDebug(7116) << "'" << (*it) << "'" << endl; + } + completeQueue.removeRef (cmd2); + } else { + kdWarning(7116) << "TLS mode setup has failed. Aborting." << endl; + error (ERR_COULD_NOT_LOGIN, i18n("Starting TLS failed.")); + closeConnection(); + return false; + } + } else completeQueue.removeRef(cmd); + } + + if (myAuth.isEmpty () || myAuth == "*") { + if (hasCapability (TQString ("LOGINDISABLED"))) { + error (ERR_COULD_NOT_LOGIN, i18n("LOGIN is disabled by the server.")); + closeConnection(); + return false; + } + } + else { + if (!hasCapability (TQString ("AUTH=") + myAuth)) { + error (ERR_COULD_NOT_LOGIN, i18n("The authentication method %1 is not " + "supported by the server.").arg(myAuth)); + closeConnection(); + return false; + } + } + + if ( greeting.contains( TQRegExp( "Cyrus IMAP4 v2.1" ) ) ) { + removeCapability( "ANNOTATEMORE" ); + } + + // starting from Cyrus IMAP 2.3.9, shared seen flags are available + TQRegExp regExp( "Cyrus\\sIMAP[4]{0,1}\\sv(\\d+)\\.(\\d+)\\.(\\d+)", false ); + if ( regExp.search( greeting ) >= 0 ) { + const int major = regExp.cap( 1 ).toInt(); + const int minor = regExp.cap( 2 ).toInt(); + const int patch = regExp.cap( 3 ).toInt(); + if ( major > 2 || (major == 2 && (minor > 3 || (minor == 3 && patch > 9))) ) { + kdDebug(7116) << k_funcinfo << "Cyrus IMAP >= 2.3.9 detected, enabling shared seen flag support" << endl; + imapCapabilities.append( "x-kmail-sharedseen" ); + } + } + + kdDebug(7116) << "IMAP4::makeLogin - attempting login" << endl; + + TDEIO::AuthInfo authInfo; + authInfo.username = myUser; + authInfo.password = myPass; + authInfo.prompt = i18n ("Username and password for your IMAP account:"); + + kdDebug(7116) << "IMAP4::makeLogin - open_PassDlg said user=" << myUser << " pass=xx" << endl; + + TQString resultInfo; + if (myAuth.isEmpty () || myAuth == "*") + { + if (myUser.isEmpty () || myPass.isEmpty ()) { + if(openPassDlg (authInfo)) { + myUser = authInfo.username; + myPass = authInfo.password; + } + } + if (!clientLogin (myUser, myPass, resultInfo)) + error(TDEIO::ERR_COULD_NOT_AUTHENTICATE, i18n("Unable to login. Probably the " + "password is wrong.\nThe server %1 replied:\n%2").arg(myHost).arg(resultInfo)); + } + else + { +#ifdef HAVE_LIBSASL2 + if (!clientAuthenticate (this, authInfo, myHost, myAuth, mySSL, resultInfo)) + error(TDEIO::ERR_COULD_NOT_AUTHENTICATE, i18n("Unable to authenticate via %1.\n" + "The server %2 replied:\n%3").arg(myAuth).arg(myHost).arg(resultInfo)); + else { + myUser = authInfo.username; + myPass = authInfo.password; + } +#else + error(TDEIO::ERR_COULD_NOT_LOGIN, i18n("SASL authentication is not compiled into kio_imap4.")); +#endif + } + if ( hasCapability("NAMESPACE") ) + { + // get all namespaces and save the namespace - delimiter association + cmd = doCommand( imapCommand::clientNamespace() ); + if (cmd->result () == "OK") + { + kdDebug(7116) << "makeLogin - registered namespaces" << endl; + } + completeQueue.removeRef (cmd); + } + // get the default delimiter (empty listing) + cmd = doCommand( imapCommand::clientList("", "") ); + if (cmd->result () == "OK") + { + TQValueListIterator < imapList > it = listResponses.begin(); + if ( it == listResponses.end() ) + { + // empty answer - this is a buggy imap server + // as a fallback we fire a normal listing and take the first answer + completeQueue.removeRef (cmd); + cmd = doCommand( imapCommand::clientList("", "%") ); + if (cmd->result () == "OK") + { + it = listResponses.begin(); + } + } + if ( it != listResponses.end() ) + { + namespaceToDelimiter[TQString()] = (*it).hierarchyDelimiter(); + kdDebug(7116) << "makeLogin - delimiter for empty ns='" << + (*it).hierarchyDelimiter() << "'" << endl; + if ( !hasCapability("NAMESPACE") ) + { + // server does not support namespaces + TQString nsentry = TQString::number( 0 ) + "==" + + (*it).hierarchyDelimiter(); + imapNamespaces.append( nsentry ); + } + } + } + completeQueue.removeRef (cmd); + } else { + kdDebug(7116) << "makeLogin - NO login" << endl; + } + + return getState() == ISTATE_LOGIN; +} + +void +IMAP4Protocol::parseWriteLine (const TQString & aStr) +{ + //kdDebug(7116) << "Writing: " << aStr << endl; + TQCString writer = aStr.utf8(); + int len = writer.length(); + + // append CRLF if necessary + if (len == 0 || (writer[len - 1] != '\n')) { + len += 2; + writer += "\r\n"; + } + + // write it + write(writer.data(), len); +} + +TQString +IMAP4Protocol::getMimeType (enum IMAP_TYPE aType) +{ + switch (aType) + { + case ITYPE_DIR: + return "inode/directory"; + break; + + case ITYPE_BOX: + return "message/digest"; + break; + + case ITYPE_DIR_AND_BOX: + return "message/directory"; + break; + + case ITYPE_MSG: + return "message/rfc822"; + break; + + // this should be handled by flushOutput + case ITYPE_ATTACH: + return "application/octet-stream"; + break; + + case ITYPE_UNKNOWN: + default: + return "unknown/unknown"; + } +} + + + +void +IMAP4Protocol::doListEntry (const KURL & _url, int stretch, imapCache * cache, + bool withFlags, bool withSubject) +{ + KURL aURL = _url; + aURL.setQuery (TQString()); + const TQString encodedUrl = aURL.url(0, 106); // utf-8 + doListEntry(encodedUrl, stretch, cache, withFlags, withSubject); +} + + + +void +IMAP4Protocol::doListEntry (const TQString & encodedUrl, int stretch, imapCache * cache, + bool withFlags, bool withSubject) +{ + if (cache) + { + UDSEntry entry; + UDSAtom atom; + + entry.clear (); + + const TQString uid = TQString::number(cache->getUid()); + + atom.m_uds = UDS_NAME; + atom.m_str = uid; + atom.m_long = 0; + if (stretch > 0) + { + atom.m_str = "0000000000000000" + atom.m_str; + atom.m_str = atom.m_str.right (stretch); + } + if (withSubject) + { + mailHeader *header = cache->getHeader(); + if (header) + atom.m_str += " " + header->getSubject(); + } + entry.append (atom); + + atom.m_uds = UDS_URL; + atom.m_str = encodedUrl; // utf-8 + if (atom.m_str[atom.m_str.length () - 1] != '/') + atom.m_str += '/'; + atom.m_str += ";UID=" + uid; + atom.m_long = 0; + entry.append (atom); + + atom.m_uds = UDS_FILE_TYPE; + atom.m_str = TQString(); + atom.m_long = S_IFREG; + entry.append (atom); + + atom.m_uds = UDS_SIZE; + atom.m_long = cache->getSize(); + entry.append (atom); + + atom.m_uds = UDS_MIME_TYPE; + atom.m_str = "message/rfc822"; + atom.m_long = 0; + entry.append (atom); + + atom.m_uds = UDS_USER; + atom.m_str = myUser; + entry.append (atom); + + atom.m_uds = TDEIO::UDS_ACCESS; + atom.m_long = (withFlags) ? cache->getFlags() : S_IRUSR | S_IXUSR | S_IWUSR; + entry.append (atom); + + listEntry (entry, false); + } +} + +void +IMAP4Protocol::doListEntry (const KURL & _url, const TQString & myBox, + const imapList & item, bool appendPath) +{ + KURL aURL = _url; + aURL.setQuery (TQString()); + UDSEntry entry; + UDSAtom atom; + int hdLen = item.hierarchyDelimiter().length(); + + { + // mailboxName will be appended to the path if appendPath is true + TQString mailboxName = item.name (); + + // some beautification + if (mailboxName.find (myBox) == 0 && mailboxName.length() > myBox.length()) + { + mailboxName = + mailboxName.right (mailboxName.length () - myBox.length ()); + } + if (mailboxName[0] == '/') + mailboxName = mailboxName.right (mailboxName.length () - 1); + if (mailboxName.left(hdLen) == item.hierarchyDelimiter()) + mailboxName = mailboxName.right(mailboxName.length () - hdLen); + if (mailboxName.right(hdLen) == item.hierarchyDelimiter()) + mailboxName.truncate(mailboxName.length () - hdLen); + + atom.m_uds = UDS_NAME; + if (!item.hierarchyDelimiter().isEmpty() && + mailboxName.find(item.hierarchyDelimiter()) != -1) + atom.m_str = mailboxName.section(item.hierarchyDelimiter(), -1); + else + atom.m_str = mailboxName; + + // konqueror will die with an assertion failure otherwise + if (atom.m_str.isEmpty ()) + atom.m_str = ".."; + + if (!atom.m_str.isEmpty ()) + { + atom.m_long = 0; + entry.append (atom); + + if (!item.noSelect ()) + { + atom.m_uds = UDS_MIME_TYPE; + if (!item.noInferiors ()) + { + atom.m_str = "message/directory"; + } else { + atom.m_str = "message/digest"; + } + atom.m_long = 0; + entry.append (atom); + mailboxName += '/'; + + // explicitly set this as a directory for KFileDialog + atom.m_uds = UDS_FILE_TYPE; + atom.m_str = TQString(); + atom.m_long = S_IFDIR; + entry.append (atom); + } + else if (!item.noInferiors ()) + { + atom.m_uds = UDS_MIME_TYPE; + atom.m_str = "inode/directory"; + atom.m_long = 0; + entry.append (atom); + mailboxName += '/'; + + // explicitly set this as a directory for KFileDialog + atom.m_uds = UDS_FILE_TYPE; + atom.m_str = TQString(); + atom.m_long = S_IFDIR; + entry.append (atom); + } + else + { + atom.m_uds = UDS_MIME_TYPE; + atom.m_str = "unknown/unknown"; + atom.m_long = 0; + entry.append (atom); + } + + atom.m_uds = UDS_URL; + TQString path = aURL.path(); + atom.m_str = aURL.url (0, 106); // utf-8 + if (appendPath) + { + if (path[path.length() - 1] == '/' && !path.isEmpty() && path != "/") + path.truncate(path.length() - 1); + if (!path.isEmpty() && path != "/" + && path.right(hdLen) != item.hierarchyDelimiter()) { + path += item.hierarchyDelimiter(); + } + path += mailboxName; + if (path.upper() == "/INBOX/") { + // make sure the client can rely on INBOX + path = path.upper(); + } + } + aURL.setPath(path); + atom.m_str = aURL.url(0, 106); // utf-8 + atom.m_long = 0; + entry.append (atom); + + atom.m_uds = UDS_USER; + atom.m_str = myUser; + entry.append (atom); + + atom.m_uds = UDS_ACCESS; + atom.m_long = S_IRUSR | S_IXUSR | S_IWUSR; + entry.append (atom); + + atom.m_uds = UDS_EXTRA; + atom.m_str = item.attributesAsString(); + atom.m_long = 0; + entry.append (atom); + + listEntry (entry, false); + } + } +} + +enum IMAP_TYPE +IMAP4Protocol::parseURL (const KURL & _url, TQString & _box, + TQString & _section, TQString & _type, TQString & _uid, + TQString & _validity, TQString & _hierarchyDelimiter, + TQString & _info, bool cache) +{ + enum IMAP_TYPE retVal; + retVal = ITYPE_UNKNOWN; + + imapParser::parseURL (_url, _box, _section, _type, _uid, _validity, _info); +// kdDebug(7116) << "URL: query - '" << KURL::decode_string(_url.query()) << "'" << endl; + + // get the delimiter + TQString myNamespace = namespaceForBox( _box ); + kdDebug(7116) << "IMAP4::parseURL - namespace=" << myNamespace << endl; + if ( namespaceToDelimiter.contains(myNamespace) ) + { + _hierarchyDelimiter = namespaceToDelimiter[myNamespace]; + kdDebug(7116) << "IMAP4::parseURL - delimiter=" << _hierarchyDelimiter << endl; + } + + if (!_box.isEmpty ()) + { + kdDebug(7116) << "IMAP4::parseURL - box=" << _box << endl; + + if (makeLogin ()) + { + if (getCurrentBox () != _box || + _type == "LIST" || _type == "LSUB" || _type == "LSUBNOCHECK") + { + if ( cache ) + { + // assume a normal box + retVal = ITYPE_DIR_AND_BOX; + } else + { + // start a listing for the box to get the type + imapCommand *cmd; + + cmd = doCommand (imapCommand::clientList ("", _box)); + if (cmd->result () == "OK") + { + for (TQValueListIterator < imapList > it = listResponses.begin (); + it != listResponses.end (); ++it) + { + //kdDebug(7116) << "IMAP4::parseURL - checking " << _box << " to " << (*it).name() << endl; + if (_box == (*it).name ()) + { + if ( !(*it).hierarchyDelimiter().isEmpty() ) + _hierarchyDelimiter = (*it).hierarchyDelimiter(); + if ((*it).noSelect ()) + { + retVal = ITYPE_DIR; + } + else if ((*it).noInferiors ()) + { + retVal = ITYPE_BOX; + } + else + { + retVal = ITYPE_DIR_AND_BOX; + } + } + } + // if we got no list response for the box see if it's a prefix + if ( retVal == ITYPE_UNKNOWN && + namespaceToDelimiter.contains(_box) ) { + retVal = ITYPE_DIR; + } + } else { + kdDebug(7116) << "IMAP4::parseURL - got error for " << _box << endl; + } + completeQueue.removeRef (cmd); + } // cache + } + else // current == box + { + retVal = ITYPE_BOX; + } + } + else + kdDebug(7116) << "IMAP4::parseURL: no login!" << endl; + + } + else // empty box + { + // the root is just a dir + kdDebug(7116) << "IMAP4: parseURL: box [root]" << endl; + retVal = ITYPE_DIR; + } + + // see if it is a real sequence or a simple uid + if (retVal == ITYPE_BOX || retVal == ITYPE_DIR_AND_BOX) + { + if (!_uid.isEmpty ()) + { + if (_uid.find (':') == -1 && _uid.find (',') == -1 + && _uid.find ('*') == -1) + retVal = ITYPE_MSG; + } + } + if (retVal == ITYPE_MSG) + { + if ( (_section.find ("BODY.PEEK[", 0, false) != -1 || + _section.find ("BODY[", 0, false) != -1) && + _section.find(".MIME") == -1 && + _section.find(".HEADER") == -1 ) + retVal = ITYPE_ATTACH; + } + if ( _hierarchyDelimiter.isEmpty() && + (_type == "LIST" || _type == "LSUB" || _type == "LSUBNOCHECK") ) + { + // this shouldn't happen but when the delimiter is really empty + // we try to reconstruct it from the URL + if (!_box.isEmpty()) + { + int start = _url.path().findRev(_box); + if (start != -1) + _hierarchyDelimiter = _url.path().mid(start-1, start); + kdDebug(7116) << "IMAP4::parseURL - reconstructed delimiter:" << _hierarchyDelimiter + << " from URL " << _url.path() << endl; + } + if (_hierarchyDelimiter.isEmpty()) + _hierarchyDelimiter = "/"; + } + kdDebug(7116) << "IMAP4::parseURL - return " << retVal << endl; + + return retVal; +} + +int +IMAP4Protocol::outputLine (const TQCString & _str, int len) +{ + if (len == -1) { + len = _str.length(); + } + + if (cacheOutput) + { + if ( !outputBuffer.isOpen() ) { + outputBuffer.open(IO_WriteOnly); + } + outputBuffer.at(outputBufferIndex); + outputBuffer.writeBlock(_str.data(), len); + outputBufferIndex += len; + return 0; + } + + TQByteArray temp; + bool relay = relayEnabled; + + relayEnabled = true; + temp.setRawData (_str.data (), len); + parseRelay (temp); + temp.resetRawData (_str.data (), len); + + relayEnabled = relay; + return 0; +} + +void IMAP4Protocol::flushOutput(TQString contentEncoding) +{ + // send out cached data to the application + if (outputBufferIndex == 0) + return; + outputBuffer.close(); + outputCache.resize(outputBufferIndex); + if (decodeContent) + { + // get the coding from the MIME header + TQByteArray decoded; + if (contentEncoding.find("quoted-printable", 0, false) == 0) + decoded = KCodecs::quotedPrintableDecode(outputCache); + else if (contentEncoding.find("base64", 0, false) == 0) + KCodecs::base64Decode(outputCache, decoded); + else + decoded = outputCache; + + TQString mimetype = KMimeType::findByContent( decoded )->name(); + kdDebug(7116) << "IMAP4::flushOutput - mimeType " << mimetype << endl; + mimeType(mimetype); + decodeContent = false; + data( decoded ); + } else { + data( outputCache ); + } + mProcessedSize += outputBufferIndex; + processedSize( mProcessedSize ); + outputBufferIndex = 0; + outputCache[0] = '\0'; + outputBuffer.setBuffer(outputCache); +} + +ssize_t IMAP4Protocol::myRead(void *data, ssize_t len) +{ + if (readBufferLen) + { + ssize_t copyLen = (len < readBufferLen) ? len : readBufferLen; + memcpy(data, readBuffer, copyLen); + readBufferLen -= copyLen; + if (readBufferLen) memcpy(readBuffer, &readBuffer[copyLen], readBufferLen); + return copyLen; + } + if (!isConnectionValid()) return 0; + waitForResponse( responseTimeout() ); + return read(data, len); +} + +bool +IMAP4Protocol::assureBox (const TQString & aBox, bool readonly) +{ + if (aBox.isEmpty()) return false; + + imapCommand *cmd = 0; + + if (aBox != getCurrentBox () || (!getSelected().readWrite() && !readonly)) + { + // open the box with the appropriate mode + kdDebug(7116) << "IMAP4Protocol::assureBox - opening box" << endl; + selectInfo = imapInfo(); + cmd = doCommand (imapCommand::clientSelect (aBox, readonly)); + bool ok = cmd->result() == "OK"; + TQString cmdInfo = cmd->resultInfo(); + completeQueue.removeRef (cmd); + + if (!ok) + { + bool found = false; + cmd = doCommand (imapCommand::clientList ("", aBox)); + if (cmd->result () == "OK") + { + for (TQValueListIterator < imapList > it = listResponses.begin (); + it != listResponses.end (); ++it) + { + if (aBox == (*it).name ()) found = true; + } + } + completeQueue.removeRef (cmd); + if (found) { + if (cmdInfo.find("permission", 0, false) != -1) { + // not allowed to enter this folder + error(ERR_ACCESS_DENIED, cmdInfo); + } else { + error(ERR_SLAVE_DEFINED, i18n("Unable to open folder %1. The server replied: %2").arg(aBox).arg(cmdInfo)); + } + } else { + error(TDEIO::ERR_DOES_NOT_EXIST, aBox); + } + return false; + } + } + else + { + // Give the server a chance to deliver updates every ten seconds. + // Doing this means a server roundtrip and since assureBox is called + // after every mail, we do it with a timeout. + kdDebug(7116) << "IMAP4Protocol::assureBox - reusing box" << endl; + if ( mTimeOfLastNoop.secsTo( TQDateTime::currentDateTime() ) > 10 ) { + cmd = doCommand (imapCommand::clientNoop ()); + completeQueue.removeRef (cmd); + mTimeOfLastNoop = TQDateTime::currentDateTime(); + kdDebug(7116) << "IMAP4Protocol::assureBox - noop timer fired" << endl; + } + } + + // if it is the mode we want + if (!getSelected().readWrite() && !readonly) + { + error(TDEIO::ERR_CANNOT_OPEN_FOR_WRITING, aBox); + return false; + } + + return true; +} diff --git a/tdeioslaves/imap4/imap4.h b/tdeioslaves/imap4/imap4.h new file mode 100644 index 00000000..a6b16089 --- /dev/null +++ b/tdeioslaves/imap4/imap4.h @@ -0,0 +1,205 @@ +#ifndef _IMAP4_H +#define _IMAP4_H +/********************************************************************** + * + * imap4.h - IMAP4rev1 KIOSlave + * Copyright (C) 2001-2002 Michael Haeckel + * Copyright (C) 1999 John Corey + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Send comments and bug fixes to jcorey@fruity.ath.cx + * + *********************************************************************/ + +#include "imapparser.h" +#include "mimeio.h" + +#include +#include + +#define IMAP_BUFFER 8192 + +/** @brief type of object the url refers too */ +enum IMAP_TYPE +{ + ITYPE_UNKNOWN, /*< unknown type */ + ITYPE_DIR, /*< Object is a directory. i.e. does not contain message, just mailboxes */ + ITYPE_BOX, /*< Object is a mailbox. i.e. contains mails */ + ITYPE_DIR_AND_BOX, /*< Object contains both mails and mailboxes */ + ITYPE_MSG, /*< Object is a mail */ + ITYPE_ATTACH /*< Object is an attachment */ +}; + +/** @brief IOSlave derived class */ +class IMAP4Protocol:public + TDEIO::TCPSlaveBase, + public + imapParser, + public + mimeIO +{ + +public: + + // reimplement the TCPSlave + IMAP4Protocol (const TQCString & pool, const TQCString & app, bool isSSL); + virtual ~IMAP4Protocol (); + + virtual void openConnection(); + virtual void closeConnection(); + + virtual void setHost (const TQString & _host, int _port, const TQString & _user, + const TQString & _pass); + /** + * @brief get a message or part of a message + * the data is normally send as we get it from the server + * if you want the slave to decode the content (e.g. for attachments) + * then append an additional INFO=DECODE to the URL + */ + virtual void get (const KURL & _url); + /** + * @brief stat a mailbox, message, attachment + */ + virtual void stat (const KURL & _url); + virtual void slave_status (); + /** + * @brief delete a mailbox + */ + virtual void del (const KURL & _url, bool isFile); + /** + * @brief Capabilites, NOOP, (Un)subscribe, Change status, + * Change ACL + */ + virtual void special (const TQByteArray & data); + /** + * @brief list a directory/mailbox + */ + virtual void listDir (const KURL & _url); + virtual void setSubURL (const KURL & _url); + virtual void dispatch (int command, const TQByteArray & data); + /** + * @brief create a mailbox + */ + virtual void mkdir (const KURL & url, int permissions); + virtual void put (const KURL & url, int permissions, bool overwrite, + bool resume); + virtual void rename (const KURL & src, const KURL & dest, bool overwrite); + virtual void copy (const KURL & src, const KURL & dest, int permissions, + bool overwrite); + + /** @brief reimplement the parser + * relay hook to send the fetched data directly to an upper level + */ + virtual void parseRelay (const TQByteArray & buffer); + + /** @brief reimplement the parser + * relay hook to announce the fetched data directly to an upper level + */ + virtual void parseRelay (ulong); + + /** @brief reimplement the parser + * read at least len bytes */ + virtual bool parseRead (TQByteArray &buffer,ulong len,ulong relay=0); + + /** @brief reimplement the parser + * @brief read at least a line (up to CRLF) */ + virtual bool parseReadLine (TQByteArray & buffer, ulong relay = 0); + + /** @brief reimplement the parser + * @brief write argument to the server */ + virtual void parseWriteLine (const TQString &); + + /** @brief reimplement the mimeIO */ + virtual int outputLine (const TQCString & _str, int len = -1); + + /** @brief send out cached data to the application */ + virtual void flushOutput(TQString contentEncoding = TQString()); + +protected: + + // select or examine the box if needed + bool assureBox (const TQString & aBox, bool readonly); + + ssize_t myRead(void *data, ssize_t len); + + /** + * @brief Parses the given URL + * The return values are set by parsing the URL and querying the server + * + * If you set caching to true the server is not queried but the type is always + * set to ITYPE_DIR_AND_BOX + */ + enum IMAP_TYPE + parseURL (const KURL & _url, TQString & _box, TQString & _section, + TQString & _type, TQString & _uid, TQString & _validity, + TQString & _hierarchyDelimiter, TQString & _info, + bool cache = false); + TQString getMimeType (enum IMAP_TYPE); + + bool makeLogin (); + + void outputLineStr (const TQString & _str) + { + outputLine (_str.latin1 (), _str.length()); + } + void doListEntry (const KURL & _url, int stretch, imapCache * cache = NULL, + bool withFlags = FALSE, bool withSubject = FALSE); + + /** + * Send a list entry (folder) to the application + * If @p appendPath is true the foldername will be appended + * to the path of @p url + */ + void doListEntry (const KURL & url, const TQString & myBox, + const imapList & item, bool appendPath = true); + + /** Send an ACL command which is identified by @p command */ + void specialACLCommand( int command, TQDataStream& stream ); + + /** Send an annotation command which is identified by @p command */ + void specialAnnotateMoreCommand( int command, TQDataStream& stream ); + void specialQuotaCommand( int command, TQDataStream& stream ); + + /** Search current folder, the search string is passed as SECTION */ + void specialSearchCommand( TQDataStream& ); + + /** Send a custom command to the server */ + void specialCustomCommand( TQDataStream& ); + +private: + + // This method behaves like the above method but takes an already encoded url, + // so you don't have to call KURL::url() for every mail. + void doListEntry (const TQString & encodedUrl, int stretch, imapCache * cache = NULL, + bool withFlags = FALSE, bool withSubject = FALSE); + + TQString myHost, myUser, myPass, myAuth, myTLS; + int myPort; + bool mySSL; + + bool relayEnabled, cacheOutput, decodeContent; + TQByteArray outputCache; + TQBuffer outputBuffer; + TQ_ULONG outputBufferIndex; + TDEIO::filesize_t mProcessedSize; + + char readBuffer[IMAP_BUFFER]; + ssize_t readBufferLen; + int readSize; + TQDateTime mTimeOfLastNoop; +}; + +#endif diff --git a/tdeioslaves/imap4/imap4.protocol b/tdeioslaves/imap4/imap4.protocol new file mode 100644 index 00000000..946d5692 --- /dev/null +++ b/tdeioslaves/imap4/imap4.protocol @@ -0,0 +1,29 @@ +[Protocol] +# The executable, of course +#### Temporary name +exec=kio_imap4 +# protocol that will appear in URLs +protocol=imap + +# input/output can be one of: filesystem, stream, none +input=stream +output=filesystem + +# Headings for file listings? +listing=Name,Type,Size,Owner +deleting=true +linking=false +# For now, reading yes, writing no +reading=true +writing=false +# For now, no moving +moving=false + +# Can be source protocol +source=true + +# List of capabilities (e.g. special() commands) +Capabilities=Subscription,ACL,Quota + +Icon=folder_inbox +DocPath=tdeioslave/imap.html diff --git a/tdeioslaves/imap4/imapcommand.cc b/tdeioslaves/imap4/imapcommand.cc new file mode 100644 index 00000000..a3239d09 --- /dev/null +++ b/tdeioslaves/imap4/imapcommand.cc @@ -0,0 +1,408 @@ +/********************************************************************** + * + * imapcommand.cc - IMAP4rev1 command handler + * Copyright (C) 2000 s.carstens@gmx.de + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Send comments and bug fixes to s.carstens@gmx.de + * + *********************************************************************/ + +#include "imapcommand.h" +#include "rfcdecoder.h" + +/*#include + +#include +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include */ + +imapCommand::imapCommand () +{ + mComplete = false; + mId = TQString(); +} + +imapCommand::imapCommand (const TQString & command, const TQString & parameter) +// aCommand(NULL), +// mResult(NULL), +// mParameter(NULL) +{ + mComplete = false; + aCommand = command; + aParameter = parameter; + mId = TQString(); +} + +bool +imapCommand::isComplete () +{ + return mComplete; +} + +const TQString & +imapCommand::result () +{ + return mResult; +} + +const TQString & +imapCommand::resultInfo () +{ + return mResultInfo; +} + +const TQString & +imapCommand::id () +{ + return mId; +} + +const TQString & +imapCommand::parameter () +{ + return aParameter; +} + +const TQString & +imapCommand::command () +{ + return aCommand; +} + +void +imapCommand::setId (const TQString & id) +{ + if (mId.isEmpty ()) + mId = id; +} + +void +imapCommand::setComplete () +{ + mComplete = true; +} + +void +imapCommand::setResult (const TQString & result) +{ + mResult = result; +} + +void +imapCommand::setResultInfo (const TQString & result) +{ + mResultInfo = result; +} + +void +imapCommand::setCommand (const TQString & command) +{ + aCommand = command; +} + +void +imapCommand::setParameter (const TQString & parameter) +{ + aParameter = parameter; +} + +const TQString +imapCommand::getStr () +{ + if (parameter().isEmpty()) + return id() + " " + command() + "\r\n"; + else + return id() + " " + command() + " " + parameter() + "\r\n"; +} + +imapCommand * +imapCommand::clientNoop () +{ + return new imapCommand ("NOOP", ""); +} + +imapCommand * +imapCommand::clientFetch (ulong uid, const TQString & fields, bool nouid) +{ + return clientFetch (uid, uid, fields, nouid); +} + +imapCommand * +imapCommand::clientFetch (ulong fromUid, ulong toUid, const TQString & fields, + bool nouid) +{ + TQString uid = TQString::number(fromUid); + + if (fromUid != toUid) + { + uid += ":"; + if (toUid < fromUid) + uid += "*"; + else + uid += TQString::number(toUid); + } + return clientFetch (uid, fields, nouid); +} + +imapCommand * +imapCommand::clientFetch (const TQString & sequence, const TQString & fields, + bool nouid) +{ + return new imapCommand (nouid ? "FETCH" : "UID FETCH", + sequence + " (" + fields + ")"); +} + +imapCommand * +imapCommand::clientList (const TQString & reference, const TQString & path, + bool lsub) +{ + return new imapCommand (lsub ? "LSUB" : "LIST", + TQString ("\"") + rfcDecoder::toIMAP (reference) + + "\" \"" + rfcDecoder::toIMAP (path) + "\""); +} + +imapCommand * +imapCommand::clientSelect (const TQString & path, bool examine) +{ + Q_UNUSED(examine); + /** @note We use always SELECT, because UW-IMAP doesn't check for new mail, when + used with the "mbox driver" and the folder is opened with EXAMINE + and Courier can't append to a mailbox that is in EXAMINE state */ + return new imapCommand ("SELECT", + TQString ("\"") + rfcDecoder::toIMAP (path) + "\""); +} + +imapCommand * +imapCommand::clientClose() +{ + return new imapCommand("CLOSE", ""); +} + +imapCommand * +imapCommand::clientCopy (const TQString & box, const TQString & sequence, + bool nouid) +{ + return new imapCommand (nouid ? "COPY" : "UID COPY", + sequence + " \"" + rfcDecoder::toIMAP (box) + "\""); +} + +imapCommand * +imapCommand::clientAppend (const TQString & box, const TQString & flags, + ulong size) +{ + return new imapCommand ("APPEND", + "\"" + rfcDecoder::toIMAP (box) + "\" " + + ((flags.isEmpty()) ? "" : ("(" + flags + ") ")) + + "{" + TQString::number(size) + "}"); +} + +imapCommand * +imapCommand::clienStatus (const TQString & path, const TQString & parameters) +{ + return new imapCommand ("STATUS", + TQString ("\"") + rfcDecoder::toIMAP (path) + + "\" (" + parameters + ")"); +} + +imapCommand * +imapCommand::clientCreate (const TQString & path) +{ + return new imapCommand ("CREATE", + TQString ("\"") + rfcDecoder::toIMAP (path) + "\""); +} + +imapCommand * +imapCommand::clientDelete (const TQString & path) +{ + return new imapCommand ("DELETE", + TQString ("\"") + rfcDecoder::toIMAP (path) + "\""); +} + +imapCommand * +imapCommand::clientSubscribe (const TQString & path) +{ + return new imapCommand ("SUBSCRIBE", + TQString ("\"") + rfcDecoder::toIMAP (path) + "\""); +} + +imapCommand * +imapCommand::clientUnsubscribe (const TQString & path) +{ + return new imapCommand ("UNSUBSCRIBE", + TQString ("\"") + rfcDecoder::toIMAP (path) + "\""); +} + +imapCommand * +imapCommand::clientExpunge () +{ + return new imapCommand ("EXPUNGE", TQString ("")); +} + +imapCommand * +imapCommand::clientRename (const TQString & src, const TQString & dest) +{ + return new imapCommand ("RENAME", + TQString ("\"") + rfcDecoder::toIMAP (src) + + "\" \"" + rfcDecoder::toIMAP (dest) + "\""); +} + +imapCommand * +imapCommand::clientSearch (const TQString & search, bool nouid) +{ + return new imapCommand (nouid ? "SEARCH" : "UID SEARCH", search); +} + +imapCommand * +imapCommand::clientStore (const TQString & set, const TQString & item, + const TQString & data, bool nouid) +{ + return new imapCommand (nouid ? "STORE" : "UID STORE", + set + " " + item + " (" + data + ")"); +} + +imapCommand * +imapCommand::clientLogout () +{ + return new imapCommand ("LOGOUT", ""); +} + +imapCommand * +imapCommand::clientStartTLS () +{ + return new imapCommand ("STARTTLS", ""); +} + +imapCommand * +imapCommand::clientSetACL( const TQString& box, const TQString& user, const TQString& acl ) +{ + return new imapCommand ("SETACL", TQString("\"") + rfcDecoder::toIMAP (box) + + "\" \"" + rfcDecoder::toIMAP (user) + + "\" \"" + rfcDecoder::toIMAP (acl) + "\""); +} + +imapCommand * +imapCommand::clientDeleteACL( const TQString& box, const TQString& user ) +{ + return new imapCommand ("DELETEACL", TQString("\"") + rfcDecoder::toIMAP (box) + + "\" \"" + rfcDecoder::toIMAP (user) + + "\""); +} + +imapCommand * +imapCommand::clientGetACL( const TQString& box ) +{ + return new imapCommand ("GETACL", TQString("\"") + rfcDecoder::toIMAP (box) + + "\""); +} + +imapCommand * +imapCommand::clientListRights( const TQString& box, const TQString& user ) +{ + return new imapCommand ("LISTRIGHTS", TQString("\"") + rfcDecoder::toIMAP (box) + + "\" \"" + rfcDecoder::toIMAP (user) + + "\""); +} + +imapCommand * +imapCommand::clientMyRights( const TQString& box ) +{ + return new imapCommand ("MYRIGHTS", TQString("\"") + rfcDecoder::toIMAP (box) + + "\""); +} + +imapCommand * +imapCommand::clientSetAnnotation( const TQString& box, const TQString& entry, const TQMap& attributes ) +{ + TQString parameter = TQString("\"") + rfcDecoder::toIMAP (box) + + "\" \"" + rfcDecoder::toIMAP (entry) + + "\" ("; + for( TQMap::ConstIterator it = attributes.begin(); it != attributes.end(); ++it ) { + parameter += "\""; + parameter += rfcDecoder::toIMAP (it.key()); + parameter += "\" \""; + parameter += rfcDecoder::toIMAP (it.data()); + parameter += "\" "; + } + // Turn last space into a ')' + parameter[parameter.length()-1] = ')'; + + return new imapCommand ("SETANNOTATION", parameter); +} + +imapCommand * +imapCommand::clientGetAnnotation( const TQString& box, const TQString& entry, const TQStringList& attributeNames ) +{ + TQString parameter = TQString("\"") + rfcDecoder::toIMAP (box) + + "\" \"" + rfcDecoder::toIMAP (entry) + + "\" "; + if ( attributeNames.count() == 1 ) + parameter += "\"" + rfcDecoder::toIMAP (attributeNames.first()) + '"'; + else { + parameter += '('; + for( TQStringList::ConstIterator it = attributeNames.begin(); it != attributeNames.end(); ++it ) { + parameter += "\"" + rfcDecoder::toIMAP (*it) + "\" "; + } + // Turn last space into a ')' + parameter[parameter.length()-1] = ')'; + } + return new imapCommand ("GETANNOTATION", parameter); +} + +imapCommand * +imapCommand::clientNamespace() +{ + return new imapCommand("NAMESPACE", ""); +} + +imapCommand * +imapCommand::clientGetQuotaroot( const TQString& box ) +{ + TQString parameter = TQString("\"") + rfcDecoder::toIMAP (box) + '"'; + return new imapCommand ("GETQUOTAROOT", parameter); +} + +imapCommand * +imapCommand::clientCustom( const TQString& command, const TQString& arguments ) +{ + return new imapCommand (command, arguments); +} + diff --git a/tdeioslaves/imap4/imapcommand.h b/tdeioslaves/imap4/imapcommand.h new file mode 100644 index 00000000..9e283442 --- /dev/null +++ b/tdeioslaves/imap4/imapcommand.h @@ -0,0 +1,394 @@ +#ifndef _IMAPCOMMAND_H +#define _IMAPCOMMAND_H +/********************************************************************** + * + * imapcommand.h - IMAP4rev1 command handler + * Copyright (C) 2000 Sven Carstens + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Send comments and bug fixes to + * + *********************************************************************/ + +#include +#include +#include + +/** + * @brief encapulate a IMAP command + * @author Svenn Carstens + * @date 2000 + * @todo fix the documentation + */ + +class imapCommand +{ +public: + + /** + * @brief Constructor + */ + imapCommand (); + /** + * @fn imapCommand (const TQString & command, const TQString & parameter); + * @brief Constructor + * @param command Imap command + * @param parameter Parameters to the command + * @return none + */ + imapCommand (const TQString & command, const TQString & parameter); + /** + * @fn bool isComplete (); + * @brief is it complete? + * @return whether the command is completed + */ + bool isComplete (); + /** + * @fn const TQString & result (); + * @brief get the result of the command + * @return The result, i.e. first word of the result line, like OK + */ + const TQString & result (); + /** + * @fn const TQString & resultInfo (); + * @brief get information about the result + * @return Information about the result, i.e. the rest of the result line + */ + const TQString & resultInfo (); + /** + * @fn const TQString & parameter (); + * @brief get the parameter + * @return the parameter + */ + const TQString & parameter (); + /** + * @fn const TQString & command (); + * @brief get the command + * @return the command + */ + const TQString & command (); + /** + * @fn const TQString & id (); + * @brief get the id + * @return the id + */ + const TQString & id (); + + /** + * @fn void setId (const TQString &); + * @brief set the id + * @param id the id used by the command + * @return none + */ + void setId (const TQString &); + /** + * @fn void setComplete (); + * @brief set the completed state + * @return none + */ + void setComplete (); + /** + * @fn void setResult (const TQString &); + * @brief set the completed state + * @param result the command result + * @return none + */ + void setResult (const TQString &); + /** + * @fn void setResultInfo (const TQString &); + * @brief set the completed state + * @param result the command result information + * @return none + */ + void setResultInfo (const TQString &); + /** + * @fn void setCommand (const TQString &); + * @brief set the command + * @param command the imap command + * @return none + */ + void setCommand (const TQString &); + /** + * @fn void setParameter (const TQString &); + * @brief set the command parameter(s) + * @param parameter the comand parameter(s) + * @return none + */ + void setParameter (const TQString &); + /** + * @fn const TQString getStr (); + * @brief returns the data to send to the server + * The function returns the complete data to be sent to + * the server (\ \ [\]) + * @return the data to send to the server + * @todo possibly rename function to be clear of it's purpose + */ + const TQString getStr (); + + /** + * @fn static imapCommand *clientNoop (); + * @brief Create a NOOP command + * @return a NOOP imapCommand + */ + static imapCommand *clientNoop (); + /** + * @fn static imapCommand *clientFetch (ulong uid, const TQString & fields, bool nouid = false); + * @brief Create a FETCH command + * @param uid Uid of the message to fetch + * @param fields options to pass to the server + * @param nouid Perform a FETCH or UID FETCH command + * @return a FETCH imapCommand + * Fetch a single uid + */ + static imapCommand *clientFetch (ulong uid, const TQString & fields, + bool nouid = false); + /** + * @fn static imapCommand *clientFetch (ulong fromUid, ulong toUid, const TQString & fields, bool nouid = false); + * @brief Create a FETCH command + * @param fromUid start uid of the messages to fetch + * @param toUid last uid of the messages to fetch + * @param fields options to pass to the server + * @param nouid Perform a FETCH or UID FETCH command + * @return a FETCH imapCommand + * Fetch a range of uids + */ + static imapCommand *clientFetch (ulong fromUid, ulong toUid, + const TQString & fields, bool nouid = + false); + /** + * @fn static imapCommand *clientFetch (const TQString & sequence, const TQString & fields, bool nouid = false); + * @brief Create a FETCH command + * @param sequence a IMAP FETCH sequence string + * @param fields options to pass to the server + * @param nouid Perform a FETCH or UID FETCH command + * @return a FETCH imapCommand + * Fetch a range of uids. The other clientFetch functions are just + * wrappers around this function. + */ + static imapCommand *clientFetch (const TQString & sequence, + const TQString & fields, bool nouid = + false); + /** + * @fn static imapCommand *clientList (const TQString & reference, const TQString & path, bool lsub = false); + * @brief Create a LIST command + * @param reference + * @param path The path to list + * @param lsub Perform a LIST or a LSUB command + * @return a LIST imapCommand + */ + static imapCommand *clientList (const TQString & reference, + const TQString & path, bool lsub = false); + /** + * @fn static imapCommand *clientSelect (const TQString & path, bool examine = false); + * @brief Create a SELECT command + * @param path The path to select + * @param lsub Perform a SELECT or a EXAMINE command + * @return a SELECT imapCommand + */ + static imapCommand *clientSelect (const TQString & path, bool examine = + false); + /** + * @fn static imapCommand *clientClose(); + * @brief Create a CLOSE command + * @return a CLOSE imapCommand + */ + static imapCommand *clientClose(); + /** + * @brief Create a STATUS command + * @param path + * @param parameters + * @return a STATUS imapCommand + */ + static imapCommand *clienStatus (const TQString & path, + const TQString & parameters); + /** + * @brief Create a COPY command + * @param box + * @param sequence + * @param nouid Perform a COPY or UID COPY command + * @return a COPY imapCommand + */ + static imapCommand *clientCopy (const TQString & box, + const TQString & sequence, bool nouid = + false); + /** + * @brief Create a APPEND command + * @param box + * @param flags + * @param size + * @return a APPEND imapCommand + */ + static imapCommand *clientAppend (const TQString & box, + const TQString & flags, ulong size); + /** + * @brief Create a CREATE command + * @param path + * @return a CREATE imapCommand + */ + static imapCommand *clientCreate (const TQString & path); + /** + * @brief Create a DELETE command + * @param path + * @return a DELETE imapCommand + */ + static imapCommand *clientDelete (const TQString & path); + /** + * @brief Create a SUBSCRIBE command + * @param path + * @return a SUBSCRIBE imapCommand + */ + static imapCommand *clientSubscribe (const TQString & path); + /** + * @brief Create a UNSUBSCRIBE command + * @param path + * @return a UNSUBSCRIBE imapCommand + */ + static imapCommand *clientUnsubscribe (const TQString & path); + /** + * @brief Create a EXPUNGE command + * @return a EXPUNGE imapCommand + */ + static imapCommand *clientExpunge (); + /** + * @brief Create a RENAME command + * @param src Source + * @param dest Destination + * @return a RENAME imapCommand + */ + static imapCommand *clientRename (const TQString & src, + const TQString & dest); + /** + * @brief Create a SEARCH command + * @param search + * @param nouid Perform a UID SEARCH or a SEARCH command + * @return a SEARCH imapCommand + */ + static imapCommand *clientSearch (const TQString & search, bool nouid = + false); + /** + * @brief Create a STORE command + * @param set + * @param item + * @param data + * @param nouid Perform a UID STORE or a STORE command + * @return a STORE imapCommand + */ + static imapCommand *clientStore (const TQString & set, const TQString & item, + const TQString & data, bool nouid = false); + /** + * @brief Create a LOGOUT command + * @return a LOGOUT imapCommand + */ + static imapCommand *clientLogout (); + /** + * @brief Create a STARTTLS command + * @return a STARTTLS imapCommand + */ + static imapCommand *clientStartTLS (); + + //////////// ACL support (RFC 2086) ///////////// + /** + * @brief Create a SETACL command + * @param box mailbox name + * @param user authentication identifier + * @param acl access right modification (starting with optional +/-) + * @return a SETACL imapCommand + */ + static imapCommand *clientSetACL ( const TQString& box, const TQString& user, const TQString& acl ); + + /** + * @brief Create a DELETEACL command + * @param box mailbox name + * @param user authentication identifier + * @return a DELETEACL imapCommand + */ + static imapCommand *clientDeleteACL ( const TQString& box, const TQString& user ); + + /** + * @brief Create a GETACL command + * @param box mailbox name + * @return a GETACL imapCommand + */ + static imapCommand *clientGetACL ( const TQString& box ); + + /** + * @brief Create a LISTRIGHTS command + * @param box mailbox name + * @param user authentication identifier + * @return a LISTRIGHTS imapCommand + */ + static imapCommand *clientListRights ( const TQString& box, const TQString& user ); + + /** + * @brief Create a MYRIGHTS command + * @param box mailbox name + * @return a MYRIGHTS imapCommand + */ + static imapCommand *clientMyRights ( const TQString& box ); + + //////////// ANNOTATEMORE support ///////////// + /** + * @brief Create a SETANNOTATION command + * @param box mailbox name + * @param entry entry specifier + * @param attributes map of attribute names + values + * @return a SETANNOTATION imapCommand + */ + static imapCommand *clientSetAnnotation ( const TQString& box, const TQString& entry, const TQMap& attributes ); + + /** + * @brief Create a GETANNOTATION command + * @param box mailbox name + * @param entry entry specifier + * @param attributeNames attribute specifier + * @return a GETANNOTATION imapCommand + */ + static imapCommand *clientGetAnnotation ( const TQString& box, const TQString& entry, const TQStringList& attributeNames ); + + /** + * @brief Create a NAMESPACE command + * @return a NAMESPACE imapCommand + */ + static imapCommand *clientNamespace (); + + /** + * @brief Create a GETQUOTAROOT command + * @param box mailbox name + * @return a GETQUOTAROOT imapCommand + */ + static imapCommand *clientGetQuotaroot ( const TQString& box ); + + /** + * @brief Create a custom command + * @param command The custom command + * @param arguments The custom arguments + * @return a custom imapCommand + */ + static imapCommand *clientCustom ( const TQString& command, const TQString& arguments ); + +protected: + TQString aCommand; + TQString mId; + bool mComplete; + TQString aParameter; + TQString mResult; + TQString mResultInfo; + +private: + imapCommand & operator = (const imapCommand &); +}; + +#endif diff --git a/tdeioslaves/imap4/imapinfo.cc b/tdeioslaves/imap4/imapinfo.cc new file mode 100644 index 00000000..4d1fc805 --- /dev/null +++ b/tdeioslaves/imap4/imapinfo.cc @@ -0,0 +1,236 @@ +/********************************************************************** + * + * imapinfo.cc - IMAP4rev1 SELECT / EXAMINE handler + * Copyright (C) 2000 Sven Carstens + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Send comments and bug fixes to + * + *********************************************************************/ + +/* + References: + RFC 2060 - Internet Message Access Protocol - Version 4rev1 - December 1996 + RFC 2192 - IMAP URL Scheme - September 1997 + RFC 1731 - IMAP Authentication Mechanisms - December 1994 + (Discusses KERBEROSv4, GSSAPI, and S/Key) + RFC 2195 - IMAP/POP AUTHorize Extension for Simple Challenge/Response + - September 1997 (CRAM-MD5 authentication method) + RFC 2104 - HMAC: Keyed-Hashing for Message Authentication - February 1997 + + Supported URLs: + imap://server/ - Prompt for user/pass, list all folders in home directory + imap://user:pass@server/ - Uses LOGIN to log in + imap://user;AUTH=method:pass@server/ - Uses AUTHENTICATE to log in + + imap://server/folder/ - List messages in folder + */ + +#include "imapinfo.h" +#include "imapparser.h" + +#include + +imapInfo::imapInfo ():count_ (0), +recent_ (0), +unseen_ (0), +uidValidity_ (0), +uidNext_ (0), +flags_ (0), +permanentFlags_ (0), +readWrite_ (false), +countAvailable_ (false), +recentAvailable_ (false), +unseenAvailable_ (false), +uidValidityAvailable_ (false), +uidNextAvailable_ (false), +flagsAvailable_ (false), +permanentFlagsAvailable_ (false), readWriteAvailable_ (false) +{ +} + +imapInfo::imapInfo (const imapInfo & mi):count_ (mi.count_), +recent_ (mi.recent_), +unseen_ (mi.unseen_), +uidValidity_ (mi.uidValidity_), +uidNext_ (mi.uidNext_), +flags_ (mi.flags_), +permanentFlags_ (mi.permanentFlags_), +readWrite_ (mi.readWrite_), +countAvailable_ (mi.countAvailable_), +recentAvailable_ (mi.recentAvailable_), +unseenAvailable_ (mi.unseenAvailable_), +uidValidityAvailable_ (mi.uidValidityAvailable_), +uidNextAvailable_ (mi.uidNextAvailable_), +flagsAvailable_ (mi.flagsAvailable_), +permanentFlagsAvailable_ (mi.permanentFlagsAvailable_), +readWriteAvailable_ (mi.readWriteAvailable_) +{ +} + +imapInfo & imapInfo::operator = (const imapInfo & mi) +{ + // Avoid a = a. + if (this == &mi) + return *this; + + count_ = mi.count_; + recent_ = mi.recent_; + unseen_ = mi.unseen_; + uidValidity_ = mi.uidValidity_; + uidNext_ = mi.uidNext_; + flags_ = mi.flags_; + permanentFlags_ = mi.permanentFlags_; + readWrite_ = mi.readWrite_; + countAvailable_ = mi.countAvailable_; + recentAvailable_ = mi.recentAvailable_; + unseenAvailable_ = mi.unseenAvailable_; + uidValidityAvailable_ = mi.uidValidityAvailable_; + uidNextAvailable_ = mi.uidNextAvailable_; + flagsAvailable_ = mi.flagsAvailable_; + permanentFlagsAvailable_ = mi.permanentFlagsAvailable_; + readWriteAvailable_ = mi.readWriteAvailable_; + + return *this; +} + +imapInfo::imapInfo (const TQStringList & list):count_ (0), +recent_ (0), +unseen_ (0), +uidValidity_ (0), +uidNext_ (0), +flags_ (0), +permanentFlags_ (0), +readWrite_ (false), +countAvailable_ (false), +recentAvailable_ (false), +unseenAvailable_ (false), +uidValidityAvailable_ (false), +uidNextAvailable_ (false), +flagsAvailable_ (false), +permanentFlagsAvailable_ (false), readWriteAvailable_ (false) +{ + for (TQStringList::ConstIterator it (list.begin ()); it != list.end (); ++it) + { + TQString line (*it); + + line.truncate(line.length() - 2); + TQStringList tokens(TQStringList::split (' ', line)); + + kdDebug(7116) << "Processing: " << line << endl; + if (tokens[0] != "*") + continue; + + if (tokens[1] == "OK") + { + if (tokens[2] == "[UNSEEN") + setUnseen (tokens[3].left (tokens[3].length () - 1).toULong ()); + + else if (tokens[2] == "[UIDVALIDITY") + setUidValidity (tokens[3].left (tokens[3].length () - 1).toULong ()); + + else if (tokens[2] == "[UIDNEXT") + setUidNext (tokens[3].left (tokens[3].length () - 1).toULong ()); + + else if (tokens[2] == "[PERMANENTFLAGS") + { + int flagsStart = line.find('('); + int flagsEnd = line.find(')'); + + kdDebug(7116) << "Checking permFlags from " << flagsStart << " to " << flagsEnd << endl; + if ((-1 != flagsStart) && (-1 != flagsEnd) && flagsStart < flagsEnd) + setPermanentFlags (_flags (line.mid (flagsStart, flagsEnd).latin1())); + + } + else if (tokens[2] == "[READ-WRITE") + { + setReadWrite (true); + } + else if (tokens[2] == "[READ-ONLY") + { + setReadWrite (false); + } + else + { + kdDebug(7116) << "unknown token2: " << tokens[2] << endl; + } + } + else if (tokens[1] == "FLAGS") + { + int flagsStart = line.find ('('); + int flagsEnd = line.find (')'); + + if ((-1 != flagsStart) && (-1 != flagsEnd) && flagsStart < flagsEnd) + setFlags (_flags (line.mid (flagsStart, flagsEnd).latin1() )); + } + else + { + if (tokens[2] == "EXISTS") + setCount (tokens[1].toULong ()); + + else if (tokens[2] == "RECENT") + setRecent (tokens[1].toULong ()); + + else + kdDebug(7116) << "unknown token1/2: " << tokens[1] << " " << tokens[2] << endl; + } + } + +} + +ulong imapInfo::_flags (const TQCString & inFlags) +{ + ulong flags = 0; + parseString flagsString; + flagsString.data.duplicate(inFlags.data(), inFlags.length()); + + if (flagsString[0] == '(') + flagsString.pos++; + + while (!flagsString.isEmpty () && flagsString[0] != ')') + { + TQCString entry = imapParser::parseOneWordC(flagsString).upper(); + + if (entry.isEmpty ()) + flagsString.clear(); + else if (0 != entry.contains ("\\SEEN")) + flags ^= Seen; + else if (0 != entry.contains ("\\ANSWERED")) + flags ^= Answered; + else if (0 != entry.contains ("\\FLAGGED")) + flags ^= Flagged; + else if (0 != entry.contains ("\\DELETED")) + flags ^= Deleted; + else if (0 != entry.contains ("\\DRAFT")) + flags ^= Draft; + else if (0 != entry.contains ("\\RECENT")) + flags ^= Recent; + else if (0 != entry.contains ("\\*")) + flags ^= User; + + // non standard kmail falgs + else if ( entry.contains( "KMAILFORWARDED" ) || entry.contains( "$FORWARDED" ) ) + flags = flags | Forwarded; + else if ( entry.contains( "KMAILTODO" ) || entry.contains( "$TODO" ) ) + flags = flags | Todo; + else if ( entry.contains( "KMAILWATCHED" ) || entry.contains( "$WATCHED" ) ) + flags = flags | Watched; + else if ( entry.contains( "KMAILIGNORED" ) || entry.contains( "$IGNORED" ) ) + flags = flags | Ignored; + } + + return flags; +} diff --git a/tdeioslaves/imap4/imapinfo.h b/tdeioslaves/imap4/imapinfo.h new file mode 100644 index 00000000..73505449 --- /dev/null +++ b/tdeioslaves/imap4/imapinfo.h @@ -0,0 +1,232 @@ +#ifndef _IMAPINFO_H +#define _IMAPINFO_H +/********************************************************************** + * + * imapinfo.h - IMAP4rev1 SELECT / EXAMINE handler + * Copyright (C) 2000 Sven Carstens + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Send comments and bug fixes to + * + *********************************************************************/ + +#include +#include + +//class handling the info we get on EXAMINE and SELECT +class imapInfo +{ +public: + + + enum MessageAttribute + { + Seen = 1 << 0, + Answered = 1 << 1, + Flagged = 1 << 2, + Deleted = 1 << 3, + Draft = 1 << 4, + Recent = 1 << 5, + User = 1 << 6, + // non standard flags + Forwarded = 1 << 7, + Todo = 1 << 8, + Watched = 1 << 9, + Ignored = 1 << 10 + }; + + + imapInfo (); + imapInfo (const TQStringList &); + imapInfo (const imapInfo &); + imapInfo & operator = (const imapInfo &); + + static ulong _flags (const TQCString &); + + void setCount (ulong l) + { + countAvailable_ = true; + count_ = l; + } + + void setRecent (ulong l) + { + recentAvailable_ = true; + recent_ = l; + } + + void setUnseen (ulong l) + { + unseenAvailable_ = true; + unseen_ = l; + } + + void setUidValidity (ulong l) + { + uidValidityAvailable_ = true; + uidValidity_ = l; + } + + void setUidNext (ulong l) + { + uidNextAvailable_ = true; + uidNext_ = l; + } + + void setFlags (ulong l) + { + flagsAvailable_ = true; + flags_ = l; + } + + void setFlags (const TQCString & inFlag) + { + flagsAvailable_ = true; + flags_ = _flags (inFlag); + } + + void setPermanentFlags (ulong l) + { + permanentFlagsAvailable_ = true; + permanentFlags_ = l; + } + + void setPermanentFlags (const TQCString & inFlag) + { + permanentFlagsAvailable_ = true; + permanentFlags_ = _flags (inFlag); + } + + void setReadWrite (bool b) + { + readWriteAvailable_ = true; + readWrite_ = b; + } + + void setAlert( const char* cstr ) + { + alert_ = cstr; + } + + ulong count () const + { + return count_; + } + + ulong recent () const + { + return recent_; + } + + ulong unseen () const + { + return unseen_; + } + + ulong uidValidity () const + { + return uidValidity_; + } + + ulong uidNext () const + { + return uidNext_; + } + + ulong flags () const + { + return flags_; + } + + ulong permanentFlags () const + { + return permanentFlags_; + } + + bool readWrite () const + { + return readWrite_; + } + + ulong countAvailable () const + { + return countAvailable_; + } + + ulong recentAvailable () const + { + return recentAvailable_; + } + + ulong unseenAvailable () const + { + return unseenAvailable_; + } + + ulong uidValidityAvailable () const + { + return uidValidityAvailable_; + } + + ulong uidNextAvailable () const + { + return uidNextAvailable_; + } + + ulong flagsAvailable () const + { + return flagsAvailable_; + } + + ulong permanentFlagsAvailable () const + { + return permanentFlagsAvailable_; + } + + bool readWriteAvailable () const + { + return readWriteAvailable_; + } + + TQCString alert() const + { + return alert_; + } + +private: + + TQCString alert_; + + ulong count_; + ulong recent_; + ulong unseen_; + ulong uidValidity_; + ulong uidNext_; + ulong flags_; + ulong permanentFlags_; + bool readWrite_; + + bool countAvailable_; + bool recentAvailable_; + bool unseenAvailable_; + bool uidValidityAvailable_; + bool uidNextAvailable_; + bool flagsAvailable_; + bool permanentFlagsAvailable_; + bool readWriteAvailable_; +}; + +#endif diff --git a/tdeioslaves/imap4/imaplist.cc b/tdeioslaves/imap4/imaplist.cc new file mode 100644 index 00000000..92918d8c --- /dev/null +++ b/tdeioslaves/imap4/imaplist.cc @@ -0,0 +1,135 @@ +/********************************************************************** + * + * imapinfo.cc - IMAP4rev1 EXAMINE / SELECT handler + * Copyright (C) 2000 Sven Carstens + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Send comments and bug fixes to + * + *********************************************************************/ + +/* + References: + RFC 2060 - Internet Message Access Protocol - Version 4rev1 - December 1996 + RFC 2192 - IMAP URL Scheme - September 1997 + RFC 1731 - IMAP Authentication Mechanisms - December 1994 + (Discusses KERBEROSv4, GSSAPI, and S/Key) + RFC 2195 - IMAP/POP AUTHorize Extension for Simple Challenge/Response + - September 1997 (CRAM-MD5 authentication method) + RFC 2104 - HMAC: Keyed-Hashing for Message Authentication - February 1997 + + Supported URLs: + imap://server/ - Prompt for user/pass, list all folders in home directory + imap://user:pass@server/ - Uses LOGIN to log in + imap://user;AUTH=method:pass@server/ - Uses AUTHENTICATE to log in + + imap://server/folder/ - List messages in folder + */ + +#include "rfcdecoder.h" +#include "imaplist.h" +#include "imapparser.h" + +#include + +imapList::imapList (): parser_(0), noInferiors_ (false), +noSelect_ (false), marked_ (false), unmarked_ (false), +hasChildren_ (false), hasNoChildren_ (false) +{ +} + +imapList::imapList (const imapList & lr):parser_(lr.parser_), +hierarchyDelimiter_ (lr.hierarchyDelimiter_), +name_ (lr.name_), +noInferiors_ (lr.noInferiors_), +noSelect_ (lr.noSelect_), marked_ (lr.marked_), unmarked_ (lr.unmarked_), +hasChildren_ (lr.hasChildren_), hasNoChildren_ (lr.hasNoChildren_), +attributes_ (lr.attributes_) +{ +} + +imapList & imapList::operator = (const imapList & lr) +{ + // Avoid a = a. + if (this == &lr) + return *this; + + parser_ = lr.parser_; + hierarchyDelimiter_ = lr.hierarchyDelimiter_; + name_ = lr.name_; + noInferiors_ = lr.noInferiors_; + noSelect_ = lr.noSelect_; + marked_ = lr.marked_; + unmarked_ = lr.unmarked_; + hasChildren_ = lr.hasChildren_; + hasNoChildren_ = lr.hasNoChildren_; + attributes_ = lr.attributes_; + + return *this; +} + +imapList::imapList (const TQString & inStr, imapParser &parser) +: parser_(&parser), +noInferiors_ (false), +noSelect_ (false), +marked_ (false), unmarked_ (false), hasChildren_ (false), +hasNoChildren_ (false) +{ + parseString s; + s.data.duplicate(inStr.latin1(), inStr.length()); + + if (s[0] != '(') + return; //not proper format for us + + s.pos++; // tie off ( + + parseAttributes( s ); + + s.pos++; // tie off ) + parser_->skipWS (s); + + hierarchyDelimiter_ = parser_->parseOneWordC(s); + if (hierarchyDelimiter_ == "NIL") + hierarchyDelimiter_ = TQString(); + name_ = rfcDecoder::fromIMAP (parser_->parseLiteral (s)); // decode modified UTF7 +} + +void imapList::parseAttributes( parseString & str ) +{ + TQCString attribute, orig; + + while ( !str.isEmpty () && str[0] != ')' ) + { + orig = parser_->parseOneWordC(str); + attributes_ << orig; + attribute = orig.lower(); + if (-1 != attribute.find ("\\noinferiors")) + noInferiors_ = true; + else if (-1 != attribute.find ("\\noselect")) + noSelect_ = true; + else if (-1 != attribute.find ("\\marked")) + marked_ = true; + else if (-1 != attribute.find ("\\unmarked")) + unmarked_ = true; + else if (-1 != attribute.find ("\\haschildren")) + hasChildren_ = true; + else if (-1 != attribute.find ("\\hasnochildren")) + hasNoChildren_ = true; + else + kdDebug(7116) << "imapList::imapList: bogus attribute " << attribute << endl; + } +} + diff --git a/tdeioslaves/imap4/imaplist.h b/tdeioslaves/imap4/imaplist.h new file mode 100644 index 00000000..9aa01f78 --- /dev/null +++ b/tdeioslaves/imap4/imaplist.h @@ -0,0 +1,137 @@ +#ifndef _IMAPLIST_H +#define _IMAPLIST_H +/********************************************************************** + * + * imaplist.h - IMAP4rev1 list response handler + * Copyright (C) 2000 Sven Carstens + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Send comments and bug fixes to + * + *********************************************************************/ + +#include +#include + +class parseString; +class imapParser; + +//the class handling the responses from list +class imapList +{ +public: + + imapList (); + imapList (const TQString &, imapParser &); + imapList (const imapList &); + imapList & operator = (const imapList &); + + // process the attributes + void parseAttributes( parseString & ); + + // return all atributes concatenated + TQString attributesAsString() const + { + return attributes_.join(","); + } + + TQString hierarchyDelimiter () const + { + return hierarchyDelimiter_; + } + void setHierarchyDelimiter (const TQString & _str) + { + hierarchyDelimiter_ = _str; + } + + TQString name () const + { + return name_; + } + void setName (const TQString & _str) + { + name_ = _str; + } + + bool noInferiors () const + { + return noInferiors_; + } + void setNoInferiors (bool _val) + { + noInferiors_ = _val; + } + + bool noSelect () const + { + return noSelect_; + } + void setNoSelect (bool _val) + { + noSelect_ = _val; + } + + bool hasChildren () const + { + return hasChildren_; + } + void setHasChildren (bool _val) + { + hasChildren_ = _val; + } + + bool hasNoChildren () const + { + return hasNoChildren_; + } + void setHasNoChildren (bool _val) + { + hasNoChildren_ = _val; + } + + bool marked () const + { + return marked_; + } + void setMarked (bool _val) + { + marked_ = _val; + } + + bool unmarked () const + { + return unmarked_; + } + void setUnmarked (bool _val) + { + unmarked_ = _val; + } + +private: + + imapParser* parser_; + TQString hierarchyDelimiter_; + TQString name_; + bool noInferiors_; + bool noSelect_; + bool marked_; + bool unmarked_; + bool hasChildren_; + bool hasNoChildren_; + TQStringList attributes_; +}; + +#endif diff --git a/tdeioslaves/imap4/imapparser.cc b/tdeioslaves/imap4/imapparser.cc new file mode 100644 index 00000000..8cb06e31 --- /dev/null +++ b/tdeioslaves/imap4/imapparser.cc @@ -0,0 +1,2094 @@ +/********************************************************************** + * + * imapparser.cc - IMAP4rev1 Parser + * Copyright (C) 2001-2002 Michael Haeckel + * Copyright (C) 2000 s.carstens@gmx.de + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Send comments and bug fixes to s.carstens@gmx.de + * + *********************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "rfcdecoder.h" + +#include "imapparser.h" + +#include "imapinfo.h" + +#include "mailheader.h" +#include "mimeheader.h" +#include "mailaddress.h" + +#include + +#include +#include + +#ifdef HAVE_LIBSASL2 +extern "C" { +#include +} +#endif + +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#ifdef HAVE_LIBSASL2 +static sasl_callback_t callbacks[] = { + { SASL_CB_ECHOPROMPT, NULL, NULL }, + { SASL_CB_NOECHOPROMPT, NULL, NULL }, + { SASL_CB_GETREALM, NULL, NULL }, + { SASL_CB_USER, NULL, NULL }, + { SASL_CB_AUTHNAME, NULL, NULL }, + { SASL_CB_PASS, NULL, NULL }, + { SASL_CB_CANON_USER, NULL, NULL }, + { SASL_CB_LIST_END, NULL, NULL } +}; +#endif + +imapParser::imapParser () +{ + sentQueue.setAutoDelete (false); + completeQueue.setAutoDelete (true); + currentState = ISTATE_NO; + commandCounter = 0; + lastHandled = 0; +} + +imapParser::~imapParser () +{ + delete lastHandled; + lastHandled = 0; +} + +imapCommand * +imapParser::doCommand (imapCommand * aCmd) +{ + int pl = 0; + sendCommand (aCmd); + while (pl != -1 && !aCmd->isComplete ()) { + while ((pl = parseLoop ()) == 0) + ; + } + + return aCmd; +} + +imapCommand * +imapParser::sendCommand (imapCommand * aCmd) +{ + aCmd->setId (TQString::number(commandCounter++)); + sentQueue.append (aCmd); + + continuation.resize(0); + const TQString& command = aCmd->command(); + + if (command == "SELECT" || command == "EXAMINE") + { + // we need to know which box we are selecting + parseString p; + p.fromString(aCmd->parameter()); + currentBox = parseOneWordC(p); + kdDebug(7116) << "imapParser::sendCommand - setting current box to " << currentBox << endl; + } + else if (command == "CLOSE") + { + // we no longer have a box open + currentBox = TQString(); + } + else if (command.find ("SEARCH") != -1 + || command == "GETACL" + || command == "LISTRIGHTS" + || command == "MYRIGHTS" + || command == "GETANNOTATION" + || command == "NAMESPACE" + || command == "GETQUOTAROOT" + || command == "GETQUOTA" + || command == "X-GET-OTHER-USERS" + || command == "X-GET-DELEGATES" + || command == "X-GET-OUT-OF-OFFICE") + { + lastResults.clear (); + } + else if (command == "LIST" + || command == "LSUB") + { + listResponses.clear (); + } + parseWriteLine (aCmd->getStr ()); + return aCmd; +} + +bool +imapParser::clientLogin (const TQString & aUser, const TQString & aPass, + TQString & resultInfo) +{ + imapCommand *cmd; + bool retVal = false; + + cmd = + doCommand (new + imapCommand ("LOGIN", "\"" + rfcDecoder::quoteIMAP(aUser) + + "\" \"" + rfcDecoder::quoteIMAP(aPass) + "\"")); + + if (cmd->result () == "OK") + { + currentState = ISTATE_LOGIN; + retVal = true; + } + resultInfo = cmd->resultInfo(); + completeQueue.removeRef (cmd); + + return retVal; +} + +#ifdef HAVE_LIBSASL2 +static bool sasl_interact( TDEIO::SlaveBase *slave, TDEIO::AuthInfo &ai, void *in ) +{ + kdDebug(7116) << "sasl_interact" << endl; + sasl_interact_t *interact = ( sasl_interact_t * ) in; + + //some mechanisms do not require username && pass, so it doesn't need a popup + //window for getting this info + for ( ; interact->id != SASL_CB_LIST_END; interact++ ) { + if ( interact->id == SASL_CB_AUTHNAME || + interact->id == SASL_CB_PASS ) { + + if ( ai.username.isEmpty() || ai.password.isEmpty() ) { + if (!slave->openPassDlg(ai)) + return false; + } + break; + } + } + + interact = ( sasl_interact_t * ) in; + while( interact->id != SASL_CB_LIST_END ) { + kdDebug(7116) << "SASL_INTERACT id: " << interact->id << endl; + switch( interact->id ) { + case SASL_CB_USER: + case SASL_CB_AUTHNAME: + kdDebug(7116) << "SASL_CB_[USER|AUTHNAME]: '" << ai.username << "'" << endl; + interact->result = strdup( ai.username.utf8() ); + interact->len = strlen( (const char *) interact->result ); + break; + case SASL_CB_PASS: + kdDebug(7116) << "SASL_CB_PASS: [hidden] " << endl; + interact->result = strdup( ai.password.utf8() ); + interact->len = strlen( (const char *) interact->result ); + break; + default: + interact->result = 0; + interact->len = 0; + break; + } + interact++; + } + return true; +} +#endif + +bool +imapParser::clientAuthenticate ( TDEIO::SlaveBase *slave, TDEIO::AuthInfo &ai, + const TQString & aFTQDN, const TQString & aAuth, bool isSSL, TQString & resultInfo) +{ + bool retVal = false; +#ifdef HAVE_LIBSASL2 + int result; + sasl_conn_t *conn = 0; + sasl_interact_t *client_interact = 0; + const char *out = 0; + uint outlen = 0; + const char *mechusing = 0; + TQByteArray tmp, challenge; + + kdDebug(7116) << "aAuth: " << aAuth << " FTQDN: " << aFTQDN << " isSSL: " << isSSL << endl; + + // see if server supports this authenticator + if (!hasCapability ("AUTH=" + aAuth)) + return false; + +// result = sasl_client_new( isSSL ? "imaps" : "imap", + result = sasl_client_new( "imap", /* FIXME: with cyrus-imapd, even imaps' digest-uri + must be 'imap'. I don't know if it's good or bad. */ + aFTQDN.latin1(), + 0, 0, callbacks, 0, &conn ); + + if ( result != SASL_OK ) { + kdDebug(7116) << "sasl_client_new failed with: " << result << endl; + resultInfo = TQString::fromUtf8( sasl_errdetail( conn ) ); + return false; + } + + do { + result = sasl_client_start(conn, aAuth.latin1(), &client_interact, + hasCapability("SASL-IR") ? &out : 0, &outlen, &mechusing); + + if ( result == SASL_INTERACT ) { + if ( !sasl_interact( slave, ai, client_interact ) ) { + sasl_dispose( &conn ); + return false; + } + } + } while ( result == SASL_INTERACT ); + + if ( result != SASL_CONTINUE && result != SASL_OK ) { + kdDebug(7116) << "sasl_client_start failed with: " << result << endl; + resultInfo = TQString::fromUtf8( sasl_errdetail( conn ) ); + sasl_dispose( &conn ); + return false; + } + imapCommand *cmd; + + tmp.setRawData( out, outlen ); + KCodecs::base64Encode( tmp, challenge ); + tmp.resetRawData( out, outlen ); + // then lets try it + TQString firstCommand = aAuth; + if ( !challenge.isEmpty() ) { + firstCommand += " "; + firstCommand += TQString::fromLatin1( challenge.data(), challenge.size() ); + } + cmd = sendCommand (new imapCommand ("AUTHENTICATE", firstCommand.latin1())); + + int pl = 0; + while ( pl != -1 && !cmd->isComplete () ) + { + //read the next line + while ((pl = parseLoop()) == 0) ; + + if (!continuation.isEmpty()) + { +// kdDebug(7116) << "S: " << TQCString(continuation.data(),continuation.size()+1) << endl; + if ( continuation.size() > 4 ) { + tmp.setRawData( continuation.data() + 2, continuation.size() - 4 ); + KCodecs::base64Decode( tmp, challenge ); +// kdDebug(7116) << "S-1: " << TQCString(challenge.data(),challenge.size()+1) << endl; + tmp.resetRawData( continuation.data() + 2, continuation.size() - 4 ); + } + + do { + result = sasl_client_step(conn, challenge.isEmpty() ? 0 : challenge.data(), + challenge.size(), + &client_interact, + &out, &outlen); + + if (result == SASL_INTERACT) { + if ( !sasl_interact( slave, ai, client_interact ) ) { + sasl_dispose( &conn ); + return false; + } + } + } while ( result == SASL_INTERACT ); + + if ( result != SASL_CONTINUE && result != SASL_OK ) { + kdDebug(7116) << "sasl_client_step failed with: " << result << endl; + resultInfo = TQString::fromUtf8( sasl_errdetail( conn ) ); + sasl_dispose( &conn ); + return false; + } + + tmp.setRawData( out, outlen ); +// kdDebug(7116) << "C-1: " << TQCString(tmp.data(),tmp.size()+1) << endl; + KCodecs::base64Encode( tmp, challenge ); + tmp.resetRawData( out, outlen ); +// kdDebug(7116) << "C: " << TQCString(challenge.data(),challenge.size()+1) << endl; + parseWriteLine (challenge); + continuation.resize(0); + } + } + + if (cmd->result () == "OK") + { + currentState = ISTATE_LOGIN; + retVal = true; + } + resultInfo = cmd->resultInfo(); + completeQueue.removeRef (cmd); + + sasl_dispose( &conn ); //we don't use sasl_en/decode(), so it's safe to dispose the connection. +#endif //HAVE_LIBSASL2 + return retVal; +} + +void +imapParser::parseUntagged (parseString & result) +{ + //kdDebug(7116) << "imapParser::parseUntagged - '" << result.cstr() << "'" << endl; + + parseOneWordC(result); // * + TQByteArray what = parseLiteral (result); // see whats coming next + + if(!what.isEmpty ()) { + switch (what[0]) + { + //the status responses + case 'B': // BAD or BYE + if (tqstrncmp(what, "BAD", what.size()) == 0) + { + parseResult (what, result); + } + else if (tqstrncmp(what, "BYE", what.size()) == 0) + { + parseResult (what, result); + if ( sentQueue.count() ) { + // BYE that interrupts a command -> copy the reason for it + imapCommand *current = sentQueue.at (0); + current->setResultInfo(result.cstr()); + } + currentState = ISTATE_NO; + } + break; + + case 'N': // NO + if (what[1] == 'O' && what.size() == 2) + { + parseResult (what, result); + } + else if (tqstrncmp(what, "NAMESPACE", what.size()) == 0) + { + parseNamespace (result); + } + break; + + case 'O': // OK + if (what[1] == 'K' && what.size() == 2) + { + parseResult (what, result); + } else if (tqstrncmp(what, "OTHER-USER", 10) == 0) { // X-GET-OTHER-USER + parseOtherUser (result); + } else if (tqstrncmp(what, "OUT-OF-OFFICE", 13) == 0) { // X-GET-OUT-OF-OFFICE + parseOutOfOffice (result); + } + break; + case 'D': + if (tqstrncmp(what, "DELEGATE", 8) == 0) { // X-GET-DELEGATES + parseDelegate (result); + } + break; + + case 'P': // PREAUTH + if (tqstrncmp(what, "PREAUTH", what.size()) == 0) + { + parseResult (what, result); + currentState = ISTATE_LOGIN; + } + break; + + // parse the other responses + case 'C': // CAPABILITY + if (tqstrncmp(what, "CAPABILITY", what.size()) == 0) + { + parseCapability (result); + } + break; + + case 'F': // FLAGS + if (tqstrncmp(what, "FLAGS", what.size()) == 0) + { + parseFlags (result); + } + break; + + case 'L': // LIST or LSUB or LISTRIGHTS + if (tqstrncmp(what, "LIST", what.size()) == 0) + { + parseList (result); + } + else if (tqstrncmp(what, "LSUB", what.size()) == 0) + { + parseLsub (result); + } + else if (tqstrncmp(what, "LISTRIGHTS", what.size()) == 0) + { + parseListRights (result); + } + break; + + case 'M': // MYRIGHTS + if (tqstrncmp(what, "MYRIGHTS", what.size()) == 0) + { + parseMyRights (result); + } + break; + case 'S': // SEARCH or STATUS + if (tqstrncmp(what, "SEARCH", what.size()) == 0) + { + parseSearch (result); + } + else if (tqstrncmp(what, "STATUS", what.size()) == 0) + { + parsetStatus (result); + } + break; + + case 'A': // ACL or ANNOTATION + if (tqstrncmp(what, "ACL", what.size()) == 0) + { + parseAcl (result); + } + else if (tqstrncmp(what, "ANNOTATION", what.size()) == 0) + { + parseAnnotation (result); + } + break; + case 'Q': // QUOTA or QUOTAROOT + if ( what.size() > 5 && tqstrncmp(what, "QUOTAROOT", what.size()) == 0) + { + parseQuotaRoot( result ); + } + else if (tqstrncmp(what, "QUOTA", what.size()) == 0) + { + parseQuota( result ); + } + break; + case 'X': // Custom command + { + parseCustom( result ); + } + break; + default: + //better be a number + { + ulong number; + bool valid; + + number = TQCString(what, what.size() + 1).toUInt(&valid); + if (valid) + { + what = parseLiteral (result); + if(!what.isEmpty ()) { + switch (what[0]) + { + case 'E': + if (tqstrncmp(what, "EXISTS", what.size()) == 0) + { + parseExists (number, result); + } + else if (tqstrncmp(what, "EXPUNGE", what.size()) == 0) + { + parseExpunge (number, result); + } + break; + + case 'F': + if (tqstrncmp(what, "FETCH", what.size()) == 0) + { + seenUid = TQString(); + parseFetch (number, result); + } + break; + + case 'S': + if (tqstrncmp(what, "STORE", what.size()) == 0) // deprecated store + { + seenUid = TQString(); + parseFetch (number, result); + } + break; + + case 'R': + if (tqstrncmp(what, "RECENT", what.size()) == 0) + { + parseRecent (number, result); + } + break; + default: + break; + } + } + } + } + break; + } //switch + } +} //func + + +void +imapParser::parseResult (TQByteArray & result, parseString & rest, + const TQString & command) +{ + if (command == "SELECT") + selectInfo.setReadWrite(true); + + if (rest[0] == '[') + { + rest.pos++; + TQCString option = parseOneWordC(rest, TRUE); + + switch (option[0]) + { + case 'A': // ALERT + if (option == "ALERT") + { + rest.pos = rest.data.find(']', rest.pos) + 1; + // The alert text is after [ALERT]. + // Is this correct or do we need to care about litterals? + selectInfo.setAlert( rest.cstr() ); + } + break; + + case 'N': // NEWNAME + if (option == "NEWNAME") + { + } + break; + + case 'P': //PARSE or PERMANENTFLAGS + if (option == "PARSE") + { + } + else if (option == "PERMANENTFLAGS") + { + uint end = rest.data.find(']', rest.pos); + TQCString flags(rest.data.data() + rest.pos, end - rest.pos); + selectInfo.setPermanentFlags (flags); + rest.pos = end; + } + break; + + case 'R': //READ-ONLY or READ-WRITE + if (option == "READ-ONLY") + { + selectInfo.setReadWrite (false); + } + else if (option == "READ-WRITE") + { + selectInfo.setReadWrite (true); + } + break; + + case 'T': //TRYCREATE + if (option == "TRYCREATE") + { + } + break; + + case 'U': //UIDVALIDITY or UNSEEN + if (option == "UIDVALIDITY") + { + ulong value; + if (parseOneNumber (rest, value)) + selectInfo.setUidValidity (value); + } + else if (option == "UNSEEN") + { + ulong value; + if (parseOneNumber (rest, value)) + selectInfo.setUnseen (value); + } + else if (option == "UIDNEXT") + { + ulong value; + if (parseOneNumber (rest, value)) + selectInfo.setUidNext (value); + } + else + break; + + } + if (rest[0] == ']') + rest.pos++; //tie off ] + skipWS (rest); + } + + if (command.isEmpty()) + { + // This happens when parsing an intermediate result line (those that start with '*'). + // No state change involved, so we can stop here. + return; + } + + switch (command[0].latin1 ()) + { + case 'A': + if (command == "AUTHENTICATE") + if (tqstrncmp(result, "OK", result.size()) == 0) + currentState = ISTATE_LOGIN; + break; + + case 'L': + if (command == "LOGIN") + if (tqstrncmp(result, "OK", result.size()) == 0) + currentState = ISTATE_LOGIN; + break; + + case 'E': + if (command == "EXAMINE") + { + if (tqstrncmp(result, "OK", result.size()) == 0) + currentState = ISTATE_SELECT; + else + { + if (currentState == ISTATE_SELECT) + currentState = ISTATE_LOGIN; + currentBox = TQString(); + } + kdDebug(7116) << "imapParser::parseResult - current box is now " << currentBox << endl; + } + break; + + case 'S': + if (command == "SELECT") + { + if (tqstrncmp(result, "OK", result.size()) == 0) + currentState = ISTATE_SELECT; + else + { + if (currentState == ISTATE_SELECT) + currentState = ISTATE_LOGIN; + currentBox = TQString(); + } + kdDebug(7116) << "imapParser::parseResult - current box is now " << currentBox << endl; + } + break; + + default: + break; + } + +} + +void imapParser::parseCapability (parseString & result) +{ + TQCString temp( result.cstr() ); + imapCapabilities = TQStringList::split ( ' ', KPIM::kAsciiToLower( temp.data() ) ); +} + +void imapParser::parseFlags (parseString & result) +{ + selectInfo.setFlags(result.cstr()); +} + +void imapParser::parseList (parseString & result) +{ + imapList this_one; + + if (result[0] != '(') + return; //not proper format for us + + result.pos++; // tie off ( + + this_one.parseAttributes( result ); + + result.pos++; // tie off ) + skipWS (result); + + this_one.setHierarchyDelimiter(parseLiteralC(result)); + this_one.setName (rfcDecoder::fromIMAP(parseLiteralC(result))); // decode modified UTF7 + + listResponses.append (this_one); +} + +void imapParser::parseLsub (parseString & result) +{ + imapList this_one (result.cstr(), *this); + listResponses.append (this_one); +} + +void imapParser::parseListRights (parseString & result) +{ + parseOneWordC (result); // skip mailbox name + parseOneWordC (result); // skip user id + int outlen = 1; + while ( outlen ) { + TQCString word = parseOneWordC (result, false, &outlen); + lastResults.append (word); + } +} + +void imapParser::parseAcl (parseString & result) +{ + parseOneWordC (result); // skip mailbox name + int outlen = 1; + // The result is user1 perm1 user2 perm2 etc. The caller will sort it out. + while ( outlen && !result.isEmpty() ) { + TQCString word = parseLiteralC (result, false, false, &outlen); + lastResults.append (word); + } +} + +void imapParser::parseAnnotation (parseString & result) +{ + parseOneWordC (result); // skip mailbox name + skipWS (result); + parseOneWordC (result); // skip entry name (we know it since we don't allow wildcards in it) + skipWS (result); + if (result.isEmpty() || result[0] != '(') + return; + result.pos++; + skipWS (result); + int outlen = 1; + // The result is name1 value1 name2 value2 etc. The caller will sort it out. + while ( outlen && !result.isEmpty() && result[0] != ')' ) { + TQCString word = parseLiteralC (result, false, false, &outlen); + lastResults.append (word); + } +} + + +void imapParser::parseQuota (parseString & result) +{ + // quota_response ::= "QUOTA" SP astring SP quota_list + // quota_list ::= "(" #quota_resource ")" + // quota_resource ::= atom SP number SP number + TQCString root = parseOneWordC( result ); + if ( root.isEmpty() ) { + lastResults.append( "" ); + } else { + lastResults.append( root ); + } + if (result.isEmpty() || result[0] != '(') + return; + result.pos++; + skipWS (result); + TQStringList triplet; + int outlen = 1; + while ( outlen && !result.isEmpty() && result[0] != ')' ) { + TQCString word = parseLiteralC (result, false, false, &outlen); + triplet.append(word); + } + lastResults.append( triplet.join(" ") ); +} + +void imapParser::parseQuotaRoot (parseString & result) +{ + // quotaroot_response + // ::= "QUOTAROOT" SP astring *(SP astring) + parseOneWordC (result); // skip mailbox name + skipWS (result); + if ( result.isEmpty() ) + return; + TQStringList roots; + int outlen = 1; + while ( outlen && !result.isEmpty() ) { + TQCString word = parseLiteralC (result, false, false, &outlen); + roots.append (word); + } + lastResults.append( roots.isEmpty()? "" : roots.join(" ") ); +} + +void imapParser::parseCustom (parseString & result) +{ + int outlen = 1; + TQCString word = parseLiteralC (result, false, false, &outlen); + lastResults.append( word ); +} + +void imapParser::parseOtherUser (parseString & result) +{ + lastResults.append( parseOneWordC( result ) ); +} + +void imapParser::parseDelegate (parseString & result) +{ + const TQString email = parseOneWordC( result ); + + TQStringList rights; + int outlen = 1; + while ( outlen && !result.isEmpty() ) { + TQCString word = parseLiteralC( result, false, false, &outlen ); + rights.append( word ); + } + + lastResults.append( email + ":" + rights.join( "," ) ); +} + +void imapParser::parseOutOfOffice (parseString & result) +{ + const TQString state = parseOneWordC (result); + parseOneWordC (result); // skip encoding + + int outlen = 1; + TQCString msg = parseLiteralC (result, false, false, &outlen); + + lastResults.append( state + "^" + TQString::fromUtf8( msg ) ); +} + +void imapParser::parseMyRights (parseString & result) +{ + parseOneWordC (result); // skip mailbox name + Q_ASSERT( lastResults.isEmpty() ); // we can only be called once + lastResults.append (parseOneWordC (result) ); +} + +void imapParser::parseSearch (parseString & result) +{ + ulong value; + + while (parseOneNumber (result, value)) + { + lastResults.append (TQString::number(value)); + } +} + +void imapParser::parsetStatus (parseString & inWords) +{ + lasStatus = imapInfo (); + + parseLiteralC(inWords); // swallow the box + if (inWords.isEmpty() || inWords[0] != '(') + return; + + inWords.pos++; + skipWS (inWords); + + while (!inWords.isEmpty() && inWords[0] != ')') + { + ulong value; + + TQCString label = parseOneWordC(inWords); + if (parseOneNumber (inWords, value)) + { + if (label == "MESSAGES") + lasStatus.setCount (value); + else if (label == "RECENT") + lasStatus.setRecent (value); + else if (label == "UIDVALIDITY") + lasStatus.setUidValidity (value); + else if (label == "UNSEEN") + lasStatus.setUnseen (value); + else if (label == "UIDNEXT") + lasStatus.setUidNext (value); + } + } + + if (inWords[0] == ')') + inWords.pos++; + skipWS (inWords); +} + +void imapParser::parseExists (ulong value, parseString & result) +{ + selectInfo.setCount (value); + result.pos = result.data.size(); +} + +void imapParser::parseExpunge (ulong value, parseString & result) +{ + Q_UNUSED(value); + Q_UNUSED(result); +} + +void imapParser::parseAddressList (parseString & inWords, TQPtrList& list) +{ + if (inWords.isEmpty()) + return; + if (inWords[0] != '(') + { + parseOneWordC (inWords); // parse NIL + } + else + { + inWords.pos++; + skipWS (inWords); + + while (!inWords.isEmpty () && inWords[0] != ')') + { + if (inWords[0] == '(') { + mailAddress *addr = new mailAddress; + parseAddress(inWords, *addr); + list.append(addr); + } else { + break; + } + } + + if (!inWords.isEmpty() && inWords[0] == ')') + inWords.pos++; + skipWS (inWords); + } +} + +const mailAddress& imapParser::parseAddress (parseString & inWords, mailAddress& retVal) +{ + inWords.pos++; + skipWS (inWords); + + retVal.setFullName(parseLiteralC(inWords)); + retVal.setCommentRaw(parseLiteralC(inWords)); + retVal.setUser(parseLiteralC(inWords)); + retVal.setHost(parseLiteralC(inWords)); + + if (!inWords.isEmpty() && inWords[0] == ')') + inWords.pos++; + skipWS (inWords); + + return retVal; +} + +mailHeader * imapParser::parseEnvelope (parseString & inWords) +{ + mailHeader *envelope = 0; + + if (inWords[0] != '(') + return envelope; + inWords.pos++; + skipWS (inWords); + + envelope = new mailHeader; + + //date + envelope->setDate(parseLiteralC(inWords)); + + //subject + envelope->setSubject(parseLiteralC(inWords)); + + TQPtrList list; + list.setAutoDelete(true); + + //from + parseAddressList(inWords, list); + if (!list.isEmpty()) { + envelope->setFrom(*list.last()); + list.clear(); + } + + //sender + parseAddressList(inWords, list); + if (!list.isEmpty()) { + envelope->setSender(*list.last()); + list.clear(); + } + + //reply-to + parseAddressList(inWords, list); + if (!list.isEmpty()) { + envelope->setReplyTo(*list.last()); + list.clear(); + } + + //to + parseAddressList (inWords, envelope->to()); + + //cc + parseAddressList (inWords, envelope->cc()); + + //bcc + parseAddressList (inWords, envelope->bcc()); + + //in-reply-to + envelope->setInReplyTo(parseLiteralC(inWords)); + + //message-id + envelope->setMessageId(parseLiteralC(inWords)); + + // see if we have more to come + while (!inWords.isEmpty () && inWords[0] != ')') + { + //eat the extensions to this part + if (inWords[0] == '(') + parseSentence (inWords); + else + parseLiteralC (inWords); + } + + if (!inWords.isEmpty() && inWords[0] == ')') + inWords.pos++; + skipWS (inWords); + + return envelope; +} + +// parse parameter pairs into a dictionary +// caller must clean up the dictionary items +TQAsciiDict < TQString > imapParser::parseDisposition (parseString & inWords) +{ + TQCString disposition; + TQAsciiDict < TQString > retVal (17, false); + + // return value is a shallow copy + retVal.setAutoDelete (false); + + if (inWords[0] != '(') + { + //disposition only + disposition = parseOneWordC (inWords); + } + else + { + inWords.pos++; + skipWS (inWords); + + //disposition + disposition = parseOneWordC (inWords); + retVal = parseParameters (inWords); + if (inWords[0] != ')') + return retVal; + inWords.pos++; + skipWS (inWords); + } + + if (!disposition.isEmpty ()) + { + retVal.insert ("content-disposition", new TQString(disposition)); + } + + return retVal; +} + +// parse parameter pairs into a dictionary +// caller must clean up the dictionary items +TQAsciiDict < TQString > imapParser::parseParameters (parseString & inWords) +{ + TQAsciiDict < TQString > retVal (17, false); + + // return value is a shallow copy + retVal.setAutoDelete (false); + + if (inWords[0] != '(') + { + //better be NIL + parseOneWordC (inWords); + } + else + { + inWords.pos++; + skipWS (inWords); + + while (!inWords.isEmpty () && inWords[0] != ')') + { + TQCString l1 = parseLiteralC(inWords); + TQCString l2 = parseLiteralC(inWords); + retVal.insert (l1, new TQString(l2)); + } + + if (inWords[0] != ')') + return retVal; + inWords.pos++; + skipWS (inWords); + } + + return retVal; +} + +mimeHeader * imapParser::parseSimplePart (parseString & inWords, + TQString & inSection, mimeHeader * localPart) +{ + TQCString subtype; + TQCString typeStr; + TQAsciiDict < TQString > parameters (17, false); + ulong size; + + parameters.setAutoDelete (true); + + if (inWords[0] != '(') + return 0; + + if (!localPart) + localPart = new mimeHeader; + + localPart->setPartSpecifier (inSection); + + inWords.pos++; + skipWS (inWords); + + //body type + typeStr = parseLiteralC(inWords); + + //body subtype + subtype = parseLiteralC(inWords); + + localPart->setType (typeStr + "/" + subtype); + + //body parameter parenthesized list + parameters = parseParameters (inWords); + { + TQAsciiDictIterator < TQString > it (parameters); + + while (it.current ()) + { + localPart->setTypeParm (it.currentKey (), *(it.current ())); + ++it; + } + parameters.clear (); + } + + //body id + localPart->setID (parseLiteralC(inWords)); + + //body description + localPart->setDescription (parseLiteralC(inWords)); + + //body encoding + localPart->setEncoding (parseLiteralC(inWords)); + + //body size + if (parseOneNumber (inWords, size)) + localPart->setLength (size); + + // type specific extensions + if (localPart->getType().upper() == "MESSAGE/RFC822") + { + //envelope structure + mailHeader *envelope = parseEnvelope (inWords); + + //body structure + parseBodyStructure (inWords, inSection, envelope); + + localPart->setNestedMessage (envelope); + + //text lines + ulong lines; + parseOneNumber (inWords, lines); + } + else + { + if (typeStr == "TEXT") + { + //text lines + ulong lines; + parseOneNumber (inWords, lines); + } + + // md5 + parseLiteralC(inWords); + + // body disposition + parameters = parseDisposition (inWords); + { + TQString *disposition = parameters["content-disposition"]; + + if (disposition) + localPart->setDisposition (disposition->ascii ()); + parameters.remove ("content-disposition"); + TQAsciiDictIterator < TQString > it (parameters); + while (it.current ()) + { + localPart->setDispositionParm (it.currentKey (), + *(it.current ())); + ++it; + } + + parameters.clear (); + } + + // body language + parseSentence (inWords); + } + + // see if we have more to come + while (!inWords.isEmpty () && inWords[0] != ')') + { + //eat the extensions to this part + if (inWords[0] == '(') + parseSentence (inWords); + else + parseLiteralC(inWords); + } + if (inWords[0] == ')') + inWords.pos++; + skipWS (inWords); + + return localPart; +} + +mimeHeader * imapParser::parseBodyStructure (parseString & inWords, + TQString & inSection, mimeHeader * localPart) +{ + bool init = false; + if (inSection.isEmpty()) + { + // first run + init = true; + // assume one part + inSection = "1"; + } + int section = 0; + + if (inWords[0] != '(') + { + // skip "" + parseOneWordC (inWords); + return 0; + } + inWords.pos++; + skipWS (inWords); + + if (inWords[0] == '(') + { + TQByteArray subtype; + TQAsciiDict < TQString > parameters (17, false); + TQString outSection; + parameters.setAutoDelete (true); + if (!localPart) + localPart = new mimeHeader; + else + { + // might be filled from an earlier run + localPart->clearNestedParts (); + localPart->clearTypeParameters (); + localPart->clearDispositionParameters (); + // an envelope was passed in so this is the multipart header + outSection = inSection + ".HEADER"; + } + if (inWords[0] == '(' && init) + inSection = "0"; + + // set the section + if ( !outSection.isEmpty() ) { + localPart->setPartSpecifier(outSection); + } else { + localPart->setPartSpecifier(inSection); + } + + // is multipart (otherwise its a simplepart and handled later) + while (inWords[0] == '(') + { + outSection = TQString::number(++section); + if (!init) + outSection = inSection + "." + outSection; + mimeHeader *subpart = parseBodyStructure (inWords, outSection, 0); + localPart->addNestedPart (subpart); + } + + // fetch subtype + subtype = parseOneWordC (inWords); + + localPart->setType ("MULTIPART/" + b2c(subtype)); + + // fetch parameters + parameters = parseParameters (inWords); + { + TQAsciiDictIterator < TQString > it (parameters); + + while (it.current ()) + { + localPart->setTypeParm (it.currentKey (), *(it.current ())); + ++it; + } + parameters.clear (); + } + + // body disposition + parameters = parseDisposition (inWords); + { + TQString *disposition = parameters["content-disposition"]; + + if (disposition) + localPart->setDisposition (disposition->ascii ()); + parameters.remove ("content-disposition"); + TQAsciiDictIterator < TQString > it (parameters); + while (it.current ()) + { + localPart->setDispositionParm (it.currentKey (), + *(it.current ())); + ++it; + } + parameters.clear (); + } + + // body language + parseSentence (inWords); + + } + else + { + // is simple part + inWords.pos--; + inWords.data[inWords.pos] = '('; //fake a sentence + if ( localPart ) + inSection = inSection + ".1"; + localPart = parseSimplePart (inWords, inSection, localPart); + inWords.pos--; + inWords.data[inWords.pos] = ')'; //remove fake + } + + // see if we have more to come + while (!inWords.isEmpty () && inWords[0] != ')') + { + //eat the extensions to this part + if (inWords[0] == '(') + parseSentence (inWords); + else + parseLiteralC(inWords); + } + + if (inWords[0] == ')') + inWords.pos++; + skipWS (inWords); + + return localPart; +} + +void imapParser::parseBody (parseString & inWords) +{ + // see if we got a part specifier + if (inWords[0] == '[') + { + TQCString specifier; + TQCString label; + inWords.pos++; + + specifier = parseOneWordC (inWords, TRUE); + + if (inWords[0] == '(') + { + inWords.pos++; + + while (!inWords.isEmpty () && inWords[0] != ')') + { + label = parseOneWordC (inWords); + } + + if (!inWords.isEmpty () && inWords[0] == ')') + inWords.pos++; + } + if (!inWords.isEmpty () && inWords[0] == ']') + inWords.pos++; + skipWS (inWords); + + // parse the header + if (specifier == "0") + { + mailHeader *envelope = 0; + if (lastHandled) + envelope = lastHandled->getHeader (); + + if (!envelope || seenUid.isEmpty ()) + { + kdDebug(7116) << "imapParser::parseBody - discarding " << envelope << " " << seenUid.ascii () << endl; + // don't know where to put it, throw it away + parseLiteralC(inWords, true); + } + else + { + kdDebug(7116) << "imapParser::parseBody - reading " << envelope << " " << seenUid.ascii () << endl; + // fill it up with data + TQString theHeader = parseLiteralC(inWords, true); + mimeIOTQString myIO; + + myIO.setString (theHeader); + envelope->parseHeader (myIO); + + } + } + else if (specifier == "HEADER.FIELDS") + { + // BODY[HEADER.FIELDS (References)] {n} + //kdDebug(7116) << "imapParser::parseBody - HEADER.FIELDS: " + // << TQCString(label.data(), label.size()+1) << endl; + if (label == "REFERENCES") + { + mailHeader *envelope = 0; + if (lastHandled) + envelope = lastHandled->getHeader (); + + if (!envelope || seenUid.isEmpty ()) + { + kdDebug(7116) << "imapParser::parseBody - discarding " << envelope << " " << seenUid.ascii () << endl; + // don't know where to put it, throw it away + parseLiteralC (inWords, true); + } + else + { + TQCString references = parseLiteralC(inWords, true); + int start = references.find ('<'); + int end = references.findRev ('>'); + if (start < end) + references = references.mid (start, end - start + 1); + envelope->setReferences(references.simplifyWhiteSpace()); + } + } + else + { // not a header we care about throw it away + parseLiteralC(inWords, true); + } + } + else + { + if (specifier.find(".MIME") != -1) + { + mailHeader *envelope = new mailHeader; + TQString theHeader = parseLiteralC(inWords, false); + mimeIOTQString myIO; + myIO.setString (theHeader); + envelope->parseHeader (myIO); + if (lastHandled) + lastHandled->setHeader (envelope); + return; + } + // throw it away + kdDebug(7116) << "imapParser::parseBody - discarding " << seenUid.ascii () << endl; + parseLiteralC(inWords, true); + } + + } + else // no part specifier + { + mailHeader *envelope = 0; + if (lastHandled) + envelope = lastHandled->getHeader (); + + if (!envelope || seenUid.isEmpty ()) + { + kdDebug(7116) << "imapParser::parseBody - discarding " << envelope << " " << seenUid.ascii () << endl; + // don't know where to put it, throw it away + parseSentence (inWords); + } + else + { + kdDebug(7116) << "imapParser::parseBody - reading " << envelope << " " << seenUid.ascii () << endl; + // fill it up with data + TQString section; + mimeHeader *body = parseBodyStructure (inWords, section, envelope); + if (body != envelope) + delete body; + } + } +} + +void imapParser::parseFetch (ulong /* value */, parseString & inWords) +{ + if (inWords[0] != '(') + return; + inWords.pos++; + skipWS (inWords); + + delete lastHandled; + lastHandled = 0; + + while (!inWords.isEmpty () && inWords[0] != ')') + { + if (inWords[0] == '(') + parseSentence (inWords); + else + { + TQCString word = parseLiteralC(inWords, false, true); + + if(!word.isEmpty()) { + switch (word[0]) + { + case 'E': + if (word == "ENVELOPE") + { + mailHeader *envelope = 0; + + if (lastHandled) + envelope = lastHandled->getHeader (); + else + lastHandled = new imapCache(); + + if (envelope && !envelope->getMessageId ().isEmpty ()) + { + // we have seen this one already + // or don't know where to put it + parseSentence (inWords); + } + else + { + envelope = parseEnvelope (inWords); + if (envelope) + { + envelope->setPartSpecifier (seenUid + ".0"); + lastHandled->setHeader (envelope); + lastHandled->setUid (seenUid.toULong ()); + } + } + } + break; + + case 'B': + if (word == "BODY") + { + parseBody (inWords); + } + else if (word == "BODY[]" ) + { + // Do the same as with "RFC822" + parseLiteralC(inWords, true); + } + else if (word == "BODYSTRUCTURE") + { + mailHeader *envelope = 0; + + if (lastHandled) + envelope = lastHandled->getHeader (); + + // fill it up with data + TQString section; + mimeHeader *body = + parseBodyStructure (inWords, section, envelope); + TQByteArray data; + TQDataStream stream( data, IO_WriteOnly ); + if (body) body->serialize(stream); + parseRelay(data); + + delete body; + } + break; + + case 'U': + if (word == "UID") + { + seenUid = parseOneWordC(inWords); + mailHeader *envelope = 0; + if (lastHandled) + envelope = lastHandled->getHeader (); + else + lastHandled = new imapCache(); + + if (seenUid.isEmpty ()) + { + // unknown what to do + kdDebug(7116) << "imapParser::parseFetch - UID empty" << endl; + } + else + { + lastHandled->setUid (seenUid.toULong ()); + } + if (envelope) + envelope->setPartSpecifier (seenUid); + } + break; + + case 'R': + if (word == "RFC822.SIZE") + { + ulong size; + parseOneNumber (inWords, size); + + if (!lastHandled) lastHandled = new imapCache(); + lastHandled->setSize (size); + } + else if (word.find ("RFC822") == 0) + { + // might be RFC822 RFC822.TEXT RFC822.HEADER + parseLiteralC(inWords, true); + } + break; + + case 'I': + if (word == "INTERNALDATE") + { + TQCString date = parseOneWordC(inWords); + if (!lastHandled) lastHandled = new imapCache(); + lastHandled->setDate(date); + } + break; + + case 'F': + if (word == "FLAGS") + { + //kdDebug(7116) << "GOT FLAGS " << inWords.cstr() << endl; + if (!lastHandled) lastHandled = new imapCache(); + lastHandled->setFlags (imapInfo::_flags (inWords.cstr())); + } + break; + + default: + parseLiteralC(inWords); + break; + } + } else { + parseLiteralC(inWords); + } + } + } + + // see if we have more to come + while (!inWords.isEmpty () && inWords[0] != ')') + { + //eat the extensions to this part + if (inWords[0] == '(') + parseSentence (inWords); + else + parseLiteralC(inWords); + } + + if (inWords.isEmpty() || inWords[0] != ')') + return; + inWords.pos++; + skipWS (inWords); +} + + +// default parser +void imapParser::parseSentence (parseString & inWords) +{ + bool first = true; + int stack = 0; + + //find the first nesting parentheses + + while (!inWords.isEmpty () && (stack != 0 || first)) + { + first = false; + skipWS (inWords); + + unsigned char ch = inWords[0]; + switch (ch) + { + case '(': + inWords.pos++; + ++stack; + break; + case ')': + inWords.pos++; + --stack; + break; + case '[': + inWords.pos++; + ++stack; + break; + case ']': + inWords.pos++; + --stack; + break; + default: + parseLiteralC(inWords); + skipWS (inWords); + break; + } + } + skipWS (inWords); +} + +void imapParser::parseRecent (ulong value, parseString & result) +{ + selectInfo.setRecent (value); + result.pos = result.data.size(); +} + +void imapParser::parseNamespace (parseString & result) +{ + if ( result[0] != '(' ) + return; + + TQString delimEmpty; + if ( namespaceToDelimiter.contains( TQString() ) ) + delimEmpty = namespaceToDelimiter[TQString()]; + + namespaceToDelimiter.clear(); + imapNamespaces.clear(); + + // remember what section we're in (user, other users, shared) + int ns = -1; + bool personalAvailable = false; + while ( !result.isEmpty() ) + { + if ( result[0] == '(' ) + { + result.pos++; // tie off ( + if ( result[0] == '(' ) + { + // new namespace section + result.pos++; // tie off ( + ++ns; + } + // namespace prefix + TQCString prefix = parseOneWordC( result ); + // delimiter + TQCString delim = parseOneWordC( result ); + kdDebug(7116) << "imapParser::parseNamespace ns='" << prefix << + "',delim='" << delim << "'" << endl; + if ( ns == 0 ) + { + // at least one personal ns + personalAvailable = true; + } + TQString nsentry = TQString::number( ns ) + "=" + TQString(prefix) + + "=" + TQString(delim); + imapNamespaces.append( nsentry ); + if ( prefix.right( 1 ) == delim ) { + // strip delimiter to get a correct entry for comparisons + prefix.resize( prefix.length() ); + } + namespaceToDelimiter[prefix] = delim; + + result.pos++; // tie off ) + skipWS( result ); + } else if ( result[0] == ')' ) + { + result.pos++; // tie off ) + skipWS( result ); + } else if ( result[0] == 'N' ) + { + // drop NIL + ++ns; + parseOneWordC( result ); + } else { + // drop whatever it is + parseOneWordC( result ); + } + } + if ( !delimEmpty.isEmpty() ) { + // remember default delimiter + namespaceToDelimiter[TQString()] = delimEmpty; + if ( !personalAvailable ) + { + // at least one personal ns would be nice + kdDebug(7116) << "imapParser::parseNamespace - registering own personal ns" << endl; + TQString nsentry = "0==" + delimEmpty; + imapNamespaces.append( nsentry ); + } + } +} + +int imapParser::parseLoop () +{ + parseString result; + + if (!parseReadLine(result.data)) return -1; + + //kdDebug(7116) << result.cstr(); // includes \n + + if (result.data.isEmpty()) + return 0; + if (!sentQueue.count ()) + { + // maybe greeting or BYE everything else SHOULD not happen, use NOOP or IDLE + kdDebug(7116) << "imapParser::parseLoop - unhandledResponse: \n" << result.cstr() << endl; + unhandled << result.cstr(); + } + else + { + imapCommand *current = sentQueue.at (0); + switch (result[0]) + { + case '*': + result.data.resize(result.data.size() - 2); // tie off CRLF + parseUntagged (result); + break; + case '+': + continuation.duplicate(result.data); + break; + default: + { + TQCString tag = parseLiteralC(result); + if (current->id() == tag.data()) + { + result.data.resize(result.data.size() - 2); // tie off CRLF + TQByteArray resultCode = parseLiteral (result); //the result + current->setResult (resultCode); + current->setResultInfo(result.cstr()); + current->setComplete (); + + sentQueue.removeRef (current); + completeQueue.append (current); + if (result.length()) + parseResult (resultCode, result, current->command()); + } + else + { + kdDebug(7116) << "imapParser::parseLoop - unknown tag '" << tag << "'" << endl; + TQCString cstr = tag + " " + result.cstr(); + result.data = cstr; + result.pos = 0; + result.data.resize(cstr.length()); + } + } + break; + } + } + + return 1; +} + +void +imapParser::parseRelay (const TQByteArray & buffer) +{ + Q_UNUSED(buffer); + tqWarning + ("imapParser::parseRelay - virtual function not reimplemented - data lost"); +} + +void +imapParser::parseRelay (ulong len) +{ + Q_UNUSED(len); + tqWarning + ("imapParser::parseRelay - virtual function not reimplemented - announcement lost"); +} + +bool imapParser::parseRead (TQByteArray & buffer, ulong len, ulong relay) +{ + Q_UNUSED(buffer); + Q_UNUSED(len); + Q_UNUSED(relay); + tqWarning + ("imapParser::parseRead - virtual function not reimplemented - no data read"); + return FALSE; +} + +bool imapParser::parseReadLine (TQByteArray & buffer, ulong relay) +{ + Q_UNUSED(buffer); + Q_UNUSED(relay); + tqWarning + ("imapParser::parseReadLine - virtual function not reimplemented - no data read"); + return FALSE; +} + +void +imapParser::parseWriteLine (const TQString & str) +{ + Q_UNUSED(str); + tqWarning + ("imapParser::parseWriteLine - virtual function not reimplemented - no data written"); +} + +void +imapParser::parseURL (const KURL & _url, TQString & _box, TQString & _section, + TQString & _type, TQString & _uid, TQString & _validity, TQString & _info) +{ + TQStringList parameters; + + _box = _url.path (); + kdDebug(7116) << "imapParser::parseURL " << _box << endl; + int paramStart = _box.find("/;"); + if ( paramStart > -1 ) + { + TQString paramString = _box.right( _box.length() - paramStart-2 ); + parameters = TQStringList::split (';', paramString); //split parameters + _box.truncate( paramStart ); // strip parameters + } + // extract parameters + for (TQStringList::ConstIterator it (parameters.begin ()); + it != parameters.end (); ++it) + { + TQString temp = (*it); + + int pt = temp.find ('/'); + if (pt > 0) + { + if (temp.findRev ('"', pt) == -1 || temp.find('"', pt) == -1) + { + // if we have non-quoted '/' separator we'll just nuke it + temp.truncate(pt); + } + } + if (temp.find ("section=", 0, false) == 0) + _section = temp.right (temp.length () - 8); + else if (temp.find ("type=", 0, false) == 0) + _type = temp.right (temp.length () - 5); + else if (temp.find ("uid=", 0, false) == 0) + _uid = temp.right (temp.length () - 4); + else if (temp.find ("uidvalidity=", 0, false) == 0) + _validity = temp.right (temp.length () - 12); + else if (temp.find ("info=", 0, false) == 0) + _info = temp.right (temp.length () - 5); + } +// kdDebug(7116) << "URL: section= " << _section << ", type= " << _type << ", uid= " << _uid << endl; +// kdDebug(7116) << "URL: user() " << _url.user() << endl; +// kdDebug(7116) << "URL: path() " << _url.path() << endl; +// kdDebug(7116) << "URL: encodedPathAndQuery() " << _url.encodedPathAndQuery() << endl; + + if (!_box.isEmpty ()) + { + // strip / + if (_box[0] == '/') + _box = _box.right (_box.length () - 1); + if (!_box.isEmpty () && _box[_box.length () - 1] == '/') + _box.truncate(_box.length() - 1); + } + kdDebug(7116) << "URL: box= " << _box << ", section= " << _section << ", type= " + << _type << ", uid= " << _uid << ", validity= " << _validity << ", info= " << _info << endl; +} + + +TQCString imapParser::parseLiteralC(parseString & inWords, bool relay, bool stopAtBracket, int *outlen) { + + if (!inWords.isEmpty() && inWords[0] == '{') + { + TQCString retVal; + long srunLen = inWords.find ('}', 1); // Can return -1, so use a signed long + if (srunLen > 0) + { + ulong runLen = (ulong)srunLen; + bool proper; + ulong runLenSave = runLen + 1; + TQCString tmpstr(runLen); + inWords.takeMidNoResize(tmpstr, 1, runLen - 1); + runLen = tmpstr.toULong (&proper); + inWords.pos += runLenSave; + if (proper) + { + //now get the literal from the server + if (relay) + parseRelay (runLen); + TQByteArray rv; + parseRead (rv, runLen, relay ? runLen : 0); + rv.resize(TQMAX(runLen, rv.size())); // what's the point? + retVal = b2c(rv); + inWords.clear(); + parseReadLine (inWords.data); // must get more + + // no duplicate data transfers + relay = false; + } + else + { + kdDebug(7116) << "imapParser::parseLiteral - error parsing {} - " /*<< strLen*/ << endl; + } + } + else + { + inWords.clear(); + kdDebug(7116) << "imapParser::parseLiteral - error parsing unmatched {" << endl; + } + if (outlen) { + *outlen = retVal.length(); // optimize me + } + skipWS (inWords); + return retVal; + } + + return parseOneWordC(inWords, stopAtBracket, outlen); +} + +// does not know about literals ( {7} literal ) +TQCString imapParser::parseOneWordC (parseString & inWords, bool stopAtBracket, int *outLen) +{ + uint retValSize = 0; + uint len = inWords.length(); + if (len == 0) { + return TQCString(); + } + + if (len > 0 && inWords[0] == '"') + { + unsigned int i = 1; + bool quote = FALSE; + while (i < len && (inWords[i] != '"' || quote)) + { + if (inWords[i] == '\\') quote = !quote; + else quote = FALSE; + i++; + } + if (i < len) + { + TQCString retVal(i); + inWords.pos++; + inWords.takeLeftNoResize(retVal, i - 1); + len = i - 1; + int offset = 0; + for (unsigned int j = 0; j <= len; j++) { + if (retVal[j] == '\\') { + offset++; + j++; + } + retVal[j - offset] = retVal[j]; + } + retVal[len - offset] = 0; + retValSize = len - offset; + inWords.pos += i; + skipWS (inWords); + if (outLen) { + *outLen = retValSize; + } + return retVal; + } + else + { + kdDebug(7116) << "imapParser::parseOneWord - error parsing unmatched \"" << endl; + TQCString retVal = inWords.cstr(); + retValSize = len; + inWords.clear(); + if (outLen) { + *outLen = retValSize; + } + return retVal; + } + } + else + { + // not quoted + unsigned int i; + // search for end + for (i = 0; i < len; ++i) { + char ch = inWords[i]; + if (ch <= ' ' || ch == '(' || ch == ')' || + (stopAtBracket && (ch == '[' || ch == ']'))) + break; + } + + TQCString retVal(i+1); + inWords.takeLeftNoResize(retVal, i); + retValSize = i; + inWords.pos += i; + + if (retVal == "NIL") { + retVal.truncate(0); + retValSize = 0; + } + skipWS (inWords); + if (outLen) { + *outLen = retValSize; + } + return retVal; + } +} + +bool imapParser::parseOneNumber (parseString & inWords, ulong & num) +{ + bool valid; + num = parseOneWordC(inWords, TRUE).toULong(&valid); + return valid; +} + +bool imapParser::hasCapability (const TQString & cap) +{ + TQString c = cap.lower(); +// kdDebug(7116) << "imapParser::hasCapability - Looking for '" << cap << "'" << endl; + for (TQStringList::ConstIterator it = imapCapabilities.begin (); + it != imapCapabilities.end (); ++it) + { +// kdDebug(7116) << "imapParser::hasCapability - Examining '" << (*it) << "'" << endl; + if ( !(kasciistricmp(c.ascii(), (*it).ascii())) ) + { + return true; + } + } + return false; +} + +void imapParser::removeCapability (const TQString & cap) +{ + imapCapabilities.remove(cap.lower()); +} + +TQString imapParser::namespaceForBox( const TQString & box ) +{ + kdDebug(7116) << "imapParse::namespaceForBox " << box << endl; + TQString myNamespace; + if ( !box.isEmpty() ) + { + TQValueList list = namespaceToDelimiter.keys(); + TQString cleanPrefix; + for ( TQValueList::Iterator it = list.begin(); it != list.end(); ++it ) + { + if ( !(*it).isEmpty() && box.find( *it ) != -1 ) + return (*it); + } + } + return myNamespace; +} + diff --git a/tdeioslaves/imap4/imapparser.h b/tdeioslaves/imap4/imapparser.h new file mode 100644 index 00000000..623fc8f8 --- /dev/null +++ b/tdeioslaves/imap4/imapparser.h @@ -0,0 +1,504 @@ +#ifndef _IMAPPARSER_H +#define _IMAPPARSER_H +/********************************************************************** + * + * imapparser.h - IMAP4rev1 Parser + * Copyright (C) 2001-2002 Michael Haeckel + * Copyright (C) 2000 s.carstens@gmx.de + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Send comments and bug fixes to s.carstens@gmx.de + * + *********************************************************************/ + +#include +#include +#include +#include + +#include +#include + +#include "imaplist.h" +#include "imapcommand.h" +#include "imapinfo.h" + +#include "mailheader.h" + +class KURL; +class TQString; +class mailAddress; +class mimeHeader; + + +/** @brief a string used during parsing + * the string allows you to move the effective start of the string using + * str.pos++ and str.pos--. + * @bug it is possible to move past the beginning and end of the string + */ +class parseString +{ +public: + parseString() { pos = 0; } + char operator[](uint i) const { return data[i + pos]; } + bool isEmpty() const { return pos >= data.size(); } + TQCString cstr() const + { + if (pos >= data.size()) return TQCString(); + return TQCString(data.data() + pos, data.size() - pos + 1); + } + int find(char c, int index = 0) + { + int res = data.find(c, index + pos); + return (res == -1) ? res : (res - pos); + } + // Warning: does not check for going past end of "data" + void takeLeft(TQCString& dest, uint len) const + { + dest.resize(len + 1); + tqmemmove(dest.data(), data.data() + pos, len); + } + // Warning: does not check for going past end of "data" + void takeLeftNoResize(TQCString& dest, uint len) const + { + tqmemmove(dest.data(), data.data() + pos, len); + } + // Warning: does not check for going past end of "data" + void takeMid(TQCString& dest, uint start, uint len) const + { + dest.resize(len + 1); + tqmemmove(dest.data(), data.data() + pos + start, len); + } + // Warning: does not check for going past end of "data" + void takeMidNoResize(TQCString& dest, uint start, uint len) const + { + tqmemmove(dest.data(), data.data() + pos + start, len); + } + void clear() + { + data.resize(0); + pos = 0; + } + uint length() + { + if( pos < data.size() ) { + return data.size() - pos; + } else { + return 0; + } + } + void fromString(const TQString &s) + { + clear(); + data.duplicate(s.latin1(), s.length()); + } + TQByteArray data; + uint pos; +}; + +class imapCache +{ +public: + imapCache () + { + myHeader = NULL; + mySize = 0; + myFlags = 0; + myUid = 0; + } + + ~imapCache () + { + if (myHeader) delete myHeader; + } + + mailHeader *getHeader () + { + return myHeader; + } + void setHeader (mailHeader * inHeader) + { + myHeader = inHeader; + } + + ulong getSize () + { + return mySize; + } + void setSize (ulong inSize) + { + mySize = inSize; + } + + ulong getUid () + { + return myUid; + } + void setUid (ulong inUid) + { + myUid = inUid; + } + + ulong getFlags () + { + return myFlags; + } + void setFlags (ulong inFlags) + { + myFlags = inFlags; + } + + TQCString getDate () + { + return myDate; + } + void setDate (const TQCString & _str) + { + myDate = _str; + } + void clear() + { + if (myHeader) delete myHeader; + myHeader = NULL; + mySize = 0; + myFlags = 0; + myDate = TQCString(); + myUid = 0; + } + +protected: + mailHeader * myHeader; + ulong mySize; + ulong myFlags; + ulong myUid; + TQCString myDate; +}; + + +class imapParser +{ + +public: + + /** the different states the client can be in */ + enum IMAP_STATE + { + ISTATE_NO, /**< Not connected */ + ISTATE_CONNECT, /**< Connected but not logged in */ + ISTATE_LOGIN, /**< Logged in */ + ISTATE_SELECT /**< A folder is currently selected */ + }; + +public: + imapParser (); + virtual ~ imapParser (); + + /** @brief Get the current state */ + enum IMAP_STATE getState () { return currentState; } + /** @brief Set the current state */ + void setState(enum IMAP_STATE state) { currentState = state; } + + /* @brief return the currently selected mailbox */ + const TQString getCurrentBox () + { + return rfcDecoder::fromIMAP(currentBox); + }; + + /** + * @brief do setup and send the command to parseWriteLine + * @param aCmd The command to perform + * @return The completed command + */ + imapCommand *sendCommand (imapCommand * aCmd); + /** + * @brief perform a command and wait to parse the result + * @param aCmd The command to perform + * @return The completed command + */ + imapCommand *doCommand (imapCommand * aCmd); + + + /** + * @brief plaintext login + * @param aUser Username + * @param aPass Password + * @param resultInfo The resultinfo from the command + * @return success or failure + */ + bool clientLogin (const TQString & aUser, const TQString & aPass, TQString & resultInfo); + /** + * @brief non-plaintext login + * @param aUser Username + * @param aPass Password + * @param aAuth authentication method + * @param isSSL are we using SSL + * @param resultInfo The resultinfo from the command + * @return success or failure + */ + bool clientAuthenticate (TDEIO::SlaveBase *slave, TDEIO::AuthInfo &ai, const TQString & aFTQDN, + const TQString & aAuth, bool isSSL, TQString & resultInfo); + + /** + * main loop for the parser + * reads one line and dispatches it to the appropriate sub parser + */ + int parseLoop (); + + /** + * @brief parses all untagged responses and passes them on to the + * following parsers + */ + void parseUntagged (parseString & result); + + /** @brief parse a RECENT line */ + void parseRecent (ulong value, parseString & result); + /** @brief parse a RESULT line */ + void parseResult (TQByteArray & result, parseString & rest, + const TQString & command = TQString()); + /** @brief parse a CAPABILITY line */ + void parseCapability (parseString & result); + /** @brief parse a FLAGS line */ + void parseFlags (parseString & result); + /** @brief parse a LIST line */ + void parseList (parseString & result); + /** @brief parse a LSUB line */ + void parseLsub (parseString & result); + /** @brief parse a LISTRIGHTS line */ + void parseListRights (parseString & result); + /** @brief parse a MYRIGHTS line */ + void parseMyRights (parseString & result); + /** @brief parse a SEARCH line */ + void parseSearch (parseString & result); + /** @brief parse a STATUS line */ + void parsetStatus (parseString & result); + /** @brief parse a EXISTS line */ + void parseExists (ulong value, parseString & result); + /** @brief parse a EXPUNGE line */ + void parseExpunge (ulong value, parseString & result); + /** @brief parse a ACL line */ + void parseAcl (parseString & result); + /** @brief parse a ANNOTATION line */ + void parseAnnotation (parseString & result); + /** @brief parse a NAMESPACE line */ + void parseNamespace (parseString & result); + /** @brief parse a QUOTAROOT line */ + void parseQuotaRoot (parseString & result); + /** @brief parse a QUOTA line */ + void parseQuota (parseString & result); + /** @brief parse a custom command line */ + void parseCustom (parseString & result); + /** @brief parse a OTHER-USER line */ + void parseOtherUser (parseString & result); + /** @brief parse a DELEGATE line */ + void parseDelegate (parseString & result); + /** @brief parse a OUT-OF-OFFICE line */ + void parseOutOfOffice (parseString & result); + + /** + * parses the results of a fetch command + * processes it with the following sub parsers + */ + void parseFetch (ulong value, parseString & inWords); + + /** read a envelope from imap and parse the addresses */ + mailHeader *parseEnvelope (parseString & inWords); + /** @brief parse an address list and return a list of addresses */ + void parseAddressList (parseString & inWords, TQPtrList& list); + /** @brief parse an address and return the ref again */ + const mailAddress& parseAddress (parseString & inWords, mailAddress& buffer); + + /** parse the result of the body command */ + void parseBody (parseString & inWords); + + /** parse the body structure recursively */ + mimeHeader *parseBodyStructure (parseString & inWords, + TQString & section, mimeHeader * inHeader = 0); + + /** parse only one not nested part */ + mimeHeader *parseSimplePart (parseString & inWords, TQString & section, + mimeHeader * localPart = 0); + + /** parse a parameter list (name value pairs) */ + TQAsciiDict < TQString > parseParameters (parseString & inWords); + + /** + * parse the disposition list (disposition (name value pairs)) + * the disposition has the key 'content-disposition' + */ + TQAsciiDict < TQString > parseDisposition (parseString & inWords); + + // reimplement these + + /** relay hook to send the fetched data directly to an upper level */ + virtual void parseRelay (const TQByteArray & buffer); + + /** relay hook to announce the fetched data directly to an upper level + */ + virtual void parseRelay (ulong); + + /** read at least len bytes */ + virtual bool parseRead (TQByteArray & buffer, ulong len, ulong relay = 0); + + /** read at least a line (up to CRLF) */ + virtual bool parseReadLine (TQByteArray & buffer, ulong relay = 0); + + /** write argument to server */ + virtual void parseWriteLine (const TQString &); + + // generic parser routines + + /** parse a parenthesized list */ + void parseSentence (parseString & inWords); + + /** parse a literal or word, may require more data */ + TQCString parseLiteralC(parseString & inWords, bool relay = false, + bool stopAtBracket = false, int *outlen = 0); + inline TQByteArray parseLiteral (parseString & inWords, bool relay = false, + bool stopAtBracket = false) { + int len = 0; // string size + // Choice: we can create an extra TQCString, or we can get the buffer in + // the wrong size to start. Let's try option b. + TQCString tmp = parseLiteralC(inWords, relay, stopAtBracket, &len); + return TQByteArray().duplicate(tmp.data(), len); + } + + // static parser routines, can be used elsewhere + + static TQCString b2c(const TQByteArray &ba) + { return TQCString(ba.data(), ba.size() + 1); } + + /** parse one word (maybe quoted) upto next space " ) ] } */ + static TQCString parseOneWordC (parseString & inWords, + bool stopAtBracket = FALSE, int *len = 0); + + /** parse one number using parseOneWord */ + static bool parseOneNumber (parseString & inWords, ulong & num); + + /** extract the box,section,list type, uid, uidvalidity,info from an url */ + static void parseURL (const KURL & _url, TQString & _box, TQString & _section, + TQString & _type, TQString & _uid, TQString & _validity, + TQString & _info); + + + /** @brief return the last handled foo + * @todo work out what a foo is + */ + imapCache *getLastHandled () + { + return lastHandled; + }; + +/** @brief return the last results */ + const TQStringList & getResults () + { + return lastResults; + }; + + /** @brief return the last status code */ + const imapInfo & geStatus () + { + return lasStatus; + }; + /** return the select info */ + const imapInfo & getSelected () + { + return selectInfo; + }; + + const TQByteArray & getContinuation () + { + return continuation; + }; + + /** @brief see if server has a capability */ + bool hasCapability (const TQString &); + + void removeCapability (const TQString & cap); + + static inline void skipWS (parseString & inWords) + { + char c; + while (!inWords.isEmpty() && + ((c = inWords[0]) == ' ' || c == '\t' || c == '\r' || c == '\n')) + { + inWords.pos++; + } + } + + /** @brief find the namespace for the given box */ + TQString namespaceForBox( const TQString & box ); + + +protected: + + /** the current state we're in */ + enum IMAP_STATE currentState; + + /** the box selected */ + TQString currentBox; + + /** @brief here we store the result from select/examine and unsolicited updates */ + imapInfo selectInfo; + + /** @brief the results from the last status command */ + imapInfo lasStatus; + + /** @brief the results from the capabilities, split at ' ' */ + TQStringList imapCapabilities; + + /** @brief the results from list/lsub/listrights commands */ + TQValueList < imapList > listResponses; + + /** @brief queues handling the running commands */ + TQPtrList < imapCommand > sentQueue; // no autodelete + TQPtrList < imapCommand > completeQueue; // autodelete !! + + /** + * everything we didn't handle, everything but the greeting is bogus + */ + TQStringList unhandled; + + /** the last continuation request (there MUST not be more than one pending) */ + TQByteArray continuation; + + /** the last uid seen while a fetch */ + TQString seenUid; + imapCache *lastHandled; + + ulong commandCounter; + + /** @brief the results from search/acl commands */ + TQStringList lastResults; + + /** + * @brief namespace prefix - delimiter association + * The namespace is cleaned before so that it does not contain the delimiter + */ + TQMap namespaceToDelimiter; + + /** + * @brief list of namespaces in the form: section=namespace=delimiter + * section is 0 (personal), 1 (other users) or 2 (shared) + */ + TQStringList imapNamespaces; + +private: + + /** we don't want to be able to copy this object */ + imapParser & operator = (const imapParser &); // hide the copy ctor + +}; +#endif diff --git a/tdeioslaves/imap4/imaps.protocol b/tdeioslaves/imap4/imaps.protocol new file mode 100644 index 00000000..00f94485 --- /dev/null +++ b/tdeioslaves/imap4/imaps.protocol @@ -0,0 +1,30 @@ +[Protocol] +# The executable, of course +#### Temporary name +exec=kio_imap4 +# protocol that will appear in URLs +#### This ioslave is temporarily named imaps, while imaps remains in tdebase +protocol=imaps + +# input/output can be one of: filesystem, stream, none +input=stream +output=filesystem + +# Headings for file listings? +listing=Name,Type,Size,Owner +deleting=true +linking=false +# For now, reading yes, writing no +reading=true +writing=false +# For now, no moving +moving=false + +# Can be source protocol +source=true + +# List of capabilities (e.g. special() commands) +Capabilities=Subscription,ACL,Quota + +Icon=folder_inbox +DocPath=tdeioslave/imaps.html diff --git a/tdeioslaves/imap4/mailaddress.cc b/tdeioslaves/imap4/mailaddress.cc new file mode 100644 index 00000000..0ddd2ff0 --- /dev/null +++ b/tdeioslaves/imap4/mailaddress.cc @@ -0,0 +1,323 @@ +/********************************************************************** + * + * mailaddress.cc - mail address parser + * Copyright (C) 2000 Sven Carstens + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Send comments and bug fixes to + * + *********************************************************************/ + + +#include "mailaddress.h" +#include "rfcdecoder.h" +#include "mimehdrline.h" +#include + +mailAddress::mailAddress () +{ +} + +mailAddress::mailAddress (const mailAddress & lr): +user (lr.user), +host (lr.host), +rawFullName (lr.rawFullName), +rawComment (lr.rawComment) +{ +// kdDebug(7116) << "mailAddress::mailAddress - " << getStr() << endl; +} + +mailAddress & mailAddress::operator = (const mailAddress & lr) +{ + // Avoid a = a. + if (this == &lr) + return *this; + + user = lr.user; + host = lr.host; + rawFullName = lr.rawFullName; + rawComment = lr.rawComment; + +// kdDebug(7116) << "mailAddress::operator= - " << getStr() << endl; + + return *this; +} + + + + +mailAddress::~mailAddress () +{ +} + +mailAddress::mailAddress (char *aCStr) +{ + parseAddress (aCStr); +} + +int +mailAddress::parseAddress (char *aCStr) +{ + int retVal = 0; + int skip; + uint len; + int pt; + + if (aCStr) + { + //skip leading white space + skip = mimeHdrLine::skipWS ((const char *) aCStr); + if (skip > 0) + { + aCStr += skip; + retVal += skip; + } + while (*aCStr) + { + int advance; + + switch (*aCStr) + { + case '"': + advance = mimeHdrLine::parseQuoted ('"', '"', aCStr); + rawFullName += TQCString (aCStr, advance + 1); + break; + case '(': + advance = mimeHdrLine::parseQuoted ('(', ')', aCStr); + rawComment += TQCString (aCStr, advance + 1); + break; + case '<': + advance = mimeHdrLine::parseQuoted ('<', '>', aCStr); + user = TQCString (aCStr, advance + 1); // copy it + len = advance; + user = user.mid (1, len - 2); // strip <> + len -= 2; + pt = user.find('@'); + host = user.right (len - pt - 1); // split it into host + user.truncate(pt); // and user + break; + default: + advance = mimeHdrLine::parseWord ((const char *) aCStr); + //if we've seen a FQ mailname the rest must be quoted or is just junk + if (user.isEmpty ()) + { + if (*aCStr != ',') + { + rawFullName += TQCString (aCStr, advance + 1); + if (mimeHdrLine::skipWS ((const char *) &aCStr[advance]) > 0) + { + rawFullName += ' '; + } + } + } + break; + } + if (advance) + { + retVal += advance; + aCStr += advance; + } + else + break; + advance = mimeHdrLine::skipWS ((const char *) aCStr); + if (advance > 0) + { + retVal += advance; + aCStr += advance; + } + //reached end of current address + if (*aCStr == ',') + { + advance++; + break; + } + } + //let's see what we've got + if (rawFullName.isEmpty ()) + { + if (user.isEmpty ()) + retVal = 0; + else + { + if (host.isEmpty ()) + { + rawFullName = user; + user.truncate(0); + } + } + } + else if (user.isEmpty ()) + { + pt = rawFullName.find ('@'); + if (pt >= 0) + { + user = rawFullName; + host = user.right (user.length () - pt - 1); + user.truncate(pt); + rawFullName.truncate(0); + } + } + +#if 0 +// dead + if (!rawFullName.isEmpty ()) + { +// if(fullName[0] == '"') +// fullName = fullName.mid(1,fullName.length()-2); +// fullName = fullName.simplifyWhiteSpace().stripWhiteSpace(); +// fullName = rfcDecoder::decodeRFC2047String(fullName.ascii()); + } +#endif + if (!rawComment.isEmpty ()) + { + if (rawComment[0] == '(') + rawComment = rawComment.mid (1, rawComment.length () - 2); + rawComment = rawComment.stripWhiteSpace (); +// comment = rfcDecoder::decodeRFC2047String(comment.ascii()); + } + } + else + { + //debug(); + } + return retVal; +} + +const TQCString +mailAddress::getStr () +{ + TQCString retVal(128); // Should be generally big enough + + if (!rawFullName.isEmpty ()) + { + KMime::addQuotes( rawFullName, false ); + retVal = rawFullName + " "; + } + if (!user.isEmpty ()) + { + retVal += '<'; + retVal += user; + if (!host.isEmpty ()) { + retVal += '@'; + retVal += host; + } + retVal += '>'; + } + if (!rawComment.isEmpty ()) + { + retVal = '(' + rawComment + ')'; + } +// kdDebug(7116) << "mailAddress::getStr - '" << retVal << "'" << endl; + return retVal; +} + +bool +mailAddress::isEmpty () const +{ + return user.isEmpty (); +} + +void +mailAddress::setFullName (const TQString & _str) +{ + rawFullName = rfcDecoder::encodeRFC2047String (_str).latin1 (); +} +const TQString +mailAddress::getFullName () const +{ + return rfcDecoder::decodeRFC2047String (rawFullName); +} + +void +mailAddress::setCommentRaw (const TQCString & _str) +{ + rawComment = _str; +} + +void +mailAddress::setComment (const TQString & _str) +{ + rawComment = rfcDecoder::encodeRFC2047String (_str).latin1 (); +} +const TQString +mailAddress::getComment () const +{ + return rfcDecoder::decodeRFC2047String (rawComment); +} + +const TQCString & +mailAddress::getCommentRaw () const +{ + return rawComment; +} + +TQString +mailAddress::emailAddrAsAnchor (const mailAddress & adr, bool shortAdr) +{ + TQString retVal; + if (!adr.getFullName ().isEmpty ()) + { + // should do some umlaut escaping + retVal += adr.getFullName () + " "; + } + if (!adr.getUser ().isEmpty () && !shortAdr) + { + retVal += "<" + adr.getUser (); + if (!adr.getHost ().isEmpty ()) + retVal += "@" + adr.getHost (); + retVal += "> "; + } + if (!adr.getComment ().isEmpty ()) + { + // should do some umlaut escaping + retVal = '(' + adr.getComment () + ')'; + } + + if (!adr.getUser ().isEmpty ()) + { + TQString mail; + mail = adr.getUser (); + if (!mail.isEmpty () && !adr.getHost ().isEmpty ()) + mail += "@" + adr.getHost (); + if (!mail.isEmpty ()) + retVal = "" + retVal + ""; + } + return retVal; +} + +TQString +mailAddress::emailAddrAsAnchor (const TQPtrList < mailAddress > &list, bool value) +{ + TQString retVal; + TQPtrListIterator < mailAddress > it (list); + + while (it.current ()) + { + retVal += emailAddrAsAnchor ((*it.current ()), value) + "

\n"; + ++it; + } + + return retVal; +} + + +void mailAddress::clear() { + user.truncate(0); + host.truncate(0); + rawFullName.truncate(0); + rawComment.truncate(0); +} + diff --git a/tdeioslaves/imap4/mailaddress.h b/tdeioslaves/imap4/mailaddress.h new file mode 100644 index 00000000..644034b2 --- /dev/null +++ b/tdeioslaves/imap4/mailaddress.h @@ -0,0 +1,81 @@ +#ifndef _MAILADDRESS_H +#define _MAILADDRESS_H +/********************************************************************** + * + * mailaddress.h - mail address handler + * Copyright (C) 2000 s.carstens@gmx.de + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Send comments and bug fixes to s.carstens@gmx.de + * + *********************************************************************/ + +#include +#include +#include +#include "rfcdecoder.h" + +class mailAddress +{ +public: + mailAddress (); + ~mailAddress (); + mailAddress (char *aCStr); + mailAddress (const mailAddress &); + mailAddress & operator = (const mailAddress &); + + void setUser (const TQCString & aUser) + { + user = aUser; + } + const TQCString & getUser () const + { + return user; + } + void setHost (const TQCString & aHost) + { + host = aHost; + } + const TQCString & getHost () const + { + return host; + } + + void setFullName (const TQString & aFull); + const TQString getFullName () const; + + void setComment (const TQString & aComment); + void setCommentRaw (const TQCString &); + const TQString getComment () const; + const TQCString & getCommentRaw () const; + + int parseAddress (char *); + const TQCString getStr (); + bool isEmpty () const; + + static TQString emailAddrAsAnchor (const mailAddress &, bool); + static TQString emailAddrAsAnchor (const TQPtrList < mailAddress > &, bool); + + void clear(); + +private: + TQCString user; + TQCString host; + TQCString rawFullName; + TQCString rawComment; +}; + +#endif diff --git a/tdeioslaves/imap4/mailheader.cc b/tdeioslaves/imap4/mailheader.cc new file mode 100644 index 00000000..c520b909 --- /dev/null +++ b/tdeioslaves/imap4/mailheader.cc @@ -0,0 +1,203 @@ +/*************************************************************************** + mailheader.cc - description + ------------------- + begin : Tue Oct 24 2000 + copyright : (C) 2000 by Sven Carstens + email : s.carstens@gmx.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "mailheader.h" +#include "rfcdecoder.h" + +mailHeader::mailHeader () +{ + toAdr.setAutoDelete (true); + ccAdr.setAutoDelete (true); + bccAdr.setAutoDelete (true); + setType ("text/plain"); + gmt_offset = 0; +} + +mailHeader::~mailHeader () +{ +} + +void +mailHeader::addHdrLine (mimeHdrLine * inLine) +{ + mimeHdrLine *addLine = new mimeHdrLine (inLine); + + const TQCString label(addLine->getLabel()); + TQCString value(addLine->getValue()); + + if (!tqstricmp (label, "Return-Path")) { + returnpathAdr.parseAddress (value.data ()); + goto out; + } + if (!tqstricmp (label, "Sender")) { + senderAdr.parseAddress (value.data ()); + goto out; + } + if (!tqstricmp (label, "From")) { + fromAdr.parseAddress (value.data ()); + goto out; + } + if (!tqstricmp (label, "Reply-To")) { + replytoAdr.parseAddress (value.data ()); + goto out; + } + if (!tqstricmp (label, "To")) { + mailHeader::parseAddressList (value, &toAdr); + goto out; + } + if (!tqstricmp (label, "CC")) { + mailHeader::parseAddressList (value, &ccAdr); + goto out; + } + if (!tqstricmp (label, "BCC")) { + mailHeader::parseAddressList (value, &bccAdr); + goto out; + } + if (!tqstricmp (label, "Subject")) { + _subject = value.simplifyWhiteSpace(); + goto out; + } + if (!tqstricmp (label.data (), "Date")) { + mDate = value; + goto out; + } + if (!tqstricmp (label.data (), "Message-ID")) { + int start = value.findRev ('<'); + int end = value.findRev ('>'); + if (start < end) + messageID = value.mid (start, end - start + 1); + else { + tqWarning("bad Message-ID"); + /* messageID = value; */ + } + goto out; + } + if (!tqstricmp (label.data (), "In-Reply-To")) { + int start = value.findRev ('<'); + int end = value.findRev ('>'); + if (start < end) + inReplyTo = value.mid (start, end - start + 1); + goto out; + } + + // everything else is handled by mimeHeader + mimeHeader::addHdrLine (inLine); + delete addLine; + return; + + out: +// cout << label.data() << ": '" << value.data() << "'" << endl; + + //need only to add this line if not handled by mimeHeader + originalHdrLines.append (addLine); +} + +void +mailHeader::outputHeader (mimeIO & useIO) +{ + static const TQCString __returnPath("Return-Path: ", 14); + static const TQCString __from ("From: ", 7); + static const TQCString __sender ("Sender: ", 9); + static const TQCString __replyTo ("Reply-To: ", 11); + static const TQCString __to ("To: ", 5); + static const TQCString __cc ("CC: ", 5); + static const TQCString __bcc ("BCC: ", 6); + static const TQCString __subject ("Subject: ", 10); + static const TQCString __messageId ("Message-ID: ", 13); + static const TQCString __inReplyTo ("In-Reply-To: ", 14); + static const TQCString __references("References: ", 13); + static const TQCString __date ("Date: ", 7); + + if (!returnpathAdr.isEmpty()) + useIO.outputMimeLine(__returnPath + returnpathAdr.getStr()); + if (!fromAdr.isEmpty()) + useIO.outputMimeLine(__from + fromAdr.getStr()); + if (!senderAdr.isEmpty()) + useIO.outputMimeLine(__sender + senderAdr.getStr()); + if (!replytoAdr.isEmpty()) + useIO.outputMimeLine(__replyTo + replytoAdr.getStr()); + + if (toAdr.count()) + useIO.outputMimeLine(mimeHdrLine::truncateLine(__to + + mailHeader::getAddressStr(&toAdr))); + if (ccAdr.count()) + useIO.outputMimeLine(mimeHdrLine::truncateLine(__cc + + mailHeader::getAddressStr(&ccAdr))); + if (bccAdr.count()) + useIO.outputMimeLine(mimeHdrLine::truncateLine(__bcc + + mailHeader::getAddressStr(&bccAdr))); + if (!_subject.isEmpty()) + useIO.outputMimeLine(mimeHdrLine::truncateLine(__subject + _subject)); + if (!messageID.isEmpty()) + useIO.outputMimeLine(mimeHdrLine::truncateLine(__messageId + messageID)); + if (!inReplyTo.isEmpty()) + useIO.outputMimeLine(mimeHdrLine::truncateLine(__inReplyTo + inReplyTo)); + if (!references.isEmpty()) + useIO.outputMimeLine(mimeHdrLine::truncateLine(__references + references)); + + if (!mDate.isEmpty()) + useIO.outputMimeLine(__date + mDate); + mimeHeader::outputHeader(useIO); +} + +int +mailHeader::parseAddressList (const char *inCStr, + TQPtrList < mailAddress > *aList) +{ + int advance = 0; + int skip = 1; + char *aCStr = (char *) inCStr; + + if (!aCStr || !aList) + return 0; + while (skip > 0) + { + mailAddress *aAddress = new mailAddress; + skip = aAddress->parseAddress (aCStr); + if (skip) + { + aCStr += skip; + if (skip < 0) + advance -= skip; + else + advance += skip; + aList->append (aAddress); + } + else + { + delete aAddress; + break; + } + } + return advance; +} + +TQCString +mailHeader::getAddressStr (TQPtrList < mailAddress > *aList) +{ + TQCString retVal; + + TQPtrListIterator < mailAddress > it = TQPtrListIterator < mailAddress > (*aList); + while (it.current ()) + { + retVal += it.current ()->getStr (); + ++it; + if (it.current ()) + retVal += ", "; + } + return retVal; +} diff --git a/tdeioslaves/imap4/mailheader.h b/tdeioslaves/imap4/mailheader.h new file mode 100644 index 00000000..633d61b7 --- /dev/null +++ b/tdeioslaves/imap4/mailheader.h @@ -0,0 +1,190 @@ +/*************************************************************************** + mailheader.h - description + ------------------- + begin : Tue Oct 24 2000 + copyright : (C) 2000 by Sven Carstens + email : s.carstens@gmx.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef MAILHEADER_H +#define MAILHEADER_H + +#include "mimeheader.h" +#include "mailaddress.h" +#include "mimeio.h" +#include "rfcdecoder.h" + +/** + *@author Sven Carstens + */ + +class mailHeader:public mimeHeader +{ +public: + mailHeader (); + ~mailHeader (); + + virtual void addHdrLine (mimeHdrLine *); + virtual void outputHeader (mimeIO &); + + void addTo (const mailAddress & _adr) + { + toAdr.append (new mailAddress (_adr)); + } + void addCC (const mailAddress & _adr) + { + ccAdr.append (new mailAddress (_adr)); + } + void addBCC (const mailAddress & _adr) + { + bccAdr.append (new mailAddress (_adr)); + } + + void setFrom (const mailAddress & _adr) + { + fromAdr = _adr; + } + void setSender (const mailAddress & _adr) + { + senderAdr = _adr; + } + void setReturnPath (const mailAddress & _adr) + { + returnpathAdr = _adr; + } + void setReplyTo (const mailAddress & _adr) + { + replytoAdr = _adr; + } + + const TQCString& getMessageId () + { + return messageID; + } + void setMessageId (const TQCString & _str) + { + messageID = _str; + } + + const TQCString& getInReplyTo () + { + return inReplyTo; + } + void setInReplyTo (const TQCString & _str) + { + inReplyTo = _str; + } + + const TQCString& getReferences () + { + return references; + } + void setReferences (const TQCString & _str) + { + references = _str; + } + + /** + * set a unicode subject + */ + void setSubject (const TQString & _str) + { + _subject = rfcDecoder::encodeRFC2047String(_str).latin1(); + } + /** + * set a encoded subject + */ + void setSubjectEncoded (const TQCString & _str) + { + _subject = _str.simplifyWhiteSpace(); + } + + /** + * get the unicode subject + */ + const TQString getSubject () + { + return rfcDecoder::decodeRFC2047String(_subject); + } + /** + * get the encoded subject + */ + const TQCString& getSubjectEncoded () + { + return _subject; + } + + /** + * set the date + */ + void setDate (const TQCString & _str) + { + mDate = _str; + } + + /** + * get the date + */ + const TQCString& date () + { + return mDate; + } + + static int parseAddressList (const char *, TQPtrList < mailAddress > *); + static TQCString getAddressStr (TQPtrList < mailAddress > *); + TQPtrList < mailAddress > &to () + { + return toAdr; + } + TQPtrList < mailAddress > &cc () + { + return ccAdr; + } + TQPtrList < mailAddress > &bcc () + { + return bccAdr; + } +#ifdef KMAIL_COMPATIBLE + TQString subject () + { + return getSubject (); + } + const mailAddress & from () + { + return fromAdr; + } + const mailAddress & replyTo () + { + return replytoAdr; + } + void readConfig (void) + {; + } +#endif + +private: + TQPtrList < mailAddress > toAdr; + TQPtrList < mailAddress > ccAdr; + TQPtrList < mailAddress > bccAdr; + mailAddress fromAdr; + mailAddress senderAdr; + mailAddress returnpathAdr; + mailAddress replytoAdr; + TQCString _subject; + TQCString mDate; + int gmt_offset; + TQCString messageID; + TQCString inReplyTo; + TQCString references; +}; + +#endif diff --git a/tdeioslaves/imap4/mimehdrline.cc b/tdeioslaves/imap4/mimehdrline.cc new file mode 100644 index 00000000..9646ed26 --- /dev/null +++ b/tdeioslaves/imap4/mimehdrline.cc @@ -0,0 +1,521 @@ +/*************************************************************************** + mimehdrline.cc - description + ------------------- + begin : Wed Oct 11 2000 + copyright : (C) 2000 by Sven Carstens + email : s.carstens@gmx.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include +#include +#include +#include +#include + +#include "mimehdrline.h" +#include "rfcdecoder.h" + +using namespace std; + +const char *wdays[] = { + "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" +}; + +const char *months[] = { + "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" +}; + +mimeHdrLine::mimeHdrLine (): +mimeValue ((const char *) NULL), mimeLabel ((const char *) NULL) +{ +} + +mimeHdrLine::mimeHdrLine (const TQCString & aLabel, const TQCString & aValue): +mimeValue (aValue), +mimeLabel (aLabel) +{ +} + +mimeHdrLine::mimeHdrLine (mimeHdrLine * aHdrLine): +mimeValue (aHdrLine->mimeValue), mimeLabel (aHdrLine->mimeLabel) +{ +} + +mimeHdrLine::~mimeHdrLine () +{ +} + +int +mimeHdrLine::appendStr (const char *inCStr) +{ + int retVal = 0; + int skip; + char *aCStr = (char *) inCStr; + + if (aCStr) + { + skip = skipWS (aCStr); + if (skip && !mimeLabel.isEmpty ()) + { + if (skip > 0) + { + mimeValue += TQCString (aCStr, skip + 1); + aCStr += skip; + retVal += skip; + skip = parseFullLine (aCStr); + mimeValue += TQCString (aCStr, skip + 1); + retVal += skip; + aCStr += skip; + } + } + else + { + if (mimeLabel.isEmpty ()) + return setStr (aCStr); + } + } + return retVal; +} + +/** parse a Line into the class +move input ptr accordingly +and report characters slurped */ +int +mimeHdrLine::setStr (const char *inCStr) +{ + int retVal = 0; + char *aCStr = (char *) inCStr; +// char *begin = aCStr; + mimeLabel = TQCString ((const char *) NULL); + mimeValue = TQCString ((const char *) NULL); + + if (aCStr) + { + // can't have spaces on normal lines + if (!skipWS (aCStr)) + { + int label = 0, advance; + while ((advance = parseWord (&aCStr[label]))) + { + label += advance; + } + if (label && aCStr[label - 1] != ':') + retVal = 0; + else + { + mimeLabel = TQCString (aCStr, label); //length including zero + retVal += label; + aCStr += label; + } + } + if (retVal) + { + int skip; + skip = skipWS (aCStr); + if (skip < 0) + skip *= -1; + aCStr += skip; + retVal += skip; + skip = parseFullLine (aCStr); + mimeValue = TQCString (aCStr, skip + 1); + retVal += skip; + aCStr += skip; + } + else + { + //Skip malformed line + while (*aCStr && *aCStr != '\r' && *aCStr != '\n') + { + retVal--; + aCStr++; + } + if (*aCStr == '\r') + { + retVal--; + aCStr++; + } + if (*aCStr == '\n') + { + retVal--; + aCStr++; + } + } + } + else + { + //debug + } + return retVal; +} + +/** slurp one word*/ +int +mimeHdrLine::parseWord (const char *inCStr) +{ + int retVal = 0; + char *aCStr = (char *) inCStr; + + if (aCStr && *aCStr) + { + if (*aCStr == '"') + return mimeHdrLine::parseQuoted ('"', '"', aCStr); + else + return mimeHdrLine::parseHalfWord (aCStr); + } + else + { + //debug(); + } + return retVal; +} + +/** slurp one word*/ +int +mimeHdrLine::parseQuoted (char startQuote, char endQuote, const char *inCStr) +{ + char *aCStr = (char *) inCStr; + int retVal = 0; + + if (aCStr && *aCStr) + { + if (*aCStr == startQuote) + { + aCStr++; + retVal++; + } + else + return 0; + while (*aCStr && *aCStr != endQuote) + { + //skip over backticks + if (*aCStr == '\\') + { + aCStr++; + retVal++; + } + //eat this + aCStr++; + retVal++; + } + if (*aCStr == endQuote) + { + aCStr++; + retVal++; + } + } + else + { + //debug(); + } + return retVal; +} + +/** slurp one alphanumerical word without continuation*/ +int +mimeHdrLine::parseAlphaNum (const char *inCStr) +{ + int retVal = 0; + char *aCStr = (char *) inCStr; + + if (aCStr) + { + while (*aCStr && isalnum (*aCStr)) + { + //skip over backticks + if (*aCStr == '\\') + { + aCStr++; + retVal++; + } + //eat this + aCStr++; + retVal++; + } + } + else + { + //debug(); + } + return retVal; +} + +int +mimeHdrLine::parseHalfWord (const char *inCStr) +{ + int retVal = 0; + char *aCStr = (char *) inCStr; + + if (aCStr && *aCStr) + { + if (isalnum (*aCStr)) + return mimeHdrLine::parseAlphaNum (aCStr); + //skip over backticks + if (*aCStr == '\\') + { + aCStr++; + retVal++; + } + else if (!isspace (*aCStr)) + { + //eat this + aCStr++; + retVal++; + } + } + else + { + //debug(); + } + return retVal; +} + +/** slurp one line without continuation*/ +int +mimeHdrLine::parseHalfLine (const char *inCStr) +{ + int retVal = 0; + char *aCStr = (char *) inCStr; + + if (aCStr) + { + while (*aCStr && *aCStr != '\n') + { + //skip over backticks + if (*aCStr == '\\') + { + aCStr++; + retVal++; + } + //eat this + aCStr++; + retVal++; + } + if (*aCStr == '\n') + { + aCStr++; + retVal++; + } + } + else + { + //debug(); + } + return retVal; +} + +/** skip all white space characters including continuation*/ +int +mimeHdrLine::skipWS (const char *inCStr) +{ + int retVal = 0; + char *aCStr = (char *) inCStr; + + if (aCStr && *aCStr) + { + while (*aCStr == ' ' || *aCStr == '\t') + { + aCStr++; + retVal++; + } + //check out for continuation lines + if (*aCStr == '\r') + { + aCStr++; + retVal++; + } + if (*aCStr++ == '\n') + if (*aCStr == '\t' || *aCStr == ' ') + { + int skip = mimeHdrLine::skipWS (aCStr); + if (skip < 0) + skip *= -1; + retVal += 1 + skip; + } + else + { + retVal = -retVal - 1; + } + } + else + { + //debug(); + } + return retVal; +} + +/** parses continuated lines */ +int +mimeHdrLine::parseFullLine (const char *inCStr) +{ + int retVal = 0; + char *aCStr = (char *) inCStr; + int skip; + + if (aCStr) + { + //skip leading white space + skip = skipWS (aCStr); + if (skip > 0) + { + aCStr += skip; + retVal += skip; + } + while (*aCStr) + { + int advance; + + if ((advance = parseHalfLine (aCStr))) + { + retVal += advance; + aCStr += advance; + } + else if ((advance = skipWS (aCStr))) + { + if (advance > 0) + { + retVal += advance; + aCStr += advance; + } + else + { + retVal -= advance; + break; + } + } + else + break; + } + } + else + { + //debug(); + } + return retVal; +} + +/** parses continuated lines */ +int +mimeHdrLine::parseSeparator (char separator, const char *inCStr) +{ + char *aCStr = (char *) inCStr; + int retVal = 0; + int skip; + + if (aCStr) + { + //skip leading white space + skip = skipWS (aCStr); + if (skip > 0) + { + aCStr += skip; + retVal += skip; + } + while (*aCStr) + { + int advance; + + if (*aCStr != separator) + { + if ((advance = mimeHdrLine::parseWord (aCStr))) + { + retVal += advance; + aCStr += advance; + } + else if ((advance = mimeHdrLine::skipWS (aCStr))) + { + if (advance > 0) + { + retVal += advance; + aCStr += advance; + } + else + { + retVal -= advance; + break; + } + } + else + break; + } + else + { + //include separator in result + retVal++; + aCStr++; + break; + } + } + } + else + { + //debug(); + } + return retVal; +} + +/** return the label */ + +const TQCString& +mimeHdrLine::getLabel () +{ + return mimeLabel; +} + +/** return the value */ +const TQCString& +mimeHdrLine::getValue () +{ + return mimeValue; +} + + +// FIXME: very inefficient still +TQCString +mimeHdrLine::truncateLine(TQCString aLine, unsigned int truncate) +{ + int cutHere; + TQCString retVal; + uint len = aLine.length(); + + // see if we have a line of the form "key: value" (like "Subject: bla") + // then we do not want to truncate between key and value + int validStart = aLine.find(": "); + if (validStart > -1) { + validStart += 2; + } + while (len > truncate) { + cutHere = aLine.findRev(' ', truncate); + if (cutHere < 1 || cutHere < validStart) { + cutHere = aLine.findRev('\t', truncate); + if (cutHere < 1) { + cutHere = aLine.find(' ', 1); + if (cutHere < 1) { + cutHere = aLine.find('\t', 1); + if (cutHere < 1) { + // simply truncate + return aLine.left(truncate); + } + } + } + } + + retVal += aLine.left(cutHere) + '\n'; + int chop = len - cutHere; + aLine = aLine.right(chop); + len -= chop; + } + retVal += aLine; + + return retVal; +} + diff --git a/tdeioslaves/imap4/mimehdrline.h b/tdeioslaves/imap4/mimehdrline.h new file mode 100644 index 00000000..e31c1864 --- /dev/null +++ b/tdeioslaves/imap4/mimehdrline.h @@ -0,0 +1,67 @@ +/*************************************************************************** + mimehdrline.h - description + ------------------- + begin : Wed Oct 11 2000 + copyright : (C) 2000 by Sven Carstens + email : s.carstens@gmx.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef MIMEHDRLINE_H +#define MIMEHDRLINE_H + + +#include +#include + +/** + *@author Sven Carstens + */ + +class mimeHdrLine +{ +public: + mimeHdrLine (); + mimeHdrLine (mimeHdrLine *); + mimeHdrLine (const TQCString &, const TQCString &); + ~mimeHdrLine (); + /** parse a Line into the class +and report characters slurped */ + int setStr (const char *); + int appendStr (const char *); + /** return the value */ + const TQCString& getValue (); + /** return the label */ + const TQCString& getLabel (); + static TQCString truncateLine (TQCString, unsigned int truncate = 80); + static int parseSeparator (char, const char *); + static int parseQuoted (char, char, const char *); + /** skip all white space characters */ + static int skipWS (const char *); + /** slurp one word respecting backticks */ + static int parseHalfWord (const char *); + static int parseWord (const char *); + static int parseAlphaNum (const char *); + +protected: // Protected attributes + /** contains the Value + */ + TQCString mimeValue; + /** contains the Label of the line + */ + TQCString mimeLabel; +protected: // Protected methods + /** parses a continuated line */ + int parseFullLine (const char *); + int parseHalfLine (const char *); +}; + +#endif diff --git a/tdeioslaves/imap4/mimeheader.cc b/tdeioslaves/imap4/mimeheader.cc new file mode 100644 index 00000000..72e3827b --- /dev/null +++ b/tdeioslaves/imap4/mimeheader.cc @@ -0,0 +1,745 @@ +/*************************************************************************** + mimeheader.cc - description + ------------------- + begin : Fri Oct 20 2000 + copyright : (C) 2000 by Sven Carstens + email : s.carstens@gmx.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "mimeheader.h" +#include "mimehdrline.h" +#include "mailheader.h" +#include "rfcdecoder.h" + +#include + +// #include +#include +#include +#include +#include +#include +#include +#include + +mimeHeader::mimeHeader (): +typeList (17, false), dispositionList (17, false) +{ + // Case insensitive hashes are killing us. Also are they too small? + originalHdrLines.setAutoDelete (true); + additionalHdrLines.setAutoDelete (false); // is also in original lines + nestedParts.setAutoDelete (true); + typeList.setAutoDelete (true); + dispositionList.setAutoDelete (true); + nestedMessage = NULL; + contentLength = 0; + contentType = "application/octet-stream"; +} + +mimeHeader::~mimeHeader () +{ +} + +/* +TQPtrList mimeHeader::getAllParts() +{ + TQPtrList retVal; + + // caller is responsible for clearing + retVal.setAutoDelete( false ); + nestedParts.setAutoDelete( false ); + + // shallow copy + retVal = nestedParts; + + // can't have duplicate pointers + nestedParts.clear(); + + // restore initial state + nestedParts.setAutoDelete( true ); + + return retVal; +} */ + +void +mimeHeader::addHdrLine (mimeHdrLine * aHdrLine) +{ + mimeHdrLine *addLine = new mimeHdrLine (aHdrLine); + if (addLine) + { + originalHdrLines.append (addLine); + if (tqstrnicmp (addLine->getLabel (), "Content-", 8)) + { + additionalHdrLines.append (addLine); + } + else + { + int skip; + const char *aCStr = addLine->getValue ().data (); + TQDict < TQString > *aList = 0; + + skip = mimeHdrLine::parseSeparator (';', aCStr); + if (skip > 0) + { + int cut = 0; + if (skip >= 2) + { + if (aCStr[skip - 1] == '\r') + cut++; + if (aCStr[skip - 1] == '\n') + cut++; + if (aCStr[skip - 2] == '\r') + cut++; + if (aCStr[skip - 1] == ';') + cut++; + } + TQCString mimeValue = TQCString (aCStr, skip - cut + 1); // cutting of one because of 0x00 + + + if (!tqstricmp (addLine->getLabel (), "Content-Disposition")) + { + aList = &dispositionList; + _contentDisposition = mimeValue; + } + else if (!tqstricmp (addLine->getLabel (), "Content-Type")) + { + aList = &typeList; + contentType = mimeValue; + } + else + if (!tqstricmp (addLine->getLabel (), "Content-Transfer-Encoding")) + { + contentEncoding = mimeValue; + } + else if (!tqstricmp (addLine->getLabel (), "Content-ID")) + { + contentID = mimeValue; + } + else if (!tqstricmp (addLine->getLabel (), "Content-Description")) + { + _contentDescription = mimeValue; + } + else if (!tqstricmp (addLine->getLabel (), "Content-MD5")) + { + contentMD5 = mimeValue; + } + else if (!tqstricmp (addLine->getLabel (), "Content-Length")) + { + contentLength = mimeValue.toULong (); + } + else + { + additionalHdrLines.append (addLine); + } +// cout << addLine->getLabel().data() << ": '" << mimeValue.data() << "'" << endl; + + aCStr += skip; + while ((skip = mimeHdrLine::parseSeparator (';', aCStr))) + { + if (skip > 0) + { + addParameter (TQCString (aCStr, skip).simplifyWhiteSpace(), aList); +// cout << "-- '" << aParm.data() << "'" << endl; + mimeValue = TQCString (addLine->getValue ().data (), skip); + aCStr += skip; + } + else + break; + } + } + } + } +} + +void +mimeHeader::addParameter (const TQCString& aParameter, TQDict < TQString > *aList) +{ + if ( !aList ) + return; + + TQString *aValue; + TQCString aLabel; + int pos = aParameter.find ('='); +// cout << aParameter.left(pos).data(); + aValue = new TQString (); + aValue->setLatin1 (aParameter.right (aParameter.length () - pos - 1)); + aLabel = aParameter.left (pos); + if ((*aValue)[0] == '"') + *aValue = aValue->mid (1, aValue->length () - 2); + + aList->insert (aLabel, aValue); +// cout << "=" << aValue->data() << endl; +} + +TQString +mimeHeader::getDispositionParm (const TQCString& aStr) +{ + return getParameter (aStr, &dispositionList); +} + +TQString +mimeHeader::getTypeParm (const TQCString& aStr) +{ + return getParameter (aStr, &typeList); +} + +void +mimeHeader::setDispositionParm (const TQCString& aLabel, const TQString& aValue) +{ + setParameter (aLabel, aValue, &dispositionList); + return; +} + +void +mimeHeader::setTypeParm (const TQCString& aLabel, const TQString& aValue) +{ + setParameter (aLabel, aValue, &typeList); +} + +TQDictIterator < TQString > mimeHeader::getDispositionIterator () +{ + return TQDictIterator < TQString > (dispositionList); +} + +TQDictIterator < TQString > mimeHeader::getTypeIterator () +{ + return TQDictIterator < TQString > (typeList); +} + +TQPtrListIterator < mimeHdrLine > mimeHeader::getOriginalIterator () +{ + return TQPtrListIterator < mimeHdrLine > (originalHdrLines); +} + +TQPtrListIterator < mimeHdrLine > mimeHeader::getAdditionalIterator () +{ + return TQPtrListIterator < mimeHdrLine > (additionalHdrLines); +} + +void +mimeHeader::outputHeader (mimeIO & useIO) +{ + if (!getDisposition ().isEmpty ()) + { + useIO.outputMimeLine (TQCString ("Content-Disposition: ") + + getDisposition () + + outputParameter (&dispositionList)); + } + + if (!getType ().isEmpty ()) + { + useIO.outputMimeLine (TQCString ("Content-Type: ") + + getType () + outputParameter (&typeList)); + } + if (!getDescription ().isEmpty ()) + useIO.outputMimeLine (TQCString ("Content-Description: ") + + getDescription ()); + if (!getID ().isEmpty ()) + useIO.outputMimeLine (TQCString ("Content-ID: ") + getID ()); + if (!getMD5 ().isEmpty ()) + useIO.outputMimeLine (TQCString ("Content-MD5: ") + getMD5 ()); + if (!getEncoding ().isEmpty ()) + useIO.outputMimeLine (TQCString ("Content-Transfer-Encoding: ") + + getEncoding ()); + + TQPtrListIterator < mimeHdrLine > ait = getAdditionalIterator (); + while (ait.current ()) + { + useIO.outputMimeLine (ait.current ()->getLabel () + ": " + + ait.current ()->getValue ()); + ++ait; + } + useIO.outputMimeLine (TQCString ("")); +} + +TQString +mimeHeader::getParameter (const TQCString& aStr, TQDict < TQString > *aDict) +{ + TQString retVal, *found; + if (aDict) + { + //see if it is a normal parameter + found = aDict->find (aStr); + if (!found) + { + //might be a continuated or encoded parameter + found = aDict->find (aStr + "*"); + if (!found) + { + //continuated parameter + TQString decoded, encoded; + int part = 0; + + do + { + TQCString search; + search.setNum (part); + search = aStr + "*" + search; + found = aDict->find (search); + if (!found) + { + found = aDict->find (search + "*"); + if (found) + encoded += rfcDecoder::encodeRFC2231String (*found); + } + else + { + encoded += *found; + } + part++; + } + while (found); + if (encoded.find ('\'') >= 0) + { + retVal = rfcDecoder::decodeRFC2231String (encoded.local8Bit ()); + } + else + { + retVal = + rfcDecoder::decodeRFC2231String (TQCString ("''") + + encoded.local8Bit ()); + } + } + else + { + //simple encoded parameter + retVal = rfcDecoder::decodeRFC2231String (found->local8Bit ()); + } + } + else + { + retVal = *found; + } + } + return retVal; +} + +void +mimeHeader::setParameter (const TQCString& aLabel, const TQString& aValue, + TQDict < TQString > *aDict) +{ + bool encoded = true; + uint vlen, llen; + TQString val = aValue; + + if (aDict) + { + + //see if it needs to get encoded + if (encoded && aLabel.find ('*') == -1) + { + val = rfcDecoder::encodeRFC2231String (aValue); + } + //kdDebug(7116) << "mimeHeader::setParameter() - val = '" << val << "'" << endl; + //see if it needs to be truncated + vlen = val.length(); + llen = aLabel.length(); + if (vlen + llen + 4 > 80 && llen < 80 - 8 - 2 ) + { + const int limit = 80 - 8 - 2 - (int)llen; + // the -2 is there to allow extending the length of a part of val + // by 1 or 2 in order to prevent an encoded character from being + // split in half + int i = 0; + TQString shortValue; + TQCString shortLabel; + + while (!val.isEmpty ()) + { + int partLen; // the length of the next part of the value + if ( limit >= int(vlen) ) { + // the rest of the value fits completely into one continued header + partLen = vlen; + } + else { + partLen = limit; + // make sure that we don't split an encoded char in half + if ( val[partLen-1] == '%' ) { + partLen += 2; + } + else if ( partLen > 1 && val[partLen-2] == '%' ) { + partLen += 1; + } + // make sure partLen does not exceed vlen (could happen in case of + // an incomplete encoded char) + if ( partLen > int(vlen) ) { + partLen = vlen; + } + } + shortValue = val.left( partLen ); + shortLabel.setNum (i); + shortLabel = aLabel + "*" + shortLabel; + val = val.right( vlen - partLen ); + vlen = vlen - partLen; + if (encoded) + { + if (i == 0) + { + shortValue = "''" + shortValue; + } + shortLabel += "*"; + } + //kdDebug(7116) << "mimeHeader::setParameter() - shortLabel = '" << shortLabel << "'" << endl; + //kdDebug(7116) << "mimeHeader::setParameter() - shortValue = '" << shortValue << "'" << endl; + //kdDebug(7116) << "mimeHeader::setParameter() - val = '" << val << "'" << endl; + aDict->insert (shortLabel, new TQString (shortValue)); + i++; + } + } + else + { + aDict->insert (aLabel, new TQString (val)); + } + } +} + +TQCString +mimeHeader::outputParameter (TQDict < TQString > *aDict) +{ + TQCString retVal; + if (aDict) + { + TQDictIterator < TQString > it (*aDict); + while (it.current ()) + { + retVal += (";\n\t" + it.currentKey () + "=").latin1 (); + if (it.current ()->find (' ') > 0 || it.current ()->find (';') > 0) + { + retVal += '"' + it.current ()->utf8 () + '"'; + } + else + { + retVal += it.current ()->utf8 (); + } + // << it.current()->utf8() << "'"; + ++it; + } + retVal += "\n"; + } + return retVal; +} + +void +mimeHeader::outputPart (mimeIO & useIO) +{ + TQPtrListIterator < mimeHeader > nestedParts = getNestedIterator (); + TQCString boundary; + if (!getTypeParm ("boundary").isEmpty ()) + boundary = getTypeParm ("boundary").latin1 (); + + outputHeader (useIO); + if (!getPreBody ().isEmpty ()) + useIO.outputMimeLine (getPreBody ()); + if (getNestedMessage ()) + getNestedMessage ()->outputPart (useIO); + while (nestedParts.current ()) + { + if (!boundary.isEmpty ()) + useIO.outputMimeLine ("--" + boundary); + nestedParts.current ()->outputPart (useIO); + ++nestedParts; + } + if (!boundary.isEmpty ()) + useIO.outputMimeLine ("--" + boundary + "--"); + if (!getPostBody ().isEmpty ()) + useIO.outputMimeLine (getPostBody ()); +} + +int +mimeHeader::parsePart (mimeIO & useIO, const TQString& boundary) +{ + int retVal = 0; + bool mbox = false; + TQCString preNested, postNested; + mbox = parseHeader (useIO); + + kdDebug(7116) << "mimeHeader::parsePart - parsing part '" << getType () << "'" << endl; + if (!tqstrnicmp (getType (), "Multipart", 9)) + { + retVal = parseBody (useIO, preNested, getTypeParm ("boundary")); //this is a message in mime format stuff + setPreBody (preNested); + int localRetVal; + do + { + mimeHeader *aHeader = new mimeHeader; + + // set default type for multipart/digest + if (!tqstrnicmp (getType (), "Multipart/Digest", 16)) + aHeader->setType ("Message/RFC822"); + + localRetVal = aHeader->parsePart (useIO, getTypeParm ("boundary")); + addNestedPart (aHeader); + } + while (localRetVal); //get nested stuff + } + if (!tqstrnicmp (getType (), "Message/RFC822", 14)) + { + mailHeader *msgHeader = new mailHeader; + retVal = msgHeader->parsePart (useIO, boundary); + setNestedMessage (msgHeader); + } + else + { + retVal = parseBody (useIO, postNested, boundary, mbox); //just a simple part remaining + setPostBody (postNested); + } + return retVal; +} + +int +mimeHeader::parseBody (mimeIO & useIO, TQCString & messageBody, + const TQString& boundary, bool mbox) +{ + TQCString inputStr; + TQCString buffer; + TQString partBoundary; + TQString partEnd; + int retVal = 0; //default is last part + + if (!boundary.isEmpty ()) + { + partBoundary = TQString ("--") + boundary; + partEnd = TQString ("--") + boundary + "--"; + } + + while (useIO.inputLine (inputStr)) + { + //check for the end of all parts + if (!partEnd.isEmpty () + && !tqstrnicmp (inputStr, partEnd.latin1 (), partEnd.length () - 1)) + { + retVal = 0; //end of these parts + break; + } + else if (!partBoundary.isEmpty () + && !tqstrnicmp (inputStr, partBoundary.latin1 (), + partBoundary.length () - 1)) + { + retVal = 1; //continue with next part + break; + } + else if (mbox && inputStr.find ("From ") == 0) + { + retVal = 0; // end of mbox + break; + } + buffer += inputStr; + if (buffer.length () > 16384) + { + messageBody += buffer; + buffer = ""; + } + } + + messageBody += buffer; + return retVal; +} + +bool +mimeHeader::parseHeader (mimeIO & useIO) +{ + bool mbox = false; + bool first = true; + mimeHdrLine my_line; + TQCString inputStr; + + kdDebug(7116) << "mimeHeader::parseHeader - starting parsing" << endl; + while (useIO.inputLine (inputStr)) + { + int appended; + if (inputStr.find ("From ") != 0 || !first) + { + first = false; + appended = my_line.appendStr (inputStr); + if (!appended) + { + addHdrLine (&my_line); + appended = my_line.setStr (inputStr); + } + if (appended <= 0) + break; + } + else + { + mbox = true; + first = false; + } + inputStr = (const char *) NULL; + } + + kdDebug(7116) << "mimeHeader::parseHeader - finished parsing" << endl; + return mbox; +} + +mimeHeader * +mimeHeader::bodyPart (const TQString & _str) +{ + // see if it is nested a little deeper + int pt = _str.find('.'); + if (pt != -1) + { + TQString tempStr = _str; + mimeHeader *tempPart; + + tempStr = _str.right (_str.length () - pt - 1); + if (nestedMessage) + { + kdDebug(7116) << "mimeHeader::bodyPart - recursing message" << endl; + tempPart = nestedMessage->nestedParts.at (_str.left(pt).toULong() - 1); + } + else + { + kdDebug(7116) << "mimeHeader::bodyPart - recursing mixed" << endl; + tempPart = nestedParts.at (_str.left(pt).toULong() - 1); + } + if (tempPart) + tempPart = tempPart->bodyPart (tempStr); + return tempPart; + } + + kdDebug(7116) << "mimeHeader::bodyPart - returning part " << _str << endl; + // or pick just the plain part + if (nestedMessage) + { + kdDebug(7116) << "mimeHeader::bodyPart - message" << endl; + return nestedMessage->nestedParts.at (_str.toULong () - 1); + } + kdDebug(7116) << "mimeHeader::bodyPart - mixed" << endl; + return nestedParts.at (_str.toULong () - 1); +} + +void mimeHeader::serialize(TQDataStream& stream) +{ + int nestedcount = nestedParts.count(); + if (nestedParts.isEmpty() && nestedMessage) + nestedcount = 1; + stream << nestedcount << contentType << TQString (getTypeParm ("name")) << _contentDescription + << _contentDisposition << contentEncoding << contentLength << partSpecifier; + // serialize nested message + if (nestedMessage) + nestedMessage->serialize(stream); + + // serialize nested parts + if (!nestedParts.isEmpty()) + { + TQPtrListIterator < mimeHeader > it(nestedParts); + mimeHeader* part; + while ( (part = it.current()) != 0 ) + { + ++it; + part->serialize(stream); + } + } +} + +#ifdef KMAIL_COMPATIBLE +// compatibility subroutines +TQString +mimeHeader::bodyDecoded () +{ + kdDebug(7116) << "mimeHeader::bodyDecoded" << endl; + TQByteArray temp; + + temp = bodyDecodedBinary (); + return TQString::fromLatin1 (temp.data (), temp.count ()); +} + +TQByteArray +mimeHeader::bodyDecodedBinary () +{ + TQByteArray retVal; + + if (contentEncoding.find ("quoted-printable", 0, false) == 0) + retVal = KCodecs::quotedPrintableDecode(postMultipartBody); + else if (contentEncoding.find ("base64", 0, false) == 0) + KCodecs::base64Decode(postMultipartBody, retVal); + else retVal = postMultipartBody; + + kdDebug(7116) << "mimeHeader::bodyDecodedBinary - size is " << retVal.size () << endl; + return retVal; +} + +void +mimeHeader::setBodyEncodedBinary (const TQByteArray & _arr) +{ + setBodyEncoded (_arr); +} + +void +mimeHeader::setBodyEncoded (const TQByteArray & _arr) +{ + TQByteArray setVal; + + kdDebug(7116) << "mimeHeader::setBodyEncoded - in size " << _arr.size () << endl; + if (contentEncoding.find ("quoted-printable", 0, false) == 0) + setVal = KCodecs::quotedPrintableEncode(_arr); + else if (contentEncoding.find ("base64", 0, false) == 0) + KCodecs::base64Encode(_arr, setVal); + else + setVal.duplicate (_arr); + kdDebug(7116) << "mimeHeader::setBodyEncoded - out size " << setVal.size () << endl; + + postMultipartBody.duplicate (setVal); + kdDebug(7116) << "mimeHeader::setBodyEncoded - out size " << postMultipartBody.size () << endl; +} + +TQString +mimeHeader::iconName () +{ + TQString fileName; + + // FIXME: bug? Why throw away this data? + fileName = + KMimeType::mimeType (contentType.lower ())->icon (TQString(), false); + fileName = + TDEGlobal::instance ()->iconLoader ()->iconPath (fileName, KIcon::Desktop); +// if (fileName.isEmpty()) +// fileName = TDEGlobal::instance()->iconLoader()->iconPath( "unknown", KIcon::Desktop ); + return fileName; +} + +void +mimeHeader::setNestedMessage (mailHeader * inPart, bool destroy) +{ +// if(nestedMessage && destroy) delete nestedMessage; + nestedMessage = inPart; +} + +TQString +mimeHeader::headerAsString () +{ + mimeIOTQString myIO; + + outputHeader (myIO); + return myIO.getString (); +} + +TQString +mimeHeader::magicSetType (bool aAutoDecode) +{ + TQString mimetype; + TQByteArray body; + KMimeMagicResult *result; + + KMimeMagic::self ()->setFollowLinks (TRUE); // is it necessary ? + + if (aAutoDecode) + body = bodyDecodedBinary (); + else + body = postMultipartBody; + + result = KMimeMagic::self ()->findBufferType (body); + mimetype = result->mimeType (); + contentType = mimetype; + return mimetype; +} +#endif diff --git a/tdeioslaves/imap4/mimeheader.h b/tdeioslaves/imap4/mimeheader.h new file mode 100644 index 00000000..bc2fd2bc --- /dev/null +++ b/tdeioslaves/imap4/mimeheader.h @@ -0,0 +1,337 @@ +/*************************************************************************** + mimeheader.h - description + ------------------- + begin : Fri Oct 20 2000 + copyright : (C) 2000 by Sven Carstens + email : s.carstens@gmx.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef MIMEHEADER_H +#define MIMEHEADER_H + +#include +#include + +#include "mimehdrline.h" +#include "mimeio.h" +#include "rfcdecoder.h" + +/** + *@author Sven Carstens + */ + +class mimeHeader +{ +public: + mimeHeader (); + virtual ~ mimeHeader (); + + virtual void addHdrLine (mimeHdrLine *); + virtual void outputHeader (mimeIO &); + virtual void outputPart (mimeIO &); + + + TQCString outputParameter (TQDict < TQString > *); + + int parsePart (mimeIO &, const TQString&); + int parseBody (mimeIO &, TQCString &, const TQString&, bool mbox = false); + + // parse a header. returns true if it had a leading 'From ' line + bool parseHeader (mimeIO &); + + TQString getDispositionParm (const TQCString&); + void setDispositionParm (const TQCString&, const TQString&); + TQDictIterator < TQString > getDispositionIterator (); + + TQString getTypeParm (const TQCString&); + void setTypeParm (const TQCString&, const TQString&); + TQDictIterator < TQString > getTypeIterator (); + + // recursively serialize all important contents to the TQDataStream + void serialize(TQDataStream& stream); + + const TQCString& getType () + { + return contentType; + } + void setType (const TQCString & _str) + { + contentType = _str; + } + + const TQCString& getDescription () + { + return _contentDescription; + } + void setDescription (const TQCString & _str) + { + _contentDescription = _str; + } + + TQCString getDisposition () + { + return _contentDisposition; + } + void setDisposition (const TQCString & _str) + { + _contentDisposition = _str; + } + + TQCString getEncoding () + { + return contentEncoding; + } + void setEncoding (const TQCString & _str) + { + contentEncoding = _str; + } + + TQCString getMD5 () + { + return contentMD5; + } + void setMD5 (const TQCString & _str) + { + contentMD5 = _str; + } + + TQCString getID () + { + return contentID; + } + void setID (const TQCString & _str) + { + contentID = _str; + } + + unsigned long getLength () + { + return contentLength; + } + void setLength (unsigned long _len) + { + contentLength = _len; + } + + const TQString & getPartSpecifier () + { + return partSpecifier; + } + void setPartSpecifier (const TQString & _str) + { + partSpecifier = _str; + } + + TQPtrListIterator < mimeHdrLine > getOriginalIterator (); + TQPtrListIterator < mimeHdrLine > getAdditionalIterator (); + void setContent (const TQCString &aContent) + { + mimeContent = aContent; + } + TQCString getContent () + { + return mimeContent; + } + + TQCString getBody () + { + return preMultipartBody + postMultipartBody; + } + TQCString getPreBody () + { + return preMultipartBody; + } + void setPreBody (TQCString & inBody) + { + preMultipartBody = inBody; + } + + TQCString getPostBody () + { + return postMultipartBody; + } + void setPostBody (TQCString & inBody) + { + postMultipartBody = inBody; + contentLength = inBody.length (); + } + + mimeHeader *getNestedMessage () + { + return nestedMessage; + } + void setNestedMessage (mimeHeader * inPart, bool destroy = true) + { + if (nestedMessage && destroy) + delete nestedMessage; + nestedMessage = inPart; + } + +// mimeHeader *getNestedPart() { return nestedPart; }; + void addNestedPart (mimeHeader * inPart) + { + nestedParts.append (inPart); + } + TQPtrListIterator < mimeHeader > getNestedIterator () + { + return TQPtrListIterator < mimeHeader > (nestedParts); + } + + // clears all parts and deletes them from memory + void clearNestedParts () + { + nestedParts.clear (); + } + + // clear all parameters to content-type + void clearTypeParameters () + { + typeList.clear (); + } + + // clear all parameters to content-disposition + void clearDispositionParameters () + { + dispositionList.clear (); + } + + // return the specified body part or NULL + mimeHeader *bodyPart (const TQString &); + +#ifdef KMAIL_COMPATIBLE + ulong msgSize () + { + return contentLength; + } + uint numBodyParts () + { + return nestedParts.count (); + } + mimeHeader *bodyPart (int which, mimeHeader ** ret = NULL) + { + if (ret) + (*ret) = nestedParts.at (which); + return nestedParts.at (which); + } + void write (const TQString &) + { + } + TQString typeStr () + { + return TQString (contentType.left (contentType.find ('/'))); + } + void setTypeStr (const TQString & _str) + { + contentType = TQCString (_str.latin1 ()) + "/" + subtypeStr ().latin1 (); + } + TQString subtypeStr () + { + return TQString (contentType. + right (contentType.length () - contentType.find ('/') - + 1)); + } + void setSubtypeStr (const TQString & _str) + { + contentType = TQCString (typeStr ().latin1 ()) + "/" + _str.latin1 (); + } + TQString cteStr () + { + return TQString (getEncoding ()); + } + void setCteStr (const TQString & _str) + { + setEncoding (_str.latin1 ()); + } + TQString contentDisposition () + { + return TQString (_contentDisposition); + } + TQString body () + { + return TQString (postMultipartBody); + } + TQString charset () + { + return getTypeParm ("charset"); + } + TQString bodyDecoded (); + void setBodyEncoded (const TQByteArray &); + void setBodyEncodedBinary (const TQByteArray &); + TQByteArray bodyDecodedBinary (); + TQString name () + { + return TQString (getTypeParm ("name")); + } + void setName (const TQString & _str) + { + setTypeParm ("name", _str); + } + TQString fileName () + { + return TQString (getDispositionParm ("filename")); + } + TQString contentDescription () + { + return TQString (rfcDecoder::decodeRFC2047String (_contentDescription)); + } + void setContentDescription (const TQString & _str) + { + _contentDescription = rfcDecoder::encodeRFC2047String (_str).latin1 (); + } + TQString msgIdMD5 () + { + return TQString (contentMD5); + } + TQString iconName (); + TQString magicSetType (bool aAutoDecode = true); + TQString headerAsString (); + ulong size () + { + return 0; + } + void fromString (const TQByteArray &) + {; + } + void setContentDisposition (const TQString & _str) + { + setDisposition (_str.latin1 ()); + } +#endif + +protected: + static void addParameter (const TQCString&, TQDict < TQString > *); + static TQString getParameter (const TQCString&, TQDict < TQString > *); + static void setParameter (const TQCString&, const TQString&, TQDict < TQString > *); + + TQPtrList < mimeHdrLine > originalHdrLines; + +private: + TQPtrList < mimeHdrLine > additionalHdrLines; + TQDict < TQString > typeList; + TQDict < TQString > dispositionList; + TQCString contentType; + TQCString _contentDisposition; + TQCString contentEncoding; + TQCString _contentDescription; + TQCString contentID; + TQCString contentMD5; + unsigned long contentLength; + TQCString mimeContent; + TQCString preMultipartBody; + TQCString postMultipartBody; + mimeHeader *nestedMessage; + TQPtrList < mimeHeader > nestedParts; + TQString partSpecifier; + +}; + +#endif diff --git a/tdeioslaves/imap4/mimeio.cc b/tdeioslaves/imap4/mimeio.cc new file mode 100644 index 00000000..757c11a4 --- /dev/null +++ b/tdeioslaves/imap4/mimeio.cc @@ -0,0 +1,188 @@ +/*************************************************************************** + mimeio.cc - description + ------------------- + begin : Wed Oct 25 2000 + copyright : (C) 2000 by Sven Carstens + email : s.carstens@gmx.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include +using namespace std; + +#include "mimeio.h" + +mimeIO::mimeIO () +{ + theCRLF = "\r\n"; + crlfLen = 2; +} + +mimeIO::~mimeIO () +{ +} + +int +mimeIO::inputLine (TQCString & aLine) +{ + char input; + + aLine = (const char *) NULL; + while (inputChar (input)) + { + aLine += input; + if (input == '\n') + break; + } +// cout << aLine.length() << " - " << aLine; + return aLine.length (); +} + +int +mimeIO::outputLine (const TQCString & aLine, int len) +{ + int i; + + if (len == -1) { + len = aLine.length(); + } + int start = len; + for (i = 0; i < start; i++) + if (!outputChar (aLine[i])) + break; + return i; +} + +int +mimeIO::outputMimeLine (const TQCString & inLine) +{ + int retVal = 0; + TQCString aLine = inLine; + int len = inLine.length(); + + int theLF = aLine.findRev ('\n'); + if (theLF == len - 1 && theLF != -1) + { + //we have a trailing LF, now check for CR + if (aLine[theLF - 1] == '\r') + theLF--; + //truncate the line + aLine.truncate(theLF); + len = theLF; + theLF = -1; + } + //now truncate the line + { + int start, end, offset; + start = 0; + end = aLine.find ('\n', start); + while (end >= 0) + { + offset = 1; + if (end && aLine[end - 1] == '\r') + { + offset++; + end--; + } + outputLine (aLine.mid (start, end - start) + theCRLF, end - start + crlfLen); + start = end + offset; + end = aLine.find ('\n', start); + } + outputLine (aLine.mid (start, len - start) + theCRLF, len - start + crlfLen); + } + return retVal; +} + +int +mimeIO::inputChar (char &aChar) +{ + if (cin.eof ()) + { +// cout << "EOF" << endl; + return 0; + } + cin.get (aChar); + return 1; +} + +int +mimeIO::outputChar (char aChar) +{ + cout << aChar; + return 1; +} + +void +mimeIO::setCRLF (const char *aCRLF) +{ + theCRLF = aCRLF; + crlfLen = strlen(aCRLF); +} + +mimeIOTQFile::mimeIOTQFile (const TQString & aName): +mimeIO (), +myFile (aName) +{ + myFile.open (IO_ReadOnly); +} + +mimeIOTQFile::~mimeIOTQFile () +{ + myFile.close (); +} + +int +mimeIOTQFile::outputLine (const TQCString &, int) +{ + return 0; +} + +int +mimeIOTQFile::inputLine (TQCString & data) +{ + data.resize( 1024 ); + myFile.readLine (data.data(), 1024); + + return data.length (); +} + +mimeIOTQString::mimeIOTQString () +{ +} + +mimeIOTQString::~mimeIOTQString () +{ +} + +int +mimeIOTQString::outputLine (const TQCString & _str, int len) +{ + if (len == -1) { + len = _str.length(); + } + theString += _str; + return len; +} + +int +mimeIOTQString::inputLine (TQCString & _str) +{ + if (theString.isEmpty ()) + return 0; + + int i = theString.find ('\n'); + + if (i == -1) + return 0; + _str = theString.left (i + 1).latin1 (); + theString = theString.right (theString.length () - i - 1); + return _str.length (); +} diff --git a/tdeioslaves/imap4/mimeio.h b/tdeioslaves/imap4/mimeio.h new file mode 100644 index 00000000..37a96998 --- /dev/null +++ b/tdeioslaves/imap4/mimeio.h @@ -0,0 +1,79 @@ +/*************************************************************************** + mimeio.h - description + ------------------- + begin : Wed Oct 25 2000 + copyright : (C) 2000 by Sven Carstens + email : s.carstens@gmx.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef MIMEIO_H +#define MIMEIO_H + +#include +#include + +/** + *@author Sven Carstens + */ + +class mimeIO +{ +public: + mimeIO (); + virtual ~ mimeIO (); + + virtual int outputLine (const TQCString &, int len = -1); + virtual int outputMimeLine (const TQCString &); + virtual int inputLine (TQCString &); + virtual int outputChar (char); + virtual int inputChar (char &); + + void setCRLF (const char *); + +protected: + TQCString theCRLF; + int crlfLen; +}; + +class mimeIOTQFile:public mimeIO +{ +public: + mimeIOTQFile (const TQString &); + virtual ~ mimeIOTQFile (); + virtual int outputLine (const TQCString &, int len = -1); + virtual int inputLine (TQCString &); + +protected: + TQFile myFile; +}; + +class mimeIOTQString:public mimeIO +{ +public: + mimeIOTQString (); + virtual ~ mimeIOTQString (); + virtual int outputLine (const TQCString &, int len = -1); + virtual int inputLine (TQCString &); + const TQString& getString () const + { + return theString; + } + void setString (const TQString & _str) + { + theString = _str; + } + +protected: + TQString theString; +}; + +#endif diff --git a/tdeioslaves/imap4/rfcdecoder.cc b/tdeioslaves/imap4/rfcdecoder.cc new file mode 100644 index 00000000..08b641b7 --- /dev/null +++ b/tdeioslaves/imap4/rfcdecoder.cc @@ -0,0 +1,668 @@ +/********************************************************************** + * + * rfcdecoder.cc - handler for various rfc/mime encodings + * Copyright (C) 2000 s.carstens@gmx.de + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Send comments and bug fixes to s.carstens@gmx.de + * + *********************************************************************/ +#include "rfcdecoder.h" + +#include +#include + +#include +#include + +#include +#include +#include +#include + +// This part taken from rfc 2192 IMAP URL Scheme. C. Newman. September 1997. +// adapted to QT-Toolkit by Sven Carstens 2000 + +static unsigned char base64chars[] = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+,"; +#define UNDEFINED 64 +#define MAXLINE 76 + +/* UTF16 definitions */ +#define UTF16MASK 0x03FFUL +#define UTF16SHIFT 10 +#define UTF16BASE 0x10000UL +#define UTF16HIGHSTART 0xD800UL +#define UTF16HIGHEND 0xDBFFUL +#define UTF16LOSTART 0xDC00UL +#define UTF16LOEND 0xDFFFUL + +/* Convert an IMAP mailbox to a Unicode path + */ +TQString rfcDecoder::fromIMAP (const TQString & inSrc) +{ + unsigned char c, i, bitcount; + unsigned long ucs4, utf16, bitbuf; + unsigned char base64[256], utf8[6]; + unsigned long srcPtr = 0; + TQCString dst; + TQCString src = inSrc.ascii (); + uint srcLen = inSrc.length(); + + /* initialize modified base64 decoding table */ + memset (base64, UNDEFINED, sizeof (base64)); + for (i = 0; i < sizeof (base64chars); ++i) + { + base64[(int)base64chars[i]] = i; + } + + /* loop until end of string */ + while (srcPtr < srcLen) + { + c = src[srcPtr++]; + /* deal with literal characters and &- */ + if (c != '&' || src[srcPtr] == '-') + { + /* encode literally */ + dst += c; + /* skip over the '-' if this is an &- sequence */ + if (c == '&') + srcPtr++; + } + else + { + /* convert modified UTF-7 -> UTF-16 -> UCS-4 -> UTF-8 -> HEX */ + bitbuf = 0; + bitcount = 0; + ucs4 = 0; + while ((c = base64[(unsigned char) src[srcPtr]]) != UNDEFINED) + { + ++srcPtr; + bitbuf = (bitbuf << 6) | c; + bitcount += 6; + /* enough bits for a UTF-16 character? */ + if (bitcount >= 16) + { + bitcount -= 16; + utf16 = (bitcount ? bitbuf >> bitcount : bitbuf) & 0xffff; + /* convert UTF16 to UCS4 */ + if (utf16 >= UTF16HIGHSTART && utf16 <= UTF16HIGHEND) + { + ucs4 = (utf16 - UTF16HIGHSTART) << UTF16SHIFT; + continue; + } + else if (utf16 >= UTF16LOSTART && utf16 <= UTF16LOEND) + { + ucs4 += utf16 - UTF16LOSTART + UTF16BASE; + } + else + { + ucs4 = utf16; + } + /* convert UTF-16 range of UCS4 to UTF-8 */ + if (ucs4 <= 0x7fUL) + { + utf8[0] = ucs4; + i = 1; + } + else if (ucs4 <= 0x7ffUL) + { + utf8[0] = 0xc0 | (ucs4 >> 6); + utf8[1] = 0x80 | (ucs4 & 0x3f); + i = 2; + } + else if (ucs4 <= 0xffffUL) + { + utf8[0] = 0xe0 | (ucs4 >> 12); + utf8[1] = 0x80 | ((ucs4 >> 6) & 0x3f); + utf8[2] = 0x80 | (ucs4 & 0x3f); + i = 3; + } + else + { + utf8[0] = 0xf0 | (ucs4 >> 18); + utf8[1] = 0x80 | ((ucs4 >> 12) & 0x3f); + utf8[2] = 0x80 | ((ucs4 >> 6) & 0x3f); + utf8[3] = 0x80 | (ucs4 & 0x3f); + i = 4; + } + /* copy it */ + for (c = 0; c < i; ++c) + { + dst += utf8[c]; + } + } + } + /* skip over trailing '-' in modified UTF-7 encoding */ + if (src[srcPtr] == '-') + ++srcPtr; + } + } + return TQString::fromUtf8 (dst.data ()); +} + +/* replace " with \" and \ with \\ " and \ characters */ +TQString rfcDecoder::quoteIMAP(const TQString &src) +{ + uint len = src.length(); + TQString result; + result.reserve(2 * len); + for (unsigned int i = 0; i < len; i++) + { + if (src[i] == '"' || src[i] == '\\') + result += '\\'; + result += src[i]; + } + //result.squeeze(); - unnecessary and slow + return result; +} + +/* Convert Unicode path to modified UTF-7 IMAP mailbox + */ +TQString rfcDecoder::toIMAP (const TQString & inSrc) +{ + unsigned int utf8pos, utf8total, c, utf7mode, bitstogo, utf16flag; + unsigned long ucs4, bitbuf; + TQCString src = inSrc.utf8 (); + TQString dst; + + ulong srcPtr = 0; + utf7mode = 0; + utf8total = 0; + bitstogo = 0; + utf8pos = 0; + bitbuf = 0; + ucs4 = 0; + while (srcPtr < src.length ()) + { + c = (unsigned char) src[srcPtr++]; + /* normal character? */ + if (c >= ' ' && c <= '~') + { + /* switch out of UTF-7 mode */ + if (utf7mode) + { + if (bitstogo) + { + dst += base64chars[(bitbuf << (6 - bitstogo)) & 0x3F]; + bitstogo = 0; + } + dst += '-'; + utf7mode = 0; + } + dst += c; + /* encode '&' as '&-' */ + if (c == '&') + { + dst += '-'; + } + continue; + } + /* switch to UTF-7 mode */ + if (!utf7mode) + { + dst += '&'; + utf7mode = 1; + } + /* Encode US-ASCII characters as themselves */ + if (c < 0x80) + { + ucs4 = c; + utf8total = 1; + } + else if (utf8total) + { + /* save UTF8 bits into UCS4 */ + ucs4 = (ucs4 << 6) | (c & 0x3FUL); + if (++utf8pos < utf8total) + { + continue; + } + } + else + { + utf8pos = 1; + if (c < 0xE0) + { + utf8total = 2; + ucs4 = c & 0x1F; + } + else if (c < 0xF0) + { + utf8total = 3; + ucs4 = c & 0x0F; + } + else + { + /* NOTE: can't convert UTF8 sequences longer than 4 */ + utf8total = 4; + ucs4 = c & 0x03; + } + continue; + } + /* loop to split ucs4 into two utf16 chars if necessary */ + utf8total = 0; + do + { + if (ucs4 >= UTF16BASE) + { + ucs4 -= UTF16BASE; + bitbuf = (bitbuf << 16) | ((ucs4 >> UTF16SHIFT) + UTF16HIGHSTART); + ucs4 = (ucs4 & UTF16MASK) + UTF16LOSTART; + utf16flag = 1; + } + else + { + bitbuf = (bitbuf << 16) | ucs4; + utf16flag = 0; + } + bitstogo += 16; + /* spew out base64 */ + while (bitstogo >= 6) + { + bitstogo -= 6; + dst += base64chars[(bitstogo ? (bitbuf >> bitstogo) : bitbuf) & 0x3F]; + } + } + while (utf16flag); + } + /* if in UTF-7 mode, finish in ASCII */ + if (utf7mode) + { + if (bitstogo) + { + dst += base64chars[(bitbuf << (6 - bitstogo)) & 0x3F]; + } + dst += '-'; + } + return quoteIMAP(dst); +} + +//----------------------------------------------------------------------------- +TQString rfcDecoder::decodeQuoting(const TQString &aStr) +{ + TQString result; + unsigned int strLength(aStr.length()); + for (unsigned int i = 0; i < strLength ; i++) + { + if (aStr[i] == "\\") i++; + result += aStr[i]; + } + return result; +} + +//----------------------------------------------------------------------------- +TQTextCodec * +rfcDecoder::codecForName (const TQString & _str) +{ + if (_str.isEmpty ()) + return NULL; + return TQTextCodec::codecForName (_str.lower (). + replace ("windows", "cp").latin1 ()); +} + +//----------------------------------------------------------------------------- +const TQString +rfcDecoder::decodeRFC2047String (const TQString & _str) +{ + TQString throw_away; + + return decodeRFC2047String (_str, throw_away); +} + +//----------------------------------------------------------------------------- +const TQString +rfcDecoder::decodeRFC2047String (const TQString & _str, TQString & charset) +{ + TQString throw_away; + + return decodeRFC2047String (_str, charset, throw_away); +} + +//----------------------------------------------------------------------------- +const TQString +rfcDecoder::decodeRFC2047String (const TQString & _str, TQString & charset, + TQString & language) +{ + //do we have a rfc string + if (_str.find("=?") < 0) + return _str; + + TQCString aStr = _str.ascii (); // TQString.length() means Unicode chars + TQCString result; + char *pos, *beg, *end, *mid = NULL; + TQCString str; + char encoding = 0, ch; + bool valid; + const int maxLen = 200; + int i; + +// result.truncate(aStr.length()); + for (pos = aStr.data (); *pos; pos++) + { + if (pos[0] != '=' || pos[1] != '?') + { + result += *pos; + continue; + } + beg = pos + 2; + end = beg; + valid = TRUE; + // parse charset name + for (i = 2, pos += 2; + i < maxLen && (*pos != '?' && (ispunct (*pos) || isalnum (*pos))); + i++) + pos++; + if (*pos != '?' || i < 4 || i >= maxLen) + valid = FALSE; + else + { + charset = TQCString (beg, i - 1); // -2 + 1 for the zero + int pt = charset.findRev('*'); + if (pt != -1) + { + // save language for later usage + language = charset.right (charset.length () - pt - 1); + + // tie off language as defined in rfc2047 + charset.truncate(pt); + } + // get encoding and check delimiting question marks + encoding = toupper (pos[1]); + if (pos[2] != '?' + || (encoding != 'Q' && encoding != 'B' && encoding != 'q' + && encoding != 'b')) + valid = FALSE; + pos += 3; + i += 3; +// kdDebug(7116) << "rfcDecoder::decodeRFC2047String - charset " << charset << " - language " << language << " - '" << pos << "'" << endl; + } + if (valid) + { + mid = pos; + // search for end of encoded part + while (i < maxLen && *pos && !(*pos == '?' && *(pos + 1) == '=')) + { + i++; + pos++; + } + end = pos + 2; //end now points to the first char after the encoded string + if (i >= maxLen || !*pos) + valid = FALSE; + } + if (valid) + { + ch = *pos; + *pos = '\0'; + str = TQCString (mid).left ((int) (mid - pos - 1)); + if (encoding == 'Q') + { + // decode quoted printable text + for (i = str.length () - 1; i >= 0; i--) + if (str[i] == '_') + str[i] = ' '; +// kdDebug(7116) << "rfcDecoder::decodeRFC2047String - before QP '" << str << "'" << endl; + + str = KCodecs::quotedPrintableDecode(str); +// kdDebug(7116) << "rfcDecoder::decodeRFC2047String - after QP '" << str << "'" << endl; + } + else + { + // decode base64 text + str = KCodecs::base64Decode(str); + } + *pos = ch; + int len = str.length(); + for (i = 0; i < len; i++) + result += (char) (TQChar) str[i]; + + pos = end - 1; + } + else + { +// kdDebug(7116) << "rfcDecoder::decodeRFC2047String - invalid" << endl; + //result += "=?"; + //pos = beg -1; // because pos gets increased shortly afterwards + pos = beg - 2; + result += *pos++; + result += *pos; + } + } + if (!charset.isEmpty ()) + { + TQTextCodec *aCodec = codecForName (charset.ascii ()); + if (aCodec) + { +// kdDebug(7116) << "Codec is " << aCodec->name() << endl; + return aCodec->toUnicode (result); + } + } + return result; +} + + +//----------------------------------------------------------------------------- +const char especials[17] = "()<>@,;:\"/[]?.= "; + +const TQString +rfcDecoder::encodeRFC2047String (const TQString & _str) +{ + if (_str.isEmpty ()) + return _str; + const signed char *latin = reinterpret_cast(_str.latin1()), *l, *start, *stop; + char hexcode; + int numQuotes, i; + int rptr = 0; + // My stats show this number results in 12 resize() out of 73,000 + int resultLen = 3 * _str.length() / 2; + TQCString result(resultLen); + + while (*latin) + { + l = latin; + start = latin; + while (*l) + { + if (*l == 32) + start = l + 1; + if (*l < 0) + break; + l++; + } + if (*l) + { + numQuotes = 1; + while (*l) + { + /* The encoded word must be limited to 75 character */ + for (i = 0; i < 16; i++) + if (*l == especials[i]) + numQuotes++; + if (*l < 0) + numQuotes++; + /* Stop after 58 = 75 - 17 characters or at "= 58 || *l == 60) + break; + l++; + } + if (*l) + { + stop = l - 1; + while (stop >= start && *stop != 32) + stop--; + if (stop <= start) + stop = l; + } + else + stop = l; + if (resultLen - rptr - 1 <= start - latin + 1 + 16 /* =?iso-88... */) { + resultLen += (start - latin + 1) * 2 + 20; // more space + result.resize(resultLen); + } + while (latin < start) + { + result[rptr++] = *latin; + latin++; + } + strcpy(&result[rptr], "=?iso-8859-1?q?"); rptr += 15; + if (resultLen - rptr - 1 <= 3*(stop - latin + 1)) { + resultLen += (stop - latin + 1) * 4 + 20; // more space + result.resize(resultLen); + } + while (latin < stop) // can add up to 3 chars/iteration + { + numQuotes = 0; + for (i = 0; i < 16; i++) + if (*latin == especials[i]) + numQuotes = 1; + if (*latin < 0) + numQuotes = 1; + if (numQuotes) + { + result[rptr++] = '='; + hexcode = ((*latin & 0xF0) >> 4) + 48; + if (hexcode >= 58) + hexcode += 7; + result[rptr++] = hexcode; + hexcode = (*latin & 0x0F) + 48; + if (hexcode >= 58) + hexcode += 7; + result[rptr++] = hexcode; + } + else + { + result[rptr++] = *latin; + } + latin++; + } + result[rptr++] = '?'; + result[rptr++] = '='; + } + else + { + while (*latin) + { + if (rptr == resultLen - 1) { + resultLen += 30; + result.resize(resultLen); + } + result[rptr++] = *latin; + latin++; + } + } + } + result[rptr] = 0; + //free (latinStart); + return result; +} + + +//----------------------------------------------------------------------------- +const TQString +rfcDecoder::encodeRFC2231String (const TQString & _str) +{ + if (_str.isEmpty ()) + return _str; + signed char *latin = (signed char *) calloc (1, _str.length () + 1); + char *latin_us = (char *) latin; + strcpy (latin_us, _str.latin1 ()); + signed char *l = latin; + char hexcode; + int i; + bool quote; + while (*l) + { + if (*l < 0) + break; + l++; + } + if (!*l) { + free(latin); + return _str.ascii (); + } + TQCString result; + l = latin; + while (*l) + { + quote = *l < 0; + for (i = 0; i < 16; i++) + if (*l == especials[i]) + quote = true; + if (quote) + { + result += "%"; + hexcode = ((*l & 0xF0) >> 4) + 48; + if (hexcode >= 58) + hexcode += 7; + result += hexcode; + hexcode = (*l & 0x0F) + 48; + if (hexcode >= 58) + hexcode += 7; + result += hexcode; + } + else + { + result += *l; + } + l++; + } + free (latin); + return result; +} + + +//----------------------------------------------------------------------------- +const TQString +rfcDecoder::decodeRFC2231String (const TQString & _str) +{ + int p = _str.find ('\''); + + //see if it is an rfc string + if (p < 0) + return _str; + + int l = _str.findRev ('\''); + + //second is language + if (p >= l) + return _str; + + //first is charset or empty + TQString charset = _str.left (p); + TQString st = _str.mid (l + 1); + TQString language = _str.mid (p + 1, l - p - 1); + + //kdDebug(7116) << "Charset: " << charset << " Language: " << language << endl; + + char ch, ch2; + p = 0; + while (p < (int) st.length ()) + { + if (st.at (p) == 37) + { + ch = st.at (p + 1).latin1 () - 48; + if (ch > 16) + ch -= 7; + ch2 = st.at (p + 2).latin1 () - 48; + if (ch2 > 16) + ch2 -= 7; + st.at (p) = ch * 16 + ch2; + st.remove (p + 1, 2); + } + p++; + } + return st; +} diff --git a/tdeioslaves/imap4/rfcdecoder.h b/tdeioslaves/imap4/rfcdecoder.h new file mode 100644 index 00000000..2095b2ed --- /dev/null +++ b/tdeioslaves/imap4/rfcdecoder.h @@ -0,0 +1,89 @@ +#ifndef RFCDECODER_H +#define RFCDECODER_H +/********************************************************************** + * + * rfcdecoder.h - handler for various rfc/mime encodings + * Copyright (C) 2000 s.carstens@gmx.de + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Send comments and bug fixes to s.carstens@gmx.de + * + *********************************************************************/ + +#include + +class TQTextCodec; + +/** + * handler for various rfc/mime encodings + * @author Sven Carstens + * @date 2000 + * @todo rename to rfcCodecs as it encodes too. + */ +class rfcDecoder +{ + +public: + +/** Convert an IMAP mailbox to a Unicode path + */ + static TQString fromIMAP (const TQString & src); +/** Convert Unicode path to modified UTF-7 IMAP mailbox + */ + static TQString toIMAP (const TQString & inSrc); +/** replace " with \" and \ with \\ " and \ characters */ + static TQString quoteIMAP (const TQString & src); + + /** remove \ from a string + * @bug I'm pretty sure this doesn't do what the author meant it to do + */ + static TQString decodeQuoting(const TQString &aStr); + + /** + * fetch a codec by name + * @return Text Codec object + */ + static TQTextCodec *codecForName (const TQString &); + + // decoder for RFC2047 and RFC1522 + /** decode a RFC2047 String */ + static const TQString decodeRFC2047String (const TQString & _str, + TQString & charset, + TQString & language); + /** decode a RFC2047 String */ + static const TQString decodeRFC2047String (const TQString & _str, + TQString & charset); + /** decode a RFC2047 String */ + static const TQString decodeRFC2047String (const TQString & _str); + + // encoder for RFC2047 and RFC1522 + /** encode a RFC2047 String */ + static const TQString encodeRFC2047String (const TQString & _str, + TQString & charset, + TQString & language); + /** encode a RFC2047 String */ + static const TQString encodeRFC2047String (const TQString & _str, + TQString & charset); + /** encode a RFC2047 String */ + static const TQString encodeRFC2047String (const TQString & _str); + + /** encode a RFC2231 String */ + static const TQString encodeRFC2231String (const TQString & _str); + /** decode a RFC2231 String */ + static const TQString decodeRFC2231String (const TQString & _str); +}; + +#endif diff --git a/tdeioslaves/imap4/selectinfo.h b/tdeioslaves/imap4/selectinfo.h new file mode 100644 index 00000000..bf75a85b --- /dev/null +++ b/tdeioslaves/imap4/selectinfo.h @@ -0,0 +1,202 @@ +#ifndef _IMAPINFO_H +#define _IMAPINFO_H +/********************************************************************** + * + * imapinfo.h - IMAP4rev1 SELECT / EXAMINE handler + * Copyright (C) 2000 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Send comments and bug fixes to + * + *********************************************************************/ + +#include +#include + +//class handling the info we get on EXAMINE and SELECT +class imapInfo +{ +public: + + imapInfo (); + imapInfo (const TQStringList &); + imapInfo (const imapInfo &); + imapInfo & operator = (const imapInfo &); + + ulong _flags (const TQString &) const; + + void setCount (ulong l) + { + countAvailable_ = true; + count_ = l; + } + + void setRecent (ulong l) + { + recentAvailable_ = true; + recent_ = l; + } + + void setUnseen (ulong l) + { + unseenAvailable_ = true; + unseen_ = l; + } + + void setUidValidity (ulong l) + { + uidValidityAvailable_ = true; + uidValidity_ = l; + } + + void setUidNext (ulong l) + { + uidNextAvailable_ = true; + uidNext_ = l; + } + + void setFlags (ulong l) + { + flagsAvailable_ = true; + flags_ = l; + } + + void setFlags (const TQString & inFlag) + { + flagsAvailable_ = true; + flags_ = _flags (inFlag); + } + + void setPermanentFlags (ulong l) + { + permanentFlagsAvailable_ = true; + permanentFlags_ = l; + } + + void setPermanentFlags (const TQString & inFlag) + { + permanentFlagsAvailable_ = true; + permanentFlags_ = _flags (inFlag); + } + + void setReadWrite (bool b) + { + readWriteAvailable_ = true; + readWrite_ = b; + } + + ulong count () const + { + return count_; + } + + ulong recent () const + { + return recent_; + } + + ulong unseen () const + { + return unseen_; + } + + ulong uidValidity () const + { + return uidValidity_; + } + + ulong uidNext () const + { + return uidNext_; + } + + ulong flags () const + { + return flags_; + } + + ulong permanentFlags () const + { + return permanentFlags_; + } + + bool readWrite () const + { + return readWrite_; + } + + ulong countAvailable () const + { + return countAvailable_; + } + + ulong recentAvailable () const + { + return recentAvailable_; + } + + ulong unseenAvailable () const + { + return unseenAvailable_; + } + + ulong uidValidityAvailable () const + { + return uidValidityAvailable_; + } + + ulong uidNextAvailable () const + { + return uidNextAvailable_; + } + + ulong flagsAvailable () const + { + return flagsAvailable_; + } + + ulong permanentFlagsAvailable () const + { + return permanentFlagsAvailable_; + } + + bool readWriteAvailable () const + { + return readWriteAvailable_; + } + +private: + + ulong count_; + ulong recent_; + ulong unseen_; + ulong uidValidity_; + ulong uidNext_; + ulong flags_; + ulong permanentFlags_; + bool readWrite_; + + bool countAvailable_; + bool recentAvailable_; + bool unseenAvailable_; + bool uidValidityAvailable_; + bool uidNextAvailable_; + bool flagsAvailable_; + bool permanentFlagsAvailable_; + bool readWriteAvailable_; +}; + +#endif diff --git a/tdeioslaves/mbox/AUTHORS b/tdeioslaves/mbox/AUTHORS new file mode 100644 index 00000000..333010f6 --- /dev/null +++ b/tdeioslaves/mbox/AUTHORS @@ -0,0 +1 @@ +Mart Kelder diff --git a/tdeioslaves/mbox/CMakeLists.txt b/tdeioslaves/mbox/CMakeLists.txt new file mode 100644 index 00000000..95ecdf49 --- /dev/null +++ b/tdeioslaves/mbox/CMakeLists.txt @@ -0,0 +1,36 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include_directories( + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/libtdepim + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### other data ################################ + +install( FILES mbox.protocol DESTINATION ${SERVICES_INSTALL_DIR} ) + + +##### kio_mbox (module) ######################### + +tde_add_kpart( kio_mbox + SOURCES + mbox.cc mboxfile.cc readmbox.cc stat.cc urlinfo.cc + LINK tdeio-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tdeioslaves/mbox/Makefile.am b/tdeioslaves/mbox/Makefile.am new file mode 100644 index 00000000..0fc50524 --- /dev/null +++ b/tdeioslaves/mbox/Makefile.am @@ -0,0 +1,30 @@ +INCLUDES= $(all_includes) + +####### Files + +METASOURCES = AUTO + +kde_module_LTLIBRARIES = kio_mbox.la + +kio_mbox_la_SOURCES = \ + mbox.cc \ + mboxfile.cc \ + readmbox.cc \ + stat.cc \ + urlinfo.cc +kio_mbox_la_LIBADD = $(LIB_KIO) $(LIB_QT) $(LIB_TDECORE) +kio_mbox_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) -module $(KDE_PLUGIN) + +noinst_HEADERS = \ + mbox.h \ + mboxfile.h \ + readmbox.h \ + stat.h \ + urlinfo.h + +kdelnk_DATA = mbox.protocol +kdelnkdir = $(kde_servicesdir) + + +include $(top_srcdir)/admin/Doxyfile.am + diff --git a/tdeioslaves/mbox/README b/tdeioslaves/mbox/README new file mode 100644 index 00000000..7adae537 --- /dev/null +++ b/tdeioslaves/mbox/README @@ -0,0 +1,7 @@ +This is a simple tdeioslave for accessing mbox-files with kio. + +At the moment, it doesn't support locking or writing, it is just reading and listing messages. + +Usage: + mbox:/path/to/mbox/file For listing the files in a mbox-file + mbox:/path/to/mbox/file/id For getting an id out of a mbox-file. diff --git a/tdeioslaves/mbox/mbox.cc b/tdeioslaves/mbox/mbox.cc new file mode 100644 index 00000000..477ef350 --- /dev/null +++ b/tdeioslaves/mbox/mbox.cc @@ -0,0 +1,168 @@ +/* + * This is a simple tdeioslave to handle mbox-files. + * Copyright (C) 2004 Mart Kelder (mart.kde@hccnet.nl) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +#include "mbox.h" + +#include "readmbox.h" +#include "stat.h" +#include "urlinfo.h" + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include "tdepimmacros.h" + +#include "mbox.h" + +extern "C" { KDE_EXPORT int kdemain(int argc, char* argv[]); } + +int kdemain( int argc, char * argv[] ) +{ + KLocale::setMainCatalogue("tdelibs"); + TDEInstance instance("kio_mbox"); + (void) TDEGlobal::locale(); + + if (argc != 4) { + fprintf(stderr, "Usage: kio_mbox protocol " + "domain-socket1 domain-socket2\n"); + exit(-1); + } + + MBoxProtocol slave(argv[2], argv[3]); + slave.dispatchLoop(); + + return 0; +} + +MBoxProtocol::MBoxProtocol( const TQCString& arg1, const TQCString& arg2 ) + : TDEIO::SlaveBase( "mbox2", arg1, arg2 ), + m_errorState( true ) +{ + +} + +MBoxProtocol::~MBoxProtocol() +{ +} + +void MBoxProtocol::get( const KURL& url ) +{ + m_errorState = false; + + UrlInfo info( url, UrlInfo::message ); + TQString line; + TQByteArray ba_line; + + if( info.type() == UrlInfo::invalid && !m_errorState ) + { + error( TDEIO::ERR_DOES_NOT_EXIST, info.url() ); + return; + } + + ReadMBox mbox( &info, this ); + + while( !mbox.atEnd() && !m_errorState) + { + line = mbox.currentLine(); + line += '\n'; + ba_line = TQCString( line.utf8() ); + ba_line.truncate( ba_line.size() - 1 ); //Removing training '\0' + data( ba_line ); + mbox.nextLine(); + }; + + if( !m_errorState ) + { + data( TQByteArray() ); + finished(); + } +} + +void MBoxProtocol::listDir( const KURL& url ) +{ + m_errorState = false; + + TDEIO::UDSEntry entry; + UrlInfo info( url, UrlInfo::directory ); + ReadMBox mbox( &info, this, hasMetaData( "onlynew" ), hasMetaData( "savetime" ) ); + + if( m_errorState ) + return; + + if( info.type() != UrlInfo::directory ) + { + error( TDEIO::ERR_DOES_NOT_EXIST, info.url() ); + return; + } + + while( !mbox.atEnd() && !m_errorState ) + { + entry = Stat::stat( mbox, info ); + if( mbox.inListing() ) + listEntry( entry, false ); + } + + listEntry( TDEIO::UDSEntry(), true ); + finished(); +} + +void MBoxProtocol::stat( const KURL& url ) +{ + UrlInfo info( url ); + if( info.type() == UrlInfo::invalid ) + { + error( TDEIO::ERR_DOES_NOT_EXIST, url.path() ); + return; + } else + { + statEntry( Stat::stat( info ) ); + } + finished(); +} + +void MBoxProtocol::mimetype( const KURL& url ) +{ + m_errorState = false; + + UrlInfo info( url ); + + if( m_errorState ) + return; + + if( info.type() == UrlInfo::invalid ) + error( TDEIO::ERR_DOES_NOT_EXIST, i18n( "Invalid URL" ) ); + else + mimeType( info.mimetype() ); + finished(); +} + +void MBoxProtocol::emitError( int errno, const TQString& arg ) +{ + m_errorState = true; + error( errno, arg ); +} + diff --git a/tdeioslaves/mbox/mbox.h b/tdeioslaves/mbox/mbox.h new file mode 100644 index 00000000..d6ef29ae --- /dev/null +++ b/tdeioslaves/mbox/mbox.h @@ -0,0 +1,81 @@ +/* + * This is a simple tdeioslave to handle mbox-files. + * Copyright (C) 2004 Mart Kelder (mart.kde@hccnet.nl) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +#ifndef MBOX_H +#define MBOX_H + +#include + +class TQCString; +class KURL; + +/** + * This class is the main class and implements all function + * which can be called through the user. + */ +class MBoxProtocol : public TDEIO::SlaveBase +{ +public: + /** + * Constructor, for the parameters, See TDEIO::SlaveBase + */ + MBoxProtocol( const TQCString&, const TQCString& ); + /** + * Empty destructor + */ + virtual ~MBoxProtocol(); + + /** + * This functions is used when an user or a program wants to + * get a file from a mbox-file + * @param url The url which points to the virtual file to get + */ + virtual void get( const KURL& url ); + + /** + * This functions gives a listing back. + * @param url The url to the mbox-file. + */ + virtual void listDir( const KURL& url ); + + /** + * This functions gives general properties about a mbox-file, + * or mbox-email back. + */ + virtual void stat( const KURL& url ); + + /** + * This functions determinate the mimetype of a given mbox-file or mbox-email. + * @param url The url to get the mimetype from + */ + virtual void mimetype( const KURL& url ); + + /** + * Through this functions, other class which have an instance to this + * class (classes which are part of kio_mbox) can emit an error with + * this function + * @param errno The error number to be thrown + * @param arg The argument of the error message of the error number. + */ + void emitError( int errno, const TQString& arg ); +private: + bool m_errorState; +}; + +#endif + diff --git a/tdeioslaves/mbox/mbox.protocol b/tdeioslaves/mbox/mbox.protocol new file mode 100644 index 00000000..8b6b412a --- /dev/null +++ b/tdeioslaves/mbox/mbox.protocol @@ -0,0 +1,14 @@ +[Protocol] +exec=kio_mbox +protocol=mbox +input=none +output=filesystem +listing=Name,Type,Size +reading=true +writing=false +makedir=false +deleting=false +Icon=folder_inbox +maxInstances=2 +DocPath= +Class=:local diff --git a/tdeioslaves/mbox/mboxfile.cc b/tdeioslaves/mbox/mboxfile.cc new file mode 100644 index 00000000..7297457e --- /dev/null +++ b/tdeioslaves/mbox/mboxfile.cc @@ -0,0 +1,45 @@ +/* + * This is a simple tdeioslave to handle mbox-files. + * Copyright (C) 2004 Mart Kelder (mart.kde@hccnet.nl) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +#include "mboxfile.h" + +#include + +MBoxFile::MBoxFile( const UrlInfo* info, MBoxProtocol* parent ) + : m_info( info ), + m_mbox( parent ) +{ + assert( m_info ); +} + +MBoxFile::~MBoxFile() +{ +} + +bool MBoxFile::lock() +{ + //Not implemented + return true; +} + +void MBoxFile::unlock() +{ + //Not implemented +} + + diff --git a/tdeioslaves/mbox/mboxfile.h b/tdeioslaves/mbox/mboxfile.h new file mode 100644 index 00000000..1defafc9 --- /dev/null +++ b/tdeioslaves/mbox/mboxfile.h @@ -0,0 +1,68 @@ +/* + * This is a simple tdeioslave to handle mbox-files. + * Copyright (C) 2004 Mart Kelder (mart.kde@hccnet.nl) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +#ifndef MBOXFILE_H +#define MBOXFILE_H +class MBoxProtocol; +class UrlInfo; + +/** + * This class can be used to lock files when implemented. + * It is a base class for all classes that needs locking and/ir + * an UrlInfo*. + */ +class MBoxFile +{ +public: + /** + * Constructor + * @param info The urlinfo which must be used + * @param parent The MBoxProtocol parent instance, used to throw errors. + */ + MBoxFile( const UrlInfo* info, MBoxProtocol* parent ); + + /** + * Empty destructor + */ + ~MBoxFile(); + +protected: + /** + * When implemented, this function handles the locking of the file. + * @return true if the locking was done succesfully. + */ + bool lock(); + + /** + * When implemented, this function unlocks the file. + */ + void unlock(); + +protected: + /** + * This can be used to get information about the file. + * The file specified here is the file that must be used. + */ + const UrlInfo* const m_info; + + /** + * A instance of the parent protocol, meant to throw errors if neccesairy. + */ + MBoxProtocol* const m_mbox; +}; +#endif diff --git a/tdeioslaves/mbox/readmbox.cc b/tdeioslaves/mbox/readmbox.cc new file mode 100644 index 00000000..942f369e --- /dev/null +++ b/tdeioslaves/mbox/readmbox.cc @@ -0,0 +1,204 @@ +/* + * This is a simple tdeioslave to handle mbox-files. + * Copyright (C) 2004 Mart Kelder (mart.kde@hccnet.nl) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +#include + +#include "readmbox.h" + +#include "mbox.h" +#include "urlinfo.h" + +#include +#include + +#include +#include +#include +#include + +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#include + +ReadMBox::ReadMBox( const UrlInfo* info, MBoxProtocol* parent, bool onlynew, bool savetime ) + : MBoxFile( info, parent ), + m_file( 0 ), + m_stream( 0 ), + m_current_line( new TQString( TQString() ) ), + m_current_id( new TQString( TQString() ) ), + m_atend( true ), + m_prev_time( 0 ), + m_only_new( onlynew ), + m_savetime( savetime ), + m_status( false ), + m_prev_status( false ), + m_header( true ) + +{ + if( m_info->type() == UrlInfo::invalid ) + m_mbox->emitError( TDEIO::ERR_DOES_NOT_EXIST, info->url() ); + + if( !open( savetime ) ) + m_mbox->emitError( TDEIO::ERR_CANNOT_OPEN_FOR_READING, info->url() ); + + if( m_info->type() == UrlInfo::message ) + if( !searchMessage( m_info->id() ) ) + m_mbox->emitError( TDEIO::ERR_DOES_NOT_EXIST, info->url() ); +} + +ReadMBox::~ReadMBox() +{ + delete m_current_line; + close(); +} + +TQString ReadMBox::currentLine() const +{ + return *m_current_line; +} + +TQString ReadMBox::currentID() const +{ + return *m_current_id; +} + +bool ReadMBox::nextLine() +{ + if( !m_stream ) + return true; + + *m_current_line = m_stream->readLine(); + m_atend = m_current_line->isNull(); + if( m_atend ) // Cursor was at EOF + { + *m_current_id = TQString(); + m_prev_status = m_status; + return true; + } + + //New message + if( m_current_line->left( 5 ) == "From " ) + { + *m_current_id = *m_current_line; + m_prev_status = m_status; + m_status = true; + m_header = true; + return true; + } else if( m_only_new ) + { + if( m_header && m_current_line->left( 7 ) == "Status:" && + ! m_current_line->contains( "U" ) && ! m_current_line->contains( "N" ) ) + { + m_status = false; + } + } + + if( m_current_line->stripWhiteSpace().isEmpty() ) + m_header = false; + + return false; +} + +bool ReadMBox::searchMessage( const TQString& id ) +{ + if( !m_stream ) + return false; + + while( !m_atend && *m_current_id != id ) + nextLine(); + + return *m_current_id == id; +} + +unsigned int ReadMBox::skipMessage() +{ + unsigned int result = m_current_line->length(); + + if( !m_stream ) + return 0; + + while( !nextLine() ) + result += m_current_line->length(); + + return result; +} + +void ReadMBox::rewind() +{ + if( !m_stream ) + return; //Rewinding not possible + + m_stream->device()->reset(); + m_atend = m_stream->atEnd(); +} + +bool ReadMBox::atEnd() const +{ + if( !m_stream ) + return true; + + return m_atend || ( m_info->type() == UrlInfo::message && *m_current_id != m_info->id() ); +} + +bool ReadMBox::inListing() const +{ + return !m_only_new || m_prev_status; +} + +bool ReadMBox::open( bool savetime ) +{ + if( savetime ) + { + TQFileInfo info( m_info->filename() ); + + m_prev_time = new utimbuf; + m_prev_time->actime = info.lastRead().toTime_t(); + m_prev_time->modtime = info.lastModified().toTime_t(); + } + + if( m_file ) + return false; //File already open + + m_file = new TQFile( m_info->filename() ); + if( !m_file->open( IO_ReadOnly ) ) + { + delete m_file; + m_file = 0; + return false; + } + m_stream = new TQTextStream( m_file ); + skipMessage(); + + return true; +} + +void ReadMBox::close() +{ + if( !m_stream ) + return; + + delete m_stream; m_stream = 0; + m_file->close(); + delete m_file; m_file = 0; + + if( m_prev_time ) + utime( TQFile::encodeName( m_info->filename() ), m_prev_time ); +} + diff --git a/tdeioslaves/mbox/readmbox.h b/tdeioslaves/mbox/readmbox.h new file mode 100644 index 00000000..0b887276 --- /dev/null +++ b/tdeioslaves/mbox/readmbox.h @@ -0,0 +1,132 @@ +/* + * This is a simple tdeioslave to handle mbox-files. + * Copyright (C) 2004 Mart Kelder (mart.kde@hccnet.nl) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +#ifndef READMBOX_H +#define READMBOX_H + +#include "mboxfile.h" + +class UrlInfo; +class MBox; + +class TQFile; +class TQString; +class TQTextStream; + +struct utimbuf; + +/** + * This class handels reading from a mbox-file. + */ +class ReadMBox : public MBoxFile +{ +public: + /** + * Constructor + * + * @param info The information of the file to read + * @param parent The instance of the parent MBoxProtocol. + * @param onlynew Only read new messages from the MBox file. + * @param savetime If true, the atime of the mbox-file is preserved (note that this touch the ctime). + */ + ReadMBox( const UrlInfo* info, MBoxProtocol* parent, bool onlynew = false, bool savetime = false ); + + /** + * Destructor + */ + ~ReadMBox(); + + /** + * This functions return the current line + * @return The line last read, or TQString() if there wasn't such last line + */ + TQString currentLine() const; + + /** + * This function returns the current id. The id is the first line of an email, + * and is used in filenaming. The id normally starts with "From ". + * @return The current ID, or TQString() if no id was found yet. + */ + TQString currentID() const; + + /** + * This function reads the next line. The next line can be read by the currentLine() + * function call. + * + * @return true if succesfull, otherwise false. + */ + bool nextLine(); + + /** + * This function search the file for a certain id. + * If not found, the position is EOF. + * @param id The id of the message to be found. + * @return true if the message was found, false otherwise. + */ + bool searchMessage( const TQString& id ); + + /** + * Skips all lines which belongs to the current message. The cursor is on the first line + * of a new message message at the end of this function, or at EOF if the cursor was already + * on the last message. + * @return The number of bytes read while skipping the message. + */ + unsigned int skipMessage(); + + /** + * Sets the cursor back to the beginning of the file + */ + void rewind(); + + /** + * Returns true if the cursor is at EOF. + * @return true if and only if the cursor is at EOF. + */ + bool atEnd() const; + + /** + * Return true if the message is a new message, or all messages are listed + * @return true if it must be listed + */ + bool inListing() const; +private: + /** + * Opens a file + * @return true Returns true if opening was succesful. + */ + bool open( bool savetime ); + + /** + * Closes a file. + */ + void close(); + +private: + TQFile* m_file; + TQTextStream* m_stream; + TQString* m_current_line; + TQString* m_current_id; + bool m_atend; + + struct utimbuf* m_prev_time; + + bool m_only_new, m_savetime; + + bool m_status, m_prev_status, m_header; +}; +#endif diff --git a/tdeioslaves/mbox/stat.cc b/tdeioslaves/mbox/stat.cc new file mode 100644 index 00000000..99267ca7 --- /dev/null +++ b/tdeioslaves/mbox/stat.cc @@ -0,0 +1,115 @@ +/* + * This is a simple tdeioslave to handle mbox-files. + * Copyright (C) 2004 Mart Kelder (mart.kde@hccnet.nl) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +#include "stat.h" + +#include "readmbox.h" +#include "urlinfo.h" + +#include +#include + +#include + +TDEIO::UDSEntry Stat::stat( const UrlInfo& info ) +{ + if( info.type() == UrlInfo::message ) + return Stat::statMessage( info ); + else if( info.type() == UrlInfo::directory ) + return Stat::statDirectory( info ); + else + return TDEIO::UDSEntry(); +} + +TDEIO::UDSEntry Stat::stat( ReadMBox& mbox, const UrlInfo& info ) +{ + kdDebug() << "Stat::stat()" << endl; + TDEIO::UDSEntry entry; + TQString url; + + if( info.type() == UrlInfo::invalid ) + return entry; + else if( info.type() == UrlInfo::message ) + mbox.searchMessage( info.id() ); + + Stat::addAtom( entry, TDEIO::UDS_FILE_TYPE, S_IFREG ); + Stat::addAtom( entry, TDEIO::UDS_MIME_TYPE, "message/rfc822" ); + + url = TQString( "mbox:%1/%2" ).arg( info.filename(), mbox.currentID() ); + Stat::addAtom( entry, TDEIO::UDS_URL, url ); + if( mbox.currentID().isEmpty() ) + Stat::addAtom( entry, TDEIO::UDS_NAME, "foobar" ); + else + Stat::addAtom( entry, TDEIO::UDS_NAME, mbox.currentID() ); + + + Stat::addAtom( entry, TDEIO::UDS_SIZE, mbox.skipMessage() ); + + return entry; +} + +TDEIO::UDSEntry Stat::statDirectory( const UrlInfo& info ) +{ + kdDebug() << "statDirectory()" << endl; + TDEIO::UDSEntry entry; + + //Specific things for a directory + Stat::addAtom( entry, TDEIO::UDS_FILE_TYPE, S_IFDIR ); + Stat::addAtom( entry, TDEIO::UDS_NAME, info.filename() ); + + return entry; +} + +TDEIO::UDSEntry Stat::statMessage( const UrlInfo& info ) +{ + kdDebug() << "statMessage( " << info.url() << " )" << endl; + TDEIO::UDSEntry entry; + TQString url = TQString( "mbox:%1" ).arg( info.url() ); + + //Specific things for a message + Stat::addAtom( entry, TDEIO::UDS_FILE_TYPE, S_IFREG ); + Stat::addAtom( entry, TDEIO::UDS_MIME_TYPE, "message/rfc822" ); + + Stat::addAtom( entry, TDEIO::UDS_URL, url ); + url = url.right( url.length() - url.findRev( "/" ) - 1 ); + Stat::addAtom( entry, TDEIO::UDS_NAME, url ); + + return entry; +} + +void Stat::addAtom( TDEIO::UDSEntry& entry, unsigned int uds, const TQString& str ) +{ + TDEIO::UDSAtom atom; + atom.m_uds = uds; + atom.m_str = str; + atom.m_long = 0; + + entry.append( atom ); +} + + +void Stat::addAtom( TDEIO::UDSEntry& entry, unsigned int uds, long lng ) +{ + TDEIO::UDSAtom atom; + atom.m_uds = uds; + atom.m_str = TQString(); + atom.m_long = lng; + + entry.append( atom ); +} + diff --git a/tdeioslaves/mbox/stat.h b/tdeioslaves/mbox/stat.h new file mode 100644 index 00000000..4e2c1f02 --- /dev/null +++ b/tdeioslaves/mbox/stat.h @@ -0,0 +1,82 @@ +/* + * This is a simple tdeioslave to handle mbox-files. + * Copyright (C) 2004 Mart Kelder (mart.kde@hccnet.nl) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +#ifndef STAT_H +#define STAT_H + +#include + +class ReadMBox; +class UrlInfo; + +class KURL; + +class TQString; + +/** + * This class is used to get the stats of a mbox-email or mbox-file. + * This class only uses static members. + */ +class Stat +{ +public: + /** + * Empty constructor + */ + Stat() {} + + /** + * Emtpy destructor + */ + ~Stat() {} + + /** + * This functions gives information with a given UrlInfo. + * @param info The file information + * @return The information of the file as destribed in UrlInfo. + */ + static TDEIO::UDSEntry stat( const UrlInfo& info ); + /** + * This function gives information with a given ReadMBox and UrlInfo. + * Through this, it is possible to ask the stats of the next message, + * without reopening the mbox-file. + * @param mbox The ReadMBox instance, used to search the mbox-email in. + * @param info The url information. + * @return The requesteds information. + */ + static TDEIO::UDSEntry stat( ReadMBox& mbox, const UrlInfo& info ); + + /** + * This function gets the stats of a given mbox-file in an UDSEntry. + * @param info The location of the mbox-file. + * @return A list of Atoms. + */ + static TDEIO::UDSEntry statDirectory( const UrlInfo& info ); + + /** + * This function gets the stats of a geven mbox-message in a UDSEntry. + * @param info The url of the mbox-message. + * @return Information shipped in an UDSEntry. + */ + static TDEIO::UDSEntry statMessage( const UrlInfo& info ); +private: + static void addAtom( TDEIO::UDSEntry& entry, unsigned int key, const TQString& value ); + static void addAtom( TDEIO::UDSEntry& entry, unsigned int key, const long value ); +}; + +#endif diff --git a/tdeioslaves/mbox/urlinfo.cc b/tdeioslaves/mbox/urlinfo.cc new file mode 100644 index 00000000..4b359e40 --- /dev/null +++ b/tdeioslaves/mbox/urlinfo.cc @@ -0,0 +1,133 @@ +/* + * This is a simple tdeioslave to handle mbox-files. + * Copyright (C) 2004 Mart Kelder (mart.kde@hccnet.nl) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +#include "urlinfo.h" + +#include +#include + +#include +#include + +UrlInfo::UrlInfo( const KURL& url, const UrlType type ) + : m_type( invalid ), + m_filename( new TQString ), + m_id( new TQString ) +{ + calculateInfo( url, type ); +} + +UrlInfo::~UrlInfo() +{ + delete m_filename; + delete m_id; +} + +TQString UrlInfo::mimetype() const +{ + switch( m_type ) + { + case message: + return "message/rfc822"; + case directory: + return "inode/directory"; + case invalid: + default: + return "invalid"; + } +} + +TQString UrlInfo::filename() const +{ + return *m_filename; +} + +TQString UrlInfo::id() const +{ + return *m_id; +} + +TQString UrlInfo::url() const +{ + return *m_filename + "/" + *m_id; +} + + +void UrlInfo::calculateInfo( const KURL& url, const UrlType type ) +{ + bool found = false; + + if( !found && type & UrlInfo::message ) + found = isMessage( url ); + if( !found && type & UrlInfo::directory ) + found = isDirectory( url ); + if( !found ) + { + m_type = invalid; + *m_filename = ""; + *m_id = ""; + } +} + +bool UrlInfo::isDirectory( const KURL& url ) +{ + //Check is url is in the form mbox://{filename} + TQString filename = url.path(); + TQFileInfo info; + + //Remove ending / + while( filename.length() > 1 && filename.right( 1 ) == "/" ) + filename.remove( filename.length()-2, 1 ); + + //Is this a directory? + info.setFile( filename ); + if( !info.isFile() ) + return false; + + //Setting paramaters + *m_filename = filename; + *m_id = TQString(); + m_type = directory; + kdDebug() << "urlInfo::isDirectory( " << url << " )" << endl; + return true; +} + +bool UrlInfo::isMessage( const KURL& url ) +{ + TQString path = url.path(); + TQFileInfo info; + int cutindex = path.findRev( '/' ); + + //Does it contain at least one /? + if( cutindex < 0 ) + return false; + + //Does the mbox-file exists? + info.setFile( path.left( cutindex ) ); + if( !info.isFile() ) + return false; + + //Settings parameters + kdDebug() << "urlInfo::isMessage( " << url << " )" << endl; + m_type = message; + *m_id = path.right( path.length() - cutindex - 1 ); + *m_filename = path.left( cutindex ); + + return true; +} + diff --git a/tdeioslaves/mbox/urlinfo.h b/tdeioslaves/mbox/urlinfo.h new file mode 100644 index 00000000..5de7804f --- /dev/null +++ b/tdeioslaves/mbox/urlinfo.h @@ -0,0 +1,82 @@ +/* + * This is a simple tdeioslave to handle mbox-files. + * Copyright (C) 2004 Mart Kelder (mart.kde@hccnet.nl) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +#ifndef URLINFO_H +#define URLINFO_H +class KURL; + +class TQString; + +class UrlInfo +{ +public: + /** + * This enum is used to determe the url type. + */ + enum UrlType { invalid = 0, message = 1, directory = 2 }; + + /** + * Constructor + * + * @param url The url: this url is used to split the location data off. + * @param type The possible types of the url + */ + UrlInfo( const KURL &url, const UrlType type = (UrlType)( message | directory ) ); + + /** + * Destructor + */ + ~UrlInfo(); + + /** + * Returns the type of the url + * @return the type of the url + */ + UrlType type() const { return m_type; } + + /** + * @return the mimetype of the url + */ + TQString mimetype() const; + + /** + * @return The location of the mbox-file + */ + TQString filename() const; + /** + * @return The id given in the url. + */ + TQString id() const; + + /** + * @return the while url as TQString + */ + TQString url() const; +private: + void calculateInfo( const KURL& url, const UrlType type ); + + bool isDirectory( const KURL& url ); + bool isMessage( const KURL& url ); + +private: + UrlType m_type; + TQString *m_filename; + TQString *m_id; +}; + +#endif diff --git a/tdeioslaves/opengroupware/Makefile.am b/tdeioslaves/opengroupware/Makefile.am new file mode 100644 index 00000000..007d74c3 --- /dev/null +++ b/tdeioslaves/opengroupware/Makefile.am @@ -0,0 +1,17 @@ +INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tderesources/opengroupware/soap \ + $(all_includes) + +noinst_HEADERS = opengroupware.h + +METASOURCES = AUTO + +kdelnkdir = $(kde_servicesdir) +kdelnk_DATA = opengroupware.protocol opengroupwares.protocol + +kde_module_LTLIBRARIES = kio_opengroupware.la + +kio_opengroupware_la_SOURCES = opengroupware.cpp webdavhandler.cpp +kio_opengroupware_la_LIBADD = $(top_builddir)/libkcal/libkcal.la \ + $(top_builddir)/libtdepim/libtdepim.la $(LIB_KIO) +kio_opengroupware_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) + diff --git a/tdeioslaves/opengroupware/opengroupware.cpp b/tdeioslaves/opengroupware/opengroupware.cpp new file mode 100644 index 00000000..ab6b3304 --- /dev/null +++ b/tdeioslaves/opengroupware/opengroupware.cpp @@ -0,0 +1,250 @@ +/* + This file is part of KDE. + + Copyright (c) 2004 Cornelius Schumacher + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#include "opengroupware.h" +#include "webdavhandler.h" + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include +#include +#include + +#include + +namespace KABC { + +class ResourceMemory : public ResourceCached +{ + public: + ResourceMemory() : ResourceCached( 0 ) {} + + Ticket *requestSaveTicket() { return 0; } + bool load() { return true; } + bool save( Ticket * ) { return true; } + void releaseSaveTicket( Ticket * ) {} +}; + +} + + +extern "C" { +KDE_EXPORT int kdemain( int argc, char **argv ); +} + +int kdemain( int argc, char **argv ) +{ + TDEInstance instance( "kio_OpenGroupware" ); + + kdDebug(7000) << "Starting kio_OpenGroupware(pid: " << getpid() << ")" << endl; + + if (argc != 4) { + fprintf( stderr, "Usage: kio_OpenGroupware protocol domain-socket1 domain-socket2\n"); + exit( -1 ); + } + + OpenGroupware slave( argv[1], argv[2], argv[3] ); + slave.dispatchLoop(); + + return 0; +} + +OpenGroupware::OpenGroupware( const TQCString &protocol, const TQCString &pool, + const TQCString &app ) + : SlaveBase( protocol, pool, app ) +{ +} + +void OpenGroupware::get( const KURL &url ) +{ + kdDebug(7000) << "OpenGroupware::get()" << endl; + kdDebug(7000) << " URL: " << url.url() << endl; + #if 1 + kdDebug(7000) << " Path: " << url.path() << endl; + kdDebug(7000) << " Query: " << url.query() << endl; + kdDebug(7000) << " Protocol: " << url.protocol() << endl; + kdDebug(7000) << " Filename: " << url.filename() << endl; + #endif + + mimeType( "text/plain" ); + + TQString path = url.path(); + debugMessage( "Path: " + path ); + + if ( path.startsWith( "/freebusy/" ) ) { + getFreeBusy( url ); + } else if ( path.startsWith( "/calendar/" ) ) { + getCalendar( url ); + } else if ( path.startsWith( "/addressbook/" ) ) { + getAddressbook( url ); + } else { + TQString error = i18n("Unknown path. Known paths are '/freebusy/', " + "'/calendar/' and '/addressbook/'."); + errorMessage( error ); + } + + kdDebug(7000) << "OpenGroupwareCgiProtocol::get() done" << endl; +} + +void OpenGroupware::getFreeBusy( const KURL &url ) +{ + TQString file = url.filename(); + if ( file.right( 4 ) != ".ifb" ) { + TQString error = i18n("Illegal filename. File has to have '.ifb' suffix."); + errorMessage( error ); + } else { + TQString email = file.left( file.length() - 4 ); + debugMessage( "Email: " + email ); + + TQString user = url.user(); + TQString pass = url.pass(); + + debugMessage( "URL: " ); + debugMessage( "User: " + user ); + debugMessage( "Password: " + pass ); + + KCal::FreeBusy *fb = new KCal::FreeBusy; + + if ( user.isEmpty() || pass.isEmpty() ) { + errorMessage( i18n("Need username and password.") ); + } else { + // FIXME get from server + + // FIXME: Read range from configuration or URL parameters. + TQDate start = TQDate::currentDate().addDays( -3 ); + TQDate end = TQDate::currentDate().addDays( 60 ); + + fb->setDtStart( start ); + fb->setDtEnd( end ); + + kdDebug() << "Login" << endl; + + } + +#if 0 + TQDateTime s = TQDateTime( TQDate( 2004, 9, 27 ), TQTime( 10, 0 ) ); + TQDateTime e = TQDateTime( TQDate( 2004, 9, 27 ), TQTime( 11, 0 ) ); + + fb->addPeriod( s, e ); +#endif + + KCal::ICalFormat format; + + TQString ical = format.createScheduleMessage( fb, KCal::Scheduler::Publish ); + + data( ical.utf8() ); + + finished(); + } +} + + +void OpenGroupware::getCalendar( const KURL &_url ) +{ + + KURL url( _url ); // we'll be changing it + TQString user = url.user(); + TQString pass = url.pass(); + + TQDomDocument props = WebdavHandler::createAllPropsRequest(); + + debugMessage( "URL: " ); + debugMessage( "User: " + user ); + debugMessage( "Password: " + pass ); + + url.setProtocol( "webdav" ); + url.setPath ( "/zidestore/dav/till/" ); + + kdDebug(7000) << "getCalendar: " << url.prettyURL() << endl; + + // FIXME do progress handling + mListEventsJob = TDEIO::davPropFind( url, props, "0", false ); + connect( mListEventsJob, TQT_SIGNAL( result( TDEIO::Job * ) ), + TQT_SLOT( slotGetCalendarListingResult( TDEIO::Job * ) ) ); +} + +void OpenGroupware::getAddressbook( const KURL &url ) +{ + +} + +void OpenGroupware::errorMessage( const TQString &msg ) +{ + error( TDEIO::ERR_SLAVE_DEFINED, msg ); +} + +void OpenGroupware::debugMessage( const TQString &msg ) +{ +#if 0 + data( ( msg + "\n" ).utf8() ); +#else + Q_UNUSED( msg ); +#endif +} + + +void OpenGroupware::slotGetCalendarListingResult( TDEIO::Job *job ) +{ + + kdDebug(7000) << k_funcinfo << endl; + + if ( job->error() ) { + job->showErrorDialog( 0 ); + } else { + kdDebug() << "ResourceSlox::slotResult() success" << endl; + + TQDomDocument doc = mListEventsJob->response(); + + } + KCal::ICalFormat format; + KCal::CalendarLocal calendar; + + TQString ical = format.toString( &calendar ); + + data( ical.utf8() ); + + finished(); +} + + +void OpenGroupware::slotGetCalendarResult( TDEIO::Job *job ) +{ + Q_UNUSED( job ); +} +#include "opengroupware.moc" + diff --git a/tdeioslaves/opengroupware/opengroupware.h b/tdeioslaves/opengroupware/opengroupware.h new file mode 100644 index 00000000..151187db --- /dev/null +++ b/tdeioslaves/opengroupware/opengroupware.h @@ -0,0 +1,57 @@ +/* + This file is part of KDE. + + Copyright (c) 2004 Cornelius Schumacher + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ +#ifndef GROUPWISE_H +#define GROUPWISE_H + +#include + +#include + +namespace TDEIO { + class Job; + class DavJob; +} + + +class OpenGroupware : public TQObject, public TDEIO::SlaveBase +{ + Q_OBJECT + + public: + OpenGroupware( const TQCString &protocol, const TQCString &pool, + const TQCString &app ); + + void get( const KURL &url ); + + protected: + void debugMessage( const TQString & ); + void errorMessage( const TQString & ); + + void getFreeBusy( const KURL &url ); + void getCalendar( const KURL &url ); + void getAddressbook( const KURL &url ); + protected slots: + void slotGetCalendarListingResult( TDEIO::Job* ); + void slotGetCalendarResult( TDEIO::Job* ); + private: + TDEIO::DavJob *mListEventsJob; +}; + +#endif diff --git a/tdeioslaves/opengroupware/opengroupware.protocol b/tdeioslaves/opengroupware/opengroupware.protocol new file mode 100644 index 00000000..b51f33a0 --- /dev/null +++ b/tdeioslaves/opengroupware/opengroupware.protocol @@ -0,0 +1,7 @@ +[Protocol] +DocPath=tdeioslave/opengroupware.html +exec=kio_opengroupware +input=none +output=filesystem +protocol=opengroupware +reading=true diff --git a/tdeioslaves/opengroupware/opengroupwares.protocol b/tdeioslaves/opengroupware/opengroupwares.protocol new file mode 100644 index 00000000..17eab5f3 --- /dev/null +++ b/tdeioslaves/opengroupware/opengroupwares.protocol @@ -0,0 +1,7 @@ +[Protocol] +DocPath=tdeioslave/opengroupware.html +exec=kio_opengroupware +input=none +output=filesystem +protocol=opengroupwares +reading=true diff --git a/tdeioslaves/opengroupware/webdavhandler.cpp b/tdeioslaves/opengroupware/webdavhandler.cpp new file mode 100644 index 00000000..9c89174a --- /dev/null +++ b/tdeioslaves/opengroupware/webdavhandler.cpp @@ -0,0 +1,81 @@ +/* + This file is part of tdepim. + + Copyright (c) 2004 Cornelius Schumacher + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#include + +#include "webdavhandler.h" + +#include + +#include + +#include +#include + +#include + + +WebdavHandler::WebdavHandler() +{ +} + + +TQDomElement WebdavHandler::addElement( TQDomDocument &doc, TQDomNode &node, + const TQString &tag ) +{ + TQDomElement el = doc.createElement( tag ); + node.appendChild( el ); + return el; +} + +TQDomElement WebdavHandler::addDavElement( TQDomDocument &doc, TQDomNode &node, + const TQString &tag ) +{ + TQDomElement el = doc.createElementNS( "DAV", tag ); + node.appendChild( el ); + return el; +} + +TQDomElement WebdavHandler::addSloxElement( TQDomDocument &doc, TQDomNode &node, + const TQString &tag, + const TQString &text ) +{ + TQDomElement el = doc.createElementNS( "SLOX", tag ); + if ( !text.isEmpty() ) { + TQDomText textnode = doc.createTextNode( text ); + el.appendChild( textnode ); + } + node.appendChild( el ); + return el; +} + +TQDomDocument WebdavHandler::createAllPropsRequest() +{ + TQDomDocument doc; + + TQDomElement root = WebdavHandler::addDavElement( doc, doc, "propfind" ); + TQDomElement prop = WebdavHandler::addDavElement( doc, root, "prop" ); + WebdavHandler::addDavElement( doc, prop, "getcontentlength"); + WebdavHandler::addDavElement( doc, prop, "getlastmodified" ); + WebdavHandler::addDavElement( doc, prop, "displayname" ); + WebdavHandler::addDavElement( doc, prop, "resourcetype" ); + prop.appendChild( doc.createElementNS( "http://apache.org/dav/props/", "executable" ) ); + return doc; +} diff --git a/tdeioslaves/opengroupware/webdavhandler.h b/tdeioslaves/opengroupware/webdavhandler.h new file mode 100644 index 00000000..a86332a3 --- /dev/null +++ b/tdeioslaves/opengroupware/webdavhandler.h @@ -0,0 +1,44 @@ +/* + This file is part of tdepim. + + Copyright (c) 2004 Cornelius Schumacher + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ +#ifndef WEBDAVHANDLER_H +#define WEBDAVHANDLER_H + +#include +#include +#include +#include + +class WebdavHandler +{ + public: + WebdavHandler(); + + + static TQDomElement addElement( TQDomDocument &, TQDomNode &, + const TQString &tag ); + static TQDomElement addDavElement( TQDomDocument &, TQDomNode &, + const TQString &tag ); + static TQDomElement addSloxElement( TQDomDocument &, TQDomNode &, + const TQString &tag, + const TQString &text = TQString() ); + static TQDomDocument createAllPropsRequest(); +}; + +#endif diff --git a/tdeioslaves/sieve/CMakeLists.txt b/tdeioslaves/sieve/CMakeLists.txt new file mode 100644 index 00000000..2ac71cc3 --- /dev/null +++ b/tdeioslaves/sieve/CMakeLists.txt @@ -0,0 +1,35 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include_directories( + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/libtdepim + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### other data ################################ + +install( FILES sieve.protocol DESTINATION ${SERVICES_INSTALL_DIR} ) + + +##### kio_sieve (module) ######################## + +tde_add_kpart( kio_sieve + SOURCES sieve.cpp + LINK tdeio-shared ${SASL_LIBRARY} + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tdeioslaves/sieve/Makefile.am b/tdeioslaves/sieve/Makefile.am new file mode 100644 index 00000000..f4d0639c --- /dev/null +++ b/tdeioslaves/sieve/Makefile.am @@ -0,0 +1,15 @@ +INCLUDES= -I$(srcdir)/../.. -I$(srcdir)/.. $(all_includes) + +kde_module_LTLIBRARIES = kio_sieve.la + +kio_sieve_la_SOURCES = sieve.cpp +kio_sieve_la_LIBADD = $(LIB_KIO) $(SASL2_LIBS) $(LIB_QT) $(LIB_TDECORE) +kio_sieve_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) + +noinst_HEADERS = sieve.h + +kdelnk_DATA = sieve.protocol +kdelnkdir = $(kde_servicesdir) + +messages: + $(XGETTEXT) *.cpp -o $(podir)/tdeio_sieve.pot diff --git a/tdeioslaves/sieve/configure.in.in b/tdeioslaves/sieve/configure.in.in new file mode 100644 index 00000000..ffc1b4b7 --- /dev/null +++ b/tdeioslaves/sieve/configure.in.in @@ -0,0 +1,18 @@ +AC_MSG_CHECKING(if we need to talk to broken timsieved's) +AC_ARG_ENABLE(broken-timsieved-workaround, +[AC_HELP_STRING([--enable-broken-timsieved-workaround], + [versions <= 1.1.0 of the timsieved (part of the Cyrus + IMAP suite) do not interpret the HAVESPACE command of + the sieve protocol. This option makes the sieve + TDEIO::Slave simply omit that command.])], +[case "${enableval}" in + yes) AC_MSG_RESULT(yes) + need_broken_timsieved_support="yes" ;; + no) AC_MSG_RESULT(no) ;; + *) AC_MSG_ERROR([bad value ${enableval} for --enable-broken-timsieved-workaround]) ;; +esac],[AC_MSG_RESULT(no)]) + +if test "$need_broken_timsieved_support" = "yes"; then + AC_SUBST(HAVE_BROKEN_TIMSIEVED) + AC_DEFINE(HAVE_BROKEN_TIMSIEVED,1,[Define if the sieve TDEIO::Slave must be able to talk to timsieved <= 1.1.0]) +fi diff --git a/tdeioslaves/sieve/draft-daboo-sieve-include.txt b/tdeioslaves/sieve/draft-daboo-sieve-include.txt new file mode 100644 index 00000000..83a08dfb --- /dev/null +++ b/tdeioslaves/sieve/draft-daboo-sieve-include.txt @@ -0,0 +1 @@ +http://ktown.kde.org/~dirk/sieve/draft-daboo-sieve-include.txt diff --git a/tdeioslaves/sieve/draft-daboo-sieve-spamtest.txt b/tdeioslaves/sieve/draft-daboo-sieve-spamtest.txt new file mode 100644 index 00000000..8f22e560 --- /dev/null +++ b/tdeioslaves/sieve/draft-daboo-sieve-spamtest.txt @@ -0,0 +1 @@ +http://ktown.kde.org/~dirk/sieve/draft-daboo-sieve-spamtest.txt diff --git a/tdeioslaves/sieve/draft-degener-sieve-body-00.txt b/tdeioslaves/sieve/draft-degener-sieve-body-00.txt new file mode 100644 index 00000000..7b1ee844 --- /dev/null +++ b/tdeioslaves/sieve/draft-degener-sieve-body-00.txt @@ -0,0 +1 @@ +http://ktown.kde.org/~dirk/sieve/draft-degener-sieve-body-00.txt diff --git a/tdeioslaves/sieve/draft-degener-sieve-copy.txt b/tdeioslaves/sieve/draft-degener-sieve-copy.txt new file mode 100644 index 00000000..8c23855c --- /dev/null +++ b/tdeioslaves/sieve/draft-degener-sieve-copy.txt @@ -0,0 +1 @@ +http://ktown.kde.org/~dirk/sieve/draft-degener-sieve-copy.txt diff --git a/tdeioslaves/sieve/draft-degener-sieve-editheader.txt b/tdeioslaves/sieve/draft-degener-sieve-editheader.txt new file mode 100644 index 00000000..6e9674f9 --- /dev/null +++ b/tdeioslaves/sieve/draft-degener-sieve-editheader.txt @@ -0,0 +1 @@ +http://ktown.kde.org/~dirk/sieve/draft-degener-sieve-editheader.txt diff --git a/tdeioslaves/sieve/draft-degener-sieve-multiscript.txt b/tdeioslaves/sieve/draft-degener-sieve-multiscript.txt new file mode 100644 index 00000000..53a83822 --- /dev/null +++ b/tdeioslaves/sieve/draft-degener-sieve-multiscript.txt @@ -0,0 +1 @@ +http://ktown.kde.org/~dirk/sieve/draft-degener-sieve-multiscript.txt diff --git a/tdeioslaves/sieve/draft-homme-sieve-variables.txt b/tdeioslaves/sieve/draft-homme-sieve-variables.txt new file mode 100644 index 00000000..cccaa59c --- /dev/null +++ b/tdeioslaves/sieve/draft-homme-sieve-variables.txt @@ -0,0 +1 @@ +http://ktown.kde.org/~dirk/sieve/draft-homme-sieve-variables.txt diff --git a/tdeioslaves/sieve/draft-martin-managesieve-04.txt b/tdeioslaves/sieve/draft-martin-managesieve-04.txt new file mode 100644 index 00000000..82684ad5 --- /dev/null +++ b/tdeioslaves/sieve/draft-martin-managesieve-04.txt @@ -0,0 +1 @@ +http://ktown.kde.org/~dirk/sieve/draft-martin-managesieve-04.txt diff --git a/tdeioslaves/sieve/draft-martin-sieve-notify-01.txt b/tdeioslaves/sieve/draft-martin-sieve-notify-01.txt new file mode 100644 index 00000000..6eb1cac3 --- /dev/null +++ b/tdeioslaves/sieve/draft-martin-sieve-notify-01.txt @@ -0,0 +1 @@ +http://ktown.kde.org/~dirk/sieve/draft-martin-sieve-notify-01.txt diff --git a/tdeioslaves/sieve/draft-melnikov-sieve-imapflags.txt b/tdeioslaves/sieve/draft-melnikov-sieve-imapflags.txt new file mode 100644 index 00000000..71cfbb3c --- /dev/null +++ b/tdeioslaves/sieve/draft-melnikov-sieve-imapflags.txt @@ -0,0 +1 @@ +http://ktown.kde.org/~dirk/sieve/draft-melnikov-sieve-imapflags.txt diff --git a/tdeioslaves/sieve/draft-murchison-sieve-regex-06.txt b/tdeioslaves/sieve/draft-murchison-sieve-regex-06.txt new file mode 100644 index 00000000..b3e922ee --- /dev/null +++ b/tdeioslaves/sieve/draft-murchison-sieve-regex-06.txt @@ -0,0 +1 @@ +http://ktown.kde.org/~dirk/sieve/draft-murchison-sieve-regex-06.txt diff --git a/tdeioslaves/sieve/draft-murchison-sieve-subaddress-05.txt b/tdeioslaves/sieve/draft-murchison-sieve-subaddress-05.txt new file mode 100644 index 00000000..95cea85a --- /dev/null +++ b/tdeioslaves/sieve/draft-murchison-sieve-subaddress-05.txt @@ -0,0 +1 @@ +http://ktown.kde.org/~dirk/sieve/draft-murchison-sieve-subaddress-05.txt diff --git a/tdeioslaves/sieve/draft-showalter-sieve-vacation-04.txt b/tdeioslaves/sieve/draft-showalter-sieve-vacation-04.txt new file mode 100644 index 00000000..bd2d3359 --- /dev/null +++ b/tdeioslaves/sieve/draft-showalter-sieve-vacation-04.txt @@ -0,0 +1 @@ +http://ktown.kde.org/~dirk/sieve/draft-showalter-sieve-vacation-04.txt diff --git a/tdeioslaves/sieve/rfc3028.txt b/tdeioslaves/sieve/rfc3028.txt new file mode 100644 index 00000000..b861e2e1 --- /dev/null +++ b/tdeioslaves/sieve/rfc3028.txt @@ -0,0 +1 @@ +http://ktown.kde.org/~dirk/sieve/rfc3028.txt diff --git a/tdeioslaves/sieve/rfc3431.txt b/tdeioslaves/sieve/rfc3431.txt new file mode 100644 index 00000000..3f11c325 --- /dev/null +++ b/tdeioslaves/sieve/rfc3431.txt @@ -0,0 +1 @@ +http://ktown.kde.org/~dirk/sieve/rfc3431.txt diff --git a/tdeioslaves/sieve/sieve.cpp b/tdeioslaves/sieve/sieve.cpp new file mode 100644 index 00000000..9d373c2a --- /dev/null +++ b/tdeioslaves/sieve/sieve.cpp @@ -0,0 +1,1343 @@ +/*************************************************************************** + sieve.cpp - description + ------------------- + begin : Thu Dec 20 18:47:08 EST 2001 + copyright : (C) 2001 by Hamish Rodda + email : meddie@yoyo.cc.monash.edu.au + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License version 2 as * + * published by the Free Software Foundation. * + * * + ***************************************************************************/ + +/** + * Portions adapted from the SMTP ioslave. + * Copyright (c) 2000, 2001 Alex Zepeda + * Copyright (c) 2001 Michael Häckel + * All rights reserved. + * + * Policy: the function where the error occurs calls error(). A result of + * false, where it signifies an error, thus doesn't need to call error() itself. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +extern "C" { +#include +} +#include "sieve.h" + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +using std::exit; +#include +#include + +#include + +static const int debugArea = 7122; + +static inline +#ifdef NDEBUG + kndbgstream ksDebug() { return kdDebug( debugArea ); } + kndbgstream ksDebug( bool cond ) { return kdDebug( cond, debugArea ); } +#else + kdbgstream ksDebug() { return kdDebug( debugArea ); } + kdbgstream ksDebug( bool cond ) { return kdDebug( cond, debugArea ); } +#endif + +#define SIEVE_DEFAULT_PORT 2000 + +static sasl_callback_t callbacks[] = { + { SASL_CB_ECHOPROMPT, NULL, NULL }, + { SASL_CB_NOECHOPROMPT, NULL, NULL }, + { SASL_CB_GETREALM, NULL, NULL }, + { SASL_CB_USER, NULL, NULL }, + { SASL_CB_AUTHNAME, NULL, NULL }, + { SASL_CB_PASS, NULL, NULL }, + { SASL_CB_CANON_USER, NULL, NULL }, + { SASL_CB_LIST_END, NULL, NULL } +}; + +static const unsigned int SIEVE_DEFAULT_RECIEVE_BUFFER = 512; + +using namespace TDEIO; +extern "C" +{ + KDE_EXPORT int kdemain(int argc, char **argv) + { + TDEInstance instance("kio_sieve" ); + + ksDebug() << "*** Starting kio_sieve " << endl; + + if (argc != 4) { + ksDebug() << "Usage: kio_sieve protocol domain-socket1 domain-socket2" << endl; + exit(-1); + } + + if ( sasl_client_init( NULL ) != SASL_OK ) { + fprintf(stderr, "SASL library initialization failed!\n"); + ::exit (-1); + } + + kio_sieveProtocol slave(argv[2], argv[3]); + slave.dispatchLoop(); + + sasl_done(); + + ksDebug() << "*** kio_sieve Done" << endl; + return 0; + } +} + +/* ---------------------------------------------------------------------------------- */ +kio_sieveResponse::kio_sieveResponse() +{ + clear(); +} + +/* ---------------------------------------------------------------------------------- */ +const uint& kio_sieveResponse::getType() const +{ + return rType; +} + +/* ---------------------------------------------------------------------------------- */ +const uint kio_sieveResponse::getQuantity() const +{ + return quantity; +} + +/* ---------------------------------------------------------------------------------- */ +const TQCString& kio_sieveResponse::getAction() const +{ + return key; +} + +/* ---------------------------------------------------------------------------------- */ +const TQCString& kio_sieveResponse::getKey() const +{ + return key; +} + +/* ---------------------------------------------------------------------------------- */ +const TQCString& kio_sieveResponse::getVal() const +{ + return val; +} + +/* ---------------------------------------------------------------------------------- */ +const TQCString& kio_sieveResponse::getExtra() const +{ + return extra; +} + +/* ---------------------------------------------------------------------------------- */ +void kio_sieveResponse::setQuantity(const uint& newTQty) +{ + rType = QUANTITY; + quantity = newTQty; +} + +/* ---------------------------------------------------------------------------------- */ +void kio_sieveResponse::setAction(const TQCString& newAction) +{ + rType = ACTION; + key = newAction.copy(); +} + +/* ---------------------------------------------------------------------------------- */ +void kio_sieveResponse::setKey(const TQCString& newKey) +{ + rType = KEY_VAL_PAIR; + key = newKey.copy(); +} + +/* ---------------------------------------------------------------------------------- */ +void kio_sieveResponse::setVal(const TQCString& newVal) +{ + val = newVal.copy(); +} + +/* ---------------------------------------------------------------------------------- */ +void kio_sieveResponse::setExtra(const TQCString& newExtra) +{ + extra = newExtra.copy(); +} + +/* ---------------------------------------------------------------------------------- */ +void kio_sieveResponse::clear() +{ + rType = NONE; + extra = key = val = TQCString(""); + quantity = 0; +} + +/* ---------------------------------------------------------------------------------- */ +kio_sieveProtocol::kio_sieveProtocol(const TQCString &pool_socket, const TQCString &app_socket) + : TCPSlaveBase( SIEVE_DEFAULT_PORT, "sieve", pool_socket, app_socket, false) + , m_connMode(NORMAL) + , m_supportsTLS(false) + , m_shouldBeConnected(false) + , m_allowUnencrypted(false) +{ +} + +/* ---------------------------------------------------------------------------------- */ +kio_sieveProtocol::~kio_sieveProtocol() +{ + if ( isConnectionValid() ) + disconnect(); +} + +/* ---------------------------------------------------------------------------------- */ +void kio_sieveProtocol::setHost (const TQString &host, int port, const TQString &user, const TQString &pass) +{ + if ( isConnectionValid() && + ( m_sServer != host || + m_iPort != port || + m_sUser != user || + m_sPass != pass ) ) { + disconnect(); + } + m_sServer = host; + m_iPort = port ? port : m_iDefaultPort; + m_sUser = user; + m_sPass = pass; + m_supportsTLS = false; +} + +/* ---------------------------------------------------------------------------------- */ +void kio_sieveProtocol::openConnection() +{ + m_connMode = CONNECTION_ORIENTED; + connect(); +} + +bool kio_sieveProtocol::parseCapabilities(bool requestCapabilities/* = false*/) +{ + ksDebug() << k_funcinfo << endl; + + // Setup... + bool ret = false; + + if (requestCapabilities) { + sendData("CAPABILITY"); + } + + while (receiveData()) { + ksDebug() << "Looping receive" << endl; + + if (r.getType() == kio_sieveResponse::ACTION) { + if ( r.getAction().contains("ok", false) != -1 ) { + ksDebug() << "Sieve server ready & awaiting authentication." << endl; + break; + } else + ksDebug() << "Unknown action " << r.getAction() << "." << endl; + + } else if (r.getKey() == "IMPLEMENTATION") { + if (r.getVal().contains("sieve", false) != -1) { + ksDebug() << "Connected to Sieve server: " << r.getVal() << endl; + ret = true; + setMetaData("implementation", r.getVal()); + m_implementation = r.getVal(); + } + + } else if (r.getKey() == "SASL") { + // Save list of available SASL methods + m_sasl_caps = TQStringList::split(' ', r.getVal()); + ksDebug() << "Server SASL authentication methods: " << m_sasl_caps.join(", ") << endl; + setMetaData("saslMethods", r.getVal()); + + } else if (r.getKey() == "SIEVE") { + // Save script capabilities; report back as meta data: + ksDebug() << "Server script capabilities: " << TQStringList::split(' ', r.getVal()).join(", ") << endl; + setMetaData("sieveExtensions", r.getVal()); + + } else if (r.getKey() == "STARTTLS") { + // The server supports TLS + ksDebug() << "Server supports TLS" << endl; + m_supportsTLS = true; + setMetaData("tlsSupported", "true"); + + } else { + ksDebug() << "Unrecognised key." << endl; + } + } + + if (!m_supportsTLS) { + setMetaData("tlsSupported", "false"); + } + + return ret; +} + + +/* ---------------------------------------------------------------------------------- */ +/** + * Checks if connection parameters have changed. + * If it it, close the current connection + */ +void kio_sieveProtocol::changeCheck( const KURL &url ) +{ + TQString auth; + + if (!metaData("sasl").isEmpty()) + auth = metaData("sasl").upper(); + else { + TQString query = url.query(); + if ( query.startsWith("?") ) query.remove( 0, 1 ); + TQStringList q = TQStringList::split( ",", query ); + TQStringList::iterator it; + + for ( it = q.begin(); it != q.end(); ++it ) { + if ( TQString( (*it).section('=',0,0) ).lower() == "x-mech" ) { + auth = TQString( (*it).section('=',1) ).upper(); + break; + } + } + } + ksDebug() << "auth: " << auth << " m_sAuth: " << m_sAuth << endl; + if ( m_sAuth != auth ) { + m_sAuth = auth; + if ( isConnectionValid() ) + disconnect(); + } + + // For TLS, only disconnect if we are unencrypted and are + // no longer allowed (otherwise, it's still fine): + const bool allowUnencryptedNow = url.queryItem("x-allow-unencrypted") == "true" ; + if ( m_allowUnencrypted && !allowUnencryptedNow ) + if ( isConnectionValid() ) + disconnect(); + m_allowUnencrypted = allowUnencryptedNow; +} + +/* ---------------------------------------------------------------------------------- */ +/** + * Connects to the server. + * returns false and calls error() if an error occurred. + */ +bool kio_sieveProtocol::connect(bool useTLSIfAvailable) +{ + ksDebug() << k_funcinfo << endl; + + if (isConnectionValid()) return true; + + infoMessage(i18n("Connecting to %1...").arg( m_sServer)); + + if (m_connMode == CONNECTION_ORIENTED && m_shouldBeConnected) { + error(ERR_CONNECTION_BROKEN, i18n("The connection to the server was lost.")); + return false; + } + + setBlockConnection(true); + + if (!connectToHost(m_sServer, m_iPort, true)) { + return false; + } + + if (!parseCapabilities()) { + closeDescriptor(); + error(ERR_UNSUPPORTED_PROTOCOL, i18n("Server identification failed.")); + return false; + } + + // Attempt to start TLS + if ( !m_allowUnencrypted && !canUseTLS() ) { + error( ERR_SLAVE_DEFINED, i18n("Can not use TLS. Please enable TLS in the TDE cryptography setting.") ); + disconnect(); + return false; + } + + if ( !m_allowUnencrypted && useTLSIfAvailable && canUseTLS() && !m_supportsTLS && + messageBox( WarningContinueCancel, + i18n("TLS encryption was requested, but your Sieve server does not advertise TLS in its capabilities.\n" + "You can choose to try to initiate TLS negotiations nonetheless, or cancel the operation."), + i18n("Server Does Not Advertise TLS"), i18n("&Start TLS nonetheless"), i18n("&Cancel") ) != KMessageBox::Continue ) + { + error( ERR_USER_CANCELED, i18n("TLS encryption requested, but not supported by server.") ); + disconnect(); + return false; + } + + // FIXME find a test server and test that this works + if (useTLSIfAvailable && canUseTLS()) { + sendData("STARTTLS"); + if (operationSuccessful()) { + ksDebug() << "TLS has been accepted. Starting TLS..." << endl + << "WARNING this is untested and may fail." << endl; + int retval = startTLS(); + if (retval == 1) { + ksDebug() << "TLS enabled successfully." << endl; + // reparse capabilities: + parseCapabilities( requestCapabilitiesAfterStartTLS() ); + } else { + ksDebug() << "TLS initiation failed, code " << retval << endl; + if ( m_allowUnencrypted ) { + disconnect(true); + return connect(false); + } + if ( retval != -3 ) + messageBox( Information, + i18n("Your Sieve server claims to support TLS, " + "but negotiation was unsuccessful."), + i18n("Connection Failed") ); + disconnect(true); + return false; + } + } else if ( !m_allowUnencrypted ) { + ksDebug() << "Server incapable of TLS." << endl; + disconnect(); + error( ERR_SLAVE_DEFINED, i18n("The server does not seem to support TLS. " + "Disable TLS if you want to connect without encryption.") ); + return false; + } else + ksDebug() << "Server incapable of TLS. Transmitted documents will be unencrypted." << endl; + } else + ksDebug() << "We are incapable of TLS. Transmitted documents will be unencrypted." << endl; + + assert( m_allowUnencrypted || usingTLS() ); + + infoMessage(i18n("Authenticating user...")); + if (!authenticate()) { + disconnect(); + error(ERR_COULD_NOT_AUTHENTICATE, i18n("Authentication failed.")); + return false; + } + + m_shouldBeConnected = true; + return true; +} + +/* ---------------------------------------------------------------------------------- */ +void kio_sieveProtocol::closeConnection() +{ + m_connMode = CONNECTION_ORIENTED; + disconnect(); +} + +/* ---------------------------------------------------------------------------------- */ +void kio_sieveProtocol::disconnect(bool forcibly) +{ + if (!forcibly) { + sendData("LOGOUT"); + + // This crashes under certain conditions as described in + // http://intevation.de/roundup/kolab/issue2442 + // Fixing TDEIO::TCPSlaveBase::atEnd() for !fd would also work but 3.x is on life support. + //if (!operationSuccessful()) + // ksDebug() << "Server did not logout cleanly." << endl; + } + + closeDescriptor(); + m_shouldBeConnected = false; +} + +/* ---------------------------------------------------------------------------------- */ +/*void kio_sieveProtocol::slave_status() +{ + slaveStatus(isConnectionValid() ? m_sServer : "", isConnectionValid()); + + finished(); +}*/ + +/* ---------------------------------------------------------------------------------- */ +void kio_sieveProtocol::special(const TQByteArray &data) +{ + int tmp; + TQDataStream stream(data, IO_ReadOnly); + KURL url; + + stream >> tmp; + + switch (tmp) { + case 1: + stream >> url; + if (!activate(url)) + return; + break; + case 2: + if (!deactivate()) + return; + break; + case 3: + parseCapabilities(true); + break; + } + + infoMessage(i18n("Done.")); + + finished(); +} + +/* ---------------------------------------------------------------------------------- */ +bool kio_sieveProtocol::activate(const KURL& url) +{ + changeCheck( url ); + if (!connect()) + return false; + + infoMessage(i18n("Activating script...")); + + TQString filename = url.fileName(false); + + if (filename.isEmpty()) { + error(ERR_DOES_NOT_EXIST, url.prettyURL()); + return false; + } + + if (!sendData("SETACTIVE \"" + filename.utf8() + "\"")) + return false; + + if (operationSuccessful()) { + ksDebug() << "Script activation complete." << endl; + return true; + } else { + error(ERR_INTERNAL_SERVER, i18n("There was an error activating the script.")); + return false; + } +} + +/* ---------------------------------------------------------------------------------- */ +bool kio_sieveProtocol::deactivate() +{ + if (!connect()) + return false; + + if (!sendData("SETACTIVE \"\"")) + return false; + + if (operationSuccessful()) { + ksDebug() << "Script deactivation complete." << endl; + return true; + } else { + error(ERR_INTERNAL_SERVER, i18n("There was an error deactivating the script.")); + return false; + } +} + +static void append_lf2crlf( TQByteArray & out, const TQByteArray & in ) { + if ( in.isEmpty() ) + return; + const unsigned int oldOutSize = out.size(); + out.resize( oldOutSize + 2 * in.size() ); + const char * s = in.begin(); + const char * const end = in.end(); + char * d = out.begin() + oldOutSize; + char last = '\0'; + while ( s < end ) { + if ( *s == '\n' && last != '\r' ) + *d++ = '\r'; + *d++ = last = *s++; + } + out.resize( d - out.begin() ); +} + +void kio_sieveProtocol::put(const KURL& url, int /*permissions*/, bool /*overwrite*/, bool /*resume*/) +{ + changeCheck( url ); + if (!connect()) + return; + + infoMessage(i18n("Sending data...")); + + TQString filename = url.fileName(false); + + if (filename.isEmpty()) { + error(ERR_MALFORMED_URL, url.prettyURL()); + return; + } + + TQByteArray data; + for (;;) { + dataReq(); + TQByteArray buffer; + const int newSize = readData(buffer); + append_lf2crlf( data, buffer ); + if ( newSize < 0 ) { + // read error: network in unknown state so disconnect + error(ERR_COULD_NOT_READ, i18n("KIO data supply error.")); + return; + } + if ( newSize == 0 ) + break; + } + + // script size + int bufLen = (int)data.size(); + totalSize(bufLen); + + // timsieved 1.1.0: + // C: HAVESPACE "rejected" 74 + // S: NO "Number expected" + // C: HAVESPACE 74 + // S: NO "Missing script name" + // S: HAVESPACE "rejected" "74" + // C: NO "Number expected" + // => broken, we can't use it :-( + // (will be fixed in Cyrus 2.1.10) +#ifndef HAVE_BROKEN_TIMSIEVED + // first, check quota (it's a SHOULD in draft std) + if (!sendData("HAVESPACE \"" + filename.utf8() + "\" " + + TQCString().setNum( bufLen ))) + return; + + if (!operationSuccessful()) { + error(ERR_DISK_FULL, i18n("Quota exceeded")); + return; + } +#endif + + if (!sendData("PUTSCRIPT \"" + filename.utf8() + "\" {" + + TQCString().setNum( bufLen ) + "+}")) + return; + + // atEnd() lies so the code below doesn't work. + /*if (!atEnd()) { + // We are not expecting any data here, so if the server has responded + // with anything but OK we treat it as an error. + char * buf = new char[2]; + while (!atEnd()) { + ksDebug() << "Reading..." << endl; + read(buf, 1); + ksDebug() << "Trailing [" << buf[0] << "]" << endl; + } + ksDebug() << "End of data." << endl; + delete[] buf; + + if (!operationSuccessful()) { + error(ERR_UNSUPPORTED_PROTOCOL, i18n("A protocol error occurred " + "while trying to negotiate script uploading.\n" + "The server responded:\n%1") + .arg(r.getAction().right(r.getAction().length() - 3))); + return; + } + }*/ + + // upload data to the server + if (write(data, bufLen) != bufLen) { + error(ERR_COULD_NOT_WRITE, i18n("Network error.")); + disconnect(true); + return; + } + + // finishing CR/LF + if (!sendData("")) + return; + + processedSize(bufLen); + + infoMessage(i18n("Verifying upload completion...")); + + if (operationSuccessful()) + ksDebug() << "Script upload complete." << endl; + + else { + /* The managesieve server parses received scripts and rejects + * scripts which are not syntactically correct. Here we expect + * to receive a message detailing the error (only the first + * error is reported. */ + if (r.getAction().length() > 3) { + // make a copy of the extra info + TQCString extra = r.getAction().right(r.getAction().length() - 3); + + // send the extra message off for re-processing + receiveData(false, &extra); + + if (r.getType() == kio_sieveResponse::QUANTITY) { + // length of the error message + uint len = r.getQuantity(); + + TQCString errmsg(len + 1); + + read(errmsg.data(), len); + + error(ERR_INTERNAL_SERVER, + i18n("The script did not upload successfully.\n" + "This is probably due to errors in the script.\n" + "The server responded:\n%1").arg(TQString(errmsg))); + + // clear the rest of the incoming data + receiveData(); + } else if (r.getType() == kio_sieveResponse::KEY_VAL_PAIR) { + error(ERR_INTERNAL_SERVER, + i18n("The script did not upload successfully.\n" + "This is probably due to errors in the script.\n" + "The server responded:\n%1").arg(TQString(r.getKey()))); + } else + error(ERR_INTERNAL_SERVER, + i18n("The script did not upload successfully.\n" + "The script may contain errors.")); + } else + error(ERR_INTERNAL_SERVER, + i18n("The script did not upload successfully.\n" + "The script may contain errors.")); + } + + //if ( permissions != -1 ) + // chmod( url, permissions ); + + infoMessage(i18n("Done.")); + + finished(); +} + +static void inplace_crlf2lf( TQByteArray & in ) { + if ( in.isEmpty() ) + return; + TQByteArray & out = in; // inplace + const char * s = in.begin(); + const char * const end = in.end(); + char * d = out.begin(); + char last = '\0'; + while ( s < end ) { + if ( *s == '\n' && last == '\r' ) + --d; + *d++ = last = *s++; + } + out.resize( d - out.begin() ); +} + +/* ---------------------------------------------------------------------------------- */ +void kio_sieveProtocol::get(const KURL& url) +{ + changeCheck( url ); + if (!connect()) + return; + + infoMessage(i18n("Retrieving data...")); + + TQString filename = url.fileName(false); + + if (filename.isEmpty()) { + error(ERR_MALFORMED_URL, url.prettyURL()); + return; + } + + //SlaveBase::mimetype( TQString("text/plain") ); // "application/sieve"); + + if (!sendData("GETSCRIPT \"" + filename.utf8() + "\"")) + return; + + if (receiveData() && r.getType() == kio_sieveResponse::QUANTITY) { + // determine script size + ssize_t total_len = r.getQuantity(); + totalSize( total_len ); + + int recv_len = 0; + do { + // wait for data... + if ( !waitForResponse( 600 ) ) { + error( TDEIO::ERR_SERVER_TIMEOUT, m_sServer ); + disconnect( true ); + return; + } + + // ...read data... + // Only read as much as we need, otherwise we slurp in the OK that + // operationSuccessful() is expecting below. + TQByteArray dat( kMin( total_len - recv_len, ssize_t(64 * 1024 )) ); + ssize_t this_recv_len = read( dat.data(), dat.size() ); + + if ( this_recv_len < 1 && !isConnectionValid() ) { + error( TDEIO::ERR_CONNECTION_BROKEN, m_sServer ); + disconnect( true ); + return; + } + + dat.resize( this_recv_len ); + inplace_crlf2lf( dat ); + // send data to slaveinterface + data( dat ); + + recv_len += this_recv_len; + processedSize( recv_len ); + } while ( recv_len < total_len ); + + infoMessage(i18n("Finishing up...") ); + data(TQByteArray()); + + if (operationSuccessful()) + ksDebug() << "Script retrieval complete." << endl; + else + ksDebug() << "Script retrieval failed." << endl; + } else { + error(ERR_UNSUPPORTED_PROTOCOL, i18n("A protocol error occurred " + "while trying to negotiate script downloading.")); + return; + } + + infoMessage(i18n("Done.")); + finished(); +} + +void kio_sieveProtocol::del(const KURL &url, bool isfile) +{ + if (!isfile) { + error(ERR_INTERNAL, i18n("Folders are not supported.")); + return; + } + + changeCheck( url ); + if (!connect()) + return; + + infoMessage(i18n("Deleting file...")); + + TQString filename = url.fileName(false); + + if (filename.isEmpty()) { + error(ERR_MALFORMED_URL, url.prettyURL()); + return; + } + + if (!sendData("DELETESCRIPT \"" + filename.utf8() + "\"")) + return; + + if (operationSuccessful()) + ksDebug() << "Script deletion successful." << endl; + else { + error(ERR_INTERNAL_SERVER, i18n("The server would not delete the file.")); + return; + } + + infoMessage(i18n("Done.")); + + finished(); +} + +void kio_sieveProtocol::chmod(const KURL& url, int permissions) +{ + switch ( permissions ) { + case 0700: // activate + activate(url); + break; + case 0600: // deactivate + deactivate(); + break; + default: // unsupported + error(ERR_CANNOT_CHMOD, i18n("Cannot chmod to anything but 0700 (active) or 0600 (inactive script).")); + return; + } + + finished(); +} + +#if defined(_AIX) && defined(stat) +#undef stat +#endif + +void kio_sieveProtocol::stat(const KURL& url) +{ + changeCheck( url ); + if (!connect()) + return; + + UDSEntry entry; + + TQString filename = url.fileName(false); + + if (filename.isEmpty()) { + UDSAtom atom; + atom.m_uds = TDEIO::UDS_NAME; + atom.m_str = "/"; + entry.append(atom); + + atom.m_uds = TDEIO::UDS_FILE_TYPE; + atom.m_long = S_IFDIR; + entry.append(atom); + + atom.m_uds = TDEIO::UDS_ACCESS; + atom.m_long = 0700; + entry.append(atom); + + statEntry(entry); + + } else { + if (!sendData("LISTSCRIPTS")) + return; + + while(receiveData()) { + if (r.getType() == kio_sieveResponse::ACTION) { + if (r.getAction().contains("OK", false) == 1) + // Script list completed + break; + + } else + if (filename == TQString::fromUtf8(r.getKey())) { + entry.clear(); + + UDSAtom atom; + atom.m_uds = TDEIO::UDS_NAME; + atom.m_str = TQString::fromUtf8(r.getKey()); + entry.append(atom); + + atom.m_uds = TDEIO::UDS_FILE_TYPE; + atom.m_long = S_IFREG; + entry.append(atom); + + atom.m_uds = TDEIO::UDS_ACCESS; + if ( r.getExtra() == "ACTIVE" ) + atom.m_long = 0700; // mark exec'able + else + atom.m_long = 0600; + entry.append(atom); + + atom.m_uds = TDEIO::UDS_MIME_TYPE; + atom.m_str = "application/sieve"; + entry.append(atom); + + //setMetaData("active", (r.getExtra() == "ACTIVE") ? "yes" : "no"); + + statEntry(entry); + // cannot break here because we need to clear + // the rest of the incoming data. + } + } + } + + finished(); +} + +void kio_sieveProtocol::listDir(const KURL& url) +{ + changeCheck( url ); + if (!connect()) + return; + + if (!sendData("LISTSCRIPTS")) + return; + + UDSEntry entry; + + while(receiveData()) { + if (r.getType() == kio_sieveResponse::ACTION) { + if (r.getAction().contains("OK", false) == 1) + // Script list completed. + break; + + } else { + entry.clear(); + + UDSAtom atom; + atom.m_uds = TDEIO::UDS_NAME; + atom.m_str = TQString::fromUtf8(r.getKey()); + entry.append(atom); + + atom.m_uds = TDEIO::UDS_FILE_TYPE; + atom.m_long = S_IFREG; + entry.append(atom); + + atom.m_uds = TDEIO::UDS_ACCESS; + if ( r.getExtra() == "ACTIVE" ) + atom.m_long = 0700; // mark exec'able + else + atom.m_long = 0600; + entry.append(atom); + + atom.m_uds = TDEIO::UDS_MIME_TYPE; + atom.m_str = "application/sieve"; + entry.append(atom); + + //asetMetaData("active", (r.getExtra() == "ACTIVE") ? "true" : "false"); + + ksDebug() << "Listing script " << r.getKey() << endl; + listEntry(entry , false); + } + } + + listEntry(entry, true); + + finished(); +} + +/* ---------------------------------------------------------------------------------- */ +bool kio_sieveProtocol::saslInteract( void *in, AuthInfo &ai ) +{ + ksDebug() << "sasl_interact" << endl; + sasl_interact_t *interact = ( sasl_interact_t * ) in; + + //some mechanisms do not require username && pass, so it doesn't need a popup + //window for getting this info + for ( ; interact->id != SASL_CB_LIST_END; interact++ ) { + if ( interact->id == SASL_CB_AUTHNAME || + interact->id == SASL_CB_PASS ) { + + if (m_sUser.isEmpty() || m_sPass.isEmpty()) { + if (!openPassDlg(ai)) { + error(ERR_ABORTED, i18n("No authentication details supplied.")); + return false; + } + m_sUser = ai.username; + m_sPass = ai.password; + } + break; + } + } + + interact = ( sasl_interact_t * ) in; + while( interact->id != SASL_CB_LIST_END ) { + ksDebug() << "SASL_INTERACT id: " << interact->id << endl; + switch( interact->id ) { + case SASL_CB_USER: + case SASL_CB_AUTHNAME: + ksDebug() << "SASL_CB_[AUTHNAME|USER]: '" << m_sUser << "'" << endl; + interact->result = strdup( m_sUser.utf8() ); + interact->len = strlen( (const char *) interact->result ); + break; + case SASL_CB_PASS: + ksDebug() << "SASL_CB_PASS: [hidden] " << endl; + interact->result = strdup( m_sPass.utf8() ); + interact->len = strlen( (const char *) interact->result ); + break; + default: + interact->result = NULL; interact->len = 0; + break; + } + interact++; + } + return true; +} + +#define SASLERROR error(ERR_COULD_NOT_AUTHENTICATE, i18n("An error occurred during authentication: %1").arg( \ + TQString::fromUtf8( sasl_errdetail( conn ) ))); + +bool kio_sieveProtocol::authenticate() +{ + int result; + sasl_conn_t *conn = NULL; + sasl_interact_t *client_interact = NULL; + const char *out = NULL; + uint outlen; + const char *mechusing = NULL; + TQByteArray challenge, tmp; + + /* Retrieve authentication details from user. + * Note: should this require realm as well as user & pass details + * before it automatically skips the prompt? + * Note2: encoding issues with PLAIN login? */ + AuthInfo ai; + ai.url.setProtocol("sieve"); + ai.url.setHost(m_sServer); + ai.url.setPort(m_iPort); + ai.username = m_sUser; + ai.password = m_sPass; + ai.keepPassword = true; + ai.caption = i18n("Sieve Authentication Details"); + ai.comment = i18n("Please enter your authentication details for your sieve account " + "(usually the same as your email password):"); + + result = sasl_client_new( "sieve", + m_sServer.latin1(), + 0, 0, callbacks, 0, &conn ); + + if ( result != SASL_OK ) { + ksDebug() << "sasl_client_new failed with: " << result << endl; + SASLERROR + return false; + } + + TQStringList strList; +// strList.append("NTLM"); + + if ( !m_sAuth.isEmpty() ) + strList.append( m_sAuth ); + else + strList = m_sasl_caps; + + do { + result = sasl_client_start(conn, strList.join(" ").latin1(), &client_interact, + &out, &outlen, &mechusing); + + if (result == SASL_INTERACT) + if ( !saslInteract( client_interact, ai ) ) { + sasl_dispose( &conn ); + return false; + }; + } while ( result == SASL_INTERACT ); + + if ( result != SASL_CONTINUE && result != SASL_OK ) { + ksDebug() << "sasl_client_start failed with: " << result << endl; + SASLERROR + sasl_dispose( &conn ); + return false; + } + + ksDebug() << "Preferred authentication method is " << mechusing << "." << endl; + + TQString firstCommand = "AUTHENTICATE \"" + TQString::fromLatin1( mechusing ) + "\""; + tmp.setRawData( out, outlen ); + KCodecs::base64Encode( tmp, challenge ); + tmp.resetRawData( out, outlen ); + if ( !challenge.isEmpty() ) { + firstCommand += " \""; + firstCommand += TQString::fromLatin1( challenge.data(), challenge.size() ); + firstCommand += "\""; + } + + if (!sendData( firstCommand.latin1() )) + return false; + + TQCString command; + + do { + receiveData(); + + if (operationResult() != OTHER) + break; + + ksDebug() << "Challenge len " << r.getQuantity() << endl; + + if (r.getType() != kio_sieveResponse::QUANTITY) { + sasl_dispose( &conn ); + error(ERR_SLAVE_DEFINED, + i18n("A protocol error occurred during authentication.\n" + "Choose a different authentication method to %1.").arg(mechusing)); + return false; + } + + uint qty = r.getQuantity(); + + receiveData(); + + if (r.getType() != kio_sieveResponse::ACTION && r.getAction().length() != qty) { + sasl_dispose( &conn ); + error(ERR_UNSUPPORTED_PROTOCOL, + i18n("A protocol error occurred during authentication.\n" + "Choose a different authentication method to %1.").arg(mechusing)); + return false; + } + + tmp.setRawData( r.getAction().data(), qty ); + KCodecs::base64Decode( tmp, challenge ); + tmp.resetRawData( r.getAction().data(), qty ); +// ksDebug() << "S: [" << r.getAction() << "]." << endl; +// ksDebug() << "S-1: [" << TQCString(challenge.data(), challenge.size()+1) << "]." << endl; + + do { + result = sasl_client_step(conn, challenge.isEmpty() ? 0 : challenge.data(), + challenge.size(), + &client_interact, + &out, &outlen); + + if (result == SASL_INTERACT) + if ( !saslInteract( client_interact, ai ) ) { + sasl_dispose( &conn ); + return false; + }; + } while ( result == SASL_INTERACT ); + + ksDebug() << "sasl_client_step: " << result << endl; + if ( result != SASL_CONTINUE && result != SASL_OK ) { + ksDebug() << "sasl_client_step failed with: " << result << endl; + SASLERROR + sasl_dispose( &conn ); + return false; + } + + tmp.setRawData( out, outlen ); + KCodecs::base64Encode( tmp, challenge ); + tmp.resetRawData( out, outlen ); + sendData("\"" + TQCString( challenge.data(), challenge.size()+1 ) + "\""); +// ksDebug() << "C: [" << TQCString(challenge.data(), challenge.size()+1) << "]." << endl; +// ksDebug() << "C-1: [" << out << "]." << endl; + } while ( true ); + + ksDebug() << "Challenges finished." << endl; + sasl_dispose( &conn ); + + if (operationResult() == OK) { + // Authentication succeeded. + return true; + } else { + // Authentication failed. + error(ERR_COULD_NOT_AUTHENTICATE, i18n("Authentication failed.\nMost likely the password is wrong.\nThe server responded:\n%1").arg( TQString(r.getAction()) ) ); + return false; + } +} + +/* --------------------------------------------------------------------------- */ +void kio_sieveProtocol::mimetype(const KURL & url) +{ + ksDebug() << "Requesting mimetype for " << url.prettyURL() << endl; + + if (url.fileName(false).isEmpty()) + mimeType( "inode/directory" ); + else + mimeType( "application/sieve" ); + + finished(); +} + + +/* --------------------------------------------------------------------------- */ +bool kio_sieveProtocol::sendData(const TQCString &data) +{ + TQCString write_buf = data + "\r\n"; + + //ksDebug() << "C: " << data << endl; + + // Write the command + ssize_t write_buf_len = write_buf.length(); + if (write(write_buf.data(), write_buf_len) != write_buf_len) { + error(ERR_COULD_NOT_WRITE, i18n("Network error.")); + disconnect(true); + return false; + } + + return true; +} + +/* --------------------------------------------------------------------------- */ +bool kio_sieveProtocol::receiveData(bool waitForData, TQCString *reparse) +{ + TQCString interpret; + int start, end; + + if (!reparse) { + if (!waitForData) + // is there data waiting? + if (atEnd()) return false; + + // read data from the server + char buffer[SIEVE_DEFAULT_RECIEVE_BUFFER]; + readLine(buffer, SIEVE_DEFAULT_RECIEVE_BUFFER - 1); + buffer[SIEVE_DEFAULT_RECIEVE_BUFFER-1] = '\0'; + + // strip LF/CR + interpret = TQCString(buffer).left(tqstrlen(buffer) - 2); + + } else { + interpret = reparse->copy(); + } + + r.clear(); + + //ksDebug() << "S: " << interpret << endl; + + switch(interpret[0]) { + case '{': + { + // expecting {quantity} + start = 0; + end = interpret.find("+}", start + 1); + // some older versions of Cyrus enclose the literal size just in { } instead of { +} + if ( end == -1 ) + end = interpret.find('}', start + 1); + + bool ok = false; + r.setQuantity(interpret.mid(start + 1, end - start - 1).toUInt( &ok )); + if (!ok) { + disconnect(); + error(ERR_INTERNAL_SERVER, i18n("A protocol error occurred.")); + return false; + } + + return true; + } + case '"': + // expecting "key" "value" pairs + break; + default: + // expecting single string + r.setAction(interpret); + return true; + } + + start = 0; + + end = interpret.find(34, start + 1); + if (end == -1) { + ksDebug() << "Possible insufficient buffer size." << endl; + r.setKey(interpret.right(interpret.length() - start)); + return true; + } + + r.setKey(interpret.mid(start + 1, end - start - 1)); + + start = interpret.find(34, end + 1); + if (start == -1) { + if ((int)interpret.length() > end) + // skip " and space + r.setExtra(interpret.right(interpret.length() - end - 2)); + + return true; + } + + end = interpret.find(34, start + 1); + if (end == -1) { + ksDebug() << "Possible insufficient buffer size." << endl; + r.setVal(interpret.right(interpret.length() - start)); + return true; + } + + r.setVal(interpret.mid(start + 1, end - start - 1)); + return true; +} + +bool kio_sieveProtocol::operationSuccessful() +{ + while (receiveData(false)) { + if (r.getType() == kio_sieveResponse::ACTION) { + TQCString response = r.getAction().left(2); + if (response == "OK") { + return true; + } else if (response == "NO") { + return false; + } + } + } + return false; +} + +int kio_sieveProtocol::operationResult() +{ + if (r.getType() == kio_sieveResponse::ACTION) { + TQCString response = r.getAction().left(2); + if (response == "OK") { + return OK; + } else if (response == "NO") { + return NO; + } else if (response == "BY"/*E*/) { + return BYE; + } + } + + return OTHER; +} + +bool kio_sieveProtocol::requestCapabilitiesAfterStartTLS() const +{ + // Cyrus didn't send CAPABILITIES after STARTTLS until 2.3.11, which is + // not standard conform, but we need to support that anyway. + // m_implementation looks like this 'Cyrus timsieved v2.2.12' for Cyrus btw. + TQRegExp regExp( "Cyrus\\stimsieved\\sv(\\d+)\\.(\\d+)\\.(\\d+)([-\\w]*)", false ); + if ( regExp.search( m_implementation ) >= 0 ) { + const int major = regExp.cap( 1 ).toInt(); + const int minor = regExp.cap( 2 ).toInt(); + const int patch = regExp.cap( 3 ).toInt(); + const TQString vendor = regExp.cap( 4 ); + if ( major < 2 || (major == 2 && (minor < 3 || (minor == 3 && patch < 11))) || (vendor == "-kolab-nocaps") ) { + ksDebug() << k_funcinfo << "Enabling compat mode for Cyrus < 2.3.11 or Cyrus marked as \"kolab-nocaps\"" << endl; + return true; + } + } + return false; +} diff --git a/tdeioslaves/sieve/sieve.h b/tdeioslaves/sieve/sieve.h new file mode 100644 index 00000000..d25b1d57 --- /dev/null +++ b/tdeioslaves/sieve/sieve.h @@ -0,0 +1,133 @@ +/*************************************************************************** + sieve.h - description + ------------------- + begin : Thu Dec 20 18:47:08 EST 2001 + copyright : (C) 2001 by Hamish Rodda + email : meddie@yoyo.cc.monash.edu.au + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License version 2 as * + * published by the Free Software Foundation. * + * * + ***************************************************************************/ +#ifndef __sieve_h__ +#define __sieve_h__ + +#include +#include + +#include +#include +#include + +class KDESasl; +class KURL; + + +class kio_sieveResponse +{ +public: + enum responses { NONE, KEY_VAL_PAIR, ACTION, QUANTITY }; + + kio_sieveResponse(); + + const uint& getType() const; + + const TQCString& getAction() const; + const uint getQuantity() const; + const TQCString& getKey() const; + const TQCString& getVal() const; + const TQCString& getExtra() const; + + void setQuantity(const uint& quantity); + void setAction(const TQCString& newAction); + void setKey(const TQCString& newKey); + void setVal(const TQCString& newVal); + void setExtra(const TQCString& newExtra); + + void clear(); + +protected: + uint rType; + uint quantity; + TQCString key; + TQCString val; + TQCString extra; +}; + +class kio_sieveProtocol : public TDEIO::TCPSlaveBase +{ + +public: + enum connectionModes { NORMAL, CONNECTION_ORIENTED }; + enum Results { OK, NO, BYE, OTHER }; + + kio_sieveProtocol(const TQCString &pool_socket, const TQCString &app_socket); + virtual ~kio_sieveProtocol(); + + virtual void mimetype(const KURL& url); + virtual void get(const KURL& url); + virtual void put(const KURL& url, int permissions, bool overwrite, bool resume); + virtual void del(const KURL &url, bool isfile); + + virtual void listDir(const KURL& url); + virtual void chmod(const KURL& url, int permissions); + virtual void stat(const KURL& url); + + virtual void setHost(const TQString &host, int port, const TQString &user, const TQString &pass); + virtual void openConnection(); + virtual void closeConnection(); + //virtual void slave_status(); + + /** + * Special commands supported by this slave: + * 1 - activate script + * 2 - deactivate (all - only one active at any one time) scripts + * 3 - request capabilities, returned as metadata + */ + virtual void special(const TQByteArray &data); + bool activate(const KURL& url); + bool deactivate(); + +protected: + bool connect(bool useTLSIfAvailable = true); + bool authenticate(); + void disconnect(bool forcibly = false); + void changeCheck( const KURL &url ); + + bool sendData(const TQCString &data); + bool receiveData(bool waitForData = true, TQCString *reparse = 0); + bool operationSuccessful(); + int operationResult(); + + bool parseCapabilities(bool requestCapabilities = false); + bool saslInteract( void *in, TDEIO::AuthInfo &ai ); + + // IOSlave global data + uint m_connMode; + + // Host-specific data + TQStringList m_sasl_caps; + bool m_supportsTLS; + + // Global server respose class + kio_sieveResponse r; + + // connection details + TQString m_sServer; + TQString m_sUser; + TQString m_sPass; + TQString m_sAuth; + bool m_shouldBeConnected; + bool m_allowUnencrypted; + +private: + bool requestCapabilitiesAfterStartTLS() const; + + TQString m_implementation; +}; + +#endif diff --git a/tdeioslaves/sieve/sieve.protocol b/tdeioslaves/sieve/sieve.protocol new file mode 100644 index 00000000..484d48da --- /dev/null +++ b/tdeioslaves/sieve/sieve.protocol @@ -0,0 +1,53 @@ +[Protocol] +exec=kio_sieve +protocol=sieve +input=none +output=filesystem +listing=Name,Access,Type,MimeType, +reading=true +writing=true +makedir=false +deleting=true +linking=false +moving=false +Icon=remote +Description=An ioslave for the Sieve mail filtering protocol +Description[af]='n IOSlave vir die Sieve e-pos filter protokol +Description[ca]=Un ioslave pel protocol de filtrar de correu Sieve +Description[cs]=ioslave pro protokol filtrování zpráv Sieve +Description[da]=En ioslave for Sieve mail filtreringsprotokollen +Description[de]=Ein-/Ausgabemodul für das E-Mail-Filterprotokoll "Sieve" +Description[el]=Ένας ioslave για το Ï€Ïωτόκολλο φιλτÏαÏίσματος αλληλογÏαφίας Sieve +Description[es]=Un ioslave para el protocolo de filtrado de correo Sieve +Description[et]=Sieve e-kirjade filtreerimise protokolli IO-moodul +Description[eu]=Sieve posta iragazketa protokoloarentztko irteerako/sarrerako mendeko bat +Description[fa]=یک ioslave برای قرارداد پالایش نامۀ Sieve +Description[fi]=Siirräntätyöskentelijä Sieve-sähköpostiensuodatusyhteyskäytännölle +Description[fr]=Un ioslave pour le protocole de filtrage de messagerie Sieve +Description[fy]=In ioslave foar it Sieve-mailfilterprotokol +Description[gl]=Un esclavo io para o protocolo de filtraxe de correo Sieve +Description[hu]=KDE-protokoll a Sieve levélszűrÅ‘ protokollhoz +Description[is]=Ioslave fyrir Sieve tölvupóstsíu samskiptaregluna +Description[it]=Un ioslave per il protocollo di filtraggio posta Sieve +Description[ja]=Sieve メールフィルタプロトコル用 ioslave +Description[kk]=Sieve поштаны Ñүзгілеу протоколының ioslave модулі +Description[km]=ioslave សម្រាប់​ពិធីការ​ážáŸ’រង​សំបុážáŸ’ážš Sieve +Description[ms]=Hamba io untuk protokol tapisan mel saringan +Description[nb]=En i/u-slave for e-postfilterprotokollen Sieve +Description[nds]=In-/Utgaavmoduul för't Nettpostfilter-Protokoll Sieve +Description[ne]=मेल फिलà¥à¤Ÿà¤°à¤¿à¤™ पà¥à¤°à¥‹à¤Ÿà¥‹à¤•à¤² सिभ गरà¥à¤¨à¤•à¤¾ लागि à¤à¤‰à¤Ÿà¤¾ आइओसà¥à¤²à¥‡à¤­ +Description[nl]=Een ioslave voor het Sieve-mailfilterprotocol +Description[nn]=Ein i/u-slave for e-postfilterprotokollen Sieve +Description[pl]=Wtyczka protokoÅ‚u filtrowania poczty Sieve +Description[pt]=Um 'ioslave' para o protocolo de filtragem de correio Sieve +Description[pt_BR]=Um IO-Slave para o protocolo de filtragem de email Sieve +Description[ru]=Канал протокола фильтра почты Sieve +Description[sk]=ioslave pre protokol Sieve filtrovanie poÅ¡ty +Description[sl]=ioslave za protokol poÅ¡tnega filtriranja Sieve +Description[sr]=IOslave протокола за филтрирање поште Sieve +Description[sr@Latn]=IOslave protokola za filtriranje poÅ¡te Sieve +Description[sv]=En I/O-slav för brevfiltreringsprotokollet Sieve +Description[ta]=Sieve அஞà¯à®šà®²à¯ வடிகடà¯à®Ÿà¯à®®à¯ நெறிமà¯à®±à¯ˆà®•à¯à®•à®¾à®© ஒர௠ioslave +Description[tr]=Sieve e-posta filtreleme protokolü için bir ioslave +Description[uk]=Підлеглий Ð’/Ð’ Ð´Ð»Ñ Ð¿Ñ€Ð¾Ñ‚Ð¾ÐºÐ¾Ð»Ñƒ Ñ„Ñ–Ð»ÑŒÑ‚Ñ€ÑƒÐ²Ð°Ð½Ð½Ñ Ð¿Ð¾ÑˆÑ‚Ð¸ Sieve +Description[zh_CN]=邮件过滤å议仆人 diff --git a/tderesources/birthdays/resourcekabc.cpp b/tderesources/birthdays/resourcekabc.cpp index f3b191e1..a36517eb 100644 --- a/tderesources/birthdays/resourcekabc.cpp +++ b/tderesources/birthdays/resourcekabc.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include diff --git a/tderesources/birthdays/resourcekabc.h b/tderesources/birthdays/resourcekabc.h index 169a0294..008b87e5 100644 --- a/tderesources/birthdays/resourcekabc.h +++ b/tderesources/birthdays/resourcekabc.h @@ -25,7 +25,7 @@ #include #include -#include +#include #include "libkcal/incidence.h" #include "libkcal/calendarlocal.h" diff --git a/tderesources/blogging/API_Blog.h b/tderesources/blogging/API_Blog.h index 9425bd5e..5ad5b478 100644 --- a/tderesources/blogging/API_Blog.h +++ b/tderesources/blogging/API_Blog.h @@ -10,7 +10,7 @@ #define API_BLOG_H #include -#include +#include #include #include diff --git a/tderesources/blogging/xmlrpcjob.cpp b/tderesources/blogging/xmlrpcjob.cpp index f2e51630..cb377e7e 100644 --- a/tderesources/blogging/xmlrpcjob.cpp +++ b/tderesources/blogging/xmlrpcjob.cpp @@ -31,9 +31,9 @@ #include #include -#include +#include #include -#include +#include #define KIO_ARGS TQByteArray packedArgs; \ diff --git a/tderesources/blogging/xmlrpcjob.h b/tderesources/blogging/xmlrpcjob.h index 1efe79e1..4cf9a5db 100644 --- a/tderesources/blogging/xmlrpcjob.h +++ b/tderesources/blogging/xmlrpcjob.h @@ -29,8 +29,8 @@ #include #include -#include -#include +#include +#include namespace TDEIO { diff --git a/tderesources/caldav/prefsskel.kcfgc b/tderesources/caldav/prefsskel.kcfgc index b6b3aae0..4406dc79 100644 --- a/tderesources/caldav/prefsskel.kcfgc +++ b/tderesources/caldav/prefsskel.kcfgc @@ -1,4 +1,4 @@ -# Code generation options for kconfig_compiler +# Code generation options for tdeconfig_compiler File=prefsskel.kcfg ClassName=CalDavPrefsSkel NameSpace=KCal diff --git a/tderesources/caldav/resource.h b/tderesources/caldav/resource.h index ea04ef48..ee580532 100644 --- a/tderesources/caldav/resource.h +++ b/tderesources/caldav/resource.h @@ -27,7 +27,7 @@ #include #include -#include +#include namespace KCal { diff --git a/tderesources/carddav/prefsskel.kcfgc b/tderesources/carddav/prefsskel.kcfgc index 12ca40ce..5eb6ae28 100644 --- a/tderesources/carddav/prefsskel.kcfgc +++ b/tderesources/carddav/prefsskel.kcfgc @@ -1,4 +1,4 @@ -# Code generation options for kconfig_compiler +# Code generation options for tdeconfig_compiler File=prefsskel.kcfg ClassName=CardDavPrefsSkel NameSpace=KABC diff --git a/tderesources/carddav/resource.h b/tderesources/carddav/resource.h index cf5090e5..8f783ab2 100644 --- a/tderesources/carddav/resource.h +++ b/tderesources/carddav/resource.h @@ -26,7 +26,7 @@ #include #include -#include +#include namespace KABC { diff --git a/tderesources/egroupware/kabc_egroupwareprefs.kcfgc b/tderesources/egroupware/kabc_egroupwareprefs.kcfgc index 599001bb..10adb19b 100644 --- a/tderesources/egroupware/kabc_egroupwareprefs.kcfgc +++ b/tderesources/egroupware/kabc_egroupwareprefs.kcfgc @@ -1,4 +1,4 @@ -# Code generation options for kconfig_compiler +# Code generation options for tdeconfig_compiler File=tderesources_kabc_egroupware.kcfg ClassName=EGroupwarePrefs NameSpace=KABC diff --git a/tderesources/egroupware/kabc_resourcexmlrpc.cpp b/tderesources/egroupware/kabc_resourcexmlrpc.cpp index 84e78382..39e3aac1 100644 --- a/tderesources/egroupware/kabc_resourcexmlrpc.cpp +++ b/tderesources/egroupware/kabc_resourcexmlrpc.cpp @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include #include diff --git a/tderesources/egroupware/kcal_egroupwareprefs.kcfgc b/tderesources/egroupware/kcal_egroupwareprefs.kcfgc index 6c9f6d4d..4eb0e394 100644 --- a/tderesources/egroupware/kcal_egroupwareprefs.kcfgc +++ b/tderesources/egroupware/kcal_egroupwareprefs.kcfgc @@ -1,4 +1,4 @@ -# Code generation options for kconfig_compiler +# Code generation options for tdeconfig_compiler File=tderesources_kcal_egroupware.kcfg ClassName=EGroupwarePrefs NameSpace=KCal diff --git a/tderesources/egroupware/kcal_resourcexmlrpc.h b/tderesources/egroupware/kcal_resourcexmlrpc.h index 5253baba..9be4662f 100644 --- a/tderesources/egroupware/kcal_resourcexmlrpc.h +++ b/tderesources/egroupware/kcal_resourcexmlrpc.h @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include diff --git a/tderesources/egroupware/knotes_egroupwareprefs.kcfgc b/tderesources/egroupware/knotes_egroupwareprefs.kcfgc index 6c3fbdff..70adfc55 100644 --- a/tderesources/egroupware/knotes_egroupwareprefs.kcfgc +++ b/tderesources/egroupware/knotes_egroupwareprefs.kcfgc @@ -1,4 +1,4 @@ -# Code generation options for kconfig_compiler +# Code generation options for tdeconfig_compiler File=tderesources_knotes_egroupware.kcfg ClassName=EGroupwarePrefs NameSpace=KNotes diff --git a/tderesources/egroupware/knotes_resourcexmlrpc.h b/tderesources/egroupware/knotes_resourcexmlrpc.h index df8a4dd3..3550aed4 100644 --- a/tderesources/egroupware/knotes_resourcexmlrpc.h +++ b/tderesources/egroupware/knotes_resourcexmlrpc.h @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include diff --git a/tderesources/egroupware/xmlrpciface.cpp b/tderesources/egroupware/xmlrpciface.cpp index d43613e6..7af9814a 100644 --- a/tderesources/egroupware/xmlrpciface.cpp +++ b/tderesources/egroupware/xmlrpciface.cpp @@ -11,7 +11,7 @@ #include #include -#include +#include #include #include diff --git a/tderesources/featureplan/kcal_resourcefeatureplan.h b/tderesources/featureplan/kcal_resourcefeatureplan.h index 2808aef7..08bf1f39 100644 --- a/tderesources/featureplan/kcal_resourcefeatureplan.h +++ b/tderesources/featureplan/kcal_resourcefeatureplan.h @@ -30,7 +30,7 @@ #include #include -#include +#include namespace KCal { diff --git a/tderesources/featureplan/prefs.kcfgc b/tderesources/featureplan/prefs.kcfgc index 0866d4e3..1b4ac494 100644 --- a/tderesources/featureplan/prefs.kcfgc +++ b/tderesources/featureplan/prefs.kcfgc @@ -1,4 +1,4 @@ -# Code generation options for kconfig_compiler +# Code generation options for tdeconfig_compiler File=tderesources_kcal_featureplan.kcfg ClassName=Prefs #NameSpace=KBB diff --git a/tderesources/groupdav/groupdavaddressbookadaptor.cpp b/tderesources/groupdav/groupdavaddressbookadaptor.cpp index f8f30f65..9704e5bd 100644 --- a/tderesources/groupdav/groupdavaddressbookadaptor.cpp +++ b/tderesources/groupdav/groupdavaddressbookadaptor.cpp @@ -30,7 +30,7 @@ #include #include -#include +#include #include using namespace KABC; diff --git a/tderesources/groupdav/groupdavglobals.cpp b/tderesources/groupdav/groupdavglobals.cpp index 5088bca9..793c1b96 100644 --- a/tderesources/groupdav/groupdavglobals.cpp +++ b/tderesources/groupdav/groupdavglobals.cpp @@ -34,8 +34,8 @@ #include #include -#include -#include +#include +#include TQString GroupDavGlobals::extractFingerprint( TDEIO::Job *job, const TQString &/*jobData*/ ) { diff --git a/tderesources/groupware/kabc_resourcegroupware.cpp b/tderesources/groupware/kabc_resourcegroupware.cpp index 3c9d9792..44cee563 100644 --- a/tderesources/groupware/kabc_resourcegroupware.cpp +++ b/tderesources/groupware/kabc_resourcegroupware.cpp @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include diff --git a/tderesources/groupware/kabc_resourcegroupware.h b/tderesources/groupware/kabc_resourcegroupware.h index 53c1d007..1c5feb84 100644 --- a/tderesources/groupware/kabc_resourcegroupware.h +++ b/tderesources/groupware/kabc_resourcegroupware.h @@ -24,7 +24,7 @@ #include -#include +#include class TDEConfig; diff --git a/tderesources/groupware/kcal_groupwareprefsbase.kcfgc b/tderesources/groupware/kcal_groupwareprefsbase.kcfgc index 7e243ddc..e174cad4 100644 --- a/tderesources/groupware/kcal_groupwareprefsbase.kcfgc +++ b/tderesources/groupware/kcal_groupwareprefsbase.kcfgc @@ -1,4 +1,4 @@ -# Code generation options for kconfig_compiler +# Code generation options for tdeconfig_compiler File=tderesources_kcal_groupware.kcfg ClassName=GroupwarePrefsBase NameSpace=KCal diff --git a/tderesources/groupware/kcal_resourcegroupware.h b/tderesources/groupware/kcal_resourcegroupware.h index d3c809db..d757ad73 100644 --- a/tderesources/groupware/kcal_resourcegroupware.h +++ b/tderesources/groupware/kcal_resourcegroupware.h @@ -26,8 +26,8 @@ #include #include -#include -#include +#include +#include namespace KPIM { class GroupwarePrefsBase; @@ -36,7 +36,7 @@ class GroupwarePrefsBase; namespace KCal { /** - This class provides a resource for accessing a Groupware kioslave-based + This class provides a resource for accessing a Groupware tdeioslave-based calendar. */ class ResourceGroupware : public ResourceCached diff --git a/tderesources/groupware/kcal_resourcegroupwareconfig.h b/tderesources/groupware/kcal_resourcegroupwareconfig.h index dd6a93af..7bfa34d4 100644 --- a/tderesources/groupware/kcal_resourcegroupwareconfig.h +++ b/tderesources/groupware/kcal_resourcegroupwareconfig.h @@ -34,7 +34,7 @@ class ResourceCachedReloadConfig; class ResourceCachedSaveConfig; /** - Configuration widget for groupware kioslave resource. + Configuration widget for groupware tdeioslave resource. @see KCalResourceGroupware */ diff --git a/tderesources/groupwise/CMakeLists.txt b/tderesources/groupwise/CMakeLists.txt index 68c829a7..a5617229 100644 --- a/tderesources/groupwise/CMakeLists.txt +++ b/tderesources/groupwise/CMakeLists.txt @@ -10,7 +10,7 @@ ################################################# add_subdirectory( soap ) -add_subdirectory( kioslave ) +add_subdirectory( tdeioslave ) include_directories( ${CMAKE_CURRENT_BINARY_DIR} diff --git a/tderesources/groupwise/Makefile.am b/tderesources/groupwise/Makefile.am index 4b7eb408..486e8977 100644 --- a/tderesources/groupwise/Makefile.am +++ b/tderesources/groupwise/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = soap kioslave +SUBDIRS = soap tdeioslave INCLUDES = -I$(top_srcdir) $(all_includes) diff --git a/tderesources/groupwise/kabc_resourcegroupwise.cpp b/tderesources/groupwise/kabc_resourcegroupwise.cpp index b3930bfb..cf5c4e95 100644 --- a/tderesources/groupwise/kabc_resourcegroupwise.cpp +++ b/tderesources/groupwise/kabc_resourcegroupwise.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include diff --git a/tderesources/groupwise/kabc_resourcegroupwise.h b/tderesources/groupwise/kabc_resourcegroupwise.h index 658ddd76..0c7533ee 100644 --- a/tderesources/groupwise/kabc_resourcegroupwise.h +++ b/tderesources/groupwise/kabc_resourcegroupwise.h @@ -27,7 +27,7 @@ #include -#include +#include class TDEConfig; diff --git a/tderesources/groupwise/kcal_groupwiseprefsbase.kcfgc b/tderesources/groupwise/kcal_groupwiseprefsbase.kcfgc index 3130cde1..357cdc95 100644 --- a/tderesources/groupwise/kcal_groupwiseprefsbase.kcfgc +++ b/tderesources/groupwise/kcal_groupwiseprefsbase.kcfgc @@ -1,4 +1,4 @@ -# Code generation options for kconfig_compiler +# Code generation options for tdeconfig_compiler File=tderesources_kcal_groupwise.kcfg ClassName=GroupwisePrefsBase NameSpace=KCal diff --git a/tderesources/groupwise/kcal_resourcegroupwise.h b/tderesources/groupwise/kcal_resourcegroupwise.h index 088e624a..f4417079 100644 --- a/tderesources/groupwise/kcal_resourcegroupwise.h +++ b/tderesources/groupwise/kcal_resourcegroupwise.h @@ -28,8 +28,8 @@ #include #include -#include -#include +#include +#include #include class ngwt__Settings; diff --git a/tderesources/groupwise/kioslave/CMakeLists.txt b/tderesources/groupwise/kioslave/CMakeLists.txt deleted file mode 100644 index 23476fe0..00000000 --- a/tderesources/groupwise/kioslave/CMakeLists.txt +++ /dev/null @@ -1,39 +0,0 @@ -################################################# -# -# (C) 2010-2011 Serghei Amelian -# serghei (DOT) amelian (AT) gmail.com -# -# Improvements and feedback are welcome -# -# This file is released under GPL >= 2 -# -################################################# - -include_directories( - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/../soap - ${CMAKE_SOURCE_DIR} - ${CMAKE_SOURCE_DIR}/libtdepim - ${TDE_INCLUDE_DIR} - ${TQT_INCLUDE_DIRS} -) - -link_directories( - ${TQT_LIBRARY_DIRS} -) - - -##### other data ################################ - -install( FILES - groupwise.protocol groupwises.protocol - DESTINATION ${SERVICES_INSTALL_DIR} ) - - -##### kio_groupwise (module) #################### - -tde_add_kpart( kio_groupwise AUTOMOC - SOURCES groupwise.cpp - LINK gwsoap-shared - DESTINATION ${PLUGIN_INSTALL_DIR} -) diff --git a/tderesources/groupwise/kioslave/Makefile.am b/tderesources/groupwise/kioslave/Makefile.am deleted file mode 100644 index 2b2eaa07..00000000 --- a/tderesources/groupwise/kioslave/Makefile.am +++ /dev/null @@ -1,19 +0,0 @@ -INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tderesources/groupwise/soap \ - -I$(top_builddir)/libtdepim $(all_includes) - -noinst_HEADERS = groupwise.h - -METASOURCES = AUTO - -kdelnkdir = $(kde_servicesdir) -kdelnk_DATA = groupwise.protocol groupwises.protocol - -kde_module_LTLIBRARIES = kio_groupwise.la - -kio_groupwise_la_SOURCES = groupwise.cpp -kio_groupwise_la_LIBADD = $(top_builddir)/libkcal/libkcal.la \ - ../soap/libgwsoap.la $(top_builddir)/libtdepim/libtdepim.la $(LIB_KIO) -kio_groupwise_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) - -messages: rc.cpp - $(XGETTEXT) *.cpp -o $(podir)/kio_groupwise.pot diff --git a/tderesources/groupwise/kioslave/groupwise.cpp b/tderesources/groupwise/kioslave/groupwise.cpp deleted file mode 100644 index c3addd3b..00000000 --- a/tderesources/groupwise/kioslave/groupwise.cpp +++ /dev/null @@ -1,426 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2004 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - - -#include "groupwiseserver.h" - -#include - -#include - -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include "groupwise.h" - -namespace KABC { - -class ResourceMemory : public ResourceCached -{ - public: - ResourceMemory() : ResourceCached( 0 ) {} - - Ticket *requestSaveTicket() { return 0; } - bool load() { return true; } - bool save( Ticket * ) { return true; } - void releaseSaveTicket( Ticket * ) {} -}; - -} - -extern "C" { -KDE_EXPORT int kdemain( int argc, char **argv ); -} - -int kdemain( int argc, char **argv ) -{ - TDEInstance instance( "kio_groupwise" ); - - kdDebug(7000) << "Starting kio_groupwise(pid: " << getpid() << ")" << endl; - - if (argc != 4) { - fprintf( stderr, "Usage: kio_groupwise protocol domain-socket1 domain-socket2\n"); - exit( -1 ); - } - - Groupwise slave( argv[1], argv[2], argv[3] ); - slave.dispatchLoop(); - - return 0; -} - -Groupwise::Groupwise( const TQCString &protocol, const TQCString &pool, - const TQCString &app ) - : SlaveBase( protocol, pool, app ) -{ -} - -void Groupwise::get( const KURL &url ) -{ - kdDebug(7000) << "Groupwise::get()" << endl; - kdDebug(7000) << " URL: " << url.url() << endl; - #if 1 - kdDebug(7000) << " Path: " << url.path() << endl; - kdDebug(7000) << " Query: " << url.query() << endl; - kdDebug(7000) << " Protocol: " << url.protocol() << endl; - kdDebug(7000) << " Filename: " << url.filename() << endl; - #endif - - mimeType( "text/plain" ); - - TQString path = url.path(); - debugMessage( "Path: " + path ); - - if ( path.contains( "/freebusy" ) ) { - getFreeBusy( url ); - } else if ( path.contains( "/calendar" ) ) { - getCalendar( url ); - } else if ( path.contains( "/addressbook" ) ) { - if ( url.query().contains( "update=true" ) ) - updateAddressbook( url ); - else - getAddressbook( url ); - } else { - TQString error = i18n("Unknown path. Known paths are '/freebusy/', " - "'/calendar/' and '/addressbook/'.") + TQString(" path was %1" ).arg( url.url() ); - errorMessage( error ); - } - - kdDebug(7000) << "Groupwise::get() done" << endl; -} - -TQString Groupwise::soapUrl( const KURL &url ) -{ - // FIXME: Get SSL from parameter - bool useSsl = url.protocol() == "groupwises"; - - TQString u; - if ( useSsl ) u = "https"; - else u = "http"; - - u += "://" + url.host() + ":"; - if ( url.port() ) - u += TQString::number( url.port() ); - else { - u += "7191"; - } - - // check for a soap path in the URL - // assume that if a path to soap is included in the URL, - // it will be at the start of the path, eg. - // groupwise://host:port/soap2/freebusy - if ( ! ( url.path().startsWith("/freebusy/") || - url.path().startsWith("/calendar/") || - url.path().startsWith("/addressbook/" ) ) ) - { - TQString soapPath = TQString("/") + TQStringList::split('/', url.path())[0]; - u += soapPath; - } - else - u += "/soap"; - - return u; -} - -void Groupwise::getFreeBusy( const KURL &url ) -{ - TQString file = url.filename(); - if ( file.right( 4 ) != ".ifb" ) { - TQString error = i18n("Illegal filename. File has to have '.ifb' suffix."); - errorMessage( error ); - } else { - TQString email = file.left( file.length() - 4 ); - debugMessage( "Email: " + email ); - - // Sanitise local Nuernberg email addresses - kdDebug() << "Email before sanitizing: " << email << endl; - email = email.replace(TQRegExp("\\.EMEA5-1\\.EMEA5" ), "" ); - email = email.replace(TQRegExp("\\.Suse.INTERNET" ), "" ); - kdDebug() << "Email after sanitizing: " << email << endl; - - TQString u = soapUrl( url ); - - TQString user = url.user(); - TQString pass = url.pass(); - - debugMessage( "URL: " + u ); - debugMessage( "User: " + user ); - debugMessage( "Password: " + pass ); - - KCal::FreeBusy *fb = new KCal::FreeBusy; - - if ( user.isEmpty() || pass.isEmpty() ) { - errorMessage( i18n("Need username and password to read Free/Busy information.") ); - } else { - GroupwiseServer server( u, user, pass, 0 ); - - // FIXME: Read range from configuration or URL parameters. - TQDate start = TQDate::currentDate().addDays( -3 ); - TQDate end = TQDate::currentDate().addDays( 60 ); - - fb->setDtStart( start ); - fb->setDtEnd( end ); - - kdDebug() << "Login" << endl; - - if ( !server.login() ) { - errorMessage( i18n("Unable to login: ") + server.errorText() ); - } else { - kdDebug() << "Read free/busy" << endl; - if ( !server.readFreeBusy( email, start, end, fb ) ) { - errorMessage( i18n("Unable to read free/busy data: ") + server.errorText() ); - } - kdDebug() << "Read free/busy" << endl; - server.logout(); - } - } - -#if 0 - TQDateTime s = TQDateTime( TQDate( 2004, 9, 27 ), TQTime( 10, 0 ) ); - TQDateTime e = TQDateTime( TQDate( 2004, 9, 27 ), TQTime( 11, 0 ) ); - - fb->addPeriod( s, e ); -#endif - - // FIXME: This does not take into account the time zone! - KCal::ICalFormat format; - - TQString ical = format.createScheduleMessage( fb, KCal::Scheduler::Publish ); - - data( ical.utf8() ); - - finished(); - } -} - -void Groupwise::getCalendar( const KURL &url ) -{ - TQString u = soapUrl( url ); - - TQString user = url.user(); - TQString pass = url.pass(); - - debugMessage( "URL: " + u ); - debugMessage( "User: " + user ); - debugMessage( "Password: " + pass ); - - GroupwiseServer server( u, user, pass, 0 ); - - KCal::CalendarLocal calendar( TQString::fromLatin1("UTC")); - - kdDebug() << "Login" << endl; - if ( !server.login() ) { - errorMessage( i18n("Unable to login: ") + server.errorText() ); - } else { - kdDebug() << "Read calendar" << endl; - if ( !server.readCalendarSynchronous( &calendar ) ) { - errorMessage( i18n("Unable to read calendar data: ") + server.errorText() ); - } - kdDebug() << "Logout" << endl; - server.logout(); - } - - KCal::ICalFormat format; - - TQString ical = format.toString( &calendar ); - - data( ical.utf8() ); - - finished(); -} - -void Groupwise::getAddressbook( const KURL &url ) -{ - TQString u = soapUrl( url ); - - TQString user = url.user(); - TQString pass = url.pass(); - - debugMessage( "URL: " + u ); - debugMessage( "User: " + user ); - debugMessage( "Password: " + pass ); - - TQString query = url.query(); - if ( query.isEmpty() || query == "?" ) { - errorMessage( i18n("No addressbook IDs given.") ); - } else { - TQStringList ids; - - query = query.mid( 1 ); - TQStringList queryItems = TQStringList::split( "&", query ); - TQStringList::ConstIterator it; - for( it = queryItems.begin(); it != queryItems.end(); ++it ) { - TQStringList item = TQStringList::split( "=", (*it) ); - if ( item.count() == 2 && item[ 0 ] == "addressbookid" ) { - ids.append( item[ 1 ] ); - } - } - - debugMessage( "IDs: " + ids.join( "," ) ); - - GroupwiseServer server( u, user, pass, 0 ); - - connect( &server, TQT_SIGNAL( readAddressBookTotalSize( int ) ), - TQT_SLOT( slotReadAddressBookTotalSize( int ) ) ); - connect( &server, TQT_SIGNAL( readAddressBookProcessedSize( int ) ), - TQT_SLOT( slotReadAddressBookProcessedSize( int ) ) ); - connect( &server, TQT_SIGNAL( errorMessage( const TQString &, bool ) ), - TQT_SLOT( slotServerErrorMessage( const TQString &, bool ) ) ); - connect( &server, TQT_SIGNAL( gotAddressees( const KABC::Addressee::List ) ), - TQT_SLOT( slotReadReceiveAddressees( const KABC::Addressee::List ) ) ); - - kdDebug() << "Login" << endl; - if ( !server.login() ) { - errorMessage( i18n("Unable to login: ") + server.errorText() ); - } else { - kdDebug() << "Read Addressbook" << endl; - if ( !server.readAddressBooksSynchronous( ids ) ) { - errorMessage( i18n("Unable to read addressbook data: ") + server.errorText() ); - } - kdDebug() << "Logout" << endl; - server.logout(); - finished(); - } - } -} - -void Groupwise::slotReadReceiveAddressees( const KABC::Addressee::List addressees ) -{ - kdDebug() << "Groupwise::slotReadReceiveAddressees() - passing " << addressees.count() << " contacts back to application" << endl; - KABC::VCardConverter conv; - - TQString vcard = conv.createVCards( addressees ); - - data( vcard.utf8() ); -} - -void Groupwise::updateAddressbook( const KURL &url ) -{ - kdDebug() << "Groupwise::updateAddressbook() " << url << endl; - TQString u = soapUrl( url ); - - TQString user = url.user(); - TQString pass = url.pass(); - - debugMessage( "update AB URL: " + u ); - debugMessage( "update AB User: " + user ); - debugMessage( "update AB Password: " + pass ); - - TQString query = url.query(); - - unsigned long lastSequenceNumber = 0; - unsigned long lastPORebuildTime = 0; - - if ( query.isEmpty() || query == "?" ) { - errorMessage( i18n("No addressbook IDs given.") ); - return; - } else { - TQStringList ids; - - query = query.mid( 1 ); - TQStringList queryItems = TQStringList::split( "&", query ); - TQStringList::ConstIterator it; - for( it = queryItems.begin(); it != queryItems.end(); ++it ) { - TQStringList item = TQStringList::split( "=", (*it) ); - if ( item.count() == 2 && item[ 0 ] == "addressbookid" ) { - ids.append( item[ 1 ] ); - } - if ( item.count() == 2 && item[ 0 ] == "lastSeqNo" ) - lastSequenceNumber = item[ 1 ].toULong(); - if ( item.count() == 2 && item[ 0 ] == "PORebuildTime" ) - lastPORebuildTime = item[ 1 ].toULong(); - } - - debugMessage( "update IDs: " + ids.join( "," ) ); - - GroupwiseServer server( u, user, pass, 0 ); - connect( &server, TQT_SIGNAL( errorMessage( const TQString &, bool ) ), - TQT_SLOT( slotServerErrorMessage( const TQString &, bool ) ) ); - connect( &server, TQT_SIGNAL( gotAddressees( const KABC::Addressee::List ) ), - TQT_SLOT( slotReadReceiveAddressees( const KABC::Addressee::List ) ) ); - - kdDebug() << " Login" << endl; - if ( !server.login() ) { - errorMessage( i18n("Unable to login: ") + server.errorText() ); - } else { - kdDebug() << " Updating Addressbook" << endl; - if ( !server.updateAddressBooks( ids, lastSequenceNumber + 1, lastPORebuildTime ) ) - { - error( TDEIO::ERR_NO_CONTENT, server.errorText() ); - //errorMessage( i18n("Unable to update addressbook data: ") + server.errorText() ); - } - kdDebug() << " Logout" << endl; - server.logout(); - finished(); - } - } -} - -void Groupwise::errorMessage( const TQString &msg ) -{ - error( TDEIO::ERR_SLAVE_DEFINED, msg ); -} - -void Groupwise::debugMessage( const TQString &msg ) -{ -#if 0 - data( ( msg + "\n" ).utf8() ); -#else - Q_UNUSED( msg ); -#endif -} - -void Groupwise::slotReadAddressBookTotalSize( int size ) -{ - totalSize( size ); -} - -void Groupwise::slotReadAddressBookProcessedSize( int size ) -{ - kdDebug() << "Groupwise::processedSize(): " << size << endl; - processedSize( size ); -} - -void Groupwise::slotServerErrorMessage( const TQString & serverErrorMessage, bool fatal ) -{ - kdDebug() << "Groupwise::slotJobErrorMessage()" << serverErrorMessage << ( fatal ? ", FATAL!" : ", proceeding" ) << endl; - errorMessage( i18n( "An error occurred while communicating with the GroupWise server:\n%1" ).arg( serverErrorMessage ) ); -} - -#include "groupwise.moc" - diff --git a/tderesources/groupwise/kioslave/groupwise.h b/tderesources/groupwise/kioslave/groupwise.h deleted file mode 100644 index c5f109d3..00000000 --- a/tderesources/groupwise/kioslave/groupwise.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2004 Cornelius Schumacher - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ -#ifndef GROUPWISE_H -#define GROUPWISE_H - -#include - -#include - -class Groupwise : public TQObject, public TDEIO::SlaveBase -{ - Q_OBJECT - - public: - void get( const KURL &url ); - Groupwise( const TQCString &protocol, const TQCString &pool, - const TQCString &app ); - - protected: - void debugMessage( const TQString & ); - void errorMessage( const TQString & ); - - void getFreeBusy( const KURL &url ); - void getCalendar( const KURL &url ); - void getAddressbook( const KURL &url ); - void updateAddressbook( const KURL &url ); - - TQString soapUrl( const KURL &url ); - - protected slots: - void slotReadAddressBookTotalSize( int ); - void slotReadAddressBookProcessedSize( int ); - void slotServerErrorMessage( const TQString &, bool ); - void slotReadReceiveAddressees( const KABC::Addressee::List ); -}; - -#endif diff --git a/tderesources/groupwise/kioslave/groupwise.protocol b/tderesources/groupwise/kioslave/groupwise.protocol deleted file mode 100644 index ec22851a..00000000 --- a/tderesources/groupwise/kioslave/groupwise.protocol +++ /dev/null @@ -1,7 +0,0 @@ -[Protocol] -DocPath=kioslave/groupwise.html -exec=kio_groupwise -input=none -output=filesystem -protocol=groupwise -reading=true diff --git a/tderesources/groupwise/kioslave/groupwises.protocol b/tderesources/groupwise/kioslave/groupwises.protocol deleted file mode 100644 index b2b2c7b9..00000000 --- a/tderesources/groupwise/kioslave/groupwises.protocol +++ /dev/null @@ -1,7 +0,0 @@ -[Protocol] -DocPath=kioslave/groupwise.html -exec=kio_groupwise -input=none -output=filesystem -protocol=groupwises -reading=true diff --git a/tderesources/groupwise/soap/groupwiseserver.cpp b/tderesources/groupwise/soap/groupwiseserver.cpp index 9112fdea..cedcde6a 100644 --- a/tderesources/groupwise/soap/groupwiseserver.cpp +++ b/tderesources/groupwise/soap/groupwiseserver.cpp @@ -30,9 +30,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/tderesources/groupwise/soap/groupwiseserver.h b/tderesources/groupwise/soap/groupwiseserver.h index 95218be0..e1c25c0f 100644 --- a/tderesources/groupwise/soap/groupwiseserver.h +++ b/tderesources/groupwise/soap/groupwiseserver.h @@ -21,8 +21,8 @@ #ifndef GROUPWISESERVER_H #define GROUPWISESERVER_H -#include -#include +#include +#include #include #include #include diff --git a/tderesources/groupwise/soap/ksslsocket.cpp b/tderesources/groupwise/soap/ksslsocket.cpp index 90ccf83d..809c29b8 100644 --- a/tderesources/groupwise/soap/ksslsocket.cpp +++ b/tderesources/groupwise/soap/ksslsocket.cpp @@ -181,12 +181,12 @@ int KSSLSocket::messageBox( TDEIO::SlaveBase::MessageBoxType type, const TQStrin d->dcc = new DCOPClient(); d->dcc->attach(); } - if (!d->dcc->isApplicationRegistered("kio_uiserver")) + if (!d->dcc->isApplicationRegistered("tdeio_uiserver")) { - TDEApplication::startServiceByDesktopPath("kio_uiserver.desktop",TQStringList()); + TDEApplication::startServiceByDesktopPath("tdeio_uiserver.desktop",TQStringList()); } - d->dcc->call("kio_uiserver", "UIServer", + d->dcc->call("tdeio_uiserver", "UIServer", "messageBox(int,int,TQString,TQString,TQString,TQString)", data, returnType, result); if( returnType == "int" ) diff --git a/tderesources/groupwise/soap/ksslsocket.h b/tderesources/groupwise/soap/ksslsocket.h index c19b440a..42545948 100644 --- a/tderesources/groupwise/soap/ksslsocket.h +++ b/tderesources/groupwise/soap/ksslsocket.h @@ -21,7 +21,7 @@ #include #include -#include +#include class KSSLSocketPrivate; diff --git a/tderesources/groupwise/soap/soapdebug.cpp b/tderesources/groupwise/soap/soapdebug.cpp index 415021a7..e68da9ee 100644 --- a/tderesources/groupwise/soap/soapdebug.cpp +++ b/tderesources/groupwise/soap/soapdebug.cpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include #include diff --git a/tderesources/groupwise/tdeioslave/CMakeLists.txt b/tderesources/groupwise/tdeioslave/CMakeLists.txt new file mode 100644 index 00000000..23476fe0 --- /dev/null +++ b/tderesources/groupwise/tdeioslave/CMakeLists.txt @@ -0,0 +1,39 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/../soap + ${CMAKE_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/libtdepim + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### other data ################################ + +install( FILES + groupwise.protocol groupwises.protocol + DESTINATION ${SERVICES_INSTALL_DIR} ) + + +##### kio_groupwise (module) #################### + +tde_add_kpart( kio_groupwise AUTOMOC + SOURCES groupwise.cpp + LINK gwsoap-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tderesources/groupwise/tdeioslave/Makefile.am b/tderesources/groupwise/tdeioslave/Makefile.am new file mode 100644 index 00000000..e6da5283 --- /dev/null +++ b/tderesources/groupwise/tdeioslave/Makefile.am @@ -0,0 +1,19 @@ +INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tderesources/groupwise/soap \ + -I$(top_builddir)/libtdepim $(all_includes) + +noinst_HEADERS = groupwise.h + +METASOURCES = AUTO + +kdelnkdir = $(kde_servicesdir) +kdelnk_DATA = groupwise.protocol groupwises.protocol + +kde_module_LTLIBRARIES = kio_groupwise.la + +kio_groupwise_la_SOURCES = groupwise.cpp +kio_groupwise_la_LIBADD = $(top_builddir)/libkcal/libkcal.la \ + ../soap/libgwsoap.la $(top_builddir)/libtdepim/libtdepim.la $(LIB_KIO) +kio_groupwise_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) + +messages: rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/tdeio_groupwise.pot diff --git a/tderesources/groupwise/tdeioslave/groupwise.cpp b/tderesources/groupwise/tdeioslave/groupwise.cpp new file mode 100644 index 00000000..bfa02156 --- /dev/null +++ b/tderesources/groupwise/tdeioslave/groupwise.cpp @@ -0,0 +1,426 @@ +/* + This file is part of KDE. + + Copyright (c) 2004 Cornelius Schumacher + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + + +#include "groupwiseserver.h" + +#include + +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include "groupwise.h" + +namespace KABC { + +class ResourceMemory : public ResourceCached +{ + public: + ResourceMemory() : ResourceCached( 0 ) {} + + Ticket *requestSaveTicket() { return 0; } + bool load() { return true; } + bool save( Ticket * ) { return true; } + void releaseSaveTicket( Ticket * ) {} +}; + +} + +extern "C" { +KDE_EXPORT int kdemain( int argc, char **argv ); +} + +int kdemain( int argc, char **argv ) +{ + TDEInstance instance( "kio_groupwise" ); + + kdDebug(7000) << "Starting kio_groupwise(pid: " << getpid() << ")" << endl; + + if (argc != 4) { + fprintf( stderr, "Usage: kio_groupwise protocol domain-socket1 domain-socket2\n"); + exit( -1 ); + } + + Groupwise slave( argv[1], argv[2], argv[3] ); + slave.dispatchLoop(); + + return 0; +} + +Groupwise::Groupwise( const TQCString &protocol, const TQCString &pool, + const TQCString &app ) + : SlaveBase( protocol, pool, app ) +{ +} + +void Groupwise::get( const KURL &url ) +{ + kdDebug(7000) << "Groupwise::get()" << endl; + kdDebug(7000) << " URL: " << url.url() << endl; + #if 1 + kdDebug(7000) << " Path: " << url.path() << endl; + kdDebug(7000) << " Query: " << url.query() << endl; + kdDebug(7000) << " Protocol: " << url.protocol() << endl; + kdDebug(7000) << " Filename: " << url.filename() << endl; + #endif + + mimeType( "text/plain" ); + + TQString path = url.path(); + debugMessage( "Path: " + path ); + + if ( path.contains( "/freebusy" ) ) { + getFreeBusy( url ); + } else if ( path.contains( "/calendar" ) ) { + getCalendar( url ); + } else if ( path.contains( "/addressbook" ) ) { + if ( url.query().contains( "update=true" ) ) + updateAddressbook( url ); + else + getAddressbook( url ); + } else { + TQString error = i18n("Unknown path. Known paths are '/freebusy/', " + "'/calendar/' and '/addressbook/'.") + TQString(" path was %1" ).arg( url.url() ); + errorMessage( error ); + } + + kdDebug(7000) << "Groupwise::get() done" << endl; +} + +TQString Groupwise::soapUrl( const KURL &url ) +{ + // FIXME: Get SSL from parameter + bool useSsl = url.protocol() == "groupwises"; + + TQString u; + if ( useSsl ) u = "https"; + else u = "http"; + + u += "://" + url.host() + ":"; + if ( url.port() ) + u += TQString::number( url.port() ); + else { + u += "7191"; + } + + // check for a soap path in the URL + // assume that if a path to soap is included in the URL, + // it will be at the start of the path, eg. + // groupwise://host:port/soap2/freebusy + if ( ! ( url.path().startsWith("/freebusy/") || + url.path().startsWith("/calendar/") || + url.path().startsWith("/addressbook/" ) ) ) + { + TQString soapPath = TQString("/") + TQStringList::split('/', url.path())[0]; + u += soapPath; + } + else + u += "/soap"; + + return u; +} + +void Groupwise::getFreeBusy( const KURL &url ) +{ + TQString file = url.filename(); + if ( file.right( 4 ) != ".ifb" ) { + TQString error = i18n("Illegal filename. File has to have '.ifb' suffix."); + errorMessage( error ); + } else { + TQString email = file.left( file.length() - 4 ); + debugMessage( "Email: " + email ); + + // Sanitise local Nuernberg email addresses + kdDebug() << "Email before sanitizing: " << email << endl; + email = email.replace(TQRegExp("\\.EMEA5-1\\.EMEA5" ), "" ); + email = email.replace(TQRegExp("\\.Suse.INTERNET" ), "" ); + kdDebug() << "Email after sanitizing: " << email << endl; + + TQString u = soapUrl( url ); + + TQString user = url.user(); + TQString pass = url.pass(); + + debugMessage( "URL: " + u ); + debugMessage( "User: " + user ); + debugMessage( "Password: " + pass ); + + KCal::FreeBusy *fb = new KCal::FreeBusy; + + if ( user.isEmpty() || pass.isEmpty() ) { + errorMessage( i18n("Need username and password to read Free/Busy information.") ); + } else { + GroupwiseServer server( u, user, pass, 0 ); + + // FIXME: Read range from configuration or URL parameters. + TQDate start = TQDate::currentDate().addDays( -3 ); + TQDate end = TQDate::currentDate().addDays( 60 ); + + fb->setDtStart( start ); + fb->setDtEnd( end ); + + kdDebug() << "Login" << endl; + + if ( !server.login() ) { + errorMessage( i18n("Unable to login: ") + server.errorText() ); + } else { + kdDebug() << "Read free/busy" << endl; + if ( !server.readFreeBusy( email, start, end, fb ) ) { + errorMessage( i18n("Unable to read free/busy data: ") + server.errorText() ); + } + kdDebug() << "Read free/busy" << endl; + server.logout(); + } + } + +#if 0 + TQDateTime s = TQDateTime( TQDate( 2004, 9, 27 ), TQTime( 10, 0 ) ); + TQDateTime e = TQDateTime( TQDate( 2004, 9, 27 ), TQTime( 11, 0 ) ); + + fb->addPeriod( s, e ); +#endif + + // FIXME: This does not take into account the time zone! + KCal::ICalFormat format; + + TQString ical = format.createScheduleMessage( fb, KCal::Scheduler::Publish ); + + data( ical.utf8() ); + + finished(); + } +} + +void Groupwise::getCalendar( const KURL &url ) +{ + TQString u = soapUrl( url ); + + TQString user = url.user(); + TQString pass = url.pass(); + + debugMessage( "URL: " + u ); + debugMessage( "User: " + user ); + debugMessage( "Password: " + pass ); + + GroupwiseServer server( u, user, pass, 0 ); + + KCal::CalendarLocal calendar( TQString::fromLatin1("UTC")); + + kdDebug() << "Login" << endl; + if ( !server.login() ) { + errorMessage( i18n("Unable to login: ") + server.errorText() ); + } else { + kdDebug() << "Read calendar" << endl; + if ( !server.readCalendarSynchronous( &calendar ) ) { + errorMessage( i18n("Unable to read calendar data: ") + server.errorText() ); + } + kdDebug() << "Logout" << endl; + server.logout(); + } + + KCal::ICalFormat format; + + TQString ical = format.toString( &calendar ); + + data( ical.utf8() ); + + finished(); +} + +void Groupwise::getAddressbook( const KURL &url ) +{ + TQString u = soapUrl( url ); + + TQString user = url.user(); + TQString pass = url.pass(); + + debugMessage( "URL: " + u ); + debugMessage( "User: " + user ); + debugMessage( "Password: " + pass ); + + TQString query = url.query(); + if ( query.isEmpty() || query == "?" ) { + errorMessage( i18n("No addressbook IDs given.") ); + } else { + TQStringList ids; + + query = query.mid( 1 ); + TQStringList queryItems = TQStringList::split( "&", query ); + TQStringList::ConstIterator it; + for( it = queryItems.begin(); it != queryItems.end(); ++it ) { + TQStringList item = TQStringList::split( "=", (*it) ); + if ( item.count() == 2 && item[ 0 ] == "addressbookid" ) { + ids.append( item[ 1 ] ); + } + } + + debugMessage( "IDs: " + ids.join( "," ) ); + + GroupwiseServer server( u, user, pass, 0 ); + + connect( &server, TQT_SIGNAL( readAddressBookTotalSize( int ) ), + TQT_SLOT( slotReadAddressBookTotalSize( int ) ) ); + connect( &server, TQT_SIGNAL( readAddressBookProcessedSize( int ) ), + TQT_SLOT( slotReadAddressBookProcessedSize( int ) ) ); + connect( &server, TQT_SIGNAL( errorMessage( const TQString &, bool ) ), + TQT_SLOT( slotServerErrorMessage( const TQString &, bool ) ) ); + connect( &server, TQT_SIGNAL( gotAddressees( const KABC::Addressee::List ) ), + TQT_SLOT( slotReadReceiveAddressees( const KABC::Addressee::List ) ) ); + + kdDebug() << "Login" << endl; + if ( !server.login() ) { + errorMessage( i18n("Unable to login: ") + server.errorText() ); + } else { + kdDebug() << "Read Addressbook" << endl; + if ( !server.readAddressBooksSynchronous( ids ) ) { + errorMessage( i18n("Unable to read addressbook data: ") + server.errorText() ); + } + kdDebug() << "Logout" << endl; + server.logout(); + finished(); + } + } +} + +void Groupwise::slotReadReceiveAddressees( const KABC::Addressee::List addressees ) +{ + kdDebug() << "Groupwise::slotReadReceiveAddressees() - passing " << addressees.count() << " contacts back to application" << endl; + KABC::VCardConverter conv; + + TQString vcard = conv.createVCards( addressees ); + + data( vcard.utf8() ); +} + +void Groupwise::updateAddressbook( const KURL &url ) +{ + kdDebug() << "Groupwise::updateAddressbook() " << url << endl; + TQString u = soapUrl( url ); + + TQString user = url.user(); + TQString pass = url.pass(); + + debugMessage( "update AB URL: " + u ); + debugMessage( "update AB User: " + user ); + debugMessage( "update AB Password: " + pass ); + + TQString query = url.query(); + + unsigned long lastSequenceNumber = 0; + unsigned long lastPORebuildTime = 0; + + if ( query.isEmpty() || query == "?" ) { + errorMessage( i18n("No addressbook IDs given.") ); + return; + } else { + TQStringList ids; + + query = query.mid( 1 ); + TQStringList queryItems = TQStringList::split( "&", query ); + TQStringList::ConstIterator it; + for( it = queryItems.begin(); it != queryItems.end(); ++it ) { + TQStringList item = TQStringList::split( "=", (*it) ); + if ( item.count() == 2 && item[ 0 ] == "addressbookid" ) { + ids.append( item[ 1 ] ); + } + if ( item.count() == 2 && item[ 0 ] == "lastSeqNo" ) + lastSequenceNumber = item[ 1 ].toULong(); + if ( item.count() == 2 && item[ 0 ] == "PORebuildTime" ) + lastPORebuildTime = item[ 1 ].toULong(); + } + + debugMessage( "update IDs: " + ids.join( "," ) ); + + GroupwiseServer server( u, user, pass, 0 ); + connect( &server, TQT_SIGNAL( errorMessage( const TQString &, bool ) ), + TQT_SLOT( slotServerErrorMessage( const TQString &, bool ) ) ); + connect( &server, TQT_SIGNAL( gotAddressees( const KABC::Addressee::List ) ), + TQT_SLOT( slotReadReceiveAddressees( const KABC::Addressee::List ) ) ); + + kdDebug() << " Login" << endl; + if ( !server.login() ) { + errorMessage( i18n("Unable to login: ") + server.errorText() ); + } else { + kdDebug() << " Updating Addressbook" << endl; + if ( !server.updateAddressBooks( ids, lastSequenceNumber + 1, lastPORebuildTime ) ) + { + error( TDEIO::ERR_NO_CONTENT, server.errorText() ); + //errorMessage( i18n("Unable to update addressbook data: ") + server.errorText() ); + } + kdDebug() << " Logout" << endl; + server.logout(); + finished(); + } + } +} + +void Groupwise::errorMessage( const TQString &msg ) +{ + error( TDEIO::ERR_SLAVE_DEFINED, msg ); +} + +void Groupwise::debugMessage( const TQString &msg ) +{ +#if 0 + data( ( msg + "\n" ).utf8() ); +#else + Q_UNUSED( msg ); +#endif +} + +void Groupwise::slotReadAddressBookTotalSize( int size ) +{ + totalSize( size ); +} + +void Groupwise::slotReadAddressBookProcessedSize( int size ) +{ + kdDebug() << "Groupwise::processedSize(): " << size << endl; + processedSize( size ); +} + +void Groupwise::slotServerErrorMessage( const TQString & serverErrorMessage, bool fatal ) +{ + kdDebug() << "Groupwise::slotJobErrorMessage()" << serverErrorMessage << ( fatal ? ", FATAL!" : ", proceeding" ) << endl; + errorMessage( i18n( "An error occurred while communicating with the GroupWise server:\n%1" ).arg( serverErrorMessage ) ); +} + +#include "groupwise.moc" + diff --git a/tderesources/groupwise/tdeioslave/groupwise.h b/tderesources/groupwise/tdeioslave/groupwise.h new file mode 100644 index 00000000..e95ed260 --- /dev/null +++ b/tderesources/groupwise/tdeioslave/groupwise.h @@ -0,0 +1,54 @@ +/* + This file is part of KDE. + + Copyright (c) 2004 Cornelius Schumacher + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ +#ifndef GROUPWISE_H +#define GROUPWISE_H + +#include + +#include + +class Groupwise : public TQObject, public TDEIO::SlaveBase +{ + Q_OBJECT + + public: + void get( const KURL &url ); + Groupwise( const TQCString &protocol, const TQCString &pool, + const TQCString &app ); + + protected: + void debugMessage( const TQString & ); + void errorMessage( const TQString & ); + + void getFreeBusy( const KURL &url ); + void getCalendar( const KURL &url ); + void getAddressbook( const KURL &url ); + void updateAddressbook( const KURL &url ); + + TQString soapUrl( const KURL &url ); + + protected slots: + void slotReadAddressBookTotalSize( int ); + void slotReadAddressBookProcessedSize( int ); + void slotServerErrorMessage( const TQString &, bool ); + void slotReadReceiveAddressees( const KABC::Addressee::List ); +}; + +#endif diff --git a/tderesources/groupwise/tdeioslave/groupwise.protocol b/tderesources/groupwise/tdeioslave/groupwise.protocol new file mode 100644 index 00000000..a7c26b6e --- /dev/null +++ b/tderesources/groupwise/tdeioslave/groupwise.protocol @@ -0,0 +1,7 @@ +[Protocol] +DocPath=tdeioslave/groupwise.html +exec=kio_groupwise +input=none +output=filesystem +protocol=groupwise +reading=true diff --git a/tderesources/groupwise/tdeioslave/groupwises.protocol b/tderesources/groupwise/tdeioslave/groupwises.protocol new file mode 100644 index 00000000..2666f1fd --- /dev/null +++ b/tderesources/groupwise/tdeioslave/groupwises.protocol @@ -0,0 +1,7 @@ +[Protocol] +DocPath=tdeioslave/groupwise.html +exec=kio_groupwise +input=none +output=filesystem +protocol=groupwises +reading=true diff --git a/tderesources/kolab/CMakeLists.txt b/tderesources/kolab/CMakeLists.txt index 01acd397..d8d19443 100644 --- a/tderesources/kolab/CMakeLists.txt +++ b/tderesources/kolab/CMakeLists.txt @@ -14,5 +14,5 @@ add_subdirectory( kabc ) add_subdirectory( knotes ) add_subdirectory( kcal ) -install( FILES kolab-resource.upd DESTINATION ${DATA_INSTALL_DIR}/kconf_update ) -install( PROGRAMS upgrade-resourcetype.pl DESTINATION ${DATA_INSTALL_DIR}/kconf_update ) +install( FILES kolab-resource.upd DESTINATION ${DATA_INSTALL_DIR}/tdeconf_update ) +install( PROGRAMS upgrade-resourcetype.pl DESTINATION ${DATA_INSTALL_DIR}/tdeconf_update ) diff --git a/tderesources/kolab/Makefile.am b/tderesources/kolab/Makefile.am index 0f144e05..3b883843 100644 --- a/tderesources/kolab/Makefile.am +++ b/tderesources/kolab/Makefile.am @@ -1,6 +1,6 @@ SUBDIRS = shared kabc knotes kcal -updatedir = $(kde_datadir)/kconf_update +updatedir = $(kde_datadir)/tdeconf_update update_DATA = kolab-resource.upd update_SCRIPTS = upgrade-resourcetype.pl diff --git a/tderesources/kolab/kabc/contact.cpp b/tderesources/kolab/kabc/contact.cpp index ff8f869b..dac619fe 100644 --- a/tderesources/kolab/kabc/contact.cpp +++ b/tderesources/kolab/kabc/contact.cpp @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/tderesources/kolab/kabc/resourcekolab.cpp b/tderesources/kolab/kabc/resourcekolab.cpp index ce7c18c4..51c3a4b4 100644 --- a/tderesources/kolab/kabc/resourcekolab.cpp +++ b/tderesources/kolab/kabc/resourcekolab.cpp @@ -38,8 +38,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include @@ -197,8 +197,8 @@ bool KABC::ResourceKolab::loadSubResource( const TQString& subResource ) // If it's too big the progressbar is jumpy. const int nbMessages = 200; - (void)Observer::self(); // ensure kio_uiserver is running - UIServer_stub uiserver( "kio_uiserver", "UIServer" ); + (void)Observer::self(); // ensure tdeio_uiserver is running + UIServer_stub uiserver( "tdeio_uiserver", "UIServer" ); int progressId = 0; if ( count > 200 ) { progressId = uiserver.newJob( kapp->dcopClient()->appId(), true ); diff --git a/tderesources/kolab/kcal/incidence.cpp b/tderesources/kolab/kcal/incidence.cpp index ddc31491..b5603b19 100644 --- a/tderesources/kolab/kcal/incidence.cpp +++ b/tderesources/kolab/kcal/incidence.cpp @@ -44,7 +44,7 @@ #include #include #include -#include +#include using namespace Kolab; diff --git a/tderesources/kolab/kcal/resourcekolab.cpp b/tderesources/kolab/kcal/resourcekolab.cpp index 44c13fd2..50f8b5b8 100644 --- a/tderesources/kolab/kcal/resourcekolab.cpp +++ b/tderesources/kolab/kcal/resourcekolab.cpp @@ -37,8 +37,8 @@ #include "task.h" #include "journal.h" -#include -#include +#include +#include #include #include #include @@ -172,8 +172,8 @@ bool ResourceKolab::loadSubResource( const TQString& subResource, : i18n( "Loading events..." ); const bool useProgress = tqApp && tqApp->type() != TQApplication::Tty && count > mProgressDialogIncidenceLimit; if ( useProgress ) - (void)::Observer::self(); // ensure kio_uiserver is running - UIServer_stub uiserver( "kio_uiserver", "UIServer" ); + (void)::Observer::self(); // ensure tdeio_uiserver is running + UIServer_stub uiserver( "tdeio_uiserver", "UIServer" ); int progressId = 0; if ( useProgress ) { progressId = uiserver.newJob( kapp->dcopClient()->appId(), true ); diff --git a/tderesources/lib/addressbookadaptor.cpp b/tderesources/lib/addressbookadaptor.cpp index 8cc28f67..230ac350 100644 --- a/tderesources/lib/addressbookadaptor.cpp +++ b/tderesources/lib/addressbookadaptor.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include using namespace KABC; diff --git a/tderesources/lib/calendaradaptor.cpp b/tderesources/lib/calendaradaptor.cpp index f2e255f0..ffbccefc 100644 --- a/tderesources/lib/calendaradaptor.cpp +++ b/tderesources/lib/calendaradaptor.cpp @@ -28,7 +28,7 @@ #include #include -#include +#include #include diff --git a/tderesources/lib/davaddressbookadaptor.cpp b/tderesources/lib/davaddressbookadaptor.cpp index 5b4a0a52..bf4a0347 100644 --- a/tderesources/lib/davaddressbookadaptor.cpp +++ b/tderesources/lib/davaddressbookadaptor.cpp @@ -30,8 +30,8 @@ // #include // #include -#include -// #include +#include +// #include #include using namespace KABC; diff --git a/tderesources/lib/davcalendaradaptor.cpp b/tderesources/lib/davcalendaradaptor.cpp index 5d6be2da..5263c2a1 100644 --- a/tderesources/lib/davcalendaradaptor.cpp +++ b/tderesources/lib/davcalendaradaptor.cpp @@ -22,7 +22,7 @@ #include "davcalendaradaptor.h" #include -#include +#include // #include // #include diff --git a/tderesources/lib/folderlister.cpp b/tderesources/lib/folderlister.cpp index 6cb341ac..c12d3ae6 100644 --- a/tderesources/lib/folderlister.cpp +++ b/tderesources/lib/folderlister.cpp @@ -25,10 +25,10 @@ #include "groupwaredataadaptor.h" #include "tderesources_groupwareprefs.h" -#include +#include #include -#include +#include #include using namespace KPIM; diff --git a/tderesources/lib/groupwaredataadaptor.cpp b/tderesources/lib/groupwaredataadaptor.cpp index 85dacdaa..4a89bd02 100644 --- a/tderesources/lib/groupwaredataadaptor.cpp +++ b/tderesources/lib/groupwaredataadaptor.cpp @@ -23,7 +23,7 @@ #include "groupwaredataadaptor.h" #include -#include +#include #include using namespace KPIM; diff --git a/tderesources/lib/groupwaredownloadjob.cpp b/tderesources/lib/groupwaredownloadjob.cpp index 9104da84..63c7e988 100644 --- a/tderesources/lib/groupwaredownloadjob.cpp +++ b/tderesources/lib/groupwaredownloadjob.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include diff --git a/tderesources/lib/groupwareresourcejob.h b/tderesources/lib/groupwareresourcejob.h index f2818f2c..d32caaae 100644 --- a/tderesources/lib/groupwareresourcejob.h +++ b/tderesources/lib/groupwareresourcejob.h @@ -32,7 +32,7 @@ namespace KPIM { class GroupwareDataAdaptor; /** - This class provides a resource for accessing a Groupware kioslave-based + This class provides a resource for accessing a Groupware tdeioslave-based calendar. */ class GroupwareJob : public TQObject diff --git a/tderesources/lib/groupwareuploadjob.cpp b/tderesources/lib/groupwareuploadjob.cpp index cf46571f..e896c0da 100644 --- a/tderesources/lib/groupwareuploadjob.cpp +++ b/tderesources/lib/groupwareuploadjob.cpp @@ -31,7 +31,7 @@ #include #include -#include +#include #include #include diff --git a/tderesources/lib/groupwareuploadjob.h b/tderesources/lib/groupwareuploadjob.h index b3a0ff75..13ba3ed5 100644 --- a/tderesources/lib/groupwareuploadjob.h +++ b/tderesources/lib/groupwareuploadjob.h @@ -41,7 +41,7 @@ class GroupwareDataAdaptor; class ProgressItem; /** - This class provides a resource for accessing a Groupware kioslave-based + This class provides a resource for accessing a Groupware tdeioslave-based calendar. */ class GroupwareUploadJob : public GroupwareJob diff --git a/tderesources/lib/kcal_cachesettingsdlg.h b/tderesources/lib/kcal_cachesettingsdlg.h index 1a6b369a..51263e26 100644 --- a/tderesources/lib/kcal_cachesettingsdlg.h +++ b/tderesources/lib/kcal_cachesettingsdlg.h @@ -36,7 +36,7 @@ class ResourceCachedReloadConfig; class ResourceCachedSaveConfig; /** - Configuration widget for groupware kioslave resource. + Configuration widget for groupware tdeioslave resource. @see KCalOpenGroupware */ class KDE_EXPORT CacheSettingsDialog : public KDialogBase diff --git a/tderesources/lib/kcal_resourcegroupwarebase.cpp b/tderesources/lib/kcal_resourcegroupwarebase.cpp index bd459331..56ffae7d 100644 --- a/tderesources/lib/kcal_resourcegroupwarebase.cpp +++ b/tderesources/lib/kcal_resourcegroupwarebase.cpp @@ -31,7 +31,7 @@ #include "groupwareuploadjob.h" #include -#include +#include #include #include diff --git a/tderesources/lib/kcal_resourcegroupwarebase.h b/tderesources/lib/kcal_resourcegroupwarebase.h index f6b46dbf..8a1033fb 100644 --- a/tderesources/lib/kcal_resourcegroupwarebase.h +++ b/tderesources/lib/kcal_resourcegroupwarebase.h @@ -46,7 +46,7 @@ namespace KCal { class CalendarAdaptor; /** - This class provides a resource for accessing a Groupware kioslave-based + This class provides a resource for accessing a Groupware tdeioslave-based calendar. */ class KDE_EXPORT ResourceGroupwareBase : public ResourceCached diff --git a/tderesources/lib/kcal_resourcegroupwarebaseconfig.h b/tderesources/lib/kcal_resourcegroupwarebaseconfig.h index ab4f841a..7639b562 100644 --- a/tderesources/lib/kcal_resourcegroupwarebaseconfig.h +++ b/tderesources/lib/kcal_resourcegroupwarebaseconfig.h @@ -40,7 +40,7 @@ namespace KCal { class CacheSettingsDialog; /** - Configuration widget for groupware kioslave resource. + Configuration widget for groupware tdeioslave resource. @see KCalOpenGroupware */ diff --git a/tderesources/newexchange/exchangeaddressbookadaptor.cpp b/tderesources/newexchange/exchangeaddressbookadaptor.cpp index 7e8ae8bb..1abaacd4 100644 --- a/tderesources/newexchange/exchangeaddressbookadaptor.cpp +++ b/tderesources/newexchange/exchangeaddressbookadaptor.cpp @@ -25,7 +25,7 @@ #include "exchangeglobals.h" #include #include -#include +#include using namespace KABC; diff --git a/tderesources/newexchange/exchangecalendaradaptor.cpp b/tderesources/newexchange/exchangecalendaradaptor.cpp index 89c9b742..a6777fb2 100644 --- a/tderesources/newexchange/exchangecalendaradaptor.cpp +++ b/tderesources/newexchange/exchangecalendaradaptor.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include "davcalendaradaptor.h" diff --git a/tderesources/newexchange/exchangeglobals.cpp b/tderesources/newexchange/exchangeglobals.cpp index f2d90cd6..dc74650c 100644 --- a/tderesources/newexchange/exchangeglobals.cpp +++ b/tderesources/newexchange/exchangeglobals.cpp @@ -29,8 +29,8 @@ #include #include -#include -#include +#include +#include #include KPIM::FolderLister::ContentType ExchangeGlobals::getContentType( const TQDomElement &prop ) diff --git a/tderesources/remote/resourceremote.cpp b/tderesources/remote/resourceremote.cpp index ed05f840..78b65065 100644 --- a/tderesources/remote/resourceremote.cpp +++ b/tderesources/remote/resourceremote.cpp @@ -28,7 +28,7 @@ #include #include -#include +#include #include #include #include diff --git a/tderesources/remote/resourceremote.h b/tderesources/remote/resourceremote.h index 2c3fd5fa..04099ff9 100644 --- a/tderesources/remote/resourceremote.h +++ b/tderesources/remote/resourceremote.h @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include diff --git a/tderesources/scalix/CMakeLists.txt b/tderesources/scalix/CMakeLists.txt index ca7fc523..0be4fd95 100644 --- a/tderesources/scalix/CMakeLists.txt +++ b/tderesources/scalix/CMakeLists.txt @@ -12,6 +12,6 @@ add_subdirectory( shared ) add_subdirectory( kabc ) add_subdirectory( kcal ) -add_subdirectory( kioslave ) +add_subdirectory( tdeioslave ) add_subdirectory( knotes ) add_subdirectory( scalixadmin ) diff --git a/tderesources/scalix/Makefile.am b/tderesources/scalix/Makefile.am index 1a58c7ec..ca323048 100644 --- a/tderesources/scalix/Makefile.am +++ b/tderesources/scalix/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = shared kabc kcal kioslave knotes scalixadmin +SUBDIRS = shared kabc kcal tdeioslave knotes scalixadmin messages: rc.cpp $(XGETTEXT) shared/*.cpp kabc/*.cpp kcal/*.cpp knotes/*.cpp -o $(podir)/kres_scalix.pot diff --git a/tderesources/scalix/kabc/resourcescalix.cpp b/tderesources/scalix/kabc/resourcescalix.cpp index 42aef92d..13ee99ec 100644 --- a/tderesources/scalix/kabc/resourcescalix.cpp +++ b/tderesources/scalix/kabc/resourcescalix.cpp @@ -38,8 +38,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include @@ -193,8 +193,8 @@ bool KABC::ResourceScalix::loadSubResourceHelper( const TQString& subResource, // If it's too big the progressbar is jumpy. const int nbMessages = 200; - (void)Observer::self(); // ensure kio_uiserver is running - UIServer_stub uiserver( "kio_uiserver", "UIServer" ); + (void)Observer::self(); // ensure tdeio_uiserver is running + UIServer_stub uiserver( "tdeio_uiserver", "UIServer" ); int progressId = 0; if ( count > 200 ) { progressId = uiserver.newJob( kapp->dcopClient()->appId(), true ); diff --git a/tderesources/scalix/kcal/resourcescalix.cpp b/tderesources/scalix/kcal/resourcescalix.cpp index a757c81f..672a7bfb 100644 --- a/tderesources/scalix/kcal/resourcescalix.cpp +++ b/tderesources/scalix/kcal/resourcescalix.cpp @@ -33,8 +33,8 @@ #include "resourcescalix.h" -#include -#include +#include +#include #include #include #include @@ -161,8 +161,8 @@ bool ResourceScalix::loadSubResource( const TQString& subResource, : i18n( "Loading events..." ); const bool useProgress = tqApp && tqApp->type() != TQApplication::Tty && count > mProgressDialogIncidenceLimit; if ( useProgress ) - (void)::Observer::self(); // ensure kio_uiserver is running - UIServer_stub uiserver( "kio_uiserver", "UIServer" ); + (void)::Observer::self(); // ensure tdeio_uiserver is running + UIServer_stub uiserver( "tdeio_uiserver", "UIServer" ); int progressId = 0; if ( useProgress ) { progressId = uiserver.newJob( kapp->dcopClient()->appId(), true ); diff --git a/tderesources/scalix/kioslave/CMakeLists.txt b/tderesources/scalix/kioslave/CMakeLists.txt deleted file mode 100644 index 7ba76f67..00000000 --- a/tderesources/scalix/kioslave/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -################################################# -# -# (C) 2010-2011 Serghei Amelian -# serghei (DOT) amelian (AT) gmail.com -# -# Improvements and feedback are welcome -# -# This file is released under GPL >= 2 -# -################################################# - -include_directories( - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_SOURCE_DIR}/libtdepim - ${TDE_INCLUDE_DIR} - ${TQT_INCLUDE_DIRS} -) - -link_directories( - ${TQT_LIBRARY_DIRS} -) - - -##### other data ################################ - -install( - FILES scalix.protocol scalixs.protocol - DESTINATION ${SERVICES_INSTALL_DIR} ) - - -##### kio_scalix (module) ####################### - -tde_add_kpart( kio_scalix AUTOMOC - SOURCES scalix.cpp - LINK tdepim-shared - DESTINATION ${PLUGIN_INSTALL_DIR} -) diff --git a/tderesources/scalix/kioslave/Makefile.am b/tderesources/scalix/kioslave/Makefile.am deleted file mode 100644 index 5607fb9d..00000000 --- a/tderesources/scalix/kioslave/Makefile.am +++ /dev/null @@ -1,17 +0,0 @@ -INCLUDES = -I$(top_srcdir) -I$(top_builddir)/libtdepim $(all_includes) - -noinst_HEADERS = scalix.h - -METASOURCES = AUTO - -kdelnkdir = $(kde_servicesdir) -kdelnk_DATA = scalix.protocol scalixs.protocol - -kde_module_LTLIBRARIES = kio_scalix.la - -kio_scalix_la_SOURCES = scalix.cpp -kio_scalix_la_LIBADD = $(top_builddir)/libkcal/libkcal.la $(top_builddir)/libtdepim/libtdepim.la $(LIB_KIO) -kio_scalix_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) - -messages: rc.cpp - $(XGETTEXT) *.cpp -o $(podir)/kio_scalix.pot diff --git a/tderesources/scalix/kioslave/scalix.cpp b/tderesources/scalix/kioslave/scalix.cpp deleted file mode 100644 index 1b4cc7b8..00000000 --- a/tderesources/scalix/kioslave/scalix.cpp +++ /dev/null @@ -1,225 +0,0 @@ -/* - This file is part of KDE. - - Copyright (C) 2007 Trolltech ASA. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -#include -#include - -#include -#include -#include -#include -#include -#include - -#include - -#include - -#include "scalix.h" - -extern "C" { - KDE_EXPORT int kdemain( int argc, char **argv ); -} - -static const KCmdLineOptions options[] = -{ - { "+protocol", I18N_NOOP( "Protocol name" ), 0 }, - { "+pool", I18N_NOOP( "Socket name" ), 0 }, - { "+app", I18N_NOOP( "Socket name" ), 0 }, - KCmdLineLastOption -}; - -int kdemain( int argc, char **argv ) -{ - putenv( strdup( "SESSION_MANAGER=" ) ); - TDEApplication::disableAutoDcopRegistration(); - - TDECmdLineArgs::init( argc, argv, "kio_scalix", 0, 0, 0, 0 ); - TDECmdLineArgs::addCmdLineOptions( options ); - TDEApplication app( false, false ); - - TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); - Scalix slave( args->arg( 0 ), args->arg( 1 ), args->arg( 2 ) ); - slave.dispatchLoop(); - - return 0; -} - -Scalix::Scalix( const TQCString &protocol, const TQCString &pool, const TQCString &app ) - : SlaveBase( protocol, pool, app ) -{ -} - -void Scalix::get( const KURL &url ) -{ - mimeType( "text/plain" ); - - TQString path = url.path(); - - if ( path.contains( "/freebusy/" ) ) { - retrieveFreeBusy( url ); - } else { - error( TDEIO::ERR_SLAVE_DEFINED, i18n( "Unknown path. Known path is '/freebusy/'" ) ); - } -} - -void Scalix::put( const KURL& url, int, bool, bool ) -{ - TQString path = url.path(); - - if ( path.contains( "/freebusy/" ) ) { - publishFreeBusy( url ); - } else { - error( TDEIO::ERR_SLAVE_DEFINED, i18n( "Unknown path. Known path is '/freebusy/'" ) ); - } -} - -void Scalix::retrieveFreeBusy( const KURL &url ) -{ - /** - * The url is of the following form: - * scalix://user:password@host/freebusy/user@domain.ifb - */ - - // Extract user@domain (e.g. everything between '/freebusy/' and '.ifb') - const TQString requestUser = url.path().mid( 10, url.path().length() - 14 ); - - TQByteArray packedArgs; - TQDataStream stream( packedArgs, IO_WriteOnly ); - - const TQString argument = TQString( "BEGIN:VFREEBUSY\nATTENDEE:MAILTO:%1\nEND:VFREEBUSY" ).arg( requestUser ); - const TQString command = TQString( "X-GET-ICAL-FREEBUSY {%1}" ).arg( argument.length() ); - - stream << (int) 'X' << 'E' << command << argument; - - TQString imapUrl = TQString( "imap://%1@%3/" ).arg( url.pass().isEmpty() ? - url.user() : url.user() + ":" + url.pass() ) - .arg( url.host() ); - - mFreeBusyData = TQString(); - - TDEIO::SimpleJob *job = TDEIO::special( imapUrl, packedArgs, false ); - connect( job, TQT_SIGNAL( infoMessage( TDEIO::Job*, const TQString& ) ), - this, TQT_SLOT( slotInfoMessage( TDEIO::Job*, const TQString& ) ) ); - connect( job, TQT_SIGNAL( result( TDEIO::Job* ) ), - this, TQT_SLOT( slotRetrieveResult( TDEIO::Job* ) ) ); - - tqApp->eventLoop()->enterLoop(); -} - -void Scalix::publishFreeBusy( const KURL &url ) -{ - /** - * The url is of the following form: - * scalix://user:password@host/freebusy/path/to/calendar/user@domain - */ - TQString requestUser, calendar; - TQString path = url.path(); - - // extract user name - int lastSlash = path.findRev( '/' ); - if ( lastSlash != -1 ) - requestUser = path.mid( lastSlash + 1 ); - - // extract calendar name - int secondSlash = path.find( '/', 1 ); - if ( secondSlash != -1 ) - calendar = path.mid( secondSlash + 1, lastSlash - secondSlash - 1 ); - - if ( requestUser.isEmpty() || calendar.isEmpty() ) { - error( TDEIO::ERR_SLAVE_DEFINED, i18n( "No user or calendar given!" ) ); - return; - }; - - // read freebusy information - TQByteArray data; - while ( true ) { - dataReq(); - - TQByteArray buffer; - const int newSize = readData(buffer); - if ( newSize < 0 ) { - // read error: network in unknown state so disconnect - error( TDEIO::ERR_COULD_NOT_READ, i18n("KIO data supply error.") ); - return; - } - - if ( newSize == 0 ) - break; - - unsigned int oldSize = data.size(); - data.resize( oldSize + buffer.size() ); - memcpy( data.data() + oldSize, buffer.data(), buffer.size() ); - } - - TQByteArray packedArgs; - TQDataStream stream( packedArgs, IO_WriteOnly ); - - const TQString argument = TQString::fromUtf8( data ); - const TQString command = TQString( "X-PUT-ICAL-FREEBUSY Calendar {%1}" ).arg( argument.length() ); - - stream << (int) 'X' << 'E' << command << argument; - - TQString imapUrl = TQString( "imap://%1@%3/" ).arg( url.pass().isEmpty() ? - url.user() : url.user() + ":" + url.pass() ) - .arg( url.host() ); - - TDEIO::SimpleJob *job = TDEIO::special( imapUrl, packedArgs, false ); - connect( job, TQT_SIGNAL( result( TDEIO::Job* ) ), - this, TQT_SLOT( slotPublishResult( TDEIO::Job* ) ) ); - - tqApp->eventLoop()->enterLoop(); -} - -void Scalix::slotInfoMessage( TDEIO::Job *job, const TQString &data ) -{ - if ( job->error() ) { - // error is handled in slotResult - return; - } - - mFreeBusyData = data; -} - - -void Scalix::slotRetrieveResult( TDEIO::Job *job ) -{ - if ( job->error() ) { - error( TDEIO::ERR_SLAVE_DEFINED, job->errorString() ); - } else { - data( mFreeBusyData.utf8() ); - finished(); - } - - tqApp->eventLoop()->exitLoop(); -} - -void Scalix::slotPublishResult( TDEIO::Job *job ) -{ - if ( job->error() ) { - error( TDEIO::ERR_SLAVE_DEFINED, job->errorString() ); - } else { - finished(); - } - - tqApp->eventLoop()->exitLoop(); -} - -#include "scalix.moc" diff --git a/tderesources/scalix/kioslave/scalix.h b/tderesources/scalix/kioslave/scalix.h deleted file mode 100644 index dc034b7b..00000000 --- a/tderesources/scalix/kioslave/scalix.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - This file is part of KDE. - - Copyright (C) 2007 Trolltech ASA. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -#ifndef SCALIX_H -#define SCALIX_H - -#include -#include - -#include - -class Scalix : public TQObject, public TDEIO::SlaveBase -{ - Q_OBJECT - - - public: - Scalix( const TQCString &protocol, const TQCString &pool, const TQCString &app ); - - void get( const KURL &url ); - void put( const KURL &url, int permissions, bool overwrite, bool resume ); - - private slots: - void slotRetrieveResult( TDEIO::Job* ); - void slotPublishResult( TDEIO::Job* ); - void slotInfoMessage( TDEIO::Job*, const TQString& ); - - private: - void retrieveFreeBusy( const KURL& ); - void publishFreeBusy( const KURL& ); - - TQString mFreeBusyData; -}; - -#endif diff --git a/tderesources/scalix/kioslave/scalix.protocol b/tderesources/scalix/kioslave/scalix.protocol deleted file mode 100644 index a527d77d..00000000 --- a/tderesources/scalix/kioslave/scalix.protocol +++ /dev/null @@ -1,8 +0,0 @@ -[Protocol] -DocPath=kioslave/scalix.html -exec=kio_scalix -input=none -output=filesystem -protocol=scalix -reading=true -writing=true diff --git a/tderesources/scalix/kioslave/scalixs.protocol b/tderesources/scalix/kioslave/scalixs.protocol deleted file mode 100644 index fd13db6a..00000000 --- a/tderesources/scalix/kioslave/scalixs.protocol +++ /dev/null @@ -1,8 +0,0 @@ -[Protocol] -DocPath=kioslave/scalix.html -exec=kio_scalix -input=none -output=filesystem -protocol=scalixs -reading=true -writing=true diff --git a/tderesources/scalix/scalixadmin/jobs.cpp b/tderesources/scalix/scalixadmin/jobs.cpp index 49b0a8fe..e7dd9445 100644 --- a/tderesources/scalix/scalixadmin/jobs.cpp +++ b/tderesources/scalix/scalixadmin/jobs.cpp @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include +#include #include #include "jobs.h" diff --git a/tderesources/scalix/scalixadmin/jobs.h b/tderesources/scalix/scalixadmin/jobs.h index 0c73fb50..832db070 100644 --- a/tderesources/scalix/scalixadmin/jobs.h +++ b/tderesources/scalix/scalixadmin/jobs.h @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include +#include #ifndef JOBS_H #define JOBS_H diff --git a/tderesources/scalix/scalixadmin/passwordpage.cpp b/tderesources/scalix/scalixadmin/passwordpage.cpp index 6dd8ab10..9bdc1377 100644 --- a/tderesources/scalix/scalixadmin/passwordpage.cpp +++ b/tderesources/scalix/scalixadmin/passwordpage.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include #include diff --git a/tderesources/scalix/scalixadmin/settings.cpp b/tderesources/scalix/scalixadmin/settings.cpp index 279491c5..277a0631 100644 --- a/tderesources/scalix/scalixadmin/settings.cpp +++ b/tderesources/scalix/scalixadmin/settings.cpp @@ -18,8 +18,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include +#include +#include #include #include "settings.h" diff --git a/tderesources/scalix/scalixadmin/settings.h b/tderesources/scalix/scalixadmin/settings.h index 29028f3b..490b98a7 100644 --- a/tderesources/scalix/scalixadmin/settings.h +++ b/tderesources/scalix/scalixadmin/settings.h @@ -22,8 +22,8 @@ #define SETTINGS_H #include -#include -#include +#include +#include class Settings { diff --git a/tderesources/scalix/tdeioslave/CMakeLists.txt b/tderesources/scalix/tdeioslave/CMakeLists.txt new file mode 100644 index 00000000..7ba76f67 --- /dev/null +++ b/tderesources/scalix/tdeioslave/CMakeLists.txt @@ -0,0 +1,37 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/libtdepim + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### other data ################################ + +install( + FILES scalix.protocol scalixs.protocol + DESTINATION ${SERVICES_INSTALL_DIR} ) + + +##### kio_scalix (module) ####################### + +tde_add_kpart( kio_scalix AUTOMOC + SOURCES scalix.cpp + LINK tdepim-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tderesources/scalix/tdeioslave/Makefile.am b/tderesources/scalix/tdeioslave/Makefile.am new file mode 100644 index 00000000..1e66f709 --- /dev/null +++ b/tderesources/scalix/tdeioslave/Makefile.am @@ -0,0 +1,17 @@ +INCLUDES = -I$(top_srcdir) -I$(top_builddir)/libtdepim $(all_includes) + +noinst_HEADERS = scalix.h + +METASOURCES = AUTO + +kdelnkdir = $(kde_servicesdir) +kdelnk_DATA = scalix.protocol scalixs.protocol + +kde_module_LTLIBRARIES = kio_scalix.la + +kio_scalix_la_SOURCES = scalix.cpp +kio_scalix_la_LIBADD = $(top_builddir)/libkcal/libkcal.la $(top_builddir)/libtdepim/libtdepim.la $(LIB_KIO) +kio_scalix_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) + +messages: rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/tdeio_scalix.pot diff --git a/tderesources/scalix/tdeioslave/scalix.cpp b/tderesources/scalix/tdeioslave/scalix.cpp new file mode 100644 index 00000000..40084669 --- /dev/null +++ b/tderesources/scalix/tdeioslave/scalix.cpp @@ -0,0 +1,225 @@ +/* + This file is part of KDE. + + Copyright (C) 2007 Trolltech ASA. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include "scalix.h" + +extern "C" { + KDE_EXPORT int kdemain( int argc, char **argv ); +} + +static const KCmdLineOptions options[] = +{ + { "+protocol", I18N_NOOP( "Protocol name" ), 0 }, + { "+pool", I18N_NOOP( "Socket name" ), 0 }, + { "+app", I18N_NOOP( "Socket name" ), 0 }, + KCmdLineLastOption +}; + +int kdemain( int argc, char **argv ) +{ + putenv( strdup( "SESSION_MANAGER=" ) ); + TDEApplication::disableAutoDcopRegistration(); + + TDECmdLineArgs::init( argc, argv, "kio_scalix", 0, 0, 0, 0 ); + TDECmdLineArgs::addCmdLineOptions( options ); + TDEApplication app( false, false ); + + TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); + Scalix slave( args->arg( 0 ), args->arg( 1 ), args->arg( 2 ) ); + slave.dispatchLoop(); + + return 0; +} + +Scalix::Scalix( const TQCString &protocol, const TQCString &pool, const TQCString &app ) + : SlaveBase( protocol, pool, app ) +{ +} + +void Scalix::get( const KURL &url ) +{ + mimeType( "text/plain" ); + + TQString path = url.path(); + + if ( path.contains( "/freebusy/" ) ) { + retrieveFreeBusy( url ); + } else { + error( TDEIO::ERR_SLAVE_DEFINED, i18n( "Unknown path. Known path is '/freebusy/'" ) ); + } +} + +void Scalix::put( const KURL& url, int, bool, bool ) +{ + TQString path = url.path(); + + if ( path.contains( "/freebusy/" ) ) { + publishFreeBusy( url ); + } else { + error( TDEIO::ERR_SLAVE_DEFINED, i18n( "Unknown path. Known path is '/freebusy/'" ) ); + } +} + +void Scalix::retrieveFreeBusy( const KURL &url ) +{ + /** + * The url is of the following form: + * scalix://user:password@host/freebusy/user@domain.ifb + */ + + // Extract user@domain (e.g. everything between '/freebusy/' and '.ifb') + const TQString requestUser = url.path().mid( 10, url.path().length() - 14 ); + + TQByteArray packedArgs; + TQDataStream stream( packedArgs, IO_WriteOnly ); + + const TQString argument = TQString( "BEGIN:VFREEBUSY\nATTENDEE:MAILTO:%1\nEND:VFREEBUSY" ).arg( requestUser ); + const TQString command = TQString( "X-GET-ICAL-FREEBUSY {%1}" ).arg( argument.length() ); + + stream << (int) 'X' << 'E' << command << argument; + + TQString imapUrl = TQString( "imap://%1@%3/" ).arg( url.pass().isEmpty() ? + url.user() : url.user() + ":" + url.pass() ) + .arg( url.host() ); + + mFreeBusyData = TQString(); + + TDEIO::SimpleJob *job = TDEIO::special( imapUrl, packedArgs, false ); + connect( job, TQT_SIGNAL( infoMessage( TDEIO::Job*, const TQString& ) ), + this, TQT_SLOT( slotInfoMessage( TDEIO::Job*, const TQString& ) ) ); + connect( job, TQT_SIGNAL( result( TDEIO::Job* ) ), + this, TQT_SLOT( slotRetrieveResult( TDEIO::Job* ) ) ); + + tqApp->eventLoop()->enterLoop(); +} + +void Scalix::publishFreeBusy( const KURL &url ) +{ + /** + * The url is of the following form: + * scalix://user:password@host/freebusy/path/to/calendar/user@domain + */ + TQString requestUser, calendar; + TQString path = url.path(); + + // extract user name + int lastSlash = path.findRev( '/' ); + if ( lastSlash != -1 ) + requestUser = path.mid( lastSlash + 1 ); + + // extract calendar name + int secondSlash = path.find( '/', 1 ); + if ( secondSlash != -1 ) + calendar = path.mid( secondSlash + 1, lastSlash - secondSlash - 1 ); + + if ( requestUser.isEmpty() || calendar.isEmpty() ) { + error( TDEIO::ERR_SLAVE_DEFINED, i18n( "No user or calendar given!" ) ); + return; + }; + + // read freebusy information + TQByteArray data; + while ( true ) { + dataReq(); + + TQByteArray buffer; + const int newSize = readData(buffer); + if ( newSize < 0 ) { + // read error: network in unknown state so disconnect + error( TDEIO::ERR_COULD_NOT_READ, i18n("KIO data supply error.") ); + return; + } + + if ( newSize == 0 ) + break; + + unsigned int oldSize = data.size(); + data.resize( oldSize + buffer.size() ); + memcpy( data.data() + oldSize, buffer.data(), buffer.size() ); + } + + TQByteArray packedArgs; + TQDataStream stream( packedArgs, IO_WriteOnly ); + + const TQString argument = TQString::fromUtf8( data ); + const TQString command = TQString( "X-PUT-ICAL-FREEBUSY Calendar {%1}" ).arg( argument.length() ); + + stream << (int) 'X' << 'E' << command << argument; + + TQString imapUrl = TQString( "imap://%1@%3/" ).arg( url.pass().isEmpty() ? + url.user() : url.user() + ":" + url.pass() ) + .arg( url.host() ); + + TDEIO::SimpleJob *job = TDEIO::special( imapUrl, packedArgs, false ); + connect( job, TQT_SIGNAL( result( TDEIO::Job* ) ), + this, TQT_SLOT( slotPublishResult( TDEIO::Job* ) ) ); + + tqApp->eventLoop()->enterLoop(); +} + +void Scalix::slotInfoMessage( TDEIO::Job *job, const TQString &data ) +{ + if ( job->error() ) { + // error is handled in slotResult + return; + } + + mFreeBusyData = data; +} + + +void Scalix::slotRetrieveResult( TDEIO::Job *job ) +{ + if ( job->error() ) { + error( TDEIO::ERR_SLAVE_DEFINED, job->errorString() ); + } else { + data( mFreeBusyData.utf8() ); + finished(); + } + + tqApp->eventLoop()->exitLoop(); +} + +void Scalix::slotPublishResult( TDEIO::Job *job ) +{ + if ( job->error() ) { + error( TDEIO::ERR_SLAVE_DEFINED, job->errorString() ); + } else { + finished(); + } + + tqApp->eventLoop()->exitLoop(); +} + +#include "scalix.moc" diff --git a/tderesources/scalix/tdeioslave/scalix.h b/tderesources/scalix/tdeioslave/scalix.h new file mode 100644 index 00000000..f4dbdead --- /dev/null +++ b/tderesources/scalix/tdeioslave/scalix.h @@ -0,0 +1,52 @@ +/* + This file is part of KDE. + + Copyright (C) 2007 Trolltech ASA. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#ifndef SCALIX_H +#define SCALIX_H + +#include +#include + +#include + +class Scalix : public TQObject, public TDEIO::SlaveBase +{ + Q_OBJECT + + + public: + Scalix( const TQCString &protocol, const TQCString &pool, const TQCString &app ); + + void get( const KURL &url ); + void put( const KURL &url, int permissions, bool overwrite, bool resume ); + + private slots: + void slotRetrieveResult( TDEIO::Job* ); + void slotPublishResult( TDEIO::Job* ); + void slotInfoMessage( TDEIO::Job*, const TQString& ); + + private: + void retrieveFreeBusy( const KURL& ); + void publishFreeBusy( const KURL& ); + + TQString mFreeBusyData; +}; + +#endif diff --git a/tderesources/scalix/tdeioslave/scalix.protocol b/tderesources/scalix/tdeioslave/scalix.protocol new file mode 100644 index 00000000..91a213e8 --- /dev/null +++ b/tderesources/scalix/tdeioslave/scalix.protocol @@ -0,0 +1,8 @@ +[Protocol] +DocPath=tdeioslave/scalix.html +exec=kio_scalix +input=none +output=filesystem +protocol=scalix +reading=true +writing=true diff --git a/tderesources/scalix/tdeioslave/scalixs.protocol b/tderesources/scalix/tdeioslave/scalixs.protocol new file mode 100644 index 00000000..19defac5 --- /dev/null +++ b/tderesources/scalix/tdeioslave/scalixs.protocol @@ -0,0 +1,8 @@ +[Protocol] +DocPath=tdeioslave/scalix.html +exec=kio_scalix +input=none +output=filesystem +protocol=scalixs +reading=true +writing=true diff --git a/tderesources/slox/kabcresourceslox.cpp b/tderesources/slox/kabcresourceslox.cpp index e7ab6eca..04ce9555 100644 --- a/tderesources/slox/kabcresourceslox.cpp +++ b/tderesources/slox/kabcresourceslox.cpp @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include #include @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include "webdavhandler.h" #include "sloxaccounts.h" diff --git a/tderesources/slox/kabcsloxprefs.kcfgc b/tderesources/slox/kabcsloxprefs.kcfgc index 11e2f2c2..51bd1ac1 100644 --- a/tderesources/slox/kabcsloxprefs.kcfgc +++ b/tderesources/slox/kabcsloxprefs.kcfgc @@ -1,4 +1,4 @@ -# Code generation options for kconfig_compiler +# Code generation options for tdeconfig_compiler File=tderesources_kabc_slox.kcfg ClassName=SloxPrefs NameSpace=KABC diff --git a/tderesources/slox/kcalresourceslox.cpp b/tderesources/slox/kcalresourceslox.cpp index 1311ebc5..a877622e 100644 --- a/tderesources/slox/kcalresourceslox.cpp +++ b/tderesources/slox/kcalresourceslox.cpp @@ -30,8 +30,8 @@ #include #include -#include -#include +#include +#include #include #include diff --git a/tderesources/slox/kcalresourceslox.h b/tderesources/slox/kcalresourceslox.h index 6735b993..8b2b68d2 100644 --- a/tderesources/slox/kcalresourceslox.h +++ b/tderesources/slox/kcalresourceslox.h @@ -29,7 +29,7 @@ #include #include -#include +#include #include #include diff --git a/tderesources/slox/kcalsloxprefs.kcfgc b/tderesources/slox/kcalsloxprefs.kcfgc index 3b352a21..e971d32d 100644 --- a/tderesources/slox/kcalsloxprefs.kcfgc +++ b/tderesources/slox/kcalsloxprefs.kcfgc @@ -1,4 +1,4 @@ -# Code generation options for kconfig_compiler +# Code generation options for tdeconfig_compiler File=tderesources_kcal_slox.kcfg ClassName=SloxPrefs NameSpace=KCal diff --git a/tderesources/slox/sloxaccounts.cpp b/tderesources/slox/sloxaccounts.cpp index aa648d1b..1831d79a 100644 --- a/tderesources/slox/sloxaccounts.cpp +++ b/tderesources/slox/sloxaccounts.cpp @@ -28,10 +28,10 @@ #include #include #include -#include -#include +#include +#include #include -#include +#include #include #include diff --git a/tderesources/slox/sloxfoldermanager.cpp b/tderesources/slox/sloxfoldermanager.cpp index a60cd788..72842055 100644 --- a/tderesources/slox/sloxfoldermanager.cpp +++ b/tderesources/slox/sloxfoldermanager.cpp @@ -22,8 +22,8 @@ #include #include -#include -#include +#include +#include #include #include diff --git a/tderesources/slox/webdavhandler.cpp b/tderesources/slox/webdavhandler.cpp index 32d3c416..65caebf2 100644 --- a/tderesources/slox/webdavhandler.cpp +++ b/tderesources/slox/webdavhandler.cpp @@ -37,7 +37,7 @@ #include #include -#include +#include #include diff --git a/tderesources/tvanytime/kcal_resourcetvanytime.h b/tderesources/tvanytime/kcal_resourcetvanytime.h index 1c8bd9c9..65e9ac11 100644 --- a/tderesources/tvanytime/kcal_resourcetvanytime.h +++ b/tderesources/tvanytime/kcal_resourcetvanytime.h @@ -28,8 +28,8 @@ #include #include -#include -#include +#include +#include #include #include "service.h" diff --git a/tderesources/tvanytime/kcal_resourcetvanytimeconfig.cpp b/tderesources/tvanytime/kcal_resourcetvanytimeconfig.cpp index f9ec2a49..dbce86fe 100644 --- a/tderesources/tvanytime/kcal_resourcetvanytimeconfig.cpp +++ b/tderesources/tvanytime/kcal_resourcetvanytimeconfig.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include //#include diff --git a/tderesources/tvanytime/kcal_tvanytimeprefsbase.kcfgc b/tderesources/tvanytime/kcal_tvanytimeprefsbase.kcfgc index 6693e414..3b5a05c6 100644 --- a/tderesources/tvanytime/kcal_tvanytimeprefsbase.kcfgc +++ b/tderesources/tvanytime/kcal_tvanytimeprefsbase.kcfgc @@ -1,4 +1,4 @@ -# Code generation options for kconfig_compiler +# Code generation options for tdeconfig_compiler File=tderesources_kcal_tvanytime.kcfg ClassName=TVAnytimePrefsBase NameSpace=KCal diff --git a/wizards/egroupwareconfig.kcfgc b/wizards/egroupwareconfig.kcfgc index 47927939..5869e009 100644 --- a/wizards/egroupwareconfig.kcfgc +++ b/wizards/egroupwareconfig.kcfgc @@ -1,4 +1,4 @@ -# Code generation options for kconfig_compiler +# Code generation options for tdeconfig_compiler File=egroupware.kcfg ClassName=EGroupwareConfig Singleton=true diff --git a/wizards/egroupwarewizard.h b/wizards/egroupwarewizard.h index 2a920467..431c61d3 100644 --- a/wizards/egroupwarewizard.h +++ b/wizards/egroupwarewizard.h @@ -21,7 +21,7 @@ #ifndef EGROUPWAREWIZARD_H #define EGROUPWAREWIZARD_H -#include +#include #include class KLineEdit; diff --git a/wizards/exchangewizard.h b/wizards/exchangewizard.h index f453356d..ffa35d02 100644 --- a/wizards/exchangewizard.h +++ b/wizards/exchangewizard.h @@ -20,7 +20,7 @@ #ifndef EXCHANGEWIZARD_H #define EXCHANGEWIZARD_H -#include +#include #include class KLineEdit; diff --git a/wizards/groupwiseconfig.kcfgc b/wizards/groupwiseconfig.kcfgc index 09231e2e..8034a0ec 100644 --- a/wizards/groupwiseconfig.kcfgc +++ b/wizards/groupwiseconfig.kcfgc @@ -1,4 +1,4 @@ -# Code generation options for kconfig_compiler +# Code generation options for tdeconfig_compiler File=groupwise.kcfg ClassName=GroupwiseConfig Singleton=true diff --git a/wizards/groupwisewizard.h b/wizards/groupwisewizard.h index 073de386..7960a39b 100644 --- a/wizards/groupwisewizard.h +++ b/wizards/groupwisewizard.h @@ -20,7 +20,7 @@ #ifndef GROUPWISEWIZARD_H #define GROUPWISEWIZARD_H -#include +#include #include class KLineEdit; diff --git a/wizards/kmailchanges.h b/wizards/kmailchanges.h index f238b362..3fc412a1 100644 --- a/wizards/kmailchanges.h +++ b/wizards/kmailchanges.h @@ -22,8 +22,8 @@ #ifndef KMAILCHANGES_H #define KMAILCHANGES_H -#include -#include +#include +#include namespace KWallet { class Wallet; diff --git a/wizards/kolabconfig.kcfgc b/wizards/kolabconfig.kcfgc index 4c265d26..c2177b86 100644 --- a/wizards/kolabconfig.kcfgc +++ b/wizards/kolabconfig.kcfgc @@ -1,4 +1,4 @@ -# Code generation options for kconfig_compiler +# Code generation options for tdeconfig_compiler File=kolab.kcfg ClassName=KolabConfig Singleton=true diff --git a/wizards/kolabkmailchanges.cpp b/wizards/kolabkmailchanges.cpp index 0adfc46b..6227383f 100644 --- a/wizards/kolabkmailchanges.cpp +++ b/wizards/kolabkmailchanges.cpp @@ -25,7 +25,7 @@ #include "kmailchanges.h" #include -#include +#include #include class KolabCustomWriter : public CreateDisconnectedImapAccount::CustomWriter diff --git a/wizards/kolabkmailchanges.h b/wizards/kolabkmailchanges.h index 74d07691..c4c9ad89 100644 --- a/wizards/kolabkmailchanges.h +++ b/wizards/kolabkmailchanges.h @@ -21,7 +21,7 @@ #ifndef KOLABKMAILCHANGES_H #define KOLABKMAILCHANGES_H -#include +#include void createKMailChanges( TDEConfigPropagator::Change::List& ); diff --git a/wizards/kolabwizard.h b/wizards/kolabwizard.h index eec25233..99fd0c0d 100644 --- a/wizards/kolabwizard.h +++ b/wizards/kolabwizard.h @@ -22,7 +22,7 @@ #ifndef KOLABWIZARD_H #define KOLABWIZARD_H -#include +#include #include class KLineEdit; diff --git a/wizards/scalixconfig.kcfgc b/wizards/scalixconfig.kcfgc index f4893ca0..82be4432 100644 --- a/wizards/scalixconfig.kcfgc +++ b/wizards/scalixconfig.kcfgc @@ -1,4 +1,4 @@ -# Code generation options for kconfig_compiler +# Code generation options for tdeconfig_compiler File=scalix.kcfg ClassName=ScalixConfig Singleton=true diff --git a/wizards/scalixkmailchanges.cpp b/wizards/scalixkmailchanges.cpp index 4926678e..89ea65d5 100644 --- a/wizards/scalixkmailchanges.cpp +++ b/wizards/scalixkmailchanges.cpp @@ -25,7 +25,7 @@ #include "kmailchanges.h" #include -#include +#include #include class ScalixCustomWriter : public CreateDisconnectedImapAccount::CustomWriter diff --git a/wizards/scalixkmailchanges.h b/wizards/scalixkmailchanges.h index 91ae7b30..e3f23aa1 100644 --- a/wizards/scalixkmailchanges.h +++ b/wizards/scalixkmailchanges.h @@ -21,7 +21,7 @@ #ifndef SCALIXKMAILCHANGES_H #define SCALIXKMAILCHANGES_H -#include +#include void createKMailChanges( TDEConfigPropagator::Change::List& ); diff --git a/wizards/scalixwizard.h b/wizards/scalixwizard.h index 6ff44b05..273f6c4a 100644 --- a/wizards/scalixwizard.h +++ b/wizards/scalixwizard.h @@ -22,7 +22,7 @@ #ifndef SCALIXWIZARD_H #define SCALIXWIZARD_H -#include +#include #include class KComboBox; diff --git a/wizards/servertype.h b/wizards/servertype.h index c7d8e7ea..700de0e8 100644 --- a/wizards/servertype.h +++ b/wizards/servertype.h @@ -22,7 +22,7 @@ #ifndef SERVERTYPE #define SERVERTYPE -#include +#include #include #include diff --git a/wizards/sloxconfig.kcfgc b/wizards/sloxconfig.kcfgc index be275788..5ca5414c 100644 --- a/wizards/sloxconfig.kcfgc +++ b/wizards/sloxconfig.kcfgc @@ -1,4 +1,4 @@ -# Code generation options for kconfig_compiler +# Code generation options for tdeconfig_compiler File=slox.kcfg ClassName=SloxConfig Singleton=true diff --git a/wizards/sloxwizard.h b/wizards/sloxwizard.h index f43525d1..d9b24c60 100644 --- a/wizards/sloxwizard.h +++ b/wizards/sloxwizard.h @@ -20,7 +20,7 @@ #ifndef SLOXWIZARD_H #define SLOXWIZARD_H -#include +#include #include class KLineEdit; -- cgit v1.2.3