summaryrefslogtreecommitdiffstats
path: root/src/tools/messageserver
Commit message (Collapse)AuthorAgeFilesLines
* Clean up service plugin signal connections - minor API changesPekka Vuorela5 days2-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | The states and signals were painful to follow due to bad naming and excessive overloading. Here: - Renamed some API to avoid overloading, help readability and allow new connect() syntax without resolving the overloads. - updateStatus() signals and slots renamed a bit to make it clearer what is a signal and what is a slot. And avoiding overloading QMailMessageService::updateStatus() to simplify signal connection. - Cleaned up QMailTranport API. It's not doing urls but hostnames and the signals were especially hard to follow - Use the new connect() syntax in messageserver side - Avoiding some protected: / virtual methods when there's nothing even able to inherit the class. - At least print SSL errors instead of signal that's not connected anywhere. - Some minor simplifications and code style adjustments. The SSL error handling is still funny but at least a bit easier to track. Change-Id: If168e15ef068fedee46b9401d695ed5dae7962ba Reviewed-by: <matti.viljanen@kapsi.fi> Reviewed-by: Damien Caliste <dcaliste@free.fr> Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
* Adjust again some smaller code detailsPekka Vuorela11 days1-1/+1
| | | | | | | | | | | | | | | - Wrap some overly long lines - Honor coding conventions better here and there - Use nullptr more instead of '0' - Switch remaining cases of Q_DECL_OVERRIDE and Q_NULLPTR to standard keywords. - Removed some unnecessary #includes - etc. Change-Id: Ia9a01807da88298a6c1c1bbb22c854743ed19429 Reviewed-by: Pekka Vuorela <pvuorela@iki.fi> Reviewed-by: <matti.viljanen@kapsi.fi> Reviewed-by: Damien Caliste <dcaliste@free.fr>
* Move resource usage configuration out of QMail namespacePekka Vuorela11 days1-3/+21
| | | | | | | | | | | | | | The maximum actions / connections shouldn't be a detail the library side needs to decide or expose. Should be up to the messageserver implementation how it wants to serve. Also not expecting much need to know when the database gets automatically closed outside the database itself. Change-Id: I5af27cbe31fe21049d6afdcb7cd7239112a6b06b Reviewed-by: Pekka Vuorela <pvuorela@iki.fi> Reviewed-by: <matti.viljanen@kapsi.fi> Reviewed-by: Damien Caliste <dcaliste@free.fr>
* Repurpose .pro files for qt5 support - almost worksPekka Vuorela2025-11-261-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | There's still need for having qt5 support out there and the .pro files don't anyway compile with qt6 by now. Adjusting those and the code to build on qt5 didn't even require much adjustments. The hack to get _p.h includes work without private prefix, that used to be there for qmake build, is horrible but at least it's relatively small and affecting only .pro files. The examples had some existing issues building there, missing includes and not entirely disabled protocol editor support. The "almost works" part: builds fine but the metatype side is slightly lacking, resulting also a unit test failure. On qt5 qmailipc.h would need qRegisterMetaTypeStreamOperators() call after qRegisterMetaType() but I'm not eager to add qt version ifdeffing inside a macro, at least now. Hoping to clean up the whole metatype registration first. Change-Id: I6e620175383690ce4e6eb4c841e314ccf031026f Reviewed-by: Damien Caliste <dcaliste@free.fr> Reviewed-by: <matti.viljanen@kapsi.fi> Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
* Separate D-Bus serialization from generic serialization APIsPekka Vuorela2025-11-251-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allows to better follow and change how D-Bus IPC happens in detail, not implemented somewhere deep there in templated serialization methods. Now only defining d-bus serialization for what's actually needed. Avoids also spreading the D-Bus around. Now it's quite well contained where needed. Allowing to better add more IPC mechanisms for other platforms if needed. Once messagekey serialization is done properly without qt binary data there shouldn't be too much need anymore for the existing serialization and those could be removed, at least to some extend. This paves the way. QMailMessageServer::registerTypes() replaced with QMailIpc::init() which should be more generic and handles now registering all the D-Bus types needed. Some minor adjustments to the D-Bus API: - The message key signatures on xml seemed wrong, more of how the common datastream serialization happened instead of the d-bus specialization. - Some enums used only on classes are not explicitly registered and are passed just by integer value. Not getting the struct container as registered enums. Simplifies the signatures a bit. - On message metadata moved custom fields as second last, and dirty states as last. Seemed more logical that way. Not sure should the dirtyness really even exist on the serialized data. Was hoping to get rid of more struct containers on enums but apparently qdbusxml2cpp ignores type annotation for basic types like strings and integers. Could consider should the signatures be still simplified by, for example, passing named property arrays, but that's for later. Change-Id: Idf55699aebca45e199fe58215df665c8092475c3 Reviewed-by: <matti.viljanen@kapsi.fi> Reviewed-by: Damien Caliste <dcaliste@free.fr> Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
* Build messageserver plugin support without configurabilityPekka Vuorela2025-11-202-9/+1
| | | | | | | | | | | | | | | | | | | | | On qmake this needs to be explicitly turned on externally while I wouldn't expect much reasons not to use it. The affected code is small. The MODULE_PLUGIN_TYPES wasn't updated to contain plugin prefix but guess it doesn't necessarily affect much with no actual messageserver plugins here. On cmake build looks like the option wasn't enabled properly. The plugin files are built but nothing did -DMESSAGESERVER_PLUGINS for the actual messageserver. Removed one leftover type declaration from messageserver too. Change-Id: I2f012f1f16f6c5c1d74c8b3b0b3ca50edebf59a1 Reviewed-by: Pekka Vuorela <pvuorela@iki.fi> Reviewed-by: <matti.viljanen@kapsi.fi> Reviewed-by: Damien Caliste <dcaliste@free.fr>
* Remove qwidgets support from qmfmessageserverPekka Vuorela2025-11-122-10/+0
| | | | | | | | | | | | | | | | | | | | | | This has little real life value. Any environment and apps starting to use the framework will or should have their own UI style. Predefined forms for some protocol configuration editing unlikely fits the rest. Moreover the support has been opt-out instead of opt-in, QMF_NO_MESSAGE_SERVICE_EDITOR which the _app_ has needed defined according to how the library has been built. Should have been some config.h provided by the framework according to how it's compiled. QMailMessageServiceConfigurator class without the editor makes little sense so removed altogether. There's qtmail example that was using this. For now just left some TODO comments to reimplement the account configuration. Unknown how the example works these days in general. Change-Id: I4122e2524a61797753999e67ecec36cb46213a7b Reviewed-by: Damien Caliste <dcaliste@free.fr> Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
* Use more standard paths for user data, remove QMail::tempPath()Pekka Vuorela2025-11-121-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Avoid data root directly in home directory, rather use QStandardPaths. For backwards compatibility the old path is still used if it's there and the new one doesn't exist. QMail::tempPath() got removed. Evidently it's not much needed and shouldn't really exist. The qmfclient doesn't use it al all and generally apps should store their temporary things in their own places. It's rarely wanted that there would be a common place to store such. On the contrary, apps should play mostly in their own sandboxes. TempPath was used on the server side but mostly either wrong or unnecessary: - requests file is messageserver app specific, shouldn't be visible to others. - QMailMessageSource was using it wrong. New messages are added to database, not temp path. - LongStream with public cleanupTempFiles() could be dangerous if it was called by multiple processes and having a common directory. (Another story whether such an api should even exist though) - SMTP, IMAP and LongStream can live with more generic locations. The generic locations for the last ones are borderline whether it should be TempLocation or CacheLocation. For side: interestingly the usage is mostly storing content in files to save memory while Linux world with /tmp as tmpfs has moved to storing files in memory to make them faster. For now made smtp use temp location as that's a quite simple usage, while imap and longstream in cache dir as they do have some more complicated detaches and append usages, and they were earlier out of the actual /tmp. Did some simplifications to LongStream and a proper error case handling to smtp client out of space error while at it. Change-Id: If52de231082085d804939002371f5a407cd0fecd Reviewed-by: Damien Caliste <dcaliste@free.fr> Reviewed-by: <matti.viljanen@kapsi.fi> Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
* Remove dead voice/video mail handlingPekka Vuorela2025-11-122-74/+1
| | | | | | | | | | | | | | Not much done here since the initial commit and the QMailMessageClassifier::classifyMessage(QMailMessageMetaData*) wasn't actually getting even called anywhere. Besides if something like this is wanted in some environment, it's better implemented as external messageserver plugin. Change-Id: Iff3b9616a739345f6dc73f7b8160b83835ece13b Reviewed-by: Pekka Vuorela <pvuorela@iki.fi> Reviewed-by: <matti.viljanen@kapsi.fi> Reviewed-by: Damien Caliste <dcaliste@free.fr>
* Remove non-functional NewCountNotifierPekka Vuorela2025-11-127-304/+6
| | | | | | | | | | | This doesn't nor has done anything meaningful. For handling new messages it should be better to just create a plugin, e.g. what SailfishOS has done for making notifications on new emails. Change-Id: I962339b406dd305c38fa11992d1576d6aa668084 Reviewed-by: Pekka Vuorela <pvuorela@iki.fi> Reviewed-by: <matti.viljanen@kapsi.fi> Reviewed-by: Damien Caliste <dcaliste@free.fr>
* Avoid some more compiler warningsPekka Vuorela2025-11-061-1/+3
| | | | | | | | | | | | | | | | | | | | | | - Missed earlier one QMessageBox deprecation from separate file - LongStream now doing consistent open() check in all code paths. Also removed unused member variable 'c' and moved internal constants to .cpp. - imapstrategy.h / ImapMessageListStrategy::selectedSectionsAppend() was dead code due to derived class ImapFetchSelectedMessagesStrategy having similar named method with extra parameter and default value. - ImapService was triggering a couple of -Woverloaded-virtual warnings due to having extra methods with same name as base class. These were really used internally so simpler as different named private. - ImapProtocol / QString::lastIndexOf() was complaining about unused return value. Using that should be even simpler than accessing regexp match. - Some small random warnings on unused parameters, missed switch case etc. Change-Id: I243c09ab2d551fe2f8be18f1b3a4df2e3d84b55c Reviewed-by: Pekka Vuorela <pvuorela@iki.fi> Reviewed-by: Damien Caliste <dcaliste@free.fr> Reviewed-by: <matti.viljanen@kapsi.fi>
* Fix nullptr warning on QObject::connect()Pekka Vuorela2025-11-061-4/+5
| | | | | | | | | And added couple 'static's to local functions etc while at it. Change-Id: I7b95c08199515f53ab0300117cdd3f1d19761b3b Reviewed-by: Pekka Vuorela <pvuorela@iki.fi> Reviewed-by: <matti.viljanen@kapsi.fi> Reviewed-by: Damien Caliste <dcaliste@free.fr>
* Remove obsolete translations and adjust the setupPekka Vuorela2025-11-0115-5814/+325
| | | | | | | | | | | | | | | | | | | | | | Practically not touched since initial commit. There is no QTranslator used in the whole repository so they shouldn't be much of help either. Library's .ts file contain lot of content coming from examples or deleted files. Translation are more or less empty except for some (mostly obsolete) German translations and a couple arabic words. Using strange names for translation files. The problems here are endless. Just removed the majority of the .ts files as crap. Kept -de and en_US as some basis for later adding these back, hoping that the -de as best translated earlier would have kept something but even that was basically nothing. Executed "lupdate -no-obsolete *.pro" to at least update the .ts files to match the current sources. Change-Id: I11e5fe8c84d1e17ab8e4fcf158594815261acfe0 Reviewed-by: <matti.viljanen@kapsi.fi> Reviewed-by: Pekka Vuorela <pvuorela@iki.fi> Reviewed-by: Damien Caliste <dcaliste@free.fr>
* Adjust messageserver naming versionsPekka Vuorela2025-11-011-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | On Qt6 it's strange to have messageserver5. Could have bumped the binary there to '6' but maybe we don't really need to highlight the qt version that much. The '5's were added to allow parallel installability but that really matters more on libraries etc rather than the server. We don't want parallel installed daemons fighting who gets autostarted first. Also on credential side it shouldn't matter which was the Qt version. Switching to newer version should still be about the same service. In practice don't think the names matter too much, and auth success is ignored so think it should be ok just changing the naming. Removed the '5's from examples too. No need there. Left the .pro file binary as it was as that side now mostly serves the Qt5 builds where we wouldn't benefit much from changing the binary name. Change-Id: Ie4a843c944caa73b080e3610baee4842500f029b Reviewed-by: Pekka Vuorela <pvuorela@iki.fi> Reviewed-by: Damien Caliste <dcaliste@free.fr> Reviewed-by: <matti.viljanen@kapsi.fi>
* Avoid qFatal in imap clientPekka Vuorela2025-11-011-6/+6
| | | | | | | | | | | Nicer if plugins don't try to make the whole messagingserver to exit. Removed also a couple qtopia references, an if() check that's guaranteed to succeed and did some more simplifications on servicehandler. Change-Id: Ibf98d57d86cd4f183f40d71b712ca1539f17b755 Reviewed-by: <matti.viljanen@kapsi.fi> Reviewed-by: Damien Caliste <dcaliste@free.fr> Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
* Simplify messageserver failure reportingPekka Vuorela2025-10-302-75/+44
| | | | | | | | | | The same thing for reporting account source failures was repeating again and again, including (in theory) translated strings. Change-Id: Ief4b40d8b1bbf84311bfe3ea398b856dbb7c344d Reviewed-by: <matti.viljanen@kapsi.fi> Reviewed-by: Pekka Vuorela <pvuorela@iki.fi> Reviewed-by: Damien Caliste <dcaliste@free.fr>
* Remove deprecated synchronizeAll requestPekka Vuorela2025-10-272-48/+0
| | | | | | | | | | | | | | | | | | | | | Small leftovers: pop service uses its synchronize() implementation also internally. ImapClient has a strategy for that which is set as ImapClient ctor. To be considered should the IPC / message source API be brought back for QMailRetrievalAction::synchronize(). Currently it ends up doing different sub-actions even if the original rationale was allowing the behavior to do thing in parallel. See commit 3e40ef86ac810. Also to worth note that this didn't possibly even work as the servicehandler code was doing exportUpdates() instead of synchronize(), maybe copy/paste error in commit 9c73f5415ace31 from the above request handler. Change-Id: I044732d63a11524a9b4d3a038123315c477d96e5 Reviewed-by: <matti.viljanen@kapsi.fi> Reviewed-by: Damien Caliste <dcaliste@free.fr> Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
* Remove deprecated retrieveAll requestPekka Vuorela2025-10-152-48/+0
| | | | | | | Change-Id: I3d973ca81b5dcf532233aa97c1065f93c6bb840e Reviewed-by: <matti.viljanen@kapsi.fi> Reviewed-by: Pekka Vuorela <pvuorela@iki.fi> Reviewed-by: Damien Caliste <dcaliste@free.fr>
* Remove more unnecessary usage of core5compatPekka Vuorela2025-10-143-5/+4
| | | | | | | | | | | | | | Besides QTextCodec in a couple places, the remaining use was just - Couple simple QRegExps in protocol plugins. - QLinkedList in messageserver. QList should be good enough for that. Also spotted one ancient symbian test file and cleaned up some minor details. Change-Id: I348fd8d54ca3a6a6fcba1a757f33c7b490661706 Reviewed-by: Pekka Vuorela <pvuorela@iki.fi> Reviewed-by: Damien Caliste <dcaliste@free.fr> Reviewed-by: <matti.viljanen@kapsi.fi>
* Fix service handler request castsPekka Vuorela2025-10-141-2/+2
| | | | | | | Change-Id: I15b64f07ea04427bd3174aa1ecb587936b35be75 Reviewed-by: <matti.viljanen@kapsi.fi> Reviewed-by: Pekka Vuorela <pvuorela@iki.fi> Reviewed-by: Damien Caliste <dcaliste@free.fr>
* Replace QmfList usage with QListPekka Vuorela2025-10-081-1/+0
| | | | | | | | | | | | QmfList was added on Qt6 migration as stopgap because of QList changes on iterator & content pointer details. Most of that seems to related to QMailMessageThreadedModel which now uses internally std::list. Doesn't seem that great stuff to begin with. Change-Id: I7c37cf69256273138e29001688de742c1d7ad40f Reviewed-by: <matti.viljanen@kapsi.fi> Reviewed-by: Pekka Vuorela <pvuorela@iki.fi> Reviewed-by: Damien Caliste <dcaliste@free.fr>
* Use common if/else brace and operator stylePekka Vuorela2025-10-062-9/+9
| | | | | | | | | And couple small simplifications too. Change-Id: Id5fe0a3e991961b9b39c92ab1b9b165c6f450289 Reviewed-by: Pekka Vuorela <pvuorela@iki.fi> Reviewed-by: Damien Caliste <dcaliste@free.fr> Reviewed-by: <matti.viljanen@kapsi.fi>
* Remove unneeded typedef QMailMessageCountMapPekka Vuorela2025-10-062-4/+6
| | | | | | | | | | Not used anywhere in the qmfclient side since commit d06d3db4dfdc6de or so. Change-Id: I64d341bf56b1e9a887566f06631958eee58677d0 Reviewed-by: <matti.viljanen@kapsi.fi> Reviewed-by: Pekka Vuorela <pvuorela@iki.fi> Reviewed-by: Damien Caliste <dcaliste@free.fr>
* Avoid (explicit) QmfList outside the libraryPekka Vuorela2025-09-291-2/+2
| | | | | | | | | | | | | | | | | Paving the way to get rid of the QmfList which was added sort of stopgap on Qt6 migration because of the QList changes. - Imap plugin using for() loop which should work for any container type returned by the methods. - tst_qmailstore unit test just getting the list of addresses after we are sure those won't change. A few more lines but avoids the custom type. - On previous changed also indexing fully 0 based to keep it more robust. "Hi 0" type of subjects shouldn't really matter on tests. Change-Id: I7a74dbe7654d5f3dd80435d5bf9af110b875b03a Reviewed-by: Damien Caliste <dcaliste@free.fr> Reviewed-by: <matti.viljanen@kapsi.fi> Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
* Avoid failing on expected unit test failures, and some cleanupsPekka Vuorela2025-09-291-1/+1
| | | | | | | | | | | | | | | | - Imap test is marked insignicant in .pro but that allows success also, cmake's WILL_FAIL doesn't. Comment out latter to avoid unexpected failure. - Instead of failing, skip tst_qmailstorageaction if there's no messageserver running as such is not there with simple 'make test'. - Removed some qtopia style file references, adjusted cosmetic details, added/removed #includes depending on whether needed or not. Avoiding some pointless trinary operators. Change-Id: Ia7f2fd8e7c7318a138e1cb043f1da436902943c0 Reviewed-by: Damien Caliste <dcaliste@free.fr> Reviewed-by: <matti.viljanen@kapsi.fi> Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
* Remove pointless prepareaccounts.cppPekka Vuorela2025-09-294-50/+0
| | | | | | | | | | The reason for the file seems more or less gone in 2009 commit 7827d40967a74 Change-Id: I6636c2bc559bebcd179fed8110c58faba6c3f094 Reviewed-by: Damien Caliste <dcaliste@free.fr> Reviewed-by: <matti.viljanen@kapsi.fi> Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
* Clean up some cosmetic detailsPekka Vuorela2025-09-194-6/+2
| | | | | | | | | | | | | | | | | | | Mostly coding conventions here. - Method opening braces to their own lines - Adjusted some inconsistent init list styles - Removed some redundant static declarations inside anon namespace - Replaced one delete loop with qDeleteAll() - Remove some trailing extra new lines - Added some missing spaces after commas - for (), if (), switch as common qt style - Removed some unnecessary scopes within switch cases Etc. Change-Id: Ide9ad7fea6f5fce3b854af2bf05874623c474028 Reviewed-by: <matti.viljanen@kapsi.fi> Reviewed-by: Damien Caliste <dcaliste@free.fr> Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
* Refactor ServiceHandler and avoid unnecessary data serializationPekka Vuorela2025-09-122-625/+855
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The serialization of request data is not only ugly but seemed problematic when trying to adjust the IPC serialization. Thus made the code use proper classes for storing the request related data. Was initially aiming at moving also the request code to some 'virtual bool execute()' type of method, but that wasn't trivial due to requests needing some private api to change the ServiceHandler state. But maybe this is a nice first phase anyway, limiting the changes done at once. While at it, did a bunch of other cleanups, simplifications, small fixes and comments for future work: - renamed reportFailures as reportPastFailures() to better indicate what it's about. - renamed Request::description as requestType which should better describe the member. - Moved internal ExpirySeconds from header to cpp - simplified markFailedMessage() to mark the failed message with the check for such need on calling place - minor functional change: retrieveNewMessages() wasn't doing the usual usesConcurrentActions() thing properly. Now passing the action id as rest. Change-Id: I8261c50492d7d496df777e69dbbc22f5485a87fa Reviewed-by: <matti.viljanen@kapsi.fi> Reviewed-by: Pekka Vuorela <pvuorela@iki.fi> Reviewed-by: Damien Caliste <dcaliste@free.fr>
* Rewrite logging with QLoggingCategoryDamien Caliste2025-06-134-74/+188
| | | | | | | | | Replace the custom logging mechanism with QLoggingCategory. Also declare the warnings with the proper category. Change-Id: If87d53d27ea0c65abd434af9f99fe49ce634d6dd Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
* Avoid confusing name overloading in messageserver's service handlerPekka Vuorela2025-05-192-124/+137
| | | | | | | | | | | | | | | Quite confusing when the same name is used for multiple slots and signals. Separated these by having slots as emitFoo or onFoo depending on what they do. onFoo is clearly a signal handler while emitFoo might be used directly and merely emits a signal. Would have used the new connect() syntax more but the signal sources also overload the signal names, making it painful to use here. Change-Id: I984c3565656a80dc8723b3c4296e2996e0748861 Reviewed-by: Damien Caliste <dcaliste@free.fr> Reviewed-by: Pekka Vuorela <pvuorela@iki.fi> Reviewed-by: <matti.viljanen@kapsi.fi>
* Add missing spaces after for/if/while/switchPekka Vuorela2025-05-092-10/+10
| | | | | | | Change-Id: I57c6ed78099b3359a16ce807da95325e755f0197 Reviewed-by: Pekka Vuorela <pvuorela@iki.fi> Reviewed-by: Damien Caliste <dcaliste@free.fr> Reviewed-by: <matti.viljanen@kapsi.fi>
* Remove trailing whitespace with sed scriptPekka Vuorela2025-05-093-20/+20
| | | | | | | Change-Id: Iebfffe7a6d5b2db40f0508ecd7c8ccddfa6665a6 Reviewed-by: Damien Caliste <dcaliste@free.fr> Reviewed-by: <matti.viljanen@kapsi.fi> Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
* Adjust and fix protocolRequest API - minor API breakPekka Vuorela2025-04-072-33/+49
| | | | | | | | | | | | | | | | | | | | | | | | | QMailProtocolAction::protocolRequest() is specified "The request may have associated \a data, in a protocol-specific form", which should mean that invalid QVariant() is allowed to indicate no data. This worked earlier but the D-Bus IPC broke it due to D-Bus wire protocol not allowing invalid variant, and QDBus was refusing to handle such: 'QDBusConnection: error: could not send message to service "org.qt.messageserver" path "/messageserver" interface "org.qt.messageserver" member "protocolRequest": Marshalling failed: Variant containing QVariant::Invalid passed in arguments' Side-stepped the problem by switching type to QVariantMap, which is simple to serialize empty and named parameters can be passed now without extra hassle. It's a small API break but the protocol requests are quite an advanced feature, and not used with the QMailMessageSource instances in this repository. Change-Id: I0a44026938d6e77bc7a89640cffe6efa38cc5616 Reviewed-by: Pekka Vuorela <pvuorela@iki.fi> Reviewed-by: <matti.viljanen@kapsi.fi> Reviewed-by: Damien Caliste <dcaliste@free.fr>
* Proper life-cycle management for messageserver plugins. API breakPekka Vuorela2025-02-272-5/+13
| | | | | | | | | | | | | | | | The setup here was quite broken, nobody really properly owned the created server plugin instances and the static instance deletion got rid of them at process shutdown in random order with other qmf stuff. Resulting in bad memory accessses and whatnot. Thus separating here the plugin api and the services the plugins can create. Needs a bit adjustment for the out-of-source plugins using this. Change-Id: I226d63ef985b215a09f6125a013bafdc80d69562 Reviewed-by: Pekka Vuorela <pvuorela@iki.fi> Reviewed-by: Damien Caliste <dcaliste@free.fr> Reviewed-by: <matti.viljanen@kapsi.fi>
* Move LongStream to server library, streamline the implementationPekka Vuorela2025-02-111-1/+1
| | | | | | | | | | | | | | | | | | The qmfclient was using this just to get storage info, which is somewhat out of scope for the class api anyway. And also the "errorMessage" meaning out-of-space error was bad API. Got rid of OS specific storage calculation in favor of QStorageInfo and streamlined the error string method. To me the implementation feels like trying a bit too much to check the available space, but I'll not touch that now. Change-Id: Ice4256c0cdf3fa3dc52c1354ab07a433862e66ae Reviewed-by: Damien Caliste <dcaliste@free.fr> Reviewed-by: <matti.viljanen@kapsi.fi> Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
* Store list of incomplete requests under the home directory rather than /tmpGuido Berhoerster2025-02-031-1/+1
| | | | | | | | | This fixes a symlink vulnerability caused by truncating /tmp/qmf-messageserver-requests on startup. Task-number: QTPLAYGROUND-56 Change-Id: I6e152e7ff1a84008e42f6abf5d0684af51220c33 Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
* Remove lock file usage from messageserverGuido Berhoerster2025-02-033-23/+29
| | | | | | | | | | Using DBus with a well known name already ensures that only a single instance can run. Thus refactor the constructor into init method which can fail in case of DBus errors and exit gracefully without dumping core. Also exit gracefully in case of database incompatibility Change-Id: I290cd438d47ea56cef4865a565c305cc2f884906 Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
* Add CMake build systemDamien Caliste2024-10-173-1/+52
| | | | | | | | | | | | | | | | Adjust source code where necessary like: - #include <private/...> cannot be used since private is the installation path, but not the path used in the sources, - fix map definition in qmailservice.xml, - had to add #include <qmailstore.h> to qmailserviceaction.h since qt_add_dbus_adaptor can only include one header, - add a method using QDBusVariant in ServiceHandler so the adaptor can call it. Change-Id: Idbecf4214dffdf523ccd8558370e8d2854b5d99a Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
* Remove SERVER_AS_DLLPekka Vuorela2024-04-012-14/+2
| | | | | | | | | I doubt this has been used anywhere in long time. Also for email client example it feels a bit strange. And there's was nothing setting it enabled on the example. Change-Id: I7a408ed490a84789000f2db8eebfa8324b493846 Reviewed-by: Matthew Vogt <matthew.vogt@qinetic.com.au>
* Remove cruft from some .pro files and remove pointless common.priPekka Vuorela2024-03-312-23/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | messageserver.pri not used anywhere. Neither PLUGIN_INTERNAL definition is no longer used anywhere. The common.pri isn't too good a common file as it's mostly included outside the src tree, only src/tools/messageserver uses it from the actual sources. Hence removing QMF_ENABLE_LOGGING shouldn't affect anything since it's used only in the libqmfclient for one thing. To use that properly one has needed the definition value passed externally. The win/mac special case release mode I didn't understand too well and neither did qtbase run_pro2cmake.py I was testing to proceed with cmake build. Unsure was that CONFIG_WIN working even in qt5 or was that some earlier thing. The mac bundle would have been used only for unit tests and such, so feels pointless. As neither target now even works because of d-bus ipc, let's just remove this part. Removing these makes the common.pri even more pointless so just moved the INSTALL=target to few places that were using the common.pri Change-Id: Ibfe6da554e0d452e09d08e184e22508c1af958e0 Reviewed-by: Damien Caliste <dcaliste@free.fr> Reviewed-by: Christopher Adams <chris.adams@qinetic.com.au>
* Switch to DBus for IPCDamien Caliste2023-11-068-510/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are two IPC mechanisms in QMF: - one between the messageserver and clients to perform actions like fetch emails, search, etc. - one between every mailstore instances to notify other instances of changes in the mail database. QCop being discontinued, this patch switchs to use DBus as an IPC transport layer. The first mechanism is implemented by registering an object on the session bus (/messageserver) providing a service (org.qt.messageserver). The second mechanism is implemented by registering each client as an object to the session bus (/mailstore/client) for the interface org.qt.mailstore. Other clients can then listen to updated() signal on this interface. DBus IPC requires to implement operator<<() and operator>>() with QDBusArgument for the objects that need to be transported. In all cases, each objects are serialised up to unitary elemental elements like int, byte arrays, etc. Except for the QMailKeyArgument that uses first a serialisation into a byte array before being sent. This is due to the recursive declaration of QMailKeyArgument with the subKeys members, not working well with QDBusArgument serialisation. Change-Id: I8f10b8b00f73d4b75dad778b591159a765e9fb89 Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
* Remove client to server email addition via a fileDamien Caliste2023-10-175-67/+0
| | | | | | | | | | | | | The possibility to transfer from client to the mail server new or modified emails by file has been deprecated by the usage of QMailMessageMetaDataList. The client side implementation is already using only the new method. So remove the server side implementation and IPC interface. Change-Id: I50df8ab04692748e3a1b66341f3b4cd05cc58501 Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
* Delete deprecated message count signals in IPCDamien Caliste2023-10-104-29/+12
| | | | | | | | | | | | | | | | | The newCountChanged signal is not used anymore in the message server. Remove the client code exposing it. Remove also client method acknowledgeNewMessages() since it's linked to newCountChanged signal to reset the counters. Remove the internal QMailMessageServerPrivate::initialize() since it's not called from anywhere and the server has no slot for this signal. Change-Id: Id5a67c22eae2c7190c3e02ed0681eab7037f1fcc Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
* Use a range for instead of foreachDamien Caliste2021-04-081-2/+2
| | | | | | | Change-Id: I33343e5d2c6c0b40e2bf70eb43b792221c980a36 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: David Llewellyn-Jones <david.llewellyn-jones@jolla.com> Reviewed-by: Christopher Adams <chris.adams@jolla.com>
* Use QmfList where required to maintain stable referencesChris Adams2021-04-081-13/+15
| | | | | | | | | | Any case where the address of an element is taken and stored or used, must be changed to use QmfList instead of QList, otherwise non-const operations will cause the reference to become invalid. Change-Id: Ic0017cb9eddcf27b93d26adb3ea9c71682c4421b Reviewed-by: Christopher Adams <chris.adams@jolla.com> Reviewed-by: David Llewellyn-Jones <david.llewellyn-jones@jolla.com>
* Use range constructors for lists and setsDamien Caliste2021-04-083-16/+22
| | | | | | Change-Id: Iccea2c86266b4c20777d939b291084cb709bf592 Reviewed-by: Christopher Adams <chris.adams@jolla.com> Reviewed-by: David Llewellyn-Jones <david.llewellyn-jones@jolla.com>
* Move away from deprecated QDateTime::fromTime_t and toTime_tDamien Caliste2021-04-082-7/+7
| | | | | | Change-Id: I978135949ee468e607d115bd31ff220f71c69368 Reviewed-by: Christopher Adams <chris.adams@jolla.com> Reviewed-by: David Llewellyn-Jones <david.llewellyn-jones@jolla.com>
* Update deprecated functions and suppress warningsDamien Caliste2018-09-291-1/+1
| | | | | | Change-Id: I2a88dafc4b47d42e27ae25c22ba03654c3830ff9 Reviewed-by: Pekka Vuorela <pvuorela@iki.fi> Reviewed-by: Matthew Vogt <matthew.vogt@qinetic.com.au>
* Fix unsafe signal handling in messageserverPekka Vuorela2018-09-293-37/+75
| | | | | | | | | | Qt code cannot be called from signal handlers so old version wasn't safe. Funny thing MessageServer already had proper handling, but it was overridden for sighup in main.cpp. Change-Id: I9ab55f943148b5cd62bb01eec0157e2500b57ba2 Reviewed-by: Christopher Adams <chris.adams@jollamobile.com> Reviewed-by: Matthew Vogt <matthew.vogt@qinetic.com.au>
* Use QTextDocument to parse htmlValério Valério2018-09-292-0/+14
| | | | | | | | | | | | Regular expression are not appropriated tool to parse a none regular language like html, a proper parse should be used. This commit introduces a dependency on QtGui making the messageserver binary marginally bigger in size. Usage of Html parse is optional can be defined via USE_HTML_PARSER compile flag. Change-Id: I2dba9042bb7f5340bfd8c24cb59c2a769489a7c6 Reviewed-by: Damien Caliste <dcaliste@free.fr> Reviewed-by: Matthew Vogt <matthew.vogt@qinetic.com.au>