Bug 138523 - Storing mail: BAD Protocol Error
Summary: Storing mail: BAD Protocol Error
Status: RESOLVED FIXED
Alias: None
Product: mailody
Classification: Miscellaneous
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Tom Albers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-12-08 09:06 UTC by Tommi Tervo
Modified: 2006-12-08 10:32 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
debug output (5.82 KB, text/plain)
2006-12-08 09:07 UTC, Tommi Tervo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tommi Tervo 2006-12-08 09:06:20 UTC
Version:           0.2.0-rc1 (using KDE 3.5.5, compiled sources)
Compiler:          Target: i486-linux-gnu
OS:                Linux (i686) release 2.6.12-10-386

Despite error, mail seems to be sent. Although mailody appends some extra information to message body: (original body just "fub dup"
 
fub dup

From: email.addreess@company.com
Bcc:
Return-Path: email.address@company.com
X-OriginalArrivalTime: 08 Dec 2006 07:41:37.0763 (UTC) FILETIME=[4AED3B30:01C71A
9C]
Date: 8 Dec 2006 09:41:37 +0200
Comment 1 Tommi Tervo 2006-12-08 09:07:00 UTC
Created attachment 18840 [details]
debug output
Comment 2 Tom Albers 2006-12-08 09:57:05 UTC
Actual sending is ok, but storing the send message on the imap server fails.
Comment 3 Tom Albers 2006-12-08 10:32:14 UTC
SVN commit 611465 by toma:

Make the Append command rfc compatible (at least the part that i read).
BUG: 138523


 M  +15 -2     imap.cpp  
 M  +3 -1      imap.h  
 M  +2 -1      socketsafe.cpp  


--- trunk/playground/pim/mailody/src/imap.cpp #611464:611465
@@ -237,10 +237,14 @@
 
     else if (m_currentQueueItem.state() == Queue::SyncMailBox ||
              m_currentQueueItem.state() == Queue::SelectMailBox ||
-             m_currentQueueItem.state() == Queue::SaveMessage)
+             m_currentQueueItem.state() == Queue::SaveMessageData)
         QTimer::singleShot(0, this,
                    SLOT(slotParseExists()));
 
+    else if (m_currentQueueItem.state() == Queue::SaveMessage)
+        QTimer::singleShot(0,this,
+                   SLOT(slotParseSaveMessage()));
+
     else if (m_currentQueueItem.state() == Queue::GetHeaderList)
         QTimer::singleShot(0, this,
                    SLOT(slotParseGetHeaderList()));
@@ -453,6 +457,14 @@
                    SLOT(slotParseExists()));
 }
 
+void Imap::slotParseSaveMessage()
+{
+    kdDebug() << k_funcinfo << " : " << m_received << endl;
+    m_currentQueueItem = m_queue.first();
+    if (m_imap)
+            m_imap->write( m_currentQueueItem.command() );
+    m_queue.pop_front();
+}
 
 void Imap::slotParseExists()
 {
@@ -831,7 +843,8 @@
     m_queue.append( Queue(Queue::SaveMessage, mb,
                     "APPEND \"" + mb + "\" (\\Seen) {"
                             + QString::number(message.length())
-                            + "}\r\n" + message));
+                            + "}"));
+    m_queue.append( Queue(Queue::SaveMessageData, mb, message));
 }
 
 void Imap::timerEvent( QTimerEvent * )
--- trunk/playground/pim/mailody/src/imap.h #611464:611465
@@ -46,7 +46,8 @@
             GetRecent,
             Move,
             Expunge,
-            SaveMessage
+            SaveMessage,
+            SaveMessageData
         };
 
         Queue(): st(0) {}
@@ -265,6 +266,7 @@
     void slotParseExists();
     void slotParseGetHeaderList();
     void slotParseGetMessage();
+    void slotParseSaveMessage();
 };
 
 }
--- trunk/playground/pim/mailody/src/socketsafe.cpp #611464:611465
@@ -184,7 +184,8 @@
 #endif
     QStringList splitted = QStringList::split("\n",t);
     if (!m_gather || splitted.grep(QRegExp("^a02")).count() != 0 ||
-        splitted.grep(QRegExp("^* OK")).count() != 0)
+        splitted.grep(QRegExp("^* OK")).count() != 0 ||
+        t.startsWith("+"))
     {
         emit data(received);
         received = QString::null;