- Partial downloaded messages are now opened by Mail and not by the mail daemon. Mail request the body fetch and get notified when the daemon is done. During this time the Mail window title is showing "Downloading: subject". This fixes #7256.

- Some cleanup in Mail.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40789 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Clemens Zeidler 2011-03-03 09:05:04 +00:00
parent e8226ce48d
commit b8d2bbd616
14 changed files with 205 additions and 266 deletions

View File

@ -195,7 +195,7 @@ public:
void SyncMessages();
void FetchBody(const entry_ref& ref,
BMessage* launch = NULL);
BMessenger* listener = NULL);
void MarkMessageAsRead(const entry_ref& ref,
read_flags flag = B_READ);
void DeleteMessage(const entry_ref& ref);

View File

@ -19,6 +19,7 @@ const uint32 kMsgSetStatusWindowMode = 'shst';
const uint32 kMsgCountNewMessages = 'mnum';
const uint32 kMsgMarkMessageAsRead = 'mmar';
const uint32 kMsgFetchBody = 'mfeb';
const uint32 kMsgBodyFetched = 'mbfe';
class BMailDaemon {
@ -32,7 +33,7 @@ public:
static status_t MarkAsRead(int32 account, const entry_ref& ref,
read_flags flag = B_READ);
static status_t FetchBody(const entry_ref& ref,
BMessage* launchMessage = NULL);
BMessenger* listener = NULL);
static status_t Quit();
};

View File

