diff options
author | CodaFi <devteam.codafi@gmail.com> | 2013-12-08 13:28:59 -0700 |
---|---|---|
committer | CodaFi <devteam.codafi@gmail.com> | 2013-12-08 13:28:59 -0700 |
commit | 87f3cb5765f961d7a7fec734dd890ff913b46393 (patch) | |
tree | d872306d4ed374c00101d2319fdf31ccf058cbbb /src/core/rfc822 | |
parent | f3eb11eec145a5db4e76bca53b6f6b05566e674e (diff) |
Unify Project Style
Diffstat (limited to 'src/core/rfc822')
-rw-r--r-- | src/core/rfc822/MCMessageBuilder.cc | 140 | ||||
-rw-r--r-- | src/core/rfc822/MCMessageBuilder.h | 82 | ||||
-rw-r--r-- | src/core/rfc822/MCMessageParser.h | 42 | ||||
-rw-r--r-- | src/core/rfc822/MCMessagePart.h | 17 | ||||
-rw-r--r-- | src/core/rfc822/MCMultipart.h | 19 |
5 files changed, 151 insertions, 149 deletions
diff --git a/src/core/rfc822/MCMessageBuilder.cc b/src/core/rfc822/MCMessageBuilder.cc index ecec743c..384bb4e5 100644 --- a/src/core/rfc822/MCMessageBuilder.cc +++ b/src/core/rfc822/MCMessageBuilder.cc @@ -21,20 +21,20 @@ part_new_empty(struct mailmime_content * content, static struct mailmime * get_multipart_alternative(const char * boundary_prefix) { - struct mailmime * mime; - - mime = part_multiple_new("multipart/alternative", boundary_prefix); - - return mime; + struct mailmime * mime; + + mime = part_multiple_new("multipart/alternative", boundary_prefix); + + return mime; } static struct mailmime * get_multipart_related(const char * boundary_prefix) { - struct mailmime * mime; - - mime = part_multiple_new("multipart/related", boundary_prefix); - - return mime; + struct mailmime * mime; + + mime = part_multiple_new("multipart/related", boundary_prefix); + + return mime; } static int add_attachment(struct mailmime * mime, @@ -134,41 +134,41 @@ err: static struct mailmime * get_text_part(const char * mime_type, const char * charset, const char * content_id, const char * description, - const char * text, size_t length, int encoding_type) -{ - struct mailmime_fields * mime_fields; - struct mailmime * mime; - struct mailmime_content * content; - struct mailmime_parameter * param; - struct mailmime_disposition * disposition; - struct mailmime_mechanism * encoding; - char * dup_content_id; + const char * text, size_t length, int encoding_type) +{ + struct mailmime_fields * mime_fields; + struct mailmime * mime; + struct mailmime_content * content; + struct mailmime_parameter * param; + struct mailmime_disposition * disposition; + struct mailmime_mechanism * encoding; + char * dup_content_id; char * dup_description; - encoding = mailmime_mechanism_new(encoding_type, NULL); - disposition = mailmime_disposition_new_with_data(MAILMIME_DISPOSITION_TYPE_INLINE, - NULL, NULL, NULL, NULL, (size_t) -1); + encoding = mailmime_mechanism_new(encoding_type, NULL); + disposition = mailmime_disposition_new_with_data(MAILMIME_DISPOSITION_TYPE_INLINE, + NULL, NULL, NULL, NULL, (size_t) -1); dup_content_id = NULL; if (content_id != NULL) dup_content_id = strdup(content_id); dup_description = NULL; if (dup_description != NULL) dup_description = strdup(description); - mime_fields = mailmime_fields_new_with_data(encoding, + mime_fields = mailmime_fields_new_with_data(encoding, dup_content_id, dup_description, disposition, NULL); - - content = mailmime_content_new_with_str(mime_type); - if (charset == NULL) { - param = mailmime_param_new_with_data((char *) "charset", (char *) "utf-8"); - } - else { - param = mailmime_param_new_with_data((char *) "charset", (char *) charset); - } - clist_append(content->ct_parameters, param); - mime = part_new_empty(content, mime_fields, NULL, 1); - mailmime_set_body_text(mime, (char *) text, length); - - return mime; + + content = mailmime_content_new_with_str(mime_type); + if (charset == NULL) { + param = mailmime_param_new_with_data((char *) "charset", (char *) "utf-8"); + } + else { + param = mailmime_param_new_with_data((char *) "charset", (char *) charset); + } + clist_append(content->ct_parameters, param); + mime = part_new_empty(content, mime_fields, NULL, 1); + mailmime_set_body_text(mime, (char *) text, length); + + return mime; } static struct mailmime * get_plain_text_part(const char * mime_type, const char * charset, const char * content_id, @@ -204,44 +204,44 @@ static struct mailmime * get_file_part(const char * filename, const char * mime_ const char * content_description, const char * text, size_t length) { - char * disposition_name; - int encoding_type; - struct mailmime_disposition * disposition; - struct mailmime_mechanism * encoding; - struct mailmime_content * content; - struct mailmime * mime; - struct mailmime_fields * mime_fields; - char * dup_content_id; + char * disposition_name; + int encoding_type; + struct mailmime_disposition * disposition; + struct mailmime_mechanism * encoding; + struct mailmime_content * content; + struct mailmime * mime; + struct mailmime_fields * mime_fields; + char * dup_content_id; char * dup_content_description; - disposition_name = NULL; - if (filename != NULL) { - disposition_name = strdup(filename); - } - if (is_inline) { - disposition = mailmime_disposition_new_with_data(MAILMIME_DISPOSITION_TYPE_INLINE, - disposition_name, NULL, NULL, NULL, (size_t) -1); - } - else { - disposition = mailmime_disposition_new_with_data(MAILMIME_DISPOSITION_TYPE_ATTACHMENT, - disposition_name, NULL, NULL, NULL, (size_t) -1); - } - content = mailmime_content_new_with_str(mime_type); - - encoding_type = MAILMIME_MECHANISM_BASE64; - encoding = mailmime_mechanism_new(encoding_type, NULL); + disposition_name = NULL; + if (filename != NULL) { + disposition_name = strdup(filename); + } + if (is_inline) { + disposition = mailmime_disposition_new_with_data(MAILMIME_DISPOSITION_TYPE_INLINE, + disposition_name, NULL, NULL, NULL, (size_t) -1); + } + else { + disposition = mailmime_disposition_new_with_data(MAILMIME_DISPOSITION_TYPE_ATTACHMENT, + disposition_name, NULL, NULL, NULL, (size_t) -1); + } + content = mailmime_content_new_with_str(mime_type); + + encoding_type = MAILMIME_MECHANISM_BASE64; + encoding = mailmime_mechanism_new(encoding_type, NULL); dup_content_id = NULL; if (content_id != NULL) dup_content_id = strdup(content_id); dup_content_description = NULL; if (content_description != NULL) dup_content_description = strdup(content_description); - mime_fields = mailmime_fields_new_with_data(encoding, - dup_content_id, dup_content_description, disposition, NULL); - mime = part_new_empty(content, mime_fields, NULL, 1); - mailmime_set_body_text(mime, (char *) text, length); - - return mime; + mime_fields = mailmime_fields_new_with_data(encoding, + dup_content_id, dup_content_description, disposition, NULL); + mime = part_new_empty(content, mime_fields, NULL, 1); + mailmime_set_body_text(mime, (char *) text, length); + + return mime; } #define MIME_ENCODED_STR(str) (str != NULL ? str->encodedMIMEHeaderValue()->bytes() : NULL) @@ -481,11 +481,11 @@ void MessageBuilder::init() { mHTMLBody = NULL; mTextBody = NULL; - mAttachments = NULL; - mRelatedAttachments = NULL; + mAttachments = NULL; + mRelatedAttachments = NULL; mBoundaryPrefix = NULL; } - + MessageBuilder::MessageBuilder() { init(); @@ -509,7 +509,7 @@ MessageBuilder::~MessageBuilder() MC_SAFE_RELEASE(mRelatedAttachments); MC_SAFE_RELEASE(mBoundaryPrefix); } - + String * MessageBuilder::description() { String * result = String::string(); diff --git a/src/core/rfc822/MCMessageBuilder.h b/src/core/rfc822/MCMessageBuilder.h index 6981e295..f592a7f3 100644 --- a/src/core/rfc822/MCMessageBuilder.h +++ b/src/core/rfc822/MCMessageBuilder.h @@ -8,37 +8,37 @@ #ifdef __cplusplus namespace mailcore { - - class Attachment; + + class Attachment; class HTMLRendererTemplateCallback; - - class MessageBuilder : public AbstractMessage { - public: - MessageBuilder(); - virtual ~MessageBuilder(); - - virtual void setHTMLBody(String * htmlBody); - virtual String * htmlBody(); - - virtual void setTextBody(String * textBody); - virtual String * textBody(); - - virtual void setAttachments(Array * /* Attachment */ attachments); - virtual Array * /* Attachment */ attachments(); - virtual void addAttachment(Attachment * attachment); - - // attachments (usually images) that are included in HTML. + + class MessageBuilder : public AbstractMessage { + public: + MessageBuilder(); + virtual ~MessageBuilder(); + + virtual void setHTMLBody(String * htmlBody); + virtual String * htmlBody(); + + virtual void setTextBody(String * textBody); + virtual String * textBody(); + + virtual void setAttachments(Array * /* Attachment */ attachments); + virtual Array * /* Attachment */ attachments(); + virtual void addAttachment(Attachment * attachment); + + // attachments (usually images) that are included in HTML. // a Content-ID should be assigned to these part to be able to reference // them in the HTML using a cid: URL. - virtual void setRelatedAttachments(Array * /* Attachment */ attachments); - virtual Array * /* Attachment */ relatedAttachments(); - virtual void addRelatedAttachment(Attachment * attachment); - - // When boundary needs to be prefixed (to go through spam filters). - virtual void setBoundaryPrefix(String * boundaryPrefix); - virtual String * boundaryPrefix(); - - virtual Data * data(); + virtual void setRelatedAttachments(Array * /* Attachment */ attachments); + virtual Array * /* Attachment */ relatedAttachments(); + virtual void addRelatedAttachment(Attachment * attachment); + + // When boundary needs to be prefixed (to go through spam filters). + virtual void setBoundaryPrefix(String * boundaryPrefix); + virtual String * boundaryPrefix(); + + virtual Data * data(); virtual String * htmlRendering(HTMLRendererTemplateCallback * htmlCallback = NULL); virtual String * htmlBodyRendering(); @@ -47,20 +47,20 @@ namespace mailcore { virtual String * plainTextBodyRendering(bool stripWhitespace); public: // subclass behavior - MessageBuilder(MessageBuilder * other); - virtual String * description(); - virtual Object * copy(); + MessageBuilder(MessageBuilder * other); + virtual String * description(); + virtual Object * copy(); - private: - String * mHTMLBody; - String * mTextBody; - Array * /* Attachment */ mAttachments; - Array * /* Attachment */ mRelatedAttachments; - String * mBoundaryPrefix; - void init(); - Data * dataAndFilterBcc(bool filterBcc); - }; - + private: + String * mHTMLBody; + String * mTextBody; + Array * /* Attachment */ mAttachments; + Array * /* Attachment */ mRelatedAttachments; + String * mBoundaryPrefix; + void init(); + Data * dataAndFilterBcc(bool filterBcc); + }; + }; #endif diff --git a/src/core/rfc822/MCMessageParser.h b/src/core/rfc822/MCMessageParser.h index 7243730b..783799af 100644 --- a/src/core/rfc822/MCMessageParser.h +++ b/src/core/rfc822/MCMessageParser.h @@ -9,19 +9,19 @@ #ifdef __cplusplus namespace mailcore { - + class HTMLRendererTemplateCallback; - class MessageParser : public AbstractMessage { - public: - static MessageParser * messageParserWithData(Data * data); - static MessageParser * messageParserWithContentsOfFile(String * filename); - - MessageParser(Data * data); - virtual ~MessageParser(); - - virtual AbstractPart * mainPart(); - virtual Data * data(); + class MessageParser : public AbstractMessage { + public: + static MessageParser * messageParserWithData(Data * data); + static MessageParser * messageParserWithContentsOfFile(String * filename); + + MessageParser(Data * data); + virtual ~MessageParser(); + + virtual AbstractPart * mainPart(); + virtual Data * data(); virtual String * htmlRendering(HTMLRendererTemplateCallback * htmlCallback = NULL); virtual String * htmlBodyRendering(); @@ -30,20 +30,20 @@ namespace mailcore { virtual String * plainTextBodyRendering(bool stripWhitespace); public: // subclass behavior - MessageParser(MessageParser * other); - virtual String * description(); - virtual Object * copy(); + MessageParser(MessageParser * other); + virtual String * description(); + virtual Object * copy(); virtual AbstractPart * partForContentID(String * contentID); virtual AbstractPart * partForUniqueID(String * uniqueID); - private: - Data * mData; - AbstractPart * mMainPart; - void init(); - - }; - + private: + Data * mData; + AbstractPart * mMainPart; + void init(); + + }; + }; #endif diff --git a/src/core/rfc822/MCMessagePart.h b/src/core/rfc822/MCMessagePart.h index 6dd5eb7f..6311e5e2 100644 --- a/src/core/rfc822/MCMessagePart.h +++ b/src/core/rfc822/MCMessagePart.h @@ -8,16 +8,17 @@ #ifdef __cplusplus namespace mailcore { - - class MessagePart : public AbstractMessagePart { - public: - MessagePart(); - virtual ~MessagePart(); + + class MessagePart : public AbstractMessagePart { + public: + MessagePart(); + virtual ~MessagePart(); public: // subclass behavior - MessagePart(MessagePart * other); - virtual Object * copy(); - }; + MessagePart(MessagePart * other); + virtual Object * copy(); + }; + } #endif diff --git a/src/core/rfc822/MCMultipart.h b/src/core/rfc822/MCMultipart.h index f65e8993..1eada13d 100644 --- a/src/core/rfc822/MCMultipart.h +++ b/src/core/rfc822/MCMultipart.h @@ -8,16 +8,17 @@ #ifdef __cplusplus namespace mailcore { - - class Multipart : public AbstractMultipart { - public: - Multipart(); - virtual ~Multipart(); - + + class Multipart : public AbstractMultipart { + public: + Multipart(); + virtual ~Multipart(); + public: // subclass behavior - Multipart(Multipart * other); - virtual Object * copy(); - }; + Multipart(Multipart * other); + virtual Object * copy(); + }; + } #endif |