summaryrefslogtreecommitdiffstats
path: root/src/plugins/messageservices/imap/imapclient.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Clean up service plugin signal connections - minor API changesPekka Vuorela6 days1-83/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Rename QMailMessageMetadata::content as contentCategoryPekka Vuorela6 days1-1/+1
| | | | | | | | | | | | | | | | | | | | The related functionality was confusing when setContent() didn't actually set any content but rather the type of it. Also there are other setContent() methods around that actually set the content. Then again calling this contentType() would have collided further in the inheritance tree by method returning a QMailMessageContentType which is referring to header fields. Thus switched this to a third distinct name. Old setter and getter names provided for backwards compatibility which should work at least for the very basic cases of setting and comparing type. Change-Id: I4c54548f3c2c85096fde64b3221e233dd3feefa3 Reviewed-by: Damien Caliste <dcaliste@free.fr> Reviewed-by: <matti.viljanen@kapsi.fi> Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
* Use more standard paths for user data, remove QMail::tempPath()Pekka Vuorela2025-11-121-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Adjust messageserver naming versionsPekka Vuorela2025-11-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | 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-5/+3
| | | | | | | | | | | 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>
* Polish QMailMessage classes, and something small elsewherePekka Vuorela2025-10-271-1/+0
| | | | | | | | | | | | | | | | | | | | - Made setBody() virtual and avoid dynamic_cast to check which type of instance was used - Cleaned up some cosmetic details, fixed typos etc - Restricted some variable scopes - Renamed some global constants with UpperCase name - Commented out some dead code - Use nullptr instead of NULL or 0 - Renamed vague "void QMailMessagePart::defaultContentType()" - Made attachment methods in QMailMessagePartContainer virtual. The implementation does some dynamic_casts to check the type of the instance, which would rather be better as overridden implementation. Didn't do that yet, but the virtuals should avoid a later ABI break if/when such is done. Change-Id: Ia7dc212a1b609d0b02c2cc269082a0e39667c157 Reviewed-by: Damien Caliste <dcaliste@free.fr> Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
* Use pointer for out-parameters in QMailMessageClassifierPekka Vuorela2025-10-201-2/+1
| | | | | | | | | Easier to follow side-effects in caller side. Change-Id: Ife9d9d159bf4aaa3bbeffc858797381839bf03bf Reviewed-by: <matti.viljanen@kapsi.fi> Reviewed-by: Pekka Vuorela <pvuorela@iki.fi> Reviewed-by: Damien Caliste <dcaliste@free.fr>
* Minor API break: remove QMailMessage CR/LFPekka Vuorela2025-10-141-5/+7
| | | | | | | | | | | | These don't really belong here, and QChar::CarriageReturn and QChar::LineFeed have existed since Qt 5.0. Not even bothering deprecating, the switch to QChar is trivial enough. Change-Id: Ic4d48fcb27436c55f26c9e735b8d1a96d1a5fa9e Reviewed-by: Pekka Vuorela <pvuorela@iki.fi> Reviewed-by: <matti.viljanen@kapsi.fi> Reviewed-by: Damien Caliste <dcaliste@free.fr>
* Clean up ImapClientPekka Vuorela2025-10-141-134/+92
| | | | | | | | | | | | | | | | - Some switches were mixing return; and break; without any actual difference between them. - retrieveMessages() accountCheck parameter was named wrong in declaration vs implementation - Some slot parameters were declared const but implementation not having such. - Simplified error handling in a method to consistently handle error first instead of nesting deeper into ifs. Change-Id: I99b2528b20db9bbdf801bc7dbe361cc7b361b9f8 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-061-15/+13
| | | | | | | | | 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>
* Clean up some cosmetic detailsPekka Vuorela2025-09-191-5/+5
| | | | | | | | | | | | | | | | | | | 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>
* Remove support for QT_NO_SSLPekka Vuorela2025-09-181-2/+0
| | | | | | | | | | In the world of today there shouldn't be much sense in doing email stuff without encryption support. Simplify code a bit by removing the ifdeffing. Change-Id: I90d90cd1ef11eed2ebd625dafee2f78b7d039233 Reviewed-by: <matti.viljanen@kapsi.fi> Reviewed-by: Pekka Vuorela <pvuorela@iki.fi> Reviewed-by: Damien Caliste <dcaliste@free.fr>
* Simply notify on authentication errorDamien Caliste2025-09-171-6/+6
| | | | | | | | | | | | | | | | Let the credential implementations decide what to do on authentication error: either invalidate or retry. Adjust the API accordingly. Apply this change when caching credential data in the SingleSignOn plug-in: Don't make SSO calls on each service connection, use cached values instead. Only reset the cached values when the authentication fails with wrong credentials. Change-Id: I14fbe416567d552e7729ad8579fd9a763a3f6749 Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
* Don't report credentials error after a connection being closedDamien Caliste2025-07-041-11/+11
| | | | | | | | | If the connection already breaks while waiting for the credentials to be fetched, it should not report error or proceed to login. Change-Id: I68a6f95232bdde03cc6cd52a2e0bf3cdfc989772 Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
* Rewrite logging with QLoggingCategoryDamien Caliste2025-06-131-57/+57
| | | | | | | | | 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>
* Add missing spaces after for/if/while/switchPekka Vuorela2025-05-091-4/+4
| | | | | | | 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-091-34/+34
| | | | | | | Change-Id: Iebfffe7a6d5b2db40f0508ecd7c8ccddfa6665a6 Reviewed-by: Damien Caliste <dcaliste@free.fr> Reviewed-by: <matti.viljanen@kapsi.fi> Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
* Continue login when there is no valid push foldersDamien Caliste2025-03-261-1/+1
| | | | | | | | | | | | | | | | | Currently, login is deferred until all configured push folders have been established (or failed), when push email is enabled. This does not work for a newly created account where there is no folder registered. This patch ensures that the code continues to the login when push email is enabled but when there is no valid configured folders. Change-Id: I397d4d2616c3c6cebc9a3f4dcc03f4b5e3564ebe Reviewed-by: Guido Berhoerster <guido+qt@berhoerster.name> Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
* Don't continue on log-in after idle renewalDamien Caliste2025-02-281-3/+5
| | | | | | | | | Fix a regression introduced in 679b6a2d. The setIdlingForFolder() is also called on idle renewal, when the main session is in logout state. There is no need to ask for a login then. Change-Id: Iec6649a529a2d2b5b9b9d817f0ea2df5ff03f383 Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
* Make ImapService the only place to delay push mail restartDamien Caliste2025-02-281-46/+13
| | | | | | | | | | | | | | | | | | | | | | | The IdleProtocol was delaying its signal emission of openRequest in case of an error. Then the client emitted restartPushEmail and the service was immediately calling initiatePushEmail(). This is the case when the error happened in the idle protocol. But the service is already having a delayed machinery to restart the idle session in case an error happens in the main client session. This patch is removing the delay timer in IdleProtocol so any error happening there is immediately reported to the service, which decides to delay the call to initiatePushEmail(). This requires some safe guards to be added in the service to ensure that the delay is applied only once even when there are several push folders emitting errors. Change-Id: I2b49c0445640d58bb391088b602f152cfe45eb49 Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
* Synchronize idle renewal timersDamien Caliste2025-02-281-10/+18
| | | | | | | | | | | Use a common QTimer in ImapClient for every IdleProtocol, so the network accesses to renew the idling connections are all done in a close- by period of time, allowing the radio to sleep for a longer time between wakes-up. Change-Id: I7c9378a0af74015a34fd6cc98fa9517433d28392 Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
* Report client error even when establishing idle connectionsDamien Caliste2025-02-211-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | The errorOccurred signal is only emitted for client session, and not for idle connections (there are reporting via the client itself, which emits restartPushEmail signal for idle errors). It is thus necessary to report any error the client is emitting. If the client session was launched to establish idle connections and these sessions are not running, then one should retry to reestablish the idle connections later. Without the patch, in case of a non responding server (connection to a captive portal without network granted yet), the client error was not reported when the connection could not be established. It was accepted wrongly as succeeded when a new attempt to establish idle connections was made and Source::retrievalCompleted() was emitted when queueing the idle folder for scan. But with the retry timeout becoming larger and larger, the strategy expiry timeout finally kicked in and the service was fully restarted. Change-Id: I206e77f221d2a7c4bdfcee1952dbe1127431e6d6 Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
* Reduce status variable number in ImapClient::monitor()Damien Caliste2025-02-211-59/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Makes the idle state to rely on _monitored and _waitingForIdleFolderIds variables only. _monitored is the set of IdleProtocol listening to changes in a folder. _waitingForIdleFolderIds is a subset of _monitored, listing folder where the protocol was started, but has not reached yet the idling status. _idlesEstablished can be replaced by a combination of the two, being true when and only when some folders are monitored and all of them are in the idling state. Old variable _waitingForIdle is not needed anymore if monitor() function is modified to ensure that the list of folders given as argument is properly transformed into monitored folders, and only these folders as argument. Calling monitor on the same list is a no operation, making _waitingForIdle completely obsolete. A new closeIdleConnections() function is added to the public API of ImapClient, since there was previously no mean to close idle connections, except by killing the client itself. This is achieved internally by closing non desired idle protocols in monitor() before checking if the settings are push enabled. Change-Id: I8c62b6d5ff7150ee2c90d7dcfec3bd44f66cf7b6 Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
* Make configuration local in the IMAP clientDamien Caliste2025-02-191-34/+45
| | | | | | | | | | | | | | | | Avoid a complete restart of the client on setting changes. Reload of the configuration was already done at each new connection. But completion of the client task may take time and settings could be changed in-between. Let instead the client reports a failure if the settings are not correct. Doing a deletion of the client and a recreation of the client on setting changes won't allow a running task to complete anyway. Change-Id: Icf11e6f33a5574d8cd7ccd07fe2f3f06e2d5d558 Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
* Add a couple null pointer checksPekka Vuorela2025-02-141-1/+1
| | | | | | | Change-Id: Id4cac8f496e9734f8f9b514e5d6c9234d0438508 Reviewed-by: <matti.viljanen@kapsi.fi> Reviewed-by: Damien Caliste <dcaliste@free.fr> Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
* Remove semicolons after method bodiesPekka Vuorela2025-02-141-1/+1
| | | | | | | | | | Fixed also a copy-paste error on qmailthreadsortkey_p.h. Change-Id: Ide4bb24e69a94f64c9521f5c4cce7a33921fab11 Reviewed-by: <matti.viljanen@kapsi.fi> Reviewed-by: Damien Caliste <dcaliste@free.fr> Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
* Setup IMAP account status in one placeDamien Caliste2025-02-031-11/+15
| | | | | | | | Centralize the status flags according to IMAP possibilities into ImapClient. Change-Id: I1019a9348f53ce98124baf297136f6e285c996dd Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
* Wait for credentials fetching in idle protocolDamien Caliste2025-02-031-24/+54
| | | | | | | | | | | | | | While an idle connection is setting up, the main client, with the credentials, may not yet have fetched and receive the credentials. Thus, authentication of within the idle protocol may fail. This patch delays sendLogin() for idle protocols waiting for the credentials to be ready. Change-Id: If14a4104f5943dcb32eda7fd969623a1ab362b0f Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
* Set accountId on construction for IETF clientsDamien Caliste2025-01-281-14/+7
| | | | | | | | | | A client is created by the corresponding service. A service is linked to an account on construction. There is no use case to change the account during the life time of a client. Change-Id: I43c60741d28b011bef9c7770433557cf54e870e6 Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
* Add a plugin mechanism to handle credentialsDamien Caliste2025-01-151-12/+74
| | | | | | | | | | | Credentials for authentication can be username / passwords or something more complex. The storage for such data can also be done outside QMF. So this commit introduce a plugin mechanism to get such credential data. Change-Id: I26ec6e98b5e900a9f93c420b00f0253f2abad25c Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
* Use QMailServiceConfiguration in authenticatorDamien Caliste2024-10-311-2/+2
| | | | | | | | | | This API change allows to create the service configuration in each plugin with its object constructor instead of its name. Change-Id: I77b253a795d6b452fbeb650cf80d925e5c53e724 Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
* Add CMake build systemDamien Caliste2024-10-171-1/+1
| | | | | | | | | | | | | | | | 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 Factory from QMailCryptographicServiceFactoryDamien Caliste2024-04-101-1/+1
| | | | | | | | | | | This class is not simply a factory creating instances of crypto plugins, but it's more like a service, providing methods on QMailMessagePart to execute cryptographic operations like signing or signature verification. Change-Id: I74f65f27137e3bfe78c0f9614728eca37a031b0c Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
* Remove traces of QAlignedTimerPekka Vuorela2024-04-011-17/+0
| | | | | | | | For what I can tell, this was something in Qt Mobility long time ago. Shouldn't be a thing anymore. Change-Id: Ice7bf7ffb9c561f0757c970eed7804508c1735f3 Reviewed-by: Matthew Vogt <matthew.vogt@qinetic.com.au>
* Mark overridden methods with keywordPekka Vuorela2023-12-141-3/+3
| | | | | | | | | | | | | Avoiding a lot of compiler noise from -Wsuggest-override. Also removed the now even reduntant virtual keywords on overridden methods as per qt coding conventions. And wrapped some overly long lines touched by the changes. Change-Id: I4e7febfa9554dfa7f366a1aabba6133a9f6c5614 Reviewed-by: Matthew Vogt <matthew.vogt@qinetic.com.au> Reviewed-by: Damien Caliste <dcaliste@free.fr> Reviewed-by: Christopher Adams <chris.adams@qinetic.com.au>
* Add QMailMessage::CalendarCancellation flagDavid Llewellyn-Jones2023-11-151-1/+2
| | | | | | | | | | | | | | | | | | | | | | Introduces a CalendarCancellation flag similar to the QMailMessage::CalendarInvitation to be matched against the QMailMessage::status() bitfield. While the CalendarInvitation flag indicates that the message contains an attachment of type text/calendar with "REQUEST" method, the CalendarCancellation flag indicates that there's an attachment of type text/calendar with "CANCEL" method type. In other words, a calendar event cancellation. For reference, the "CANCEL" method of the Content Type header is described in RFC2447 (iMIP) Section 2.4 [1] in combination with the RFC2446 (iTIP) sections 3.2 and 3.2.5 [2] [1] https://tools.ietf.org/html/rfc2447#section-2.4 [2] https://tools.ietf.org/html/rfc2446#section-3.2 Change-Id: I1ef1d8a070e527552dae1ebe1677156bc07ba04d Reviewed-by: Matthew Vogt <matthew.vogt@qinetic.com.au>
* Fix some compiler warningsPekka Vuorela2023-11-131-2/+2
| | | | | | | | | Avoid unused variable, QString conversion from ascii and move fall through note so GCC detects it. Change-Id: Id50a2b90c8c8c345a117c713849f65f45515eddb Reviewed-by: Christopher Adams <chris.adams@qinetic.com.au> Reviewed-by: Damien Caliste <dcaliste@free.fr>
* Check if IDLE connection needs to be established after loginDavid Llewellyn-Jones2021-04-091-0/+10
| | | | | | | | | | | Some servers only advertise full capabilities after sucessful login, so we need to check if IDLE connection needs to be established in such cases. Created by Valério Valério <valerio.valerio@jolla.com>, 11 May 2015. Change-Id: I307f7be0e07b1639c80f01a3205bcff9de96525a Reviewed-by: Christopher Adams <chris.adams@jolla.com>
* Set new IMAP folders to inherit SynchronizationEnabled flagDavid Llewellyn-Jones2021-04-091-1/+4
| | | | | | | | | | | | | | | | | When new folders are received from the server, the client-side SynchronizationEnabled flag must be set for them. Previously they were always set to true, but if they're inside a folder that isn't being synced, this probably doesn't reflect the user's intent. This change makes it so that for IMAP any new folders received from the server will have the SynchronizationEnabled flag set to whatever value their parent has it set to. If they have no parent (i.e. are in the root folder) then the flag is set to true as before. Change-Id: If43d5e2b4469a402d203841c04cc4b1b30ffc3b1 Reviewed-by: Christopher Adams <chris.adams@jolla.com> Reviewed-by: Matthew Vogt <matthew.vogt@qinetic.com.au> Reviewed-by: Damien Caliste <dcaliste@free.fr>
* Fix some warningsChris Adams2021-04-081-3/+3
| | | | | | Change-Id: Ifad72f55ca3988e84749d9f8868ec6d8d6c986ec Reviewed-by: Christopher Adams <chris.adams@jolla.com> Reviewed-by: David Llewellyn-Jones <david.llewellyn-jones@jolla.com>
* Use QmfList where required to maintain stable referencesChris Adams2021-04-081-3/+3
| | | | | | | | | | 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 QMultiMap when necessary instead of QMapDamien Caliste2021-04-081-1/+1
| | | | | | Change-Id: Iabf4dad9998e46163e4f2e2090419c662a817377 Reviewed-by: Christopher Adams <chris.adams@jolla.com> Reviewed-by: David Llewellyn-Jones <david.llewellyn-jones@jolla.com>
* Add network listeners to IDLE connectionsPekka Vuorela2019-03-211-0/+13
| | | | | | | | | | | | | | | | | | | | | | Use QMailAccount::HasPersistentConnection status flag for IMAP idle instead of updating last sync time every minute, this reduces accounts db writes (they trigger notifications to other processes). Trigger IDLE connection error on session error. When a network session error occurs (e.g. the Wifi connection changes), the connection can sometimes become unusable, but without generating a transport error. IdleProtocol only listens for transport errors, so this can leave the IDLE connection broken until the 28 minute failsafe timer triggers. This patch pushes network session errors from ImapService through to the IdleProtocol objects, so they can act in the same way as if a transport error had occurred, causing them to restart after a short delay. Change-Id: I8034df3d40fcc8e100ae204beee9251629a95704 Reviewed-by: Rolf Eike Beer <eb@emlix.com> Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
* Ensure on startup that pop3/imap accounts and folders have correct flagsMichael Nosov2018-11-011-0/+9
| | | | | | | | | | | | | | | | | | For IMAP, ensure that: - IMAP account has 'CanCreateFolders' flag set For POP3, ensure that: - POP3 account has 'CanCreateFolders' flag unset - Inbox folder has 'MessagesPermitted' flag set during sync - All POP3 non-local folders have "DeletionPermitted=false" "RenamePermitted=false" "ChildCreationPermitted=false" "MessagesPermitted=true" Change-Id: I547e756a1cc4d25d47c832d6247c5472f6308ae1 Reviewed-by: Pekka Vuorela <pvuorela@iki.fi> Reviewed-by: Matthew Vogt <matthew.vogt@qinetic.com.au>
* Add an interface for cryptographic operationsDamien Caliste2018-10-241-1/+76
| | | | | | | | | | | | | | Create a new interface for cryptographic operations like digital signatures. Also implement two plug-ins based on GPGme implementing the OpenPGP and S/MIME protocols. To allow digital signature checking to work, pristine data as received from the server need to be stored. This patch is adding such "undecodedData()" information to the content manager. The IMAP implementation has been updated also to ensure that pristine data can be retrieved and saved. Change-Id: Ic801b0de84b42c16f6c64fffdd67dc51c2b8b9b9 Reviewed-by: Christopher Adams <chris.adams@jollamobile.com>
* [qmf] onlineMoveFolder API + IMAP implementationMichael Nosov2018-08-231-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | API to move folder in the hierarchy. Implementation is mostly based on 'onlineRenameFolder' API implementation Testing: ======== 1) Gmail account: Try to move a folder from one folder to another. Expected result: move success 2) Gmail account: Try to move a folder from one folder to root. Expected: move success 3) Gmail account: Try to move top-level (root) folder to some other folder. Expected result: move success 4) Binary compatibility - Verify that existing 3rd party QMF plugins still work well with new QMF - Try to move folder for 3rd party QMF account (which doesn't have implementation of MoveFolder) Verify that MoveFolder action is failed. Verify in logs that action is completed with "This function is not currently supported" error 5) Gmail account (handling errors): - Delete folder A on Web UI - Try to move folder A to folder B on device - Verify that action is failed - Try to perform some moveFolder operations again - Verify that those operation are completed (e.g. completion is not freezed) Change-Id: Ifd59ad4fe9c41d17963aa64101b203d31dcdfb2d Reviewed-by: Christopher Adams <chris.adams@jollamobile.com>
* [qmf] IMAP: handle errors for Create/Rename/Delete online folder actionsMichael Nosov2018-08-231-13/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem description: classes ImapCreate(Delete/Rename)FolderStrategy have internal '_inProgress' counters to support multiple requests processing. However, when some action is completed with error - instances of those classes are not notified at all. Thus, counters are never become zero and actions are never completed on client side Additional fixes: don't allow create/rename folder if new name contains IMAP delimiter. Even if IMAP RFC allows this, it will create multiple folders instead of 1, and it contradicts with user expectations (and with IMAP plugin expectations as well) Testing: ======= Use IMAP Gmail account Delete Folder: -------------- - Have some folder 'A' and folder 'B' in Gmail structure - From Gmail Web UI, delete folder 'A', don't sync with device (I used jolla-email) - On device try to delete this folder 'A' - Action is completed with error - Delete folder 'B' on device - Without the fix: action will not be completed (even if folder is really deleted) - With the fix: action is completed successfully Rename folder 1: - Have some folder 'A' and folder 'B' in Gmail structure - From Gmail Web UI, delete folder 'A', don't sync with device (I used jolla-email) - On device try to rename this folder 'A' - Action is completed with error - Rename folder 'B' on device - Without the fix: action will not be completed (even if folder is really renamed) - With the fix: action is completed successfully Rename folder 2: - Have some folder 'A' in Gmail structure - Try to rename it to 'A/B/C' (where / is IMAP delimiter) - Without the fix: folder will be created incorrectly (and there will be some empty name folders on device) - With the fix: action will be completed with error. Log will indicate that folder name contains IMAP delimiter - The same scenario is applicable to 'Create' folder action Change-Id: I126f60d38a068a7ffd6cd86b5293866c31bd7633 Reviewed-by: Christopher Adams <chris.adams@jollamobile.com> Reviewed-by: Matthew Vogt <matthew.vogt@qinetic.com.au>
* [qmf] IMAP: '\\Junk' folder flag shall not be ignoredMichael Nosov2018-08-061-14/+21
| | | | | | | | | | Spam folder, check attributes "\\Spam" and "\\Junk" (see rfc6154, Section 2). Flag "\\Junk" also may indicate that current folder is for spam Example IMAP response (provider yandex.ru): * XLIST (\Unmarked \HasNoChildren \Junk \Spam) "|" "&BCEEPwQwBDw-" Change-Id: Ia4d641d218ea85bf4b9df8c76412adaf1de07a16 Reviewed-by: Christopher Adams <chris.adams@jollamobile.com>
* [qmf] IMAP: encode folder name with non-US charactersMichael Nosov2018-08-031-121/+2
| | | | | | | | | | | | | | | | | Part 1: Encode folder name on create/rename according to RFC 3501, section 5.1.3. Part 2: Move decode/encode implementation in separate files, because decodeFolderName also needs to be used in ImapRenameFolderStrategy::folderRenamed Testing (Gmail): ------- - Create folder with non-English chars (e.g. "Папка") using onlineCreateFolder API - In web interface - verify that folder name is correct - Rename folder to some another non-English name using onlineRenameFolder API - Verify that folder is renamed correctly (Web interface and local device) Change-Id: Ifb93cacb8832992d796037eb3fb47c4253e08d14 Reviewed-by: Matthew Vogt <matthew.vogt@qinetic.com.au> Reviewed-by: Christopher Adams <chris.adams@jollamobile.com>
* [qmf] IMAP: avoid creation of folders with empty names during syncMichael Nosov2018-07-201-1/+4
| | | | | | | | Fix for ImapClient::mailboxListed: avoid empty folder creations on following IMAP response * LIST (\Noselect) "/" "/" Change-Id: I7fa151fc3f9e93ac04641d2bb54acb469bb3aea7 Reviewed-by: Matthew Vogt <matthew.vogt@qinetic.com.au>