Loading...
Searching...
No Matches
Public Member Functions | List of all members
BMailDaemon Class Reference

Provides user level access to the mail_daemon to perform common mail tasks such as check for new messages or send queued messages. More...

Public Member Functions

 BMailDaemon ()
 Creates a BMailDaemon object that communicates with the mail_daemon server.
 
virtual ~BMailDaemon ()
 Frees all resources associated with this object.
 
Running status
bool IsRunning ()
 Checks if the mail_daemon is running.
 
status_t Quit ()
 Request the mail_daemon to quit.
 
status_t Launch ()
 Launches the mail_daemon.
 
Mail tasks
status_t CheckMail (int32 accountID=-1)
 Asks the mail_daemon to check if there are new messages for the account with ID accountID.
 
status_t CheckAndSendQueuedMail (int32 accountID=-1)
 Asks the mail_daemon to check if there are new messages and to send any queued messages pending to be sent, for the account with ID accountID.
 
status_t SendQueuedMail ()
 Asks the mail_daemon to send any queued message pending to be sent.
 
int32 CountNewMessages (bool waitForFetchCompletion=false)
 Asks the mail_daemon how many new messages there are.
 
status_t MarkAsRead (int32 account, const entry_ref &ref, read_flags flag=B_READ)
 Requests the mail_daemon to mark an e-mail message as read or unread.
 
status_t FetchBody (const entry_ref &ref, BMessenger *listener=NULL)
 Requests the mail_daemon to retrieve the message's body.
 

Detailed Description

Provides user level access to the mail_daemon to perform common mail tasks such as check for new messages or send queued messages.

Since
Haiku R1

Constructor & Destructor Documentation

◆ BMailDaemon()

BMailDaemon::BMailDaemon ( )

Creates a BMailDaemon object that communicates with the mail_daemon server.

Since
Haiku R1

◆ ~BMailDaemon()

BMailDaemon::~BMailDaemon ( )
virtual

Frees all resources associated with this object.

Since
Haiku R1

Member Function Documentation

◆ CheckAndSendQueuedMail()

status_t BMailDaemon::CheckAndSendQueuedMail ( int32  accountID = -1)

Asks the mail_daemon to check if there are new messages and to send any queued messages pending to be sent, for the account with ID accountID.

If accountID is -1, it will check for new messages and send the queued messages for all the available accounts.

Parameters
[in]accountIDThe ID of the account.
Return values
B_OKThe request has been sent successfully.
B_MAIL_NO_DAEMONThe mail_daemon is not currently running.
Since
Haiku R1

◆ CheckMail()

status_t BMailDaemon::CheckMail ( int32  accountID = -1)

Asks the mail_daemon to check if there are new messages for the account with ID accountID.

If accountID is -1, it will check for new messages for all the available accounts.

Parameters
[in]accountIDThe ID of the account.
Return values
B_OKThe request has been sent successfully.
B_MAIL_NO_DAEMONThe mail_daemon is not currently running.
Since
Haiku R1

◆ CountNewMessages()

int32 BMailDaemon::CountNewMessages ( bool  waitForFetchCompletion = false)

Asks the mail_daemon how many new messages there are.

Parameters
[in]waitForFetchCompletionIf true, it will make the count once the mail server fetching is completed.
Returns
The number of new messages, or B_MAIL_NO_DAEMON if the mail_daemon is not currently running.
Since
Haiku R1

◆ FetchBody()

status_t BMailDaemon::FetchBody ( const entry_ref ref,
BMessenger listener = NULL 
)

Requests the mail_daemon to retrieve the message's body.

If listener is not NULL, it will receive a B_MAIL_BODY_FETCHED notification after the e-mail message's body was fetched successfully, or else an error code if something went wrong.

Parameters
[in]refThe entry_ref of the target message.
[in]listenerA BMessenger where a reply will be sent to.
Return values
B_OKThe request has been sent successfully.
B_MAIL_NO_DAEMONThe mail_daemon is not currently running.
Since
Haiku R1

◆ IsRunning()

bool BMailDaemon::IsRunning ( )

Checks if the mail_daemon is running.

Return values
trueThe mail_daemon is running.
falseThe mail_daemon is not running.
Since
Haiku R1

◆ Launch()

status_t BMailDaemon::Launch ( )

Launches the mail_daemon.

Return values
B_OKThe mail_daemon has been launched successfully.
B_ALREADY_RUNNINGThe mail_daemon is already running.
Since
Haiku R1

◆ MarkAsRead()

status_t BMailDaemon::MarkAsRead ( int32  account,
const entry_ref ref,
read_flags  flag = B_READ 
)

Requests the mail_daemon to mark an e-mail message as read or unread.

Parameters
[in]accountThe account's ID.
[in]refThe entry_ref of the target message.
[in]flagCan be one of these: B_UNREAD, B_SEEN, B_READ.
Return values
B_OKThe request has been sent successfully.
B_MAIL_NO_DAEMONThe mail_daemon is not currently running.
Since
Haiku R1

◆ Quit()

status_t BMailDaemon::Quit ( )

Request the mail_daemon to quit.

Return values
B_OKThe request has been sent successfully.
B_MAIL_NO_DAEMONThe mail_daemon is not currently running.
Since
Haiku R1

◆ SendQueuedMail()

status_t BMailDaemon::SendQueuedMail ( )

Asks the mail_daemon to send any queued message pending to be sent.

Return values
B_OKThe request has been sent successfully.
B_MAIL_NO_DAEMONThe mail_daemon is not currently running.
Since
Haiku R1