Fixed forward with attachments

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9657 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Nathan Whitehorn 2004-10-30 02:45:37 +00:00
parent a8574e9d75
commit 6686b03883
5 changed files with 39 additions and 13 deletions

View File

@ -352,6 +352,23 @@ TEnclosuresView::Focus(bool focus)
}
static void recursive_attachment_search(TEnclosuresView *us,BMailContainer *mail) {
if (mail == NULL)
return;
for (int32 i = 0; i < mail->CountComponents(); i++)
{
BMailComponent *component = mail->GetComponent(i);
if (component->ComponentType() == B_MAIL_MULTIPART_CONTAINER)
recursive_attachment_search(us,dynamic_cast<BMIMEMultipartMailContainer *>(component));
BMailAttachment *attachment = dynamic_cast<BMailAttachment *>(component);
if (attachment == NULL)
continue;
us->fList->AddItem(new TListItem(component));
}
}
void
TEnclosuresView::AddEnclosuresFromMail(BEmailMessage *mail)
{
@ -360,7 +377,10 @@ TEnclosuresView::AddEnclosuresFromMail(BEmailMessage *mail)
BMailComponent *component = mail->GetComponent(i);
if (component == mail->Body())
continue;
if (component->ComponentType() == B_MAIL_MULTIPART_CONTAINER)
recursive_attachment_search(this,dynamic_cast<BMIMEMultipartMailContainer *>(component));
BMailAttachment *attachment = dynamic_cast<BMailAttachment *>(component);
if (attachment == NULL)
continue;

View File

@ -241,7 +241,7 @@ TMailApp::AboutRequested()
(new BAlert("",
"BeMail\nBy Robert Polic\n\n"
"Enhanced by Axel Dörfler and the Dr. Zoidberg crew\n\n"
"Mail.cpp $Revision: 1.1 $\n"
"Mail.cpp $Revision: 1.2 $\n"
"Compiled on " __DATE__ " at " __TIME__ ".",
"Close"))->Go();
}
@ -2875,14 +2875,19 @@ class HorizontalLine : public BView {
void
TMailWindow::Print()
{
BPrintJob print(Title());
if (!print_settings)
{
PrintSetup();
if (!print_settings)
return;
if (print.Settings()) {
print_settings = print.Settings();
} else {
PrintSetup();
if (!print_settings)
return;
}
}
BPrintJob print(Title());
print.SetSettings(new BMessage(*print_settings));
if (print.ConfigJob() == B_NO_ERROR)

View File

@ -340,6 +340,7 @@ void BSimpleMailAttachment::ParseNow() {
}
status_t BSimpleMailAttachment::RenderToRFC822(BPositionIO *render_to) {
ParseNow();
BMailComponent::RenderToRFC822(render_to);
//---------Massive memory squandering!---ALERT!----------
// now with error checks, dumb :-) -- axeld.

View File

@ -427,6 +427,9 @@ void BTextMailComponent::Quote(const char *message, const char *quote_style) {
status_t BTextMailComponent::GetDecodedData(BPositionIO *data) {
ParseRaw();
if (data == NULL)
return B_IO_ERROR;
BMimeType type;
ssize_t written;

View File

@ -168,7 +168,6 @@ BEmailMessage::ReplyMessage(mail_reply_to_mode replyTo, bool accountFromMail, co
return to_return;
}
BEmailMessage *
BEmailMessage::ForwardMessage(bool accountFromMail, bool includeAttachments)
{
@ -195,25 +194,23 @@ BEmailMessage::ForwardMessage(bool accountFromMail, bool includeAttachments)
if (includeAttachments) {
for (int32 i = 0; i < CountComponents(); i++) {
BMailComponent *cmpt = GetComponent(i);
if (cmpt == _text_body)
if (cmpt == _text_body || cmpt == NULL)
continue;
//---I am ashamed to have the written the code between here and the next comment
cmpt->GetDecodedData(NULL);
// ... and you still managed to get it wrong ;-)), axeld.
// we should really move this stuff into copy constructors
// or something like that
BMallocIO io;
cmpt->RenderToRFC822(&io);
BMailComponent *clone = cmpt->WhatIsThis();
io.Seek(0, SEEK_SET);
clone->SetToRFC822(&io, io.BufferLength(), true);
message->AddComponent(clone);
//---
//---
}
}
if (accountFromMail)
message->SendViaAccountFrom(this);