本文整理汇总了C++中BMailAccounts::AccountByID方法的典型用法代码示例。如果您正苦于以下问题:C++ BMailAccounts::AccountByID方法的具体用法?C++ BMailAccounts::AccountByID怎么用?C++ BMailAccounts::AccountByID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BMailAccounts
的用法示例。
在下文中一共展示了BMailAccounts::AccountByID方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: directory
status_t
BEmailMessage::Send(bool sendNow)
{
BMailAccounts accounts;
BMailAccountSettings* account = accounts.AccountByID(_account_id);
if (!account || !account->HasOutbound()) {
account = accounts.AccountByID(
BMailSettings().DefaultOutboundAccount());
if (!account)
return B_ERROR;
SendViaAccount(account->AccountID());
}
BString path;
if (account->OutboundSettings().Settings().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);
if (status >= B_OK && sendNow) {
BMailSettings settings_file;
if (settings_file.SendOnlyIfPPPUp()) {
// TODO!
}
BMessenger daemon(B_MAIL_DAEMON_SIGNATURE);
if (!daemon.IsValid())
return B_MAIL_NO_DAEMON;
BMessage msg('msnd');
msg.AddInt32("account",_account_id);
BPath path;
message.GetPath(&path);
msg.AddString("message_path",path.Path());
daemon.SendMessage(&msg);
}
return status;
}
示例2:
void
BEmailMessage::SendViaAccount(int32 account)
{
_account_id = account;
BMailAccounts accounts;
BMailAccountSettings* accountSettings = accounts.AccountByID(_account_id);
BString from;
if (accountSettings) {
from << '\"' << accountSettings->RealName() << "\" <"
<< accountSettings->ReturnAddress() << '>';
}
SetFrom(from);
}
示例3: sizeof
status_t
BEmailMessage::GetAccountName(BString& accountName) const
{
BFile *file = dynamic_cast<BFile *>(fData);
if (file == NULL)
return B_ERROR;
int32 accountId;
size_t read = file->ReadAttr(B_MAIL_ATTR_ACCOUNT, B_INT32_TYPE, 0,
&accountId, sizeof(int32));
if (read < sizeof(int32))
return B_ERROR;
BMailAccounts accounts;
BMailAccountSettings* account = accounts.AccountByID(accountId);
if (account)
accountName = account->Name();
else
accountName = "";
return B_OK;
}
示例4: CC
BEmailMessage *
BEmailMessage::ReplyMessage(mail_reply_to_mode replyTo, bool accountFromMail,
const char *quoteStyle)
{
BEmailMessage *reply = new BEmailMessage;
// Set ReplyTo:
if (replyTo == B_MAIL_REPLY_TO_ALL) {
reply->SetTo(From());
BList list;
get_address_list(list, CC(), extract_address);
get_address_list(list, To(), extract_address);
// Filter out the sender
BMailAccounts accounts;
BMailAccountSettings* account = accounts.AccountByID(Account());
BString sender;
if (account)
sender = account->ReturnAddress();
extract_address(sender);
BString cc;
for (int32 i = list.CountItems(); i-- > 0;) {
char *address = (char *)list.RemoveItem((int32)0);
// add everything which is not the sender and not already in the list
if (sender.ICompare(address) && cc.FindFirst(address) < 0) {
if (cc.Length() > 0)
cc << ", ";
cc << address;
}
free(address);
}
if (cc.Length() > 0)
reply->SetCC(cc.String());
} else if (replyTo == B_MAIL_REPLY_TO_SENDER || ReplyTo() == NULL)
reply->SetTo(From());
else
reply->SetTo(ReplyTo());
// Set special "In-Reply-To:" header (used for threading)
const char *messageID = _body ? _body->HeaderField("Message-Id") : NULL;
if (messageID != NULL)
reply->SetHeaderField("In-Reply-To", messageID);
// quote body text
reply->SetBodyTextTo(BodyText());
if (quoteStyle)
reply->Body()->Quote(quoteStyle);
// Set the subject (and add a "Re:" if needed)
BString string = Subject();
if (string.ICompare("re:", 3) != 0)
string.Prepend("Re: ");
reply->SetSubject(string.String());
// set the matching outbound chain
if (accountFromMail)
reply->SendViaAccountFrom(this);
return reply;
}