@ -644,9 +644,12 @@ TextRunArray::~TextRunArray()
// #pragma mark -
TContentView::TContentView(BRect rect, bool incoming, BEmailMessage *mail,
BFont* font, bool showHeader, bool coloredQuotes)
: BView(rect, "m_content", B_FOLLOW_ALL, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE),
TContentView::TContentView(BRect rect, bool incoming, BFont* font,
bool showHeader, bool coloredQuotes)
:
BView(rect, "m_content", B_FOLLOW_ALL,
B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE),
fFocus(false),
fIncoming(incoming)
{
@ -662,8 +665,8 @@ TContentView::TContentView(BRect rect, bool incoming, BEmailMessage *mail,
text.OffsetTo(0, 0);
text.InsetBy(5, 5);
fTextView = new TTextView(r, text, fIncoming, mail, this, font,
showHeader, coloredQuotes);
fTextView = new TTextView(r, text, fIncoming, this, font, showHeader,
coloredQuotes);
BScrollView *scroll = new BScrollView("", fTextView, B_FOLLOW_ALL, 0, true, true);
AddChild(scroll);
}
@ -849,16 +852,17 @@ TContentView::FrameResized(float /* width */, float /* height */)
// #pragma mark -
TTextView::TTextView(BRect frame, BRect text, bool incoming,
BEmailMessage *mail, TContentView *view, BFont *font,
bool showHeader, bool coloredQuotes)
: BTextView(frame, "", text, B_FOLLOW_ALL, B_WILL_DRAW | B_NAVIGABLE),
TTextView::TTextView(BRect frame, BRect text, bool incoming, TContentView *view,
BFont *font, bool showHeader, bool coloredQuotes)
:
BTextView(frame, "", text, B_FOLLOW_ALL, B_WILL_DRAW | B_NAVIGABLE),
fHeader(showHeader),
fColoredQuotes(coloredQuotes),
fReady(false),
fYankBuffer(NULL),
fLastPosition(-1),
fMail(mail),
fMail(NULL),
fFont(font),
fParent(view),
fStopLoading(false),

View File

@ -106,7 +106,7 @@ class TSavePanel;
class TContentView : public BView {
public:
TContentView(BRect, bool incoming, BEmailMessage *mail, BFont*,
TContentView(BRect, bool incoming, BFont*,
bool showHeader, bool coloredQuotes);
virtual void MessageReceived(BMessage *);
void FindString(const char *);
@ -148,9 +148,10 @@ struct quote_context {
class TTextView : public BTextView {
public:
TTextView(BRect, BRect, bool incoming, BEmailMessage *mail,
TContentView *, BFont *, bool showHeader, bool coloredQuotes);
~TTextView();
TTextView(BRect, BRect, bool incoming,
TContentView*, BFont*, bool showHeader,
bool coloredQuotes);
~TTextView();
virtual void AttachedToWindow();
virtual void KeyDown(const char*, int32);

View File

@ -133,9 +133,10 @@ static const float kPlainFontSizeScale = 0.9;
THeaderView::THeaderView(BRect rect, BRect windowRect, bool incoming,
BEmailMessage *mail, bool resending, uint32 defaultCharacterSet,
int32 defaultAccount)
: BBox(rect, "m_header", B_FOLLOW_LEFT_RIGHT, B_WILL_DRAW, B_NO_BORDER),
bool resending, uint32 defaultCharacterSet, int32 defaultAccount)
:
BBox(rect, "m_header", B_FOLLOW_LEFT_RIGHT, B_WILL_DRAW, B_NO_BORDER),
fAccountMenu(NULL),
fEncodingMenu(NULL),
fAccountID(defaultAccount),
@ -465,8 +466,6 @@ THeaderView::THeaderView(BRect rect, BRect windowRect, bool incoming,
fDate->SetHighColor(0, 0, 0);
y += controlHeight + 5;
LoadMessage(mail);
}
ResizeTo(Bounds().Width(), y);
}

View File

@ -82,8 +82,7 @@ class TTextControl;
class THeaderView : public BBox {
public:
THeaderView(BRect, BRect, bool incoming,
BEmailMessage *mail, bool resending,
uint32 defaultCharacterSet,
bool resending, uint32 defaultCharacterSet,
int32 defaultAccount);
virtual void MessageReceived(BMessage*);

View File

@ -5,6 +5,7 @@ resource app_flags B_SINGLE_LAUNCH;
resource file_types message {
"types" = "text/x-email",
"types" = "text/x-partial-email",
"types" = "application/x-person",
"types" = "application/x-vnd.Be.URL.mailto",
"types" = "text/x-vnd.Be-MailDraft"
@ -70,7 +71,62 @@ resource(0, "BEOS:L:text/x-email") #'VICN' array {
$"000A020105000A03010200"
};
resource(1, "BEOS:L:text/x-vnd.be-maildraft") #'VICN' array {
resource(1, "BEOS:L:text/x-partial-email") #'ICON' array {
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"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FFF"
$"FF0F0F00001B1C3F3F3F0FFF1C1C11001B1C3F3F3F3F3F7B2B3F3F1B000F0FFF"
$"FFFFFF0F0F00001B1C3F0FFF1C3F3F3F00003F3F3F3F3F3F3F3F1B000F0FFFFF"
$"FFFFFFFFFF0F0F0F0F0F0FFF1C3F3F3F1B3F3F3F3F3F3F3F3F1B000F0FFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFFFF1C3F3F3F3F3F3F3F3F3F3F3F1B000F0FFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFF0F00001B1C3F3F3F3F3F3F3F3F1B000F0FFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFF0F0F00001B1C3F3F3F3F3F1B000F0FFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFFFFFF0F0F00001B1C3F3F1B000F0FFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0F0F00001B1C000F0FFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0F0F00000F0FFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0F0F0FFFFFFFFFFFFFFFFFFFFF"
};
resource(1, "BEOS:M:text/x-partial-email") #'MICN' array
{
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFF00FFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFF001B0000FFFFFFFFFFFFFFFF"
$"FFFFFF001B3F1B1B00FFFFFFFFFFFFFF"
$"FFFF001B3F3F3F3F1B0FFF00FFFFFFFF"
$"FF001B3F3F00000F0F0FFF1B0000FFFF"
$"001B3F3F1C1C1C0FFFFFFF2B1B1B0000"
$"001B1B3F00001C0FFF1C7B2B2C1B000F"
$"0F00001B0F0F0F0FFF1C3F7B1B000FFF"
$"FF0F0F000FFFFFFFFF1C3F1B000FFFFF"
$"FFFFFF0F0FFF001B1B1C1B000FFFFFFF"
$"FFFFFFFFFFFF0F00001B000FFFFFFFFF"
$"FFFFFFFFFFFFFF0F0F000FFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF"
};
resource(2, "BEOS:L:text/x-vnd.be-maildraft") #'VICN' array {
$"6E636966070500040178020006023A94CE3C078BBE370C3CD1394B9EF949A6E5"
$"00FFFCACFFE6E27C03A07D3303A0893C02000602B4491E38CD95BCF086B8659B"
$"4B4F4E49909100ECE986FFC9C55C020016023A4998B6DADD38AE423C25DB4932"
@ -81,4 +137,3 @@ resource(1, "BEOS:L:text/x-vnd.be-maildraft") #'VICN' array {
$"01011001178402040A040103000A050104000A0001061001178200040A060106"
$"000A020105000A03010200"
};

View File

@ -590,10 +590,11 @@ TMailApp::RefsReceived(BMessage *msg)
if (file.InitCheck() == B_NO_ERROR) {
BNodeInfo node(&file);
node.GetType(type);
if (!strcmp(type, B_MAIL_TYPE)) {
if (strcmp(type, B_MAIL_TYPE) == 0
|| strcmp(type, B_PARTIAL_MAIL_TYPE) == 0) {
window = NewWindow(&ref, NULL, false, &messenger);
window->Show();
} else if(!strcmp(type, "application/x-person")) {
} else if(strcmp(type, "application/x-person") == 0) {
/* Got a People contact info file, see if it has an Email address. */
BString name;
BString email;
@ -631,8 +632,7 @@ TMailApp::RefsReceived(BMessage *msg)
}
}
}
else if (!strcmp(type, kDraftType))
{
else if (strcmp(type, kDraftType) == 0) {
window = NewWindow();
// If it's a draft message, open it

View File

@ -145,10 +145,14 @@ BLocker TMailWindow::sWindowListLock;
TMailWindow::TMailWindow(BRect rect, const char* title, TMailApp* app,
const entry_ref* ref, const char* to, const BFont* font, bool resending,
BMessenger* messenger)
: BWindow(rect, title, B_DOCUMENT_WINDOW, 0),
const entry_ref* ref, const char* to, const BFont* font, bool resending,
BMessenger* messenger)
:
BWindow(rect, title, B_DOCUMENT_WINDOW, 0),
fApp(app),
fMail(NULL),
fRef(NULL),
fFieldState(0),
fPanel(NULL),
fSendButton(NULL),
@ -168,7 +172,9 @@ TMailWindow::TMailWindow(BRect rect, const char* title, TMailApp* app,
fStartingText(NULL),
fOriginatingWindow(NULL),
fReadButton(NULL),
fNextButton(NULL)
fNextButton(NULL),
fDownloading(false)
{
fKeepStatusOnQuit = false;
@ -187,13 +193,9 @@ TMailWindow::TMailWindow(BRect rect, const char* title, TMailApp* app,
if (ref) {
fRef = new entry_ref(*ref);
fMail = new BEmailMessage(fRef);
fIncoming = true;
} else {
fRef = NULL;
fMail = NULL;
} else
fIncoming = false;
}
fAutoMarkRead = fApp->AutoMarkRead();
BRect r(0, 0, RIGHT_BOUNDARY, 15);
@ -413,40 +415,6 @@ TMailWindow::TMailWindow(BRect rect, const char* title, TMailApp* app,
menu->AddItem(fNextMsg);
menu->AddSeparatorItem();
fSaveAddrMenu = subMenu = new BMenu(B_TRANSLATE("Save address"));
// create the list of addresses
BList addressList;
get_address_list(addressList, fMail->To(), extract_address);
get_address_list(addressList, fMail->CC(), extract_address);
get_address_list(addressList, fMail->From(), extract_address);
get_address_list(addressList, fMail->ReplyTo(), extract_address);
for (int32 i = addressList.CountItems(); i-- > 0;) {
char *address = (char *)addressList.RemoveItem(0L);
// insert the new address in alphabetical order
int32 index = 0;
while ((item = subMenu->ItemAt(index)) != NULL) {
if (!strcmp(address, item->Label())) {
// item already in list
goto skip;
}
if (strcmp(address, item->Label()) < 0)
break;
index++;
}
msg = new BMessage(M_SAVE);
msg->AddString("address", address);
subMenu->AddItem(new BMenuItem(address, msg), index);
skip:
free(address);
}
menu->AddItem(subMenu);
fMenuBar->AddItem(menu);
@ -520,7 +488,7 @@ TMailWindow::TMailWindow(BRect rect, const char* title, TMailApp* app,
fButtonBar = NULL;
r.top = r.bottom = height + bbheight + 1;
fHeaderView = new THeaderView (r, rect, fIncoming, fMail, resending,
fHeaderView = new THeaderView (r, rect, fIncoming, resending,
(resending || !fIncoming)
? fApp->MailCharacterSet()
// Use preferences setting for composing mail.
@ -531,8 +499,8 @@ TMailWindow::TMailWindow(BRect rect, const char* title, TMailApp* app,
r = Frame();
r.OffsetTo(0, 0);
r.top = fHeaderView->Frame().bottom - 1;
fContentView = new TContentView(r, fIncoming, fMail,
const_cast<BFont *>(font), false, fApp->ColoredQuotes());
fContentView = new TContentView(r, fIncoming, const_cast<BFont *>(font),
false, fApp->ColoredQuotes());
// TContentView needs to be properly const, for now cast away constness
AddChild(fHeaderView);
@ -592,8 +560,7 @@ TMailWindow::TMailWindow(BRect rect, const char* title, TMailApp* app,
}
}
if (fRef != NULL)
SetTitleForMessage();
OpenMessage(ref, fHeaderView->fCharacterSetUserSees);
_UpdateSizeLimits();
@ -719,6 +686,7 @@ TMailWindow::~TMailWindow()
delete fMail;
delete fPanel;
delete fOriginatingWindow;
delete fRef;
BAutolock locker(sWindowListLock);
sWindowList.RemoveItem(this);
@ -952,6 +920,25 @@ TMailWindow::MessageReceived(BMessage *msg)
{
bool wasReadMsg = false;
switch (msg->what) {
case kMsgBodyFetched:
{
status_t status = msg->FindInt32("status");
if (status != B_OK) {
PostMessage(B_QUIT_REQUESTED);
break;
}
entry_ref ref;
if (msg->FindRef("ref", &ref) != B_OK)
break;
if (ref != *fRef)
break;
// reload the current message
OpenMessage(&ref, fHeaderView->fCharacterSetUserSees);
break;
}
case FIELD_CHANGED:
{
int32 prevState = fFieldState;
@ -1479,45 +1466,46 @@ TMailWindow::MessageReceived(BMessage *msg)
break;
case M_READ:
wasReadMsg = true;
SetCurrentMessageRead(B_READ);
_UpdateReadButton();
msg->what = M_NEXTMSG;
case M_PREVMSG:
case M_NEXTMSG:
if (fRef != NULL) {
entry_ref nextRef = *fRef;
if (GetTrackerWindowFile(&nextRef, (msg->what == M_NEXTMSG))) {
TMailWindow *window = static_cast<TMailApp *>(be_app)
->FindWindow(nextRef);
if (window == NULL) {
BNode node(fRef);
read_flags currentFlag;
if (read_read_attr(node, currentFlag) != B_OK)
currentFlag = B_UNREAD;
if (fAutoMarkRead == true || wasReadMsg)
SetCurrentMessageRead(B_READ);
else if (currentFlag != B_READ)
SetCurrentMessageRead(B_SEEN);
OpenMessage(&nextRef,
fHeaderView->fCharacterSetUserSees, msg);
} else {
window->Activate();
if (wasReadMsg)
SetCurrentMessageRead(B_READ);
PostMessage(B_CLOSE_REQUESTED);
}
SetTrackerSelectionToCurrent();
} else {
if (wasReadMsg) {
{
if (fRef == NULL)
break;
entry_ref nextRef = *fRef;
if (GetTrackerWindowFile(&nextRef, (msg->what == M_NEXTMSG))) {
TMailWindow *window = static_cast<TMailApp *>(be_app)
->FindWindow(nextRef);
if (window == NULL) {
BNode node(fRef);
read_flags currentFlag;
if (read_read_attr(node, currentFlag) != B_OK)
currentFlag = B_UNREAD;
if (fAutoMarkRead == true)
SetCurrentMessageRead(B_READ);
PostMessage(B_CLOSE_REQUESTED);
}
beep();
else if (currentFlag != B_READ && !wasReadMsg)
SetCurrentMessageRead(B_SEEN);
OpenMessage(&nextRef,
fHeaderView->fCharacterSetUserSees);
} else {
window->Activate();
//fSent = true;
PostMessage(B_CLOSE_REQUESTED);
}
SetTrackerSelectionToCurrent();
} else {
if (wasReadMsg)
PostMessage(B_CLOSE_REQUESTED);
beep();
}
break;
}
case M_SAVE_POSITION:
if (fRef != NULL)
SaveTrackerPosition(fRef);
@ -2761,6 +2749,9 @@ TMailWindow::SetTitleForMessage()
else
title = fMail->Subject();
if (fDownloading)
title.Prepend("Downloading: ");
if (fApp->ShowSpamGUI() && fRef != NULL) {
BString classification;
BNode node (fRef);
@ -2783,7 +2774,7 @@ TMailWindow::SetTitleForMessage()
title << "[" << classification << "] " << oldTitle;
}
}
SetTitle(title.String());
SetTitle(title);
}
@ -2794,8 +2785,7 @@ TMailWindow::SetTitleForMessage()
//
status_t
TMailWindow::OpenMessage(entry_ref *ref, uint32 characterSetForDecoding,
BMessage* trackerMsg)
TMailWindow::OpenMessage(const entry_ref *ref, uint32 characterSetForDecoding)
{
//
// Set some references to the email file
@ -2812,6 +2802,7 @@ TMailWindow::OpenMessage(entry_ref *ref, uint32 characterSetForDecoding,
fContentView->fTextView->StopLoad();
delete fMail;
fMail = NULL;
BFile file(fRef, B_READ_ONLY);
status_t err = file.InitCheck();
@ -2823,9 +2814,12 @@ TMailWindow::OpenMessage(entry_ref *ref, uint32 characterSetForDecoding,
fileInfo.GetType(mimeType);
if (strcmp(mimeType, B_PARTIAL_MAIL_TYPE) == 0) {
BMailDaemon::FetchBody(*ref, trackerMsg);
BMessenger listener(this);
BMailDaemon::FetchBody(*ref, &listener);
fileInfo.GetType(mimeType);
}
_SetDownloading(true);
} else
_SetDownloading(false);
// Check if it's a draft file, which contains only the text, and has the
// from, to, bcc, attachments listed as attributes.
@ -3215,3 +3209,9 @@ TMailWindow::_UpdateReadButton()
UpdateViews();
}
void
TMailWindow::_SetDownloading(bool downloading)
{
fDownloading = downloading;
}

View File

@ -96,10 +96,9 @@ class TMailWindow : public BWindow {
void CopyMessage(entry_ref* ref, TMailWindow* src);
status_t Send(bool);
status_t SaveAsDraft();
status_t OpenMessage(entry_ref* ref,
status_t OpenMessage(const entry_ref* ref,
uint32 characterSetForDecoding
= B_MAIL_NULL_CONVERSION,
BMessage* trackerMsg = NULL);
= B_MAIL_NULL_CONVERSION);
status_t GetMailNodeRef(node_ref &nodeRef) const;
BEmailMessage* Mail() const { return fMail; }
@ -130,7 +129,9 @@ class TMailWindow : public BWindow {
void _AddReadButton();
void _UpdateReadButton();
void _SetDownloading(bool downloading);
TMailApp* fApp;
BEmailMessage* fMail;
@ -205,6 +206,8 @@ class TMailWindow : public BWindow {
BmapButton* fNextButton;
bool fKeepStatusOnQuit;
bool fDownloading;
};
#endif // _MAIL_WINDOW_H

View File

@ -87,7 +87,7 @@ BMailDaemon::MarkAsRead(int32 account, const entry_ref& ref, read_flags flag)
status_t
BMailDaemon::FetchBody(const entry_ref& ref, BMessage* launchMessage)
BMailDaemon::FetchBody(const entry_ref& ref, BMessenger* listener)
{
BMessenger daemon("application/x-vnd.Be-POST");
if (!daemon.IsValid())
@ -95,7 +95,8 @@ BMailDaemon::FetchBody(const entry_ref& ref, BMessage* launchMessage)
BMessage message(kMsgFetchBody);
message.AddRef("refs", &ref);
message.AddMessage("launch", launchMessage);
if (listener != NULL)
message.AddMessenger("target", *listener);
BMessage reply;
return daemon.SendMessage(&message, &reply);

View File

@ -27,6 +27,7 @@
#include <mail_util.h>
#include <MailAddon.h>
#include <MailDaemon.h>
#include <MailProtocol.h>
#include <MailSettings.h>
@ -542,8 +543,6 @@ MailProtocolThread::TriggerFileDeleted(const node_ref& node)
const uint32 kMsgSyncMessages = '&SyM';
const uint32 kMsgFetchBody = '&FeB';
const uint32 kMsgMarkMessageAsRead = '&MaR';
const uint32 kMsgDeleteMessage = '&DeM';
const uint32 kMsgAppendMessage = '&ApM';
@ -579,20 +578,15 @@ InboundProtocolThread::MessageReceived(BMessage* message)
entry_ref ref;
message->FindRef("ref", &ref);
status_t status = fProtocol->FetchBody(ref);
if (status != B_OK)
BMessenger target;
if (message->FindMessenger("target", &target) != B_OK)
break;
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);
BMessage message(kMsgBodyFetched);
message.AddInt32("status", status);
message.AddRef("ref", &ref);
target.SendMessage(&message);
break;
}
@ -635,11 +629,12 @@ InboundProtocolThread::SyncMessages()
void
InboundProtocolThread::FetchBody(const entry_ref& ref, BMessage* launch)
InboundProtocolThread::FetchBody(const entry_ref& ref, BMessenger* listener)
{
BMessage message(kMsgFetchBody);
message.AddRef("ref", &ref);
message.AddMessage("launch", launch);
if (listener)
message.AddMessenger("target", *listener);
PostMessage(&message);
}

View File

@ -201,11 +201,11 @@ MailDaemonApp::RefsReceived(BMessage* message)
if (!protocol)
continue;
BMessage* launchMessage = message;
BMessage temp;
if (message->FindMessage("launch", &temp) == B_OK)
launchMessage = &temp;
protocol->FetchBody(ref, launchMessage);
BMessenger target;
BMessenger* messenger = &target;
if (message->FindMessenger("target", &target) != B_OK)
messenger = NULL;
protocol->FetchBody(ref, messenger);
}
}
@ -638,12 +638,12 @@ MailDaemonApp::MakeMimeTypes(bool remakeMIMETypes)
// do a full rebuild from nothing, or just add on the new attributes that
// we support which the regular BeOS mail daemon didn't have.
const char* types[2] = {"text/x-email", "text/x-partial-email"};
BMimeType mime;
BMessage info;
const uint8 kNTypes = 2;
const char* types[kNTypes] = {"text/x-email", "text/x-partial-email"};
for (size_t i = 0; i < sizeof(types) / sizeof(types[0]); i++) {
info.MakeEmpty();
for (size_t i = 0; i < kNTypes; i++) {
BMessage info;
BMimeType mime;
mime.SetTo(types[i]);
if (mime.InitCheck() != B_OK) {
fputs("could not init mime type.\n", stderr);
@ -682,7 +682,7 @@ MailDaemonApp::MakeMimeTypes(bool remakeMIMETypes)
} else {
mime.SetShortDescription("Partial E-mail");
mime.SetLongDescription("A Partially Downloaded E-mail");
mime.SetPreferredApp("application/x-vnd.Be-POST");
mime.SetPreferredApp("application/x-vnd.Be-MAIL");
}
} else {
// Just add the e-mail related attribute types we use to the MIME

View File

@ -2,10 +2,6 @@ resource app_signature "application/x-vnd.Be-POST";
resource app_flags B_BACKGROUND_APP;
resource(1, "BEOS:FILE_TYPES") message {
"types" = "text/x-partial-email"
};
resource app_version {
major = 3,
middle = 0,
@ -90,63 +86,6 @@ resource(3) #'BBMP' archive BBitmap {
}
};
resource(0, "BEOS:L:text/x-partial-email") #'ICON' array {
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF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FFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFF001B0000FFFFFFFFFFFFFFFF"
$"FFFFFF001B3F1B1B00FFFFFFFFFFFFFF"
$"FFFF001B3F3F3F3F1B0FFF00FFFFFFFF"
$"FF001B3F3F00000F0F0FFF1B0000FFFF"
$"001B3F3F1C1C1C0FFFFFFF2B1B1B0000"
$"001B1B3F00001C0FFF1C7B2B2C1B000F"
$"0F00001B0F0F0F0FFF1C3F7B1B000FFF"
$"FF0F0F000FFFFFFFFF1C3F1B000FFFFF"
$"FFFFFF0F0FFF001B1B1C1B000FFFFFFF"
$"FFFFFFFFFFFF0F00001B000FFFFFFFFF"
$"FFFFFFFFFFFFFF0F0F000FFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF"
};
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
resource vector_icon {
$"6E6369660A04016A0501020116023D5F72B9240538B7E13CEB504758E9489EE5"
$"7CFFFDA9020116023C848B3B432FBBCE623CEFF849000048C0007CFF00A90201"
@ -173,61 +112,3 @@ resource vector_icon {
$"03123F34DC0000000000003F3E3A41F7B04381C001178400040A060103000A05"
$"010800"
};
#else // HAIKU_TARGET_PLATFORM_HAIKU
resource large_icon {
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFF"
$"FFFFFFFFFF000000000000000000000000000000FFFF003FD9D9D90000FFFFFF"
$"FFFFFFFF003F3F3F3F3F3F3F3F3F3F3F3F3F3F3F00003FD9D9D9D9D9D90000FF"
$"FFFFFFFF003FD9D9D9D9D9D9D9D9D9D9D9D9D9D93F3FAAAAD9D9D9D9D9D98300"
$"FFFFFFFF003FD98383000083838383D9D9D9D9D9D9838383AAAAD9D9D983AA00"
$"FFFFFFFF11000000003FFD000083838383838383833F3FD93F3FAAAA83AAAA00"
$"FFFFFFFFFF1111003F0000FDFD0000008383833F3FD9D9D9D9D93F3FAAAAAA00"
$"FFFFFFFFFFFF003F3FFDFD0000FDFD0000838383D9D9D9D93F3FD9D983AA0011"
$"FFFFFFFFFF003F3FFDFDFDFDFDFDFDFDFD0000838383D9D93F3FD9D9D9AA0017"
$"FFFFFFFF003F3FFDFDFDFDFDFDFDFDFDFDFDFD000083D9D9D9D9D9D9D9830011"
$"FFFFFF003F3FFDFDFDFDFDFDFDFDFDFDFDFDFDFDFD0000D9D9D9D9D983AA0011"
$"FFFF003F3FFDFDFDFDFDFD0000FDFDFDFDFDFDFDFDFDFD000083838383001111"
$"FF00FDFDFDFDFDFDFDFDFDFDFD0000FDFDFDFDFDFDFDFDFDFD000083001111FF"
$"FFFF0000FDFDFDFDFDFD0000FDFDFD0000FDFDFDFDFDFDD898D8FD000011FFFF"
$"FF1111110000FDFDFDFDFDFD0000FDFDFDFDFDFDFDFDFD2D2D2DFDFD000011FF"
$"FFFFFF0083830000FDFDFDFDFDFD0000FDFDFDFDFDFDFDD82DD8FDF8001111FF"
$"FFFF003FD98383000000FDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDF8001111FFFF"
$"FF003FD98383008383830000FDFDFDFDFDFDFDFDFDFDFDFDFDF8001111FFFFFF"
$"003FD98383003FD9D98383000000FDFDFDFDFDFDFDFDFDFDF8001111FFFFFFFF"
$"00D983AA003FD9D98383008383830000FDFDFDFDFDFDFDF8001111FFFFFFFFFF"
$"FF0000003FD9D983AA003FD9D98383000000FDFDFDFDF8001111FFFFFFFFFFFF"
$"FFFF003FD9D983AA003FD9D98383008383830000F8F8001111FFFFFFFFFFFFFF"
$"FFFF00D9838300003FD9D983AA003FD98383001100001111FFFFFFFFFFFFFFFF"
$"FFFFFF000000FF00D9D983AA003FD98383001111FFFFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFF000000003FD98300001111FFFFFFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFFFF000000111111FFFFFFFFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
};
resource mini_icon {
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFF0000FFFFFF"
$"FFFFFF0000000000000000D9D90000FF"
$"FFFF00D9D9D9D9D9D9D9D9AAAAD98300"
$"FFFF0000000000D9D983833F3FAAAA00"
$"FFFF11003F0000D9D9D9D9D9D9D9AA00"
$"FFFF003F0011FD0000D9D9D93FD9AA01"
$"FF003FFDFDFDFDFDFD0000D9D9830011"
$"003FFDFDFD0000FDFDFDFD00000011FF"
$"110000FDFDFDFD0000FD982DFD0000FF"
$"00D9830000FDFDFDFDFDFDD8F80011FF"
$"008300D9830000FDFDFDFDF80011FFFF"
$"FF00D98300D9000000FDF80011FFFFFF"
$"FFFF00000000008300000011FFFFFFFF"
$"FFFFFFFFFFFF0000111111FFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
};
#endif // HAIKU_TARGET_PLATFORM_HAIKU