From be1c10ae1974b30a80fb9b312f5361e8df440d98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Mon, 26 Apr 2010 13:58:32 +0000 Subject: [PATCH] If the BMailChain does not contain a setting for the path for storing out-going mail, fall back to using $HOME/mail/out. Otherwise mails would be stored in the current directroy. I have no idea why the default BMailChain would not contain the setting, though. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36490 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/mail/MailMessage.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/kits/mail/MailMessage.cpp b/src/kits/mail/MailMessage.cpp index 5ac93eb5dd..10a4f9f6e7 100644 --- a/src/kits/mail/MailMessage.cpp +++ b/src/kits/mail/MailMessage.cpp @@ -1,6 +1,6 @@ /* * Copyright 2001-2004 Dr. Zoidberg Enterprises. All rights reserved. - * Copyright 2007, Haiku Inc. All Rights Reserved. + * Copyright 2007, 2010, Haiku Inc. All Rights Reserved. * * Distributed under the terms of the MIT License. */ @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -908,12 +909,22 @@ BEmailMessage::Send(bool send_now) SendViaAccount(via->ID()); } - create_directory(via->MetaData()->FindString("path"),0777); - BDirectory directory(via->MetaData()->FindString("path")); + BString path; + if (via->MetaData()->FindString("path", &path) != B_OK) { + BPath defaultMailOutPath; + if (find_directory(B_USER_DIRECTORY, &defaultMailOutPath) != B_OK + || defaultMailOutPath.Append("mail/out") != B_OK) + path = "/boot/home/mail/out"; + else + path = defaultMailOutPath.Path(); + } + + create_directory(path.String(), 0777); + BDirectory directory(path.String()); BEntry message; - status_t status = RenderTo(&directory,&message); + status_t status = RenderTo(&directory, &message); delete via; if (status >= B_OK && send_now) { BMailSettings settings_file;