[haiku-commits] r40575 - in haiku/trunk: headers/os/add-ons/mail_daemon headers/os/mail src/apps/mail src/kits/mail src/servers/mail

  • From: clemens.zeidler@xxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 20 Feb 2011 08:55:47 +0100 (CET)

Author: czeidler
Date: 2011-02-20 08:55:47 +0100 (Sun, 20 Feb 2011)
New Revision: 40575
Changeset: http://dev.haiku-os.org/changeset/40575

Modified:
   haiku/trunk/headers/os/add-ons/mail_daemon/MailProtocol.h
   haiku/trunk/headers/os/mail/MailDaemon.h
   haiku/trunk/src/apps/mail/MailWindow.cpp
   haiku/trunk/src/apps/mail/MailWindow.h
   haiku/trunk/src/kits/mail/MailDaemon.cpp
   haiku/trunk/src/kits/mail/MailProtocol.cpp
   haiku/trunk/src/servers/mail/MailDaemon.cpp
Log:
Remember tracker message when downloading a partial message and open it with 
Mail. This is needed to get the next/previous message after downloading the 
body.



Modified: haiku/trunk/headers/os/add-ons/mail_daemon/MailProtocol.h
===================================================================
--- haiku/trunk/headers/os/add-ons/mail_daemon/MailProtocol.h   2011-02-20 
07:53:57 UTC (rev 40574)
+++ haiku/trunk/headers/os/add-ons/mail_daemon/MailProtocol.h   2011-02-20 
07:55:47 UTC (rev 40575)
@@ -194,7 +194,7 @@
 
                        void                            SyncMessages();
                        void                            FetchBody(const 
entry_ref& ref,
-                                                                       bool 
launch = false);
+                                                                       
BMessage* launch = NULL);
                        void                            MarkMessageAsRead(const 
entry_ref& ref,
                                                                        bool 
read = true);
                        void                            DeleteMessage(const 
entry_ref& ref);

Modified: haiku/trunk/headers/os/mail/MailDaemon.h
===================================================================
--- haiku/trunk/headers/os/mail/MailDaemon.h    2011-02-20 07:53:57 UTC (rev 
40574)
+++ haiku/trunk/headers/os/mail/MailDaemon.h    2011-02-20 07:55:47 UTC (rev 
40575)
@@ -28,7 +28,8 @@
                                                                        bool 
waitForFetchCompletion = false);
        static status_t                         MarkAsRead(int32 account, const 
entry_ref& ref,
                                                                        bool 
read = true);
-       static status_t                         FetchBody(const entry_ref& ref);
+       static status_t                         FetchBody(const entry_ref& ref,
+                                                                       
BMessage* launchMessage = NULL);
        static status_t                         Quit();
 };
 

