Major coding style cleanup.

This commit is contained in:
Axel Dörfler
2015-01-06 15:23:33 +01:00
parent 81ec973846
commit 4a8448ce34
2 changed files with 322 additions and 291 deletions
+103 -72
View File
@@ -1,20 +1,27 @@
#ifndef ZOIDBERG_MAIL_MESSAGE_H
#define ZOIDBERG_MAIL_MESSAGE_H
/* Message - the main general purpose mail message class
**
** Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved.
*/
/*
* Copyright 2007-2012, Haiku Inc. All Rights Reserved.
* Copyright 2001, Dr. Zoidberg Enterprises. All rights reserved.
*
* Distributed under the terms of the MIT License.
*/
#ifndef _MAIL_MESSAGE_H_
#define _MAIL_MESSAGE_H_
//! The main general purpose mail message class
#include <MailContainer.h>
// add our additional attributes
// add our additional attributes
#define B_MAIL_ATTR_ACCOUNT "MAIL:account"
#define B_MAIL_ATTR_THREAD "MAIL:thread"
class BDirectory;
class BEntry;
enum mail_reply_to_mode {
B_MAIL_REPLY_TO = 0,
@@ -22,91 +29,115 @@ enum mail_reply_to_mode {
B_MAIL_REPLY_TO_SENDER
};
class BEmailMessage : public BMailContainer {
public:
BEmailMessage(BPositionIO *mail_file = NULL, bool own = false, uint32 defaultCharSet = B_MAIL_NULL_CONVERSION);
BEmailMessage(const entry_ref *ref,
uint32 defaultCharSet = B_MAIL_NULL_CONVERSION);
virtual ~BEmailMessage();
public:
BEmailMessage(BPositionIO* stream = NULL,
bool ownStream = false,
uint32 defaultCharSet
= B_MAIL_NULL_CONVERSION);
BEmailMessage(const entry_ref* ref,
uint32 defaultCharSet
= B_MAIL_NULL_CONVERSION);
virtual ~BEmailMessage();
status_t InitCheck() const;
BPositionIO *Data() const { return fData; }
// is only set if the message owns the data
status_t InitCheck() const;
BPositionIO* Data() const { return fData; }
// is only set if the message owns the data
BEmailMessage *ReplyMessage(mail_reply_to_mode replyTo, bool accountFromMail, const char *quote_style = "> ");
BEmailMessage *ForwardMessage(bool accountFromMail, bool includeAttachments = false);
// These return messages with the body quoted and
// ready to send via the appropriate channel. ReplyMessage()
// addresses the message appropriately, but ForwardMessage()
// leaves it unaddressed.
BEmailMessage* ReplyMessage(mail_reply_to_mode replyTo,
bool accountFromMail,
const char* quoteStyle = "> ");
BEmailMessage* ForwardMessage(bool accountFromMail,
bool includeAttachments = false);
// These return messages with the body quoted and
// ready to send via the appropriate channel. ReplyMessage()
// addresses the message appropriately, but ForwardMessage()
// leaves it unaddressed.
const char *To();
const char *From();
const char *ReplyTo();
const char *CC();
const char *Subject();
const char *Date();
int Priority();
const char* To();
const char* From();
const char* ReplyTo();
const char* CC();
const char* Subject();
const char* Date();
int Priority();
void SetSubject(const char *to, uint32 charset = B_MAIL_NULL_CONVERSION, mail_encoding encoding = null_encoding);
void SetReplyTo(const char *to, uint32 charset = B_MAIL_NULL_CONVERSION, mail_encoding encoding = null_encoding);
void SetFrom(const char *to, uint32 charset = B_MAIL_NULL_CONVERSION, mail_encoding encoding = null_encoding);
void SetTo(const char *to, uint32 charset = B_MAIL_NULL_CONVERSION, mail_encoding encoding = null_encoding);
void SetCC(const char *to, uint32 charset = B_MAIL_NULL_CONVERSION, mail_encoding encoding = null_encoding);
void SetBCC(const char *to);
void SetPriority(int to);
void SetSubject(const char* to,
uint32 charset = B_MAIL_NULL_CONVERSION,
mail_encoding encoding = null_encoding);
void SetReplyTo(const char* to,
uint32 charset = B_MAIL_NULL_CONVERSION,
mail_encoding encoding = null_encoding);
void SetFrom(const char* to,
uint32 charset = B_MAIL_NULL_CONVERSION,
mail_encoding encoding = null_encoding);
void SetTo(const char* to,
uint32 charset = B_MAIL_NULL_CONVERSION,
mail_encoding encoding = null_encoding);
void SetCC(const char* to,
uint32 charset = B_MAIL_NULL_CONVERSION,
mail_encoding encoding = null_encoding);
void SetBCC(const char* to);
void SetPriority(int to);
status_t GetName(char *name,int32 maxLength) const;
status_t GetName(BString *name) const;
status_t GetName(char* name, int32 maxLength) const;
status_t GetName(BString* name) const;
void SendViaAccountFrom(BEmailMessage *message);
void SendViaAccount(const char *account_name);
void SendViaAccount(int32 account);
int32 Account() const;
status_t GetAccountName(BString& accountName) const;
void SendViaAccountFrom(BEmailMessage* message);
void SendViaAccount(const char* accountName);
void SendViaAccount(int32 account);
int32 Account() const;
status_t GetAccountName(BString& accountName) const;
virtual status_t AddComponent(BMailComponent *component);
virtual status_t RemoveComponent(BMailComponent *component);
virtual status_t RemoveComponent(int32 index);
virtual status_t AddComponent(BMailComponent *component);
virtual status_t RemoveComponent(BMailComponent *component);
virtual status_t RemoveComponent(int32 index);
virtual BMailComponent *GetComponent(int32 index, bool parse_now = false);
virtual int32 CountComponents() const;
virtual BMailComponent* GetComponent(int32 index,
bool parseNow = false);
virtual int32 CountComponents() const;
void Attach(entry_ref *ref, bool include_attributes = true);
bool IsComponentAttachment(int32 index);
void Attach(entry_ref* ref,
bool includeAttributes = true);
bool IsComponentAttachment(int32 index);
void SetBodyTextTo(const char *text);
const char *BodyText();
void SetBodyTextTo(const char* text);
const char* BodyText();
status_t SetBody(BTextMailComponent *body);
BTextMailComponent *Body();
status_t SetBody(BTextMailComponent* body);
BTextMailComponent* Body();
virtual status_t SetToRFC822(BPositionIO *data, size_t length, bool parse_now = false);
virtual status_t RenderToRFC822(BPositionIO *render_to);
virtual status_t SetToRFC822(BPositionIO* data, size_t length,
bool parseNow = false);
virtual status_t RenderToRFC822(BPositionIO* renderTo);
status_t RenderTo(BDirectory *dir, BEntry *message = NULL);
//---message will be set to the message file if not equal to NULL
status_t RenderTo(BDirectory* dir,
BEntry* message = NULL);
// Message will be set to the message file if not equal to NULL
status_t Send(bool send_now);
status_t Send(bool sendNow);
private:
BTextMailComponent *RetrieveTextBody(BMailComponent *);
private:
BTextMailComponent* _RetrieveTextBody(BMailComponent* component);
virtual void _ReservedMessage1();
virtual void _ReservedMessage2();
virtual void _ReservedMessage3();
virtual void _ReservedMessage1();
virtual void _ReservedMessage2();
virtual void _ReservedMessage3();
BPositionIO *fData;
private:
BPositionIO* fData;
status_t _status;
int32 _account_id;
char *_bcc;
status_t fStatus;
int32 fAccountID;
char* fBCC;
int32 _num_components;
BMailComponent *_body;
BTextMailComponent *_text_body;
int32 fComponentCount;
BMailComponent* fBody;
BTextMailComponent* fTextBody;
uint32 _reserved[5];
uint32 _reserved[5];
};
#endif /* ZOIDBERG_MAIL_MESSAGE_H */
#endif // _MAIL_MESSAGE_H_