The Message-Id field now gets a default hostname added in case there is none set in the system.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20363 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,7 +1,11 @@
|
|||||||
/* Message - the main general purpose mail message class
|
/*
|
||||||
**
|
* Copyright 2001-2004 Dr. Zoidberg Enterprises. All rights reserved.
|
||||||
** Copyright 2001-2004 Dr. Zoidberg Enterprises. All rights reserved.
|
* Copyright 2007, Haiku Inc. All Rights Reserved.
|
||||||
*/
|
*
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
//! The main general purpose mail message class
|
||||||
|
|
||||||
|
|
||||||
#include <List.h>
|
#include <List.h>
|
||||||
@@ -685,7 +689,7 @@ BEmailMessage::RenderToRFC822(BPositionIO *file)
|
|||||||
if (_body == NULL)
|
if (_body == NULL)
|
||||||
return B_MAIL_INVALID_MAIL;
|
return B_MAIL_INVALID_MAIL;
|
||||||
|
|
||||||
//------Do real rendering
|
// Do real rendering
|
||||||
|
|
||||||
if (From() == NULL)
|
if (From() == NULL)
|
||||||
SendViaAccount(_chain_id); //-----Set the from string
|
SendViaAccount(_chain_id); //-----Set the from string
|
||||||
@@ -726,28 +730,30 @@ BEmailMessage::RenderToRFC822(BPositionIO *file)
|
|||||||
SetHeaderField("Date", date);
|
SetHeaderField("Date", date);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* add a message-id */
|
// add a message-id
|
||||||
BString message_id;
|
|
||||||
/* empirical evidence indicates message id must be enclosed in
|
// empirical evidence indicates message id must be enclosed in
|
||||||
** angle brackets and there must be an "at" symbol in it
|
// angle brackets and there must be an "at" symbol in it
|
||||||
*/
|
BString messageID;
|
||||||
message_id << "<";
|
messageID << "<";
|
||||||
message_id << system_time();
|
messageID << system_time();
|
||||||
message_id << "-BeMail@";
|
messageID << "-BeMail@";
|
||||||
|
|
||||||
char host[255];
|
char host[255];
|
||||||
gethostname(host,255);
|
if (gethostname(host, sizeof(host)) < 0 || !host[0])
|
||||||
message_id << host;
|
strcpy(host, "zoidberg");
|
||||||
|
|
||||||
message_id << ">";
|
messageID << host;
|
||||||
|
messageID << ">";
|
||||||
|
|
||||||
SetHeaderField("Message-Id", message_id.String());
|
SetHeaderField("Message-Id", messageID.String());
|
||||||
|
|
||||||
status_t err = BMailComponent::RenderToRFC822(file);
|
status_t err = BMailComponent::RenderToRFC822(file);
|
||||||
if (err < B_OK)
|
if (err < B_OK)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
file->Seek(-2, SEEK_CUR); //-----Remove division between headers
|
file->Seek(-2, SEEK_CUR);
|
||||||
|
// Remove division between headers
|
||||||
|
|
||||||
err = _body->RenderToRFC822(file);
|
err = _body->RenderToRFC822(file);
|
||||||
if (err < B_OK)
|
if (err < B_OK)
|
||||||
@@ -759,7 +765,6 @@ BEmailMessage::RenderToRFC822(BPositionIO *file)
|
|||||||
// set to "Pending").
|
// set to "Pending").
|
||||||
|
|
||||||
if (BFile *attributed = dynamic_cast <BFile *>(file)) {
|
if (BFile *attributed = dynamic_cast <BFile *>(file)) {
|
||||||
|
|
||||||
BNodeInfo(attributed).SetType(B_MAIL_TYPE);
|
BNodeInfo(attributed).SetType(B_MAIL_TYPE);
|
||||||
|
|
||||||
attributed->WriteAttrString(B_MAIL_ATTR_RECIPIENTS,&recipients);
|
attributed->WriteAttrString(B_MAIL_ATTR_RECIPIENTS,&recipients);
|
||||||
@@ -800,7 +805,7 @@ BEmailMessage::RenderToRFC822(BPositionIO *file)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BEmailMessage::RenderTo(BDirectory *dir,BEntry *msg)
|
BEmailMessage::RenderTo(BDirectory *dir, BEntry *msg)
|
||||||
{
|
{
|
||||||
time_t currentTime;
|
time_t currentTime;
|
||||||
char numericDateString [40];
|
char numericDateString [40];
|
||||||
|
|||||||
Reference in New Issue
Block a user