Modified: haiku/trunk/src/apps/mail/MailWindow.cpp
===================================================================
--- haiku/trunk/src/apps/mail/MailWindow.cpp    2011-02-20 07:53:57 UTC (rev 
40574)
+++ haiku/trunk/src/apps/mail/MailWindow.cpp    2011-02-20 07:55:47 UTC (rev 
40575)
@@ -1511,7 +1511,7 @@
                                                if (fAutoMarkRead)
                                                        SetCurrentMessageRead();
                                                OpenMessage(&nextRef,
-                                                       
fHeaderView->fCharacterSetUserSees);
+                                                       
fHeaderView->fCharacterSetUserSees, msg);
                                        } else {
                                                window->Activate();
 
@@ -2794,7 +2794,8 @@
 //
 
 status_t
-TMailWindow::OpenMessage(entry_ref *ref, uint32 characterSetForDecoding)
+TMailWindow::OpenMessage(entry_ref *ref, uint32 characterSetForDecoding,
+       BMessage* trackerMsg)
 {
        //
        //      Set some references to the email file
@@ -2822,7 +2823,7 @@
        fileInfo.GetType(mimeType);
 
        if (strcmp(mimeType, B_PARTIAL_MAIL_TYPE) == 0) {
-               BMailDaemon::FetchBody(*ref);
+               BMailDaemon::FetchBody(*ref, trackerMsg);
                fileInfo.GetType(mimeType);
        }
 

Modified: haiku/trunk/src/apps/mail/MailWindow.h
===================================================================
--- haiku/trunk/src/apps/mail/MailWindow.h      2011-02-20 07:53:57 UTC (rev 
40574)
+++ haiku/trunk/src/apps/mail/MailWindow.h      2011-02-20 07:55:47 UTC (rev 
40575)
@@ -97,7 +97,8 @@
                                status_t                SaveAsDraft();
                                status_t                OpenMessage(entry_ref* 
ref,
                                                                        uint32 
characterSetForDecoding
-                                                                               
= B_MAIL_NULL_CONVERSION);
+                                                                               
= B_MAIL_NULL_CONVERSION,
+                                                                               
BMessage* trackerMsg = NULL);
 
                                status_t                GetMailNodeRef(node_ref 
&nodeRef) const;
                                BEmailMessage*  Mail() const { return fMail; }

Modified: haiku/trunk/src/kits/mail/MailDaemon.cpp
===================================================================
--- haiku/trunk/src/kits/mail/MailDaemon.cpp    2011-02-20 07:53:57 UTC (rev 
40574)
+++ haiku/trunk/src/kits/mail/MailDaemon.cpp    2011-02-20 07:55:47 UTC (rev 
40575)
@@ -87,7 +87,7 @@
 
 
 status_t
-BMailDaemon::FetchBody(const entry_ref& ref)
+BMailDaemon::FetchBody(const entry_ref& ref, BMessage* launchMessage)
 {
        BMessenger daemon("application/x-vnd.Be-POST");
        if (!daemon.IsValid())
@@ -95,6 +95,7 @@
 
        BMessage message(kMsgFetchBody);
        message.AddRef("refs", &ref);
+       message.AddMessage("launch", launchMessage);
 
        BMessage reply;
        return daemon.SendMessage(&message, &reply);

Modified: haiku/trunk/src/kits/mail/MailProtocol.cpp
===================================================================
--- haiku/trunk/src/kits/mail/MailProtocol.cpp  2011-02-20 07:53:57 UTC (rev 
40574)
+++ haiku/trunk/src/kits/mail/MailProtocol.cpp  2011-02-20 07:55:47 UTC (rev 
40575)
@@ -582,11 +582,17 @@
                entry_ref ref;
                message->FindRef("ref", &ref);
                status_t status = fProtocol->FetchBody(ref);
-               if (status != B_OK || !message->FindBool("launch"))
+               if (status != B_OK)
                        break;
-               BMessage argv(B_ARGV_RECEIVED);
+
+               BMessage argv;
+               if (message->FindMessage("launch", &argv) != B_OK)
+                       break;
+               argv.RemoveName("argv");
+               argv.RemoveName("argc");
+
+               argv.AddString("argv", "E-mail");
                BPath path(&ref);
-               argv.AddString("argv", "E-mail");
                argv.AddString("argv", path.Path());
                argv.AddInt32("argc", 2);
                be_roster->Launch("text/x-email", &argv);
@@ -632,11 +638,11 @@
 
 
 void
-InboundProtocolThread::FetchBody(const entry_ref& ref, bool launch)
+InboundProtocolThread::FetchBody(const entry_ref& ref, BMessage* launch)
 {
        BMessage message(kMsgFetchBody);
        message.AddRef("ref", &ref);
-       message.AddBool("launch", launch);
+       message.AddMessage("launch", launch);
        PostMessage(&message);
 }
 

Modified: haiku/trunk/src/servers/mail/MailDaemon.cpp
===================================================================
--- haiku/trunk/src/servers/mail/MailDaemon.cpp 2011-02-20 07:53:57 UTC (rev 
40574)
+++ haiku/trunk/src/servers/mail/MailDaemon.cpp 2011-02-20 07:55:47 UTC (rev 
40575)
@@ -199,8 +199,12 @@
                InboundProtocolThread* protocol = _FindInboundProtocol(account);
                if (!protocol)
                        continue;
-               bool launch = true;
-               protocol->FetchBody(ref, launch);
+
+               BMessage* launchMessage = message;
+               BMessage temp;
+               if (message->FindMessage("launch", &temp) == B_OK)
+                       launchMessage = &temp;
+               protocol->FetchBody(ref, launchMessage);
        }
 }
 


Other related posts:

  • » [haiku-commits] r40575 - in haiku/trunk: headers/os/add-ons/mail_daemon headers/os/mail src/apps/mail src/kits/mail src/servers/mail - clemens . zeidler