Completed transition to the new mail API; ie. it compiles.

* Completely untested yet. Unlikely to work yet.
This commit is contained in:
Axel Dörfler
2015-01-06 15:21:55 +01:00
parent 383b34adac
commit 146357b547
14 changed files with 408 additions and 301 deletions
+3 -3
View File
@@ -2,8 +2,8 @@
* Copyright 2011-2012, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef MAIL_FILTER_H
#define MAIL_FILTER_H
#ifndef _MAIL_FILTER_H
#define _MAIL_FILTER_H
#include "MailProtocol.h"
@@ -47,4 +47,4 @@ extern "C" BMailFilter* instantiate_filter(BMailProtocol& protocol,
extern "C" BString filter_name();
#endif // MAIL_FILTER_H
#endif // _MAIL_FILTER_H
+18 -12
View File
@@ -1,16 +1,16 @@
/* Protocol - the base class for protocol filters
*
/*
* Copyright 2004-2012, Haiku, Inc. All Rights Reserved.
* Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved.
* Copyright 2011 Clemens Zeidler. All rights reserved.
*/
#ifndef MAIL_PROTOCOL_H
#define MAIL_PROTOCOL_H
*
* Distributed under the terms of the MIT License.
*/
#ifndef _MAIL_PROTOCOL_H
#define _MAIL_PROTOCOL_H
#include <map>
#include <vector>
#include <Handler.h>
#include <Looper.h>
#include <OS.h>
#include <ObjectList.h>
@@ -22,6 +22,7 @@
class BMailFilter;
class BView;
class BMailNotifier {
@@ -41,7 +42,7 @@ public:
};
class BMailProtocol : BLooper {
class BMailProtocol : public BLooper {
public:
BMailProtocol(
const BMailAccountSettings& settings);
@@ -74,6 +75,12 @@ public:
void ShowError(const char* error);
void ShowMessage(const char* message);
#if __GNUC__ > 2
// Unhide virtual base methods
using BHandler::AddFilter;
using BHandler::RemoveFilter;
#endif
protected:
void SetTotalItems(uint32 items);
void SetTotalItemsSize(uint64 size);
@@ -136,9 +143,8 @@ public:
virtual void MessageReceived(BMessage* message);
virtual status_t SendMessages(
const std::vector<entry_ref>& mails,
size_t totalBytes) = 0;
virtual status_t SendMessages(const BMessage& message,
off_t totalBytes) = 0;
};
@@ -151,4 +157,4 @@ extern "C" _EXPORT BView* instantiate_protocol_config_panel(
BMailAccountSettings& settings);
#endif // MAIL_PROTOCOL_H
#endif // _MAIL_PROTOCOL_H
+28 -33
View File
@@ -1,45 +1,40 @@
#ifndef MAIL_DAEMON_H
#define MAIL_DAEMON_H
/* Daemon - talking to the mail daemon
*
* Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved.
* Copyright 2011, Clemens Zeidler <[email protected]>
*/
/*
* Copyright 2012, Haiku Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _MAIL_DAEMON_H
#define _MAIL_DAEMON_H
#include <E-mail.h>
#define B_MAIL_DAEMON_SIGNATURE "application/x-vnd.Be-POST"
const uint32 kMsgCheckAndSend = 'mbth';
const uint32 kMsgCheckMessage = 'mnow';
const uint32 kMsgSendMessages = 'msnd';
const uint32 kMsgSettingsUpdated = 'mrrs';
const uint32 kMsgAccountsChanged = 'macc';
const uint32 kMsgSetStatusWindowMode = 'shst';
const uint32 kMsgCountNewMessages = 'mnum';
const uint32 kMsgMarkMessageAsRead = 'mmar';
const uint32 kMsgFetchBody = 'mfeb';
const uint32 kMsgBodyFetched = 'mbfe';
class BMessenger;
#include <Messenger.h>
class BMailDaemon {
public:
//! accountID = -1 means check all accounts
static status_t CheckMail(int32 accountID = -1);
static status_t CheckAndSendQueuedMail(int32 accountID = -1);
static status_t SendQueuedMail();
static int32 CountNewMessages(
BMailDaemon();
virtual ~BMailDaemon();
bool IsRunning();
status_t CheckMail(int32 accountID = -1);
status_t CheckAndSendQueuedMail(int32 accountID = -1);
status_t SendQueuedMail();
int32 CountNewMessages(
bool waitForFetchCompletion = false);
static status_t MarkAsRead(int32 account, const entry_ref& ref,
status_t MarkAsRead(int32 account, const entry_ref& ref,
read_flags flag = B_READ);
static status_t FetchBody(const entry_ref& ref,
status_t FetchBody(const entry_ref& ref,
BMessenger* listener = NULL);
static status_t Quit();
status_t Quit();
status_t Launch();
private:
BMessenger fDaemon;
};
#endif // MAIL_DAEMON_H
#endif // _MAIL_DAEMON_H
+21 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2011, Haiku Inc. All Rights Reserved.
* Copyright 2011-2012, Haiku Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef MAIL_PRIVATE_H
@@ -12,13 +12,33 @@
namespace BPrivate {
#define B_MAIL_DAEMON_SIGNATURE "application/x-vnd.Be-POST"
// mail daemon & protocol message constants
const uint32 kMsgCheckAndSend = 'mbth';
const uint32 kMsgCheckMessage = 'mnow';
const uint32 kMsgSendMessages = 'msnd';
const uint32 kMsgSettingsUpdated = 'mrrs';
const uint32 kMsgAccountsChanged = 'macc';
const uint32 kMsgSetStatusWindowMode = 'shst';
const uint32 kMsgCountNewMessages = 'mnum';
const uint32 kMsgMarkMessageAsRead = 'mmar';
const uint32 kMsgFetchBody = 'mfeb';
const uint32 kMsgBodyFetched = 'mbfe';
const uint32 kMsgSyncMessages = '&SyM';
BPath default_mail_directory();
BPath default_mail_in_directory();
BPath default_mail_out_directory();
status_t WriteMessageFile(const BMessage& archive, const BPath& path,
const char* name);
} // namespace BPrivate