Bug 354394 - Add $Submitted and $SubmitPending keywords as appropriate
Summary: Add $Submitted and $SubmitPending keywords as appropriate
Status: CONFIRMED
Alias: None
Product: trojita
Classification: Applications
Component: Message Composer (show other bugs)
Version: git
Platform: Gentoo Packages Linux
: NOR minor
Target Milestone: ---
Assignee: Trojita default assignee
URL:
Keywords:
: 356858 396112 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-10-26 10:55 UTC by Erik Quaeghebeur
Modified: 2018-07-03 10:13 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Erik Quaeghebeur 2015-10-26 10:55:16 UTC
When sending mails, the $Submitted keyword does not seem to get added to it.

Note that it should (see bug #332911).

Reproducible: Always

Steps to Reproduce:
1. Send test mail
2. Look at keywords of saved sent message using Akonadiconsole

Actual Results:  
$Submitted is not present (it is hard to check for $SubmitPending)

Expected Results:  
$Submitted is present

A redacted log of a submission:

10:46:27.127 Imap::Mailbox::OpenConnectionTask OpenConnectionTask:  Activated
10:46:27.240 *** Looking up mail.example.org...
10:46:27.240 conn Resolving hostname...
10:46:27.263 *** Connecting to mail.example.org:993 (SSL)...
10:46:27.263 conn Connecting to the IMAP server...
10:46:27.279 *** Negotiating encryption...
10:46:27.279 conn Starting encryption (SSL)...
10:46:27.348 *** [Socket is encrypted now; no errors]
10:46:27.348 conn Checking certificates (SSL)...
10:46:27.349 conn Checking capabilities...
10:46:27.401 <<< * OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE AUTH=PLAIN] Dovecot ready.␍␊
10:46:27.402 conn Logging in...
10:46:27.406 >>> [LOGIN command goes here]
10:46:27.486 <<< y0 OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS MULTIAPPEND UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CO
(+ 104 more bytes)
10:46:27.488 conn Logged in.
10:46:27.489 Imap::Mailbox::IdTask Activated
10:46:27.492 Imap::Mailbox::EnableTask Activated
10:46:27.492 Imap::Mailbox::OpenConnectionTask OpenConnectionTask: Logged in. Completed
10:46:27.492 Imap::Mailbox::GetAnyConnectionTask Activated
10:46:27.493 Imap::Mailbox::GetAnyConnectionTask Completed
10:46:27.493 Imap::Mailbox::ListChildMailboxesTask Listing stuff below mailbox  Activated
10:46:27.495 >>> y1 ID ("name" "Trojita" "os" "Qt/4.8.6; X11; Linux; " "version" "v0.5-111-g6fef217")␍␊
10:46:27.495 >>> y2 ENABLE QRESYNC␍␊
10:46:27.495 >>> y3 LIST "" "%" RETURN (SUBSCRIBED CHILDREN STATUS (MESSAGES UNSEEN RECENT))␍␊
10:46:28.800 <<< * ID NIL␍␊
10:46:28.802 <<< y1 OK ID completed.␍␊
10:46:28.802 <<< * ENABLED QRESYNC␍␊
10:46:28.802 <<< y2 OK Enabled.␍␊
10:46:28.802 <<< * LIST (\Subscribed \HasNoChildren) "." "Drafts"␍␊
10:46:28.802 <<< * STATUS "Drafts" (MESSAGES 0 RECENT 0 UNSEEN 0)␍␊
10:46:28.802 <<< * LIST (\Subscribed \HasNoChildren) "." "Trash"␍␊
10:46:28.802 <<< * STATUS "Trash" (MESSAGES 1 RECENT 0 UNSEEN 0)␍␊
10:46:28.802 <<< * LIST (\Subscribed \HasNoChildren) "." "Archives"␍␊
10:46:28.802 <<< * STATUS "Archives" (MESSAGES 12345 RECENT 0 UNSEEN 0)␍␊
10:46:28.802 <<< * LIST (\Subscribed \HasNoChildren) "." "Sent"␍␊
10:46:28.802 <<< * STATUS "Sent" (MESSAGES 0 RECENT 0 UNSEEN 0)␍␊
10:46:28.803 <<< * LIST (\Subscribed \HasNoChildren) "." "INBOX"␍␊
10:46:28.803 <<< * STATUS "INBOX" (MESSAGES 2 RECENT 0 UNSEEN 0)␍␊
10:46:28.803 <<< y3 OK List completed.␍␊
10:46:28.803 Imap::Mailbox::IdTask Completed
10:46:28.804 Imap::Mailbox::EnableTask Completed
10:46:28.809 Imap::Mailbox::ListChildMailboxesTask Listing stuff below mailbox  Completed
...
10:55:16.8620  Submission Cannot BURL without the URLAUTH extension
10:55:16.8630  Submission STATE_INIT
10:55:16.8720  Submission STATE_BUILDING_MESSAGE
10:55:16.8750  Submission STATE_SAVING
10:55:16.8761  [task] Imap::Mailbox::GetAnyConnectionTask Activated
10:55:16.8781  [task] Imap::Mailbox::GetAnyConnectionTask Completed
10:55:16.8791  [task] Imap::Mailbox::AppendTask Activated
10:55:16.8821  >>>  y10 APPEND Sent (\Seen) "26-Oct-2015 10:55:16 +0100" {411+}␍␊From: Somebody <somebody@example.org>␍␊To: <someone@example.com>␍␊Subject: test $Submitted␍␊Date: Mon, 26 Oct 2015 10:55:16 +0100␍␊MIME-Version: 1.0␍␊Message-ID: <1fe4adde-7b41-4121-b1e3-996ff16402ed@example.org>␍␊User-Agent: Trojita/v0.5-111-g6fef217; Qt/4.8.6; X11; Linux; ␍␊Content-Type: text/plain; charset=utf-8; format=flowed␍␊Content-Transfer-Encoding: quoted-printable
10:55:17.3781  <<<  y10 OK [APPENDUID 1370200162 360] Append completed.
10:55:17.3781  [task] Imap::Mailbox::AppendTask Completed
10:55:17.3780  Submission STATE_SUBMITTING
10:55:18.1730  Submission STATE_SENT
...

