Major restructuring of the mail server:
Accounts are now stored in a separate file. Previously they where somehow magically assembled from the chain ids. Now its possible to remove a account temporary by removing the account file form the account folder. Each account could have an inbound protocol, an outbound protocol and some filters. Mails are now associated with an account and not with a chain. This required to replace the chain id attribute by an account attribute. Replace BMailFilter and BMailChain by a less general approach. Basically the chain had a list of filters and call the ProcessMailMessage for each filter. This made it sometime difficult to understand what is going on, e.g. sometimes a filter used information gathered by another filters. The new MailProtocol and MailFilter classes are calling more dedicated hook functions, e.g. HeaderFetched or MessageReadyToSend. As before all MailProtocol's (plus their filters) are running in their own thread. Cleaned up the error and status window a bit. Abstracted the interface to these windows. Should be easy to write a BNotification api back-end now. Parsing of mail headers is much faster now. Fetching the headers of a large mailbox takes ~min and not ~hour now! Initial checkout time is in the same order like Opera. The problem was the massive use of fgets in parse_header (mail_util.cpp) now the complete header is read in one go. Furthermore, only interesting fields are extracted. Remove some unused files, BeOS relicts... Feel free to translate the mail server and remove the own language system (headers/private/mail/MDRLanguage.h). Sorry for the remaining old (and new) coding style issues, sometime just ignore them, to many :( git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40397 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,98 +0,0 @@
|
||||
#ifndef ZOIDBERG_MAIL_CHAIN_RUNNER_H
|
||||
#define ZOIDBERG_MAIL_CHAIN_RUNNER_H
|
||||
/* ChainRunner - runs the mail inbound and outbound chains
|
||||
**
|
||||
** Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved.
|
||||
*/
|
||||
|
||||
|
||||
#include <MailAddon.h>
|
||||
#include <MailSettings.h>
|
||||
#include <Looper.h>
|
||||
|
||||
class BStringList;
|
||||
class BMailStatusWindow;
|
||||
class BMailStatusView;
|
||||
class BMailChain;
|
||||
|
||||
class BMailChainCallback {
|
||||
public:
|
||||
virtual void Callback(status_t result) = 0;
|
||||
// Called by the callback routines in ChainRunner
|
||||
// result is the message that ended the chain
|
||||
// (MD_HANDLED, MD_DISCARD, MD_NO_MORE_MESSAGES)
|
||||
// Obviously, for process callbacks, result is
|
||||
// gauranteed to be MD_NO_MORE_MESSAGES.
|
||||
};
|
||||
|
||||
class BMailChainRunner : public BLooper {
|
||||
public:
|
||||
BMailChainRunner(BMailChain *chain, BMailStatusWindow *status,
|
||||
bool self_destruct_when_done = true, bool save_chain_when_done = false,
|
||||
bool destruct_chain_when_done = false);
|
||||
~BMailChainRunner();
|
||||
|
||||
//----Callback functions. Callback objects will be deleted for you.
|
||||
|
||||
void RegisterMessageCallback(BMailChainCallback *callback);
|
||||
// Your callback->Callback() function will be called when
|
||||
// the current message is done being processed.
|
||||
|
||||
void RegisterProcessCallback(BMailChainCallback *callback);
|
||||
// Your callback->Callback() function will be called when
|
||||
// a filter returns MD_PASS_COMPLETE and before we go back
|
||||
// to waiting for new messages, or when the fetch list
|
||||
// runs out.
|
||||
|
||||
void RegisterChainCallback(BMailChainCallback *callback);
|
||||
// Your callback->Callback() function will be called when
|
||||
// a filter returns MD_ALL_PASSES_DONE and before everything
|
||||
// is unloaded and sent home.
|
||||
|
||||
void Stop(bool immediately = false);
|
||||
void ReportProgress(int bytes, int messages, const char *message = NULL);
|
||||
void ResetProgress(const char *message = NULL);
|
||||
|
||||
void GetMessages(BStringList *list, int32 bytes);
|
||||
void GetSingleMessage(const char *uid, int32 length, BPath *into);
|
||||
// The bytes or length field is the total size, used for updating the
|
||||
// progress bar. Use -1 for unknown maximum size.
|
||||
|
||||
bool QuitRequested();
|
||||
|
||||
void ShowError(const char *error);
|
||||
void ShowMessage(const char *message);
|
||||
|
||||
BMailChain *Chain();
|
||||
|
||||
//----The big, bad asynchronous RunChain() function. Pretty harmless looking, huh?
|
||||
status_t RunChain(bool asynchronous = true);
|
||||
|
||||
void MessageReceived (BMessage *msg);
|
||||
|
||||
private:
|
||||
void CallCallbacksFor(BList &list, status_t code);
|
||||
void get_messages(BStringList *list);
|
||||
status_t Init();
|
||||
#if USE_NASTY_SYNC_THREAD_HACK
|
||||
static int32 thread_sync_func(void *arg);
|
||||
status_t init_addons();
|
||||
#endif
|
||||
|
||||
BMailChain *_chain;
|
||||
BList message_cb, process_cb, chain_cb;
|
||||
|
||||
bool destroy_self, destroy_chain, save_chain;
|
||||
|
||||
BMailStatusWindow *_status;
|
||||
BMailStatusView *_statview;
|
||||
BList addons;
|
||||
|
||||
bool suicide;
|
||||
uint8 _other_reserved[3];
|
||||
uint32 _reserved[4];
|
||||
};
|
||||
|
||||
BMailChainRunner *GetMailChainRunner(int32 chain_id, BMailStatusWindow *status, bool selfDestruct = true);
|
||||
|
||||
#endif /* ZOIDBERG_MAIL_CHAIN_RUNNER_H */
|
||||
@@ -1,116 +1,39 @@
|
||||
#ifndef ZOIDBERG_MAIL_ADDON_H
|
||||
#define ZOIDBERG_MAIL_ADDON_H
|
||||
/* Filter - the base class for all mail filters
|
||||
**
|
||||
** Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved.
|
||||
*/
|
||||
#ifndef ZOIDBERG_MAIL_ADDON_H
|
||||
#define ZOIDBERG_MAIL_ADDON_H
|
||||
|
||||
|
||||
#include "MailProtocol.h"
|
||||
#include "MailSettings.h"
|
||||
|
||||
|
||||
class BMessage;
|
||||
class BView;
|
||||
class BPositionIO;
|
||||
class BEntry;
|
||||
class BPath;
|
||||
class BView;
|
||||
class BString;
|
||||
class BPositionIO;
|
||||
class BEntry;
|
||||
|
||||
enum {
|
||||
B_MAIL_DISCARD = B_MAIL_ERROR_BASE + 8,
|
||||
//--- This terminates the chain and removes the message being processed
|
||||
// both from disk and from the server.
|
||||
B_MAIL_END_FETCH,
|
||||
//--- Terminates the current operation
|
||||
B_MAIL_END_CHAIN
|
||||
//--- This is for yikes errors, like an unreachable server.
|
||||
};
|
||||
|
||||
class BMailStatusView;
|
||||
class BMailChainRunner;
|
||||
|
||||
class BMailFilter
|
||||
{
|
||||
public:
|
||||
BMailFilter(BMessage* settings);
|
||||
// How to support queueing messages until a time of the
|
||||
// day/week/month/year? The settings will contain a
|
||||
// persistent ChainID field, the same for all Filters
|
||||
// on the same "chain".
|
||||
|
||||
virtual ~BMailFilter();
|
||||
// This will be called when the settings for this Filter
|
||||
// are changed, or there are no new messages to consume
|
||||
// after settings->FindInt32("timeout") seconds.
|
||||
|
||||
virtual status_t InitCheck(BString* out_message = NULL) = 0;
|
||||
// Returns B_OK if the Filter was constructed success-
|
||||
// fully. Otherwise it returns an error code. If it is
|
||||
// passed a valid BString*, it may add an error message
|
||||
// to the end of that BString iff it returns an error.
|
||||
// If it returns an error code then the MailFilter will
|
||||
// probably be deleted and the error shown to the user.
|
||||
|
||||
virtual status_t ProcessMailMessage
|
||||
(
|
||||
BPositionIO** io_message, BEntry* io_entry,
|
||||
BMessage* io_headers, BPath* io_folder, const char *io_uid
|
||||
) = 0;
|
||||
// Filters a message. On input and output, the arguments
|
||||
// are expected to be as below; however it is allowed for
|
||||
// the MailFilter to alter any of these values as nece-
|
||||
// ssary, so long as the constraints are as described when
|
||||
// the function returns:
|
||||
//
|
||||
// * io_message - a PositionIO that contains the message
|
||||
// data, pointing to the first byte of the message's
|
||||
// header. This can be swapped if, eg, the message
|
||||
// is copied across volume boundries. When the chain
|
||||
// begins this is a file in /tmp.
|
||||
// * io_entry - The entry for the PositionIO above.
|
||||
// * io_headers - a list of attributes that will be added
|
||||
// to the message file.
|
||||
// * io_folder - The message's "folder"---may be com-
|
||||
// pletely unrelated to its on-disk Entry.
|
||||
// * io_uid - The unique ID provided by the message's
|
||||
// Protocol
|
||||
//
|
||||
// At most one Filter::ProcessMailMessage() for a given
|
||||
// chain (and thus ChainID) will be called at a time.
|
||||
|
||||
private:
|
||||
virtual void _ReservedFilter1();
|
||||
virtual void _ReservedFilter2();
|
||||
virtual void _ReservedFilter3();
|
||||
virtual void _ReservedFilter4();
|
||||
};
|
||||
|
||||
//
|
||||
// The addon interface: export instantiate_mailfilter()
|
||||
// and instantiate_mailconfig() to create a Filter addon
|
||||
//
|
||||
|
||||
extern "C" _EXPORT BView* instantiate_config_panel(BMessage *settings,BMessage *metadata);
|
||||
// return a view that configures the MailProtocol or MailFilter
|
||||
extern "C" _EXPORT InboundProtocol* instantiate_inbound_protocol(
|
||||
BMailAccountSettings* settings);
|
||||
extern "C" _EXPORT OutboundProtocol* instantiate_outbound_protocol(
|
||||
BMailAccountSettings* settings);
|
||||
extern "C" _EXPORT BView* instantiate_config_panel(MailAddonSettings&,
|
||||
BMailAccountSettings&);
|
||||
// return a view that configures the MailProtocol
|
||||
// returned by the functions below. BView::Archive(foo,true)
|
||||
// produces this addon's settings, which are passed to the in-
|
||||
// stantiate_* functions and stored persistently. This function
|
||||
// should gracefully handle empty and NULL settings.
|
||||
// A note on the metadata argument: The metadata pointer is
|
||||
// guaranteed to remain valid as long as this view exists. As it is
|
||||
// a pointer to the chain's metadata, your view can save any
|
||||
// chain-global settings to it in its Archive() function. Note that
|
||||
// you must cache this pointer yourself! You will never get it again.
|
||||
// Also note that it is possible for it to be NULL.
|
||||
|
||||
extern "C" _EXPORT BMailFilter* instantiate_mailfilter(BMessage *settings,
|
||||
BMailChainRunner *runner);
|
||||
// Return a MailProtocol or MailFilter ready to do its thing,
|
||||
// based on settings produced by archiving your config panel.
|
||||
// Note that a Mail::Protocol is a Mail::Filter, so use
|
||||
// instantiate_mailfilter to start things up.
|
||||
extern "C" _EXPORT BView* instantiate_filter_config_panel(AddonSettings&);
|
||||
extern "C" _EXPORT MailFilter* instantiate_mailfilter(MailProtocol& protocol,
|
||||
AddonSettings* settings);
|
||||
|
||||
extern "C" _EXPORT status_t descriptive_name(BMessage *msg, char *buffer);
|
||||
extern "C" _EXPORT BString descriptive_name();
|
||||
// the config panel will show this name in the chains filter
|
||||
// list if this function returns B_OK.
|
||||
// The buffer is as big as B_FILE_NAME_LENGTH.
|
||||
|
||||
@@ -1,107 +1,225 @@
|
||||
#ifndef ZOIDBERG_MAIL_PROTOCOL_H
|
||||
#define ZOIDBERG_MAIL_PROTOCOL_H
|
||||
/* Protocol - the base class for protocol filters
|
||||
**
|
||||
** Copyright 2001 Dr. Zoidberg Enterprises. 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
|
||||
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
#include <Handler.h>
|
||||
#include <Looper.h>
|
||||
#include <OS.h>
|
||||
#include <ObjectList.h>
|
||||
#include <Entry.h>
|
||||
#include <File.h>
|
||||
|
||||
#include <MailAddon.h>
|
||||
#include <MailSettings.h>
|
||||
|
||||
|
||||
class BHandler;
|
||||
class BStringList;
|
||||
class BMailChainRunner;
|
||||
class MailNotifier {
|
||||
public:
|
||||
virtual ~MailNotifier() {}
|
||||
|
||||
class BMailProtocol : public BMailFilter
|
||||
{
|
||||
public:
|
||||
BMailProtocol(BMessage* settings, BMailChainRunner *runner);
|
||||
// Open a connection based on 'settings'. 'settings' will
|
||||
// contain a persistent uint32 ChainID field. At most one
|
||||
// Protocol per ChainID will exist at a given time.
|
||||
// The constructor of Mail::Protocol initializes manifest.
|
||||
// It is your responsibility to fill in unique_ids, *and
|
||||
// to keep it updated* in the course of whatever nefarious
|
||||
// things your protocol does.
|
||||
|
||||
virtual ~BMailProtocol();
|
||||
// Close the connection and clean up. This will be cal-
|
||||
// led after FetchMessage() or FetchNewMessage() returns
|
||||
// B_TIMED_OUT or B_ERROR, or when the settings for this
|
||||
// Protocol are changed.
|
||||
|
||||
virtual status_t GetMessage(
|
||||
const char* uid,
|
||||
BPositionIO** out_file, BMessage* out_headers,
|
||||
BPath* out_folder_location
|
||||
)=0;
|
||||
// Downloads the message with id uid, writing the message's
|
||||
// RFC2822 contents to *out_file and storing any headers it
|
||||
// wants to add other than those from the message itself into
|
||||
// out_headers. It may store a path (if this type of account
|
||||
// supports folders) in *out_folder_location.
|
||||
//
|
||||
// Returns B_OK if the message is now available in out_file,
|
||||
// B_NAME_NOT_FOUND if there is no message with id 'uid' on
|
||||
// the server, or another error if the connection failed.
|
||||
//
|
||||
// B_OK will cause the message to be stored and processed.
|
||||
// B_NAME_NOT_FOUND will cause appropriate recovery to be
|
||||
// taken (if such exists) but not cause the connection to
|
||||
// be terminated. Any other error will cause anything writen
|
||||
// to be discarded and and the connection closed.
|
||||
|
||||
// OBS:
|
||||
// The Protocol may replace *out_file with a custom (read-
|
||||
// only) BPositionIO-derived object that preserves the il-
|
||||
// lusion that the message is writen to *out_file, but in
|
||||
// fact only reads from the server and writes to *out_file
|
||||
// on demand. This BPositionIO must guarantee that any
|
||||
// data returned by Read() has also been writen to *out_-
|
||||
// file. It must return a read error if reading from the
|
||||
// network or writing to *out_file fails.
|
||||
//
|
||||
// The mail_daemon will delete *out_file before invoking
|
||||
// FetchMessage() or FetchNewMessage() again.
|
||||
|
||||
virtual status_t DeleteMessage(const char* uid)=0;
|
||||
// Removes the message from the server. After this, it's
|
||||
// assumed (but not required) that GetMessage(uid,...)
|
||||
// et al will fail with B_NAME_NOT_FOUND.
|
||||
|
||||
void CheckForDeletedMessages();
|
||||
// You can call this to trigger a sweep for deleted messages.
|
||||
// Automatically called at the beginning of the chain.
|
||||
|
||||
//------MailFilter calls
|
||||
virtual status_t ProcessMailMessage
|
||||
(
|
||||
BPositionIO** io_message, BEntry* io_entry,
|
||||
BMessage* io_headers, BPath* io_folder, const char* io_uid
|
||||
);
|
||||
|
||||
protected:
|
||||
BStringList *manifest, *unique_ids;
|
||||
BMessage *settings;
|
||||
|
||||
BMailChainRunner *runner;
|
||||
private:
|
||||
inline void error_alert(const char *process, status_t error);
|
||||
virtual void _ReservedProtocol1();
|
||||
virtual void _ReservedProtocol2();
|
||||
virtual void _ReservedProtocol3();
|
||||
virtual void _ReservedProtocol4();
|
||||
virtual void _ReservedProtocol5();
|
||||
virtual MailNotifier* Clone() = 0;
|
||||
|
||||
friend class DeletePass;
|
||||
|
||||
BHandler *trash_monitor;
|
||||
BStringList *uids_on_disk;
|
||||
|
||||
uint32 _reserved[3];
|
||||
virtual void ShowError(const char* error) = 0;
|
||||
virtual void ShowMessage(const char* message) = 0;
|
||||
|
||||
virtual void SetTotalItems(int32 items) = 0;
|
||||
virtual void SetTotalItemsSize(int32 size) = 0;
|
||||
virtual void ReportProgress(int bytes, int messages,
|
||||
const char* message = NULL) = 0;
|
||||
virtual void ResetProgress(const char* message = NULL) = 0;
|
||||
};
|
||||
|
||||
#endif // ZOIDBERG_MAIL_PROTOCOL_H
|
||||
|
||||
class MailProtocol;
|
||||
|
||||
|
||||
class MailFilter {
|
||||
public:
|
||||
MailFilter(MailProtocol& protocol,
|
||||
AddonSettings* settings);
|
||||
virtual ~MailFilter();
|
||||
|
||||
//! Message hooks if filter is installed to a inbound protocol
|
||||
virtual void HeaderFetched(const entry_ref& ref,
|
||||
BFile* file);
|
||||
virtual void BodyFetched(const entry_ref& ref, BFile* file);
|
||||
virtual void MailboxSynced(status_t status);
|
||||
|
||||
//! Message hooks if filter is installed to a outbound protocol
|
||||
virtual void MessageReadyToSend(const entry_ref& ref,
|
||||
BFile* file);
|
||||
virtual void MessageSent(const entry_ref& ref,
|
||||
BFile* file);
|
||||
protected:
|
||||
MailProtocol& fMailProtocol;
|
||||
AddonSettings* fAddonSettings;
|
||||
};
|
||||
|
||||
|
||||
class MailProtocolThread;
|
||||
|
||||
|
||||
class MailProtocol {
|
||||
public:
|
||||
MailProtocol(BMailAccountSettings* settings);
|
||||
virtual ~MailProtocol();
|
||||
|
||||
virtual void SetStopNow() {}
|
||||
|
||||
BMailAccountSettings& AccountSettings();
|
||||
|
||||
void SetProtocolThread(
|
||||
MailProtocolThread* protocolThread);
|
||||
virtual void AddedToLooper() {}
|
||||
MailProtocolThread* Looper();
|
||||
/*! Add handler to the handler list. The handler is installed /
|
||||
removed to the according BLooper automatically. */
|
||||
bool AddHandler(BHandler* handler);
|
||||
//! Does not delete handler
|
||||
bool RemoveHandler(BHandler* handler);
|
||||
|
||||
void SetMailNotifier(MailNotifier* mailNotifier);
|
||||
|
||||
virtual void ShowError(const char* error);
|
||||
virtual void ShowMessage(const char* message);
|
||||
virtual void SetTotalItems(int32 items);
|
||||
virtual void SetTotalItemsSize(int32 size);
|
||||
virtual void ReportProgress(int bytes, int messages,
|
||||
const char* message = NULL);
|
||||
virtual void ResetProgress(const char* message = NULL);
|
||||
|
||||
//! MailProtocol takes ownership of the filters
|
||||
bool AddFilter(MailFilter* filter);
|
||||
int32 CountFilter();
|
||||
MailFilter* FilterAt(int32 index);
|
||||
MailFilter* RemoveFilter(int32 index);
|
||||
bool RemoveFilter(MailFilter* filter);
|
||||
|
||||
void NotifyNewMessagesToFetch(int32 nMessages);
|
||||
void NotifyHeaderFetched(const entry_ref& ref,
|
||||
BFile* mail);
|
||||
void NotifyBodyFetched(const entry_ref& ref,
|
||||
BFile* mail);
|
||||
void NotifyMessageReadyToSend(const entry_ref& ref,
|
||||
BFile* mail);
|
||||
void NotifyMessageSent(const entry_ref& ref,
|
||||
BFile* mail);
|
||||
|
||||
//! mail storage operations
|
||||
virtual status_t MoveMessage(const entry_ref& ref,
|
||||
BDirectory& dir);
|
||||
virtual status_t DeleteMessage(const entry_ref& ref);
|
||||
|
||||
virtual void FileRenamed(const entry_ref& from,
|
||||
const entry_ref& to);
|
||||
virtual void FileDeleted(const node_ref& node);
|
||||
|
||||
protected:
|
||||
void LoadFilters(MailAddonSettings& settings);
|
||||
|
||||
BMailAccountSettings fAccountSettings;
|
||||
MailNotifier* fMailNotifier;
|
||||
|
||||
private:
|
||||
MailFilter* _LoadFilter(AddonSettings* filterSettings);
|
||||
|
||||
MailProtocolThread* fProtocolThread;
|
||||
BObjectList<BHandler> fHandlerList;
|
||||
BObjectList<MailFilter> fFilterList;
|
||||
std::map<entry_ref, image_id> fFilterImages;
|
||||
};
|
||||
|
||||
|
||||
class InboundProtocol : public MailProtocol {
|
||||
public:
|
||||
InboundProtocol(BMailAccountSettings* settings);
|
||||
virtual ~InboundProtocol();
|
||||
|
||||
virtual status_t SyncMessages() = 0;
|
||||
virtual status_t FetchBody(const entry_ref& ref) = 0;
|
||||
virtual status_t MarkMessageAsRead(const entry_ref& ref,
|
||||
bool read = true);
|
||||
virtual status_t DeleteMessage(const entry_ref& ref) = 0;
|
||||
virtual status_t AppendMessage(const entry_ref& ref);
|
||||
};
|
||||
|
||||
|
||||
class OutboundProtocol : public MailProtocol {
|
||||
public:
|
||||
OutboundProtocol(
|
||||
BMailAccountSettings* settings);
|
||||
virtual ~OutboundProtocol();
|
||||
|
||||
virtual status_t SendMessages(const std::vector<entry_ref>&
|
||||
mails, size_t totalBytes) = 0;
|
||||
};
|
||||
|
||||
|
||||
class MailProtocolThread : public BLooper {
|
||||
public:
|
||||
MailProtocolThread(MailProtocol* protocol);
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
|
||||
MailProtocol* Protocol() { return fMailProtocol; }
|
||||
|
||||
void SetStopNow();
|
||||
/*! These function post a message to the loop to trigger the action.
|
||||
*/
|
||||
void TriggerFileMove(const entry_ref& ref,
|
||||
BDirectory& dir);
|
||||
void TriggerFileDeletion(const entry_ref& ref);
|
||||
|
||||
void TriggerFileRenamed(const entry_ref& from,
|
||||
const entry_ref& to);
|
||||
void TriggerFileDeleted(const node_ref& node);
|
||||
private:
|
||||
MailProtocol* fMailProtocol;
|
||||
};
|
||||
|
||||
|
||||
class InboundProtocolThread : public MailProtocolThread {
|
||||
public:
|
||||
InboundProtocolThread(
|
||||
InboundProtocol* protocol);
|
||||
~InboundProtocolThread();
|
||||
|
||||
void MessageReceived(BMessage* message);
|
||||
|
||||
void SyncMessages();
|
||||
void FetchBody(const entry_ref& ref,
|
||||
bool launch = false);
|
||||
void MarkMessageAsRead(const entry_ref& ref,
|
||||
bool read = true);
|
||||
void DeleteMessage(const entry_ref& ref);
|
||||
void AppendMessage(const entry_ref& ref);
|
||||
private:
|
||||
void _NotiyMailboxSynced(status_t status);
|
||||
|
||||
InboundProtocol* fProtocol;
|
||||
};
|
||||
|
||||
|
||||
class OutboundProtocolThread : public MailProtocolThread {
|
||||
public:
|
||||
OutboundProtocolThread(
|
||||
OutboundProtocol* protocol);
|
||||
~OutboundProtocolThread();
|
||||
|
||||
void MessageReceived(BMessage* message);
|
||||
|
||||
void SendMessages(const std::vector<entry_ref>&
|
||||
mails, size_t totalBytes);
|
||||
|
||||
private:
|
||||
OutboundProtocol* fProtocol;
|
||||
};
|
||||
|
||||
|
||||
#endif // MAIL_PROTOCOL_H
|
||||
|
||||
@@ -1,38 +1,69 @@
|
||||
#ifndef ZOIDBERG_PROTOCOL_CONFIG_VIEW_H
|
||||
#define ZOIDBERG_PROTOCOL_CONFIG_VIEW_H
|
||||
/* ProtocolConfigView - the standard config view for all protocols
|
||||
**
|
||||
** Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved.
|
||||
*/
|
||||
#ifndef ZOIDBERG_PROTOCOL_CONFIG_VIEW_H
|
||||
#define ZOIDBERG_PROTOCOL_CONFIG_VIEW_H
|
||||
|
||||
|
||||
#include <CheckBox.h>
|
||||
#include <StringView.h>
|
||||
#include <TextControl.h>
|
||||
#include <View.h>
|
||||
|
||||
#include "MailSettings.h"
|
||||
|
||||
|
||||
class BodyDownloadConfig : public BView {
|
||||
public:
|
||||
BodyDownloadConfig();
|
||||
|
||||
void SetTo(MailAddonSettings& settings);
|
||||
|
||||
void MessageReceived(BMessage *msg);
|
||||
void AttachedToWindow();
|
||||
void GetPreferredSize(float *width, float *height);
|
||||
status_t Archive(BMessage *into, bool) const;
|
||||
private:
|
||||
BTextControl* fSizeBox;
|
||||
BCheckBox* fPartialBox;
|
||||
BStringView* fBytesLabel;
|
||||
};
|
||||
|
||||
|
||||
typedef enum {
|
||||
B_MAIL_PROTOCOL_HAS_AUTH_METHODS = 1,
|
||||
B_MAIL_PROTOCOL_HAS_FLAVORS = 2,
|
||||
B_MAIL_PROTOCOL_HAS_USERNAME = 4,
|
||||
B_MAIL_PROTOCOL_HAS_PASSWORD = 8,
|
||||
B_MAIL_PROTOCOL_HAS_HOSTNAME = 16,
|
||||
B_MAIL_PROTOCOL_CAN_LEAVE_MAIL_ON_SERVER = 32
|
||||
B_MAIL_PROTOCOL_CAN_LEAVE_MAIL_ON_SERVER = 32,
|
||||
B_MAIL_PROTOCOL_PARTIAL_DOWNLOAD = 64
|
||||
} b_mail_protocol_config_options;
|
||||
|
||||
class BMailProtocolConfigView : public BView {
|
||||
public:
|
||||
BMailProtocolConfigView(uint32 options_mask = B_MAIL_PROTOCOL_HAS_FLAVORS | B_MAIL_PROTOCOL_HAS_USERNAME | B_MAIL_PROTOCOL_HAS_PASSWORD | B_MAIL_PROTOCOL_HAS_HOSTNAME);
|
||||
virtual ~BMailProtocolConfigView();
|
||||
|
||||
void SetTo(BMessage *archive);
|
||||
|
||||
void AddFlavor(const char *label);
|
||||
void AddAuthMethod(const char *label,bool needUserPassword = true);
|
||||
|
||||
virtual status_t Archive(BMessage *into, bool deep = true) const;
|
||||
virtual void GetPreferredSize(float *width, float *height);
|
||||
virtual void AttachedToWindow();
|
||||
virtual void MessageReceived(BMessage *msg);
|
||||
class BMailProtocolConfigView : public BView {
|
||||
public:
|
||||
BMailProtocolConfigView(uint32 options_mask
|
||||
= B_MAIL_PROTOCOL_HAS_FLAVORS
|
||||
| B_MAIL_PROTOCOL_HAS_USERNAME
|
||||
| B_MAIL_PROTOCOL_HAS_PASSWORD
|
||||
| B_MAIL_PROTOCOL_HAS_HOSTNAME);
|
||||
virtual ~BMailProtocolConfigView();
|
||||
|
||||
void SetTo(MailAddonSettings& archive);
|
||||
|
||||
void AddFlavor(const char *label);
|
||||
void AddAuthMethod(const char *label,
|
||||
bool needUserPassword = true);
|
||||
|
||||
virtual status_t Archive(BMessage *into, bool deep = true) const;
|
||||
virtual void GetPreferredSize(float *width, float *height);
|
||||
virtual void AttachedToWindow();
|
||||
virtual void MessageReceived(BMessage *msg);
|
||||
|
||||
private:
|
||||
uint32 _reserved[5];
|
||||
private:
|
||||
BodyDownloadConfig* fBodyDownloadConfig;
|
||||
};
|
||||
|
||||
#endif /* ZOIDBERG_PROTOCOL_CONFIG_VIEW_H */
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
#ifndef ZOIDBERG_MAIL_REMOTESTORAGEPROTOCOL_H
|
||||
#define ZOIDBERG_MAIL_REMOTESTORAGEPROTOCOL_H
|
||||
/* RemoteStorageProtocol - the base class for protocol filters
|
||||
**
|
||||
** Copyright 2003 Dr. Zoidberg Enterprises. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <MailProtocol.h>
|
||||
#include <StringList.h>
|
||||
|
||||
class BRemoteMailStorageProtocol : public BMailProtocol {
|
||||
public:
|
||||
BRemoteMailStorageProtocol(BMessage *settings, BMailChainRunner *runner);
|
||||
virtual ~BRemoteMailStorageProtocol();
|
||||
|
||||
virtual status_t GetMessage(const char *mailbox, const char *message, BPositionIO **, BMessage *headers) = 0;
|
||||
virtual status_t AddMessage(const char *mailbox, BPositionIO *data, BString *id) = 0;
|
||||
|
||||
virtual status_t DeleteMessage(const char *mailbox, const char *message) = 0;
|
||||
virtual status_t CopyMessage(const char *mailbox, const char *to_mailbox, BString *message) = 0;
|
||||
|
||||
virtual status_t CreateMailbox(const char *mailbox) = 0;
|
||||
virtual status_t DeleteMailbox(const char *mailbox) = 0;
|
||||
|
||||
void SyncMailbox(const char *mailbox);
|
||||
|
||||
//----Mail::Protocol stuff
|
||||
virtual status_t GetMessage(
|
||||
const char* uid,
|
||||
BPositionIO** out_file, BMessage* out_headers,
|
||||
BPath* out_folder_location);
|
||||
virtual status_t DeleteMessage(const char* uid);
|
||||
|
||||
//---Data members
|
||||
BStringList mailboxes;
|
||||
|
||||
private:
|
||||
BHandler *handler;
|
||||
};
|
||||
|
||||
#endif // ZOIDBERG_MAIL_REMOTESTORAGEPROTOCOL_H
|
||||
@@ -92,27 +92,6 @@ typedef struct {
|
||||
} mail_notification;
|
||||
|
||||
|
||||
// #pragma mark - global functions
|
||||
|
||||
|
||||
int32 count_pop_accounts(void);
|
||||
status_t get_pop_account(mail_pop_account*, int32 index = 0);
|
||||
status_t set_pop_account(mail_pop_account*, int32 index = 0,
|
||||
bool save = true);
|
||||
status_t get_smtp_host(char*);
|
||||
status_t set_smtp_host(char*, bool save = true);
|
||||
status_t get_mail_notification(mail_notification*);
|
||||
status_t set_mail_notification(mail_notification*, bool save = true);
|
||||
|
||||
status_t check_for_mail(int32* incoming_count = NULL);
|
||||
status_t send_queued_mail(void);
|
||||
status_t forward_mail(entry_ref*, const char* recipients, bool now = true);
|
||||
|
||||
ssize_t decode_base64(char* out, char* in, off_t length,
|
||||
bool replace_cr = false);
|
||||
ssize_t encode_base64(char* out, char* in, off_t length);
|
||||
|
||||
|
||||
// #pragma mark - BMailMessage
|
||||
|
||||
class BMailMessage {
|
||||
|
||||
@@ -1,18 +1,34 @@
|
||||
#ifndef ZOIDBERG_MAIL_DAEMON_H
|
||||
#define ZOIDBERG_MAIL_DAEMON_H
|
||||
#ifndef MAIL_DAEMON_H
|
||||
#define MAIL_DAEMON_H
|
||||
/* Daemon - talking to the mail daemon
|
||||
**
|
||||
** Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved.
|
||||
*
|
||||
* Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved.
|
||||
* Copyright 2011, Clemens Zeidler <[email protected]>
|
||||
*/
|
||||
|
||||
class BMailDaemon {
|
||||
public:
|
||||
static status_t CheckMail(bool send_queued_mail = true,const char *account = NULL);
|
||||
static status_t SendQueuedMail();
|
||||
static int32 CountNewMessages(bool wait_for_fetch_completion = false);
|
||||
|
||||
static status_t Quit();
|
||||
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';
|
||||
|
||||
|
||||
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(
|
||||
bool waitForFetchCompletion = false);
|
||||
static status_t MarkAsRead(int32 account, const entry_ref& ref,
|
||||
bool read = true);
|
||||
|
||||
static status_t Quit();
|
||||
};
|
||||
|
||||
#endif /* ZOIDBERG_MAIL_DAEMON_H */
|
||||
|
||||
#endif // MAIL_DAEMON_H
|
||||
|
||||
@@ -25,7 +25,8 @@ enum mail_reply_to_mode {
|
||||
class BEmailMessage : public BMailContainer {
|
||||
public:
|
||||
BEmailMessage(BPositionIO *mail_file = NULL, bool own = false, uint32 defaultCharSet = B_MAIL_NULL_CONVERSION);
|
||||
BEmailMessage(entry_ref *ref, uint32 defaultCharSet = B_MAIL_NULL_CONVERSION);
|
||||
BEmailMessage(const entry_ref *ref,
|
||||
uint32 defaultCharSet = B_MAIL_NULL_CONVERSION);
|
||||
virtual ~BEmailMessage();
|
||||
|
||||
status_t InitCheck() const;
|
||||
@@ -60,7 +61,7 @@ class BEmailMessage : public BMailContainer {
|
||||
|
||||
void SendViaAccountFrom(BEmailMessage *message);
|
||||
void SendViaAccount(const char *account_name);
|
||||
void SendViaAccount(int32 chain_id);
|
||||
void SendViaAccount(int32 account);
|
||||
int32 Account() const;
|
||||
status_t GetAccountName(char *account,int32 maxLength) const;
|
||||
status_t GetAccountName(BString *account) const;
|
||||
@@ -99,7 +100,7 @@ class BEmailMessage : public BMailContainer {
|
||||
BPositionIO *fData;
|
||||
|
||||
status_t _status;
|
||||
int32 _chain_id;
|
||||
int32 _account_id;
|
||||
char *_bcc;
|
||||
|
||||
int32 _num_components;
|
||||
|
||||
+172
-119
@@ -1,17 +1,25 @@
|
||||
#ifndef ZOIDBERG_MAIL_SETTINGS_H
|
||||
#define ZOIDBERG_MAIL_SETTINGS_H
|
||||
/* Settings - the mail daemon's settings
|
||||
**
|
||||
** Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved.
|
||||
* Copyright 2011 Clemens Zeidler.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef MAIL_SETTINGS_H
|
||||
#define MAIL_SETTINGS_H
|
||||
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <Archivable.h>
|
||||
#include <Entry.h>
|
||||
#include <List.h>
|
||||
#include <Message.h>
|
||||
#include <ObjectList.h>
|
||||
#include <String.h>
|
||||
|
||||
|
||||
class BPath;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
B_MAIL_SHOW_STATUS_WINDOW_NEVER = 0,
|
||||
@@ -20,6 +28,7 @@ typedef enum
|
||||
B_MAIL_SHOW_STATUS_WINDOW_ALWAYS = 3
|
||||
} b_mail_status_window_option;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
B_MAIL_STATUS_LOOK_TITLED = 0,
|
||||
@@ -29,126 +38,170 @@ typedef enum
|
||||
B_MAIL_STATUS_LOOK_NO_BORDER = 4
|
||||
} b_mail_status_window_look;
|
||||
|
||||
typedef enum {
|
||||
inbound,
|
||||
outbound
|
||||
} b_mail_chain_direction;
|
||||
|
||||
class BMailStatusWindow;
|
||||
class BMailChain;
|
||||
|
||||
BMailChain* NewMailChain();
|
||||
BMailChain* GetMailChain(uint32 id);
|
||||
|
||||
status_t GetOutboundMailChains(BList* list);
|
||||
status_t GetInboundMailChains(BList* list);
|
||||
|
||||
|
||||
class BMailChain : public BArchivable {
|
||||
public:
|
||||
BMailChain(uint32 id);
|
||||
BMailChain(BMessage*);
|
||||
virtual ~BMailChain();
|
||||
|
||||
virtual status_t Archive(BMessage*, bool) const;
|
||||
static BArchivable* Instantiate(BMessage*);
|
||||
|
||||
status_t Save(bigtime_t timeout = B_INFINITE_TIMEOUT);
|
||||
status_t Delete() const;
|
||||
status_t Reload();
|
||||
status_t InitCheck() const;
|
||||
|
||||
uint32 ID() const;
|
||||
|
||||
b_mail_chain_direction ChainDirection() const;
|
||||
void SetChainDirection(b_mail_chain_direction);
|
||||
|
||||
const char* Name() const;
|
||||
status_t SetName(const char*);
|
||||
|
||||
BMessage* MetaData() const;
|
||||
|
||||
// "Filter" below refers to the settings message for a MailFilter
|
||||
int32 CountFilters() const;
|
||||
status_t GetFilter(int32 index, BMessage* out_settings, entry_ref* addon = NULL) const;
|
||||
status_t SetFilter(int32 index, const BMessage&, const entry_ref&);
|
||||
|
||||
status_t AddFilter(const BMessage&, const entry_ref&); // at end
|
||||
status_t AddFilter(int32 index, const BMessage&, const entry_ref&);
|
||||
status_t RemoveFilter(int32 index);
|
||||
|
||||
void RunChain(BMailStatusWindow* window,
|
||||
bool async = true,
|
||||
bool save_when_done = true,
|
||||
bool delete_when_done = false);
|
||||
|
||||
private:
|
||||
status_t GetPath(BPath& path) const;
|
||||
status_t Load(BMessage*);
|
||||
|
||||
int32 fId;
|
||||
char fName[B_FILE_NAME_LENGTH];
|
||||
BMessage* fMetaData;
|
||||
|
||||
status_t fStatus;
|
||||
|
||||
b_mail_chain_direction fDirection;
|
||||
|
||||
int32 fSettingsCount;
|
||||
int32 fAddonsCount;
|
||||
BList fFilterSettings;
|
||||
BList fFilterAddons;
|
||||
|
||||
uint32 _reserved[5];
|
||||
};
|
||||
|
||||
|
||||
class BMailSettings {
|
||||
public:
|
||||
BMailSettings();
|
||||
~BMailSettings();
|
||||
|
||||
status_t Save(bigtime_t timeout = B_INFINITE_TIMEOUT);
|
||||
status_t Reload();
|
||||
status_t InitCheck() const;
|
||||
|
||||
// Global settings
|
||||
int32 WindowFollowsCorner();
|
||||
void SetWindowFollowsCorner(int32 which_corner);
|
||||
|
||||
uint32 ShowStatusWindow();
|
||||
void SetShowStatusWindow(uint32 mode);
|
||||
|
||||
bool DaemonAutoStarts();
|
||||
void SetDaemonAutoStarts(bool does_it);
|
||||
public:
|
||||
BMailSettings();
|
||||
~BMailSettings();
|
||||
|
||||
void SetConfigWindowFrame(BRect frame);
|
||||
BRect ConfigWindowFrame();
|
||||
status_t Save(bigtime_t timeout = B_INFINITE_TIMEOUT);
|
||||
status_t Reload();
|
||||
status_t InitCheck() const;
|
||||
|
||||
void SetStatusWindowFrame(BRect frame);
|
||||
BRect StatusWindowFrame();
|
||||
// Global settings
|
||||
int32 WindowFollowsCorner();
|
||||
void SetWindowFollowsCorner(int32 which_corner);
|
||||
|
||||
int32 StatusWindowWorkspaces();
|
||||
void SetStatusWindowWorkspaces(int32 workspaces);
|
||||
uint32 ShowStatusWindow();
|
||||
void SetShowStatusWindow(uint32 mode);
|
||||
|
||||
bool DaemonAutoStarts();
|
||||
void SetDaemonAutoStarts(bool does_it);
|
||||
|
||||
int32 StatusWindowLook();
|
||||
void SetStatusWindowLook(int32 look);
|
||||
|
||||
bigtime_t AutoCheckInterval();
|
||||
void SetAutoCheckInterval(bigtime_t);
|
||||
|
||||
bool CheckOnlyIfPPPUp();
|
||||
void SetCheckOnlyIfPPPUp(bool yes);
|
||||
|
||||
bool SendOnlyIfPPPUp();
|
||||
void SetSendOnlyIfPPPUp(bool yes);
|
||||
|
||||
uint32 DefaultOutboundChainID();
|
||||
void SetDefaultOutboundChainID(uint32 to);
|
||||
void SetConfigWindowFrame(BRect frame);
|
||||
BRect ConfigWindowFrame();
|
||||
|
||||
private:
|
||||
BMessage fData;
|
||||
uint32 _reserved[4];
|
||||
void SetStatusWindowFrame(BRect frame);
|
||||
BRect StatusWindowFrame();
|
||||
|
||||
int32 StatusWindowWorkspaces();
|
||||
void SetStatusWindowWorkspaces(int32 workspaces);
|
||||
|
||||
int32 StatusWindowLook();
|
||||
void SetStatusWindowLook(int32 look);
|
||||
|
||||
bigtime_t AutoCheckInterval();
|
||||
void SetAutoCheckInterval(bigtime_t);
|
||||
|
||||
bool CheckOnlyIfPPPUp();
|
||||
void SetCheckOnlyIfPPPUp(bool yes);
|
||||
|
||||
bool SendOnlyIfPPPUp();
|
||||
void SetSendOnlyIfPPPUp(bool yes);
|
||||
|
||||
int32 DefaultOutboundAccount();
|
||||
void SetDefaultOutboundAccount(int32 to);
|
||||
|
||||
private:
|
||||
BMessage fData;
|
||||
uint32 _reserved[4];
|
||||
};
|
||||
|
||||
|
||||
class AddonSettings
|
||||
{
|
||||
public:
|
||||
AddonSettings();
|
||||
|
||||
bool Load(const BMessage& message);
|
||||
bool Save(BMessage& message);
|
||||
|
||||
void SetAddonRef(const entry_ref& ref);
|
||||
const entry_ref& AddonRef() const;
|
||||
|
||||
const BMessage& Settings() const;
|
||||
BMessage& EditSettings();
|
||||
|
||||
bool HasBeenModified();
|
||||
private:
|
||||
BMessage fSettings;
|
||||
entry_ref fAddonRef;
|
||||
|
||||
bool fModified;
|
||||
};
|
||||
|
||||
|
||||
class MailAddonSettings : public AddonSettings
|
||||
{
|
||||
public:
|
||||
bool Load(const BMessage& message);
|
||||
bool Save(BMessage& message);
|
||||
|
||||
int32 CountFilterSettings();
|
||||
int32 AddFilterSettings(const entry_ref* ref = NULL);
|
||||
bool RemoveFilterSettings(int32 index);
|
||||
bool MoveFilterSettings(int32 from, int32 to);
|
||||
AddonSettings* FilterSettingsAt(int32 index);
|
||||
|
||||
bool HasBeenModified();
|
||||
private:
|
||||
std::vector<AddonSettings> fFiltersSettings;
|
||||
};
|
||||
|
||||
|
||||
class BMailAccountSettings
|
||||
{
|
||||
public:
|
||||
BMailAccountSettings();
|
||||
BMailAccountSettings(BEntry account);
|
||||
~BMailAccountSettings();
|
||||
|
||||
status_t InitCheck() { return fStatus; }
|
||||
|
||||
void SetAccountID(int32 id);
|
||||
int32 AccountID();
|
||||
|
||||
void SetName(const char* name);
|
||||
const char* Name() const;
|
||||
|
||||
void SetRealName(const char* realName);
|
||||
const char* RealName() const;
|
||||
|
||||
void SetReturnAddress(const char* returnAddress);
|
||||
const char* ReturnAddress() const;
|
||||
|
||||
bool SetInboundAddon(const char* name);
|
||||
bool SetOutboundAddon(const char* name);
|
||||
const entry_ref& InboundPath() const;
|
||||
const entry_ref& OutboundPath() const;
|
||||
|
||||
MailAddonSettings& InboundSettings();
|
||||
MailAddonSettings& OutboundSettings();
|
||||
|
||||
bool HasInbound();
|
||||
bool HasOutbound();
|
||||
|
||||
status_t Reload();
|
||||
status_t Save();
|
||||
status_t Delete();
|
||||
|
||||
bool HasBeenModified();
|
||||
|
||||
const BEntry& AccountFile();
|
||||
private:
|
||||
status_t _CreateAccountFile();
|
||||
|
||||
status_t fStatus;
|
||||
BEntry fAccountFile;
|
||||
|
||||
int32 fAccountID;
|
||||
|
||||
BString fAccountName;
|
||||
BString fRealName;
|
||||
BString fReturnAdress;
|
||||
|
||||
MailAddonSettings fInboundSettings;
|
||||
MailAddonSettings fOutboundSettings;
|
||||
|
||||
bool fModified;
|
||||
};
|
||||
|
||||
|
||||
class BMailAccounts {
|
||||
public:
|
||||
BMailAccounts();
|
||||
~BMailAccounts();
|
||||
|
||||
static status_t AccountsPath(BPath& path);
|
||||
|
||||
int32 CountAccounts();
|
||||
BMailAccountSettings* AccountAt(int32 index);
|
||||
|
||||
BMailAccountSettings* AccountByID(int32 id);
|
||||
BMailAccountSettings* AccountByName(const char* name);
|
||||
private:
|
||||
BObjectList<BMailAccountSettings> fAccounts;
|
||||
};
|
||||
|
||||
|
||||
#endif /* ZOIDBERG_MAIL_SETTINGS_H */
|
||||
|
||||
@@ -42,8 +42,8 @@ class BMailFileConfigView : public BFileControl
|
||||
public:
|
||||
BMailFileConfigView(const char *label,const char *name,bool useMeta = false,const char *defaultPath = NULL,uint32 flavors = B_DIRECTORY_NODE);
|
||||
|
||||
void SetTo(BMessage *archive,BMessage *metadata);
|
||||
virtual status_t Archive(BMessage *into,bool deep = true) const;
|
||||
void SetTo(const BMessage *archive, BMessage *metadata);
|
||||
virtual status_t Archive(BMessage *into, bool deep = true) const;
|
||||
|
||||
private:
|
||||
BMessage *fMeta;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#define PASSWORD_LENGTH 32
|
||||
|
||||
|
||||
char *get_passwd(BMessage *msg,const char *name);
|
||||
char *get_passwd(const BMessage *msg,const char *name);
|
||||
bool set_passwd(BMessage *msg,const char *name,const char *password);
|
||||
|
||||
void passwd_crypt(char *in,char *out,int length);
|
||||
|
||||
@@ -72,6 +72,8 @@ ssize_t readfoldedline(BPositionIO &in, char **buffer, size_t *buflen);
|
||||
// start with a buffer of size *buflen
|
||||
|
||||
status_t parse_header(BMessage &headers, BPositionIO &input);
|
||||
status_t extract_from_header(const BString& header, const BString& field,
|
||||
BString& target);
|
||||
|
||||
void extract_address(BString &address);
|
||||
// retrieves the mail address only from an address header formatted field
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
/*
|
||||
* Copyright 2001-2003 Dr. Zoidberg Enterprises. All rights reserved.
|
||||
* Copyright 2004-2007, Haiku Inc. All rights reserved.
|
||||
*
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef ZOIDBERG_STATUS_WINDOW_H
|
||||
#define ZOIDBERG_STATUS_WINDOW_H
|
||||
|
||||
|
||||
#include <Alert.h>
|
||||
#include <Box.h>
|
||||
#include <List.h>
|
||||
#include <Node.h>
|
||||
#include <Window.h>
|
||||
|
||||
class BStatusBar;
|
||||
class BStringView;
|
||||
class BMailStatusView;
|
||||
|
||||
class BMailStatusWindow : public BWindow {
|
||||
public:
|
||||
BMailStatusWindow(BRect rect, const char *name, uint32 showMode);
|
||||
~BMailStatusWindow();
|
||||
|
||||
virtual void FrameMoved(BPoint origin);
|
||||
virtual void WorkspaceActivated(int32 workspace, bool active);
|
||||
virtual void MessageReceived(BMessage *msg);
|
||||
|
||||
BMailStatusView *NewStatusView(const char *description, bool upstream);
|
||||
void RemoveView(BMailStatusView *view);
|
||||
int32 CountVisibleItems();
|
||||
|
||||
bool HasItems(void);
|
||||
void SetShowCriterion(uint32);
|
||||
void SetDefaultMessage(const BString &message);
|
||||
|
||||
private:
|
||||
friend class BMailStatusView;
|
||||
|
||||
void _CheckChains();
|
||||
void SetBorderStyle(int32 look);
|
||||
void ActuallyAddStatusView(BMailStatusView *status);
|
||||
|
||||
node_ref fChainDirectory;
|
||||
BButton* fCheckNowButton;
|
||||
BList fStatusViews;
|
||||
uint32 fShowMode;
|
||||
BView *fDefaultView;
|
||||
BStringView *fMessageView;
|
||||
float fMinWidth;
|
||||
float fMinHeight;
|
||||
int32 fWindowMoved;
|
||||
int32 fLastWorkspace;
|
||||
BRect fFrame;
|
||||
|
||||
uint32 _reserved[5];
|
||||
};
|
||||
|
||||
class BMailStatusView : public BBox {
|
||||
public:
|
||||
void AddProgress(int32 how_much);
|
||||
void SetMessage(const char *msg);
|
||||
void SetMaximum(int32 max_bytes);
|
||||
int32 CountTotalItems();
|
||||
void SetTotalItems(int32 items);
|
||||
void AddItem(void);
|
||||
void Reset(bool hide = true);
|
||||
|
||||
virtual ~BMailStatusView();
|
||||
|
||||
private:
|
||||
friend class BMailStatusWindow;
|
||||
|
||||
BMailStatusView(BRect rect,const char *description,bool upstream);
|
||||
void AddSelfToWindow();
|
||||
|
||||
BStatusBar *status;
|
||||
BMailStatusWindow *window;
|
||||
int32 items_now;
|
||||
int32 total_items;
|
||||
bool is_upstream;
|
||||
bool by_bytes;
|
||||
char pre_text[255];
|
||||
|
||||
uint32 _reserved[5];
|
||||
};
|
||||
|
||||
#endif /* ZOIDBERG_STATUS_WINDOW_H */
|
||||
Reference in New Issue
Block a user