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.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40575 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Clemens Zeidler
2011-02-20 07:55:47 +00:00
parent 65598ac67b
commit 0e657c0b6c
7 changed files with 28 additions and 14 deletions
@@ -194,7 +194,7 @@ public:
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);
+2 -1
View File
@@ -28,7 +28,8 @@ public:
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();
};
+4 -3
View File
@@ -1511,7 +1511,7 @@ TMailWindow::MessageReceived(BMessage *msg)
if (fAutoMarkRead)
SetCurrentMessageRead();
OpenMessage(&nextRef,
fHeaderView->fCharacterSetUserSees);
fHeaderView->fCharacterSetUserSees, msg);
} else {
window->Activate();
@@ -2794,7 +2794,8 @@ TMailWindow::SetTitleForMessage()
//
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 @@ TMailWindow::OpenMessage(entry_ref *ref, uint32 characterSetForDecoding)
fileInfo.GetType(mimeType);
if (strcmp(mimeType, B_PARTIAL_MAIL_TYPE) == 0) {
BMailDaemon::FetchBody(*ref);
BMailDaemon::FetchBody(*ref, trackerMsg);
fileInfo.GetType(mimeType);
}
+2 -1
View File
@@ -97,7 +97,8 @@ class TMailWindow : public BWindow {
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; }
+2 -1
View File
@@ -87,7 +87,7 @@ BMailDaemon::MarkAsRead(int32 account, const entry_ref& ref, bool read)
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 @@ BMailDaemon::FetchBody(const entry_ref& ref)
BMessage message(kMsgFetchBody);
message.AddRef("refs", &ref);
message.AddMessage("launch", launchMessage);
BMessage reply;
return daemon.SendMessage(&message, &reply);
+11 -5
View File
@@ -582,11 +582,17 @@ InboundProtocolThread::MessageReceived(BMessage* message)
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);
BPath path(&ref);
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", path.Path());
argv.AddInt32("argc", 2);
be_roster->Launch("text/x-email", &argv);
@@ -632,11 +638,11 @@ InboundProtocolThread::SyncMessages()
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);
}
+6 -2
View File
@@ -199,8 +199,12 @@ MailDaemonApp::RefsReceived(BMessage* message)
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);
}
}