When looking through the code, I find, in Submission.cpp:

#if 0
    if (m_appendUidReceived) {
        // FIXME: check the UIDVALIDITY!!!
        // FIXME: doesn't work at all; the messageIndexByUid() only works on already selected mailboxes
        QModelIndex message = m_mainWindow->imapModel()->
                messageIndexByUid(QSettings().value(Common::SettingsNames::composerImapSentKey, tr("Sent")).toString(), m_appendUid);
        if (message.isValid()) {
            m_mainWindow->imapModel()->setMessageFlags(QModelIndexList() << message,
                                                       QLatin1String("\\Seen $Submitted"), Imap::Mailbox::FLAG_USE_THESE);
        }
    }
#endif

So the $Submitted functionality seems to be commented out for now. Similarly, in the same file, we see

        if (m_model->isCatenateSupported()) {
            // FIXME: without UIDPLUS, there isn't much point in $SubmitPending...
            appendTask = QPointer<Imap::Mailbox::AppendTask>(
                        m_model->appendIntoMailbox(
                            m_sentFolderName,
                            catenateable,
                            QStringList() << QLatin1String("\\Seen"),
                            m_composer->timestamp()));
        } else {
            // FIXME: without UIDPLUS, there isn't much point in $SubmitPending...
            appendTask = QPointer<Imap::Mailbox::AppendTask>(
                        m_model->appendIntoMailbox(
                            m_sentFolderName,
                            m_rawMessageData,
                            QStringList() << QLatin1String("\\Seen"),
                            m_composer->timestamp()));
        }

So also $SubmitPending seems to be ignored for now.
Comment 1 Jan Kundrát 2015-10-26 12:31:46 UTC
Ah, right. There was a bug in this, related to the missing APPENDUID, so in the end this was disabled. I agree that we should be setting these. Sorry for noise, and thanks for the report.

Here's what needs to be done:

- implement parsing of the [COPYUID] response code, including cases where we're copying multiple messages (this might need changes to the LowLevelParser)
- cover it by tests,
- implement a fallback for situations where the UIDPLUS extensions is missing (and hence COPYUID is not available), maybe via a lookup through the Message-Id header,
- cover that by tests, too
Comment 2 Jan Kundrát 2015-12-22 11:21:12 UTC
*** Bug 356858 has been marked as a duplicate of this bug. ***
Comment 3 Jan Kundrát 2018-07-03 10:13:37 UTC
*** Bug 396112 has been marked as a duplicate of this bug. ***