summaryrefslogtreecommitdiffstats
path: root/src/plugins/messageservices/imap/imapstrategy.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Rewrite logging with QLoggingCategoryDamien Caliste2025-06-131-78/+78
| | | | | | | | | Replace the custom logging mechanism with QLoggingCategory. Also declare the warnings with the proper category. Change-Id: If87d53d27ea0c65abd434af9f99fe49ce634d6dd Reviewed-by: Pekka Vuorela <[email protected]>
* Add missing spaces after for/if/while/switchPekka Vuorela2025-05-091-37/+37
| | | | | | | Change-Id: I57c6ed78099b3359a16ce807da95325e755f0197 Reviewed-by: Pekka Vuorela <[email protected]> Reviewed-by: Damien Caliste <[email protected]> Reviewed-by: <[email protected]>
* Remove trailing whitespace with sed scriptPekka Vuorela2025-05-091-125/+125
| | | | | | | Change-Id: Iebfffe7a6d5b2db40f0508ecd7c8ccddfa6665a6 Reviewed-by: Damien Caliste <[email protected]> Reviewed-by: <[email protected]> Reviewed-by: Pekka Vuorela <[email protected]>
* Make configuration local in the IMAP clientDamien Caliste2025-02-191-69/+76
| | | | | | | | | | | | | | | | 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 <[email protected]>
* Switch to CamelCased Qt #includesPekka Vuorela2025-02-121-2/+4
| | | | | | | Change-Id: Ifa2dad56db9667fcbeaff4c618a8a8de75d693c4 Reviewed-by: Damien Caliste <[email protected]> Reviewed-by: Pekka Vuorela <[email protected]> Reviewed-by: <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* Set replied and forwarded flags on message update from serverDamien Caliste2023-11-211-0/+10
| | | | | | | | | | | | | The replied flag (\Answered in IMAP protocol) is properly set for a new mail. But it was not set on a qresync action (fetching mail updates). The forwarded flag ($Forwarded as an extension in IMAP protocol), was detected in the received flags but was not set or updated in created QMailMessages. Change-Id: I78eb16650dc706e08fee1c6aab68d601159a52e4 Reviewed-by: Pekka Vuorela <[email protected]>
* Add QMailMessage::CalendarCancellation flagDavid Llewellyn-Jones2023-11-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | 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 <[email protected]>
* Follow the synchronizationEnabled flag when folders are not specifiedDamien Caliste2021-04-091-9/+23
| | | | | | | | | | | | | | If the synchronizationEnabled flag is set to false, a variety of strategy, like search, folder listing, will not search in such folders. This is maybe a too restrictive usage of this flag. This patch change the behavior of this flag to act on synchronization strategies only, when desired. It activates it only for message retrieval in all folders. Change-Id: Iebec872984c7e2650167ae585b06bfa3d8cd6990 Reviewed-by: Christopher Adams <[email protected]> Reviewed-by: David Llewellyn-Jones <[email protected]>
* Use QmfList where required to maintain stable referencesChris Adams2021-04-081-14/+14
| | | | | | | | | | 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 <[email protected]> Reviewed-by: David Llewellyn-Jones <[email protected]>
* Use range constructors for lists and setsDamien Caliste2021-04-081-10/+14
| | | | | | Change-Id: Iccea2c86266b4c20777d939b291084cb709bf592 Reviewed-by: Christopher Adams <[email protected]> Reviewed-by: David Llewellyn-Jones <[email protected]>
* Don't download twice part content in case of signed message with IMAP protocolDamien Caliste2018-12-211-18/+20
| | | | | | | | | | | | | | | | | | | | | There is an issue with the current implementation that downloads twice the part content in case of subparts and signed mails. For instance a mail with this layout: 1: multipart/signed 1.1: text/plain 1.2: image/png 2: application/pgp-signature will trigger in mode RetrievalAction::Auto the following requests: 1-HEADER // as a signed part 1-BODY // as a signed part 1.1-BODY // as a text part 2-BODY // as a non attachment part which will result in text/plain part being downloaded twice and appended twice in a text file. To avoid this, this patch don't append to the list of requests any requests that are within a signed part. Change-Id: I654d020acf2a6a1fe26ae53ad667a84e7ea90c2e Reviewed-by: Matthew Vogt <[email protected]>
* Add an interface for cryptographic operationsDamien Caliste2018-10-241-32/+60
| | | | | | | | | | | | | | 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 <[email protected]>
* Set highestmodseq to zero when server using QRESYNC does not support ↵Robin Burchell2018-09-111-1/+1
| | | | | | | | permanent modsequences. Change-Id: Idc61404580f308e22df90559f4a7d7a59759b273 Done-with: Valério Valério <[email protected]> Reviewed-by: Valerio Valerio <[email protected]>
* Introduce a new function to test content type contentDamien Caliste2018-09-111-5/+4
| | | | | | | | | | | Create a new function to ensure that content type matching is always done case insensitive. Originally the comparison was done after a toLower(), but forgetting this, like in src/libraries/qmfclient/qmailmessage.cpp#6252, can create bugs. Change-Id: Ia93e068e5374c346c94c2afe4de768d3833b4a9a Reviewed-by: Pekka Vuorela <[email protected]>
* Handle 'Deleted' flag properly for IMAP accountsValério Valério2018-09-071-8/+37
| | | | | | | | | | | | | Some email clients (e.g Thunderbird) have an option to just flag a email as deleted and still leave it around, those will go way once the folder is expunged or they can also be marked as undeleted before that. We were not handling this case well before, now those emails are correctly updated and the client can choose to show them or just hide them from the lists checking the status flag QMailMessage::Removed. Change-Id: I9c98481c8994be5226ccde544a091e4fc7b54e4c Reviewed-by: Christopher Adams <[email protected]> Reviewed-by: Matthew Vogt <[email protected]>
* [qmf] onlineMoveFolder API + IMAP implementationMichael Nosov2018-08-231-1/+109
| | | | | | | | | | | | | | | | | | | | | | | | | | 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 <[email protected]>
* [qmf] IMAP: handle errors for Create/Rename/Delete online folder actionsMichael Nosov2018-08-231-14/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <[email protected]> Reviewed-by: Matthew Vogt <[email protected]>
* Replace deprecated qSort/qLowerBound/qGreater with std methodsPekka Vuorela2018-08-161-3/+3
| | | | | Change-Id: Ia3913b998f3686d6f047d02d8781a7297b018bbd Reviewed-by: Christopher Adams <[email protected]>
* [qmf] IMAP: encode folder name with non-US charactersMichael Nosov2018-08-031-1/+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 <[email protected]> Reviewed-by: Christopher Adams <[email protected]>
* [qmf] IMAP: fix for rename top level folderMichael Nosov2018-08-021-11/+11
| | | | | | | | | | | | | | | | | When renaming top level folder - descendant folder paths were not updated Scenario: for IMAP account, have the following hierarchy: Folder1 -> Folder2 If delimiter is "/", then path for Folder2 shall be Folder1/Folder2 Step 1: rename Folder1 to Folder1_new Step 2: try to rename Folder2 to Folder2_new. Expected result: Folder2 will be renamed Actual result: Folder2 will not be renamed, because its full path is still Folder1/Folder2, not Folder1_new/Folder2 IMAP error will be like "NO Unknown source folder. (Failure)" Change-Id: Ia3a78ffd38c44b7babda93ed554b914cb8bcc47d Reviewed-by: Matthew Vogt <[email protected]> Reviewed-by: Christopher Adams <[email protected]>
* Set contentAvailable and encoding correctly for transferred body parts.Valerio Valerio2015-08-281-1/+9
| | | | | Change-Id: I5ee07f902ddb7f6b2d6ea4662070757df74f22ad Reviewed-by: Robin Burchell <[email protected]>
* Update licensing to match latest approach in QtCore.Robin Burchell2015-08-281-22/+14
| | | | | Change-Id: Icce55517963f0cbc35211e9fc6f1a0fc413f5676 Reviewed-by: Simon Hausmann <[email protected]>
* Don't enqueue preferred body part for fetching twiceValerio Valerio2014-03-261-10/+12
| | | | | | | | | | | | | For mutipart/alternative mails the code introduced by commit: a7096490c094608239918ebbdbcca8003e81a8de, enqueues the preferred body part twice when the content size is bigger that maxMailSize, causing the part to be written twice. Signed-off-by: Valerio Valerio <[email protected]> Change-Id: I9367494efc19d6a7de73c558044eaab4ca8974c3 Reviewed-by: Matthew Vogt <[email protected]> Reviewed-by: Robin Burchell <[email protected]>
* Convert qmfclient & qmfmessageserver into Qt modules: QmfClient & ↵Robin Burchell2014-01-231-1/+1
| | | | | | | | | | | | | | | | | | | | | QmfMessageServer. This was not possible prior to now due to Qt 4 support hanging around like the undead vampire it is, but now we purged it with fire and light, and the build system looks a lot less like a stinky, decomposed corpse. There's still a lot of surprises lurking: qtmail is one such surprise. I don't quite grasp why it's so heavy on plugins, and qmfutil also needs some... attention. But at least it's a start. As part of this work, we rename the qcop headers to fit the private convention. This could have been done in a prior commit, but given that I didn't have an easy way to build prior to this commit, I opted to roll them together. Change-Id: Ia3e288ffc3639a7751c9040ceecb54fca77a31b1 Reviewed-by: Oswald Buddenhagen <[email protected]> Reviewed-by: Matthew Vogt <[email protected]> Reviewed-by: Valerio Valerio <[email protected]>
* Change to new-form Digia license headers.Robin Burchell2013-02-121-24/+24
| | | | | Change-Id: If0f4427ee93a37de4ebd9e097defd8b3956f0fc6 Reviewed-by: Lars Knoll <[email protected]>
* Fix bug in meta data analysis algorithmDon Sanders2012-05-311-17/+33
| | | | | | | When determing which parts of a message to download make sure to give highest priority to the preferred body part, if a preferred body part (text/plain or text/html) is defined.
* Fix synchronization bug for qresync capable servers.Don Sanders2012-05-281-1/+4
| | | | | | | highestmodseq for folders wasn't being recorded in mailstore until the second sync. So flag changes and deletions made by another client between the first and second sync weren't being detected.
* Add new QMailMessage::NoNotification flagDon Sanders2012-05-151-0/+3
| | | | | | | | | | | This flag indicates that a new message notification should not be shown for the message. e.g. an older message retrieved in a folder that has previously been synchronized, or an existing message moved to a folder such as trash, or a message externalized by saving in a drafts or sent folder It should only be used for new messages, e.g. messageAdded signal. (I've also included some missing doc in the commit.)
* Fix a bug where externalize/move operations were leaking files.Don Sanders2012-04-191-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Need to set content scheme and identifier for effected mails. Did numerous tests to ensure there are no regressions, details below * Tests with sent folder and trash folder on server for fwod server * 1) check forward without download send and check mail is in sent folder on server sync and check mail is in inbox check can get attachment for message in inbox check can get attachment for message in sent folder 2) move to trash complete mail check moved mail in trash on server is ok before/after sync check moved mail is shown in universal trash before/after sync 3) move to trash partially downloaded (forwarded) mail in inbox forward without download again check mail in trash on server is ok before sync check can complete mail (download attachment) before sync check moved mail is shown in universal trash before sync 4) move to trash partially downloaded (forwarded) mail in inbox forward without download again check mail in trash is ok after sync check can complete mail (download attachment after sync) check moved mail is shown in universal trash after sync 5) copy message to trash (only works for complete messages) check copied message is in trash (noticed that only metadata is fetched for copied message, but can retrieve rest of mail using GUI) 6) remove from trash check still removed after sync 7) normal send, restore from trash on server send normal mail with attachment, sync, move to trash, restore from trash on server, get attachment * Tests without sent folder and trash on server for fwod server * Same as above, but test using universal trash and universal sent mail e.g. check mail is in univeral sent, check can restore from universal trash * Tests on server without fwod * Need to do all above tests again
* Ensure temporary files are deleted.Don Sanders2012-04-031-0/+1
| | | | Patch from Edit Siket-Szasz
* Add service action to find and create standard folders.Valerio Valerio2012-01-271-3/+8
| | | | | | | | | | | | void QMailRetrievalAction::createStandardFolders(const QMailAccountId &accountId) Requests that the message server create the standard folders for the account accountId. If all standard folders are already set in the storage the service action will return success immediately, in case some standard folders are not set, a matching attempt against a predefined list of translations will be made, if the folders can't be matched, messageserver will try to create them in the server side and match them if the creation is successful. In case folder creation is not allowed for the account accountId the service action will return.
* Don't delete all message removal records instead of none.Don Sanders2012-01-121-1/+2
| | | | | | | | | | | | | | | Would cause deleted messages to not be deleted from server. Only occurs in rare situations. Only occurs for ImapUpdateMessagesFlagsStrategy and ImapSynchronizeAllStrategy strategies. So will not occur in any known products using QMF, except qtmail. Probably will not occur in qtmail either, but I need to fix this for edit mail in drafts. Fix a bug whereby all message removal records where deleted instead of none
* Detect removed messages on imap servers that don't provide UIDNEXTDon Sanders2011-12-211-0/+4
| | | | | | | | Ensure removed messages are detected on IMAP servers that don't provide a UIDNEXT response when a folder is SELECTed. A UIDNEXT response MUST be sent according to RFC 3501 section 6.3.1 but some servers such as Courier don't provide it.
* Implement support for XLIST IMAP extension2011W47Don Sanders2011-11-211-20/+8
| | | | | | | | | To automatically detect standard folders. Also set flags for messages in standard folders, and unset flags for messages previously in standard folders. Used in QMailRetrievalAction::retrieveFolderList.
* Added QMailSearchAction::countMessages function, and ↵Don Sanders2011-11-211-2/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | QMailMessageServer::messagesCount signal. QMailSearchAction::countMessages(const QMailMessageKey &filter, const QString &bodyText) function Requests that the message server count all messages that match the criteria specified by \a filter. If \a bodyText is non-empty then messages that contain the supplied text in their content will also be matched and counted. It should be implemented for all protocol plugins for accounts with the QMailAccount::CanSearchOnServer flag set. Implemented for IMAP plugin, accelerated by use of ESEARH IMAP extension when supported by the remote server. QMailSearchAction::messagesCount(uint count) This signal emits the \a count of matching messages on the remote server. Only emitted for remote searches. Emitted by countMessages, and searchMessages functions. uint QMailSearchAction::messagesCount() const Returns the count of matching messages on the remote server. Also implemented boiler plate code in QMailMessageServer etc.
* Update remote server search API.Don Sanders2011-11-171-3/+13
| | | | | | | Add 'QMailSearchAction::remainingMessagesCount(uint count) signal. and 'QMailSearchAction::searchMessages' function with limit argument. Also add doc.
* Fix bug emitting QMailSearchAction::matchMessageIds signalDon Sanders2011-11-091-0/+1
| | | | Sometimes some ids were not being emitted.
* Use new ImapConfiguration "searchLimit" in server based searching2011W44Don Sanders2011-11-061-0/+12
|
* Forward without download (fwod) fixes.Don Sanders2011-10-211-2/+2
| | | | | | | | | | | Don't clear capabilities after sending an IMAP CLOSE command. As this result in imapprotocol considering server to not be fwod capable half way through a fwod operation Default to forwarding entire message with IMAP CATENATE command rather than forwarding all of message except header, as the later results in gibberish being sent for messages with attachments.
* Integrate Harmattan QMF fix for NB#278368Don Sanders2011-09-051-1/+2
| | | | | [REG] IMAP: All deleted messages from Trash folder are NOT synced to the server and retained in device after sync
* Integrate Meego Harmattan fix for NB272852Don Sanders2011-09-051-1/+1
| | | | Last updated time is not refreshing properly in always up to date mode
* Merging QMF part of downstream fix for NB#238413 into Qt QMF.Don Sanders2011-08-171-3/+21
| | | | | | | | | In exportUpdates handle case of deleting message on remote server when serverUid and removalRecord parent folder do not match. Also in retrieveMessageList don't retrieve a message from remote server when the message has been deleted on the device and a removal record has been created for it.
* Update license headers (make them consistent with harmattan qmf)Don Sanders2011-08-071-17/+17
| | | | Remove obsolete pre-release clause.
* Imap flag change handling optimizationDon Sanders2011-07-211-0/+5
| | | | | | When an unsolicited flag change event is received, and no message flags need to be updated, then instead of logging into server do nothing.
* Fix error in commits related to NB#267169.Don Sanders2011-07-031-2/+1
|
* Fix errors in previous commit related to NB#267169.Don Sanders2011-07-031-4/+2
|
* Preserve message ids when resuming a cancelled sync in IMAPEric Springer2011-06-301-21/+35
| | | | Patch by Don
* Fix a regression with imap/pop services not adapting to account changes.Don Sanders2011-06-071-1/+2
|