00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #ifndef INCL_MAIL_DATA
00038 #define INCL_MAIL_DATA
00039
00041 #include "base/util/ArrayElement.h"
00042 #include "base/util/StringBuffer.h"
00043 #include "mail/MailMessage.h"
00044 #include "mail/MailData.h"
00045 #include "base/globalsdef.h"
00046
00047 BEGIN_NAMESPACE
00048
00049 class MailData : public ArrayElement {
00050
00051
00052 private:
00053 bool read;
00054 bool forwarded;
00055 bool replied;
00056 StringBuffer received;
00057 StringBuffer created;
00058 StringBuffer modified;
00059 bool deleted;
00060 bool flagged;
00061
00062 MailMessage emailItem;
00063
00064
00065 class ExtMailData : public ArrayElement {
00066 public:
00067 ExtMailData() {
00068 attachName = NULL;
00069 attachSize = NULL;
00070 attachMime = NULL;
00071 attachURL = NULL;
00072 }
00073 ~ExtMailData() {
00074 delete [] attachName; attachName = NULL;
00075 delete [] attachMime; attachMime = NULL;
00076 delete [] attachURL; attachURL = NULL;
00077 }
00078 char* attachName;
00079 long attachSize;
00080 char* attachMime;
00081 char* attachURL;
00082
00083 ArrayElement* clone() {
00084 ExtMailData* ret = new ExtMailData();
00085 ret->attachName = stringdup(attachName);
00086 ret->attachSize = attachSize;
00087 ret->attachMime = stringdup(attachMime);
00088 ret->attachURL = stringdup(attachURL);
00089 return ret;
00090 }
00091
00092 } *extMailData;
00093
00094
00095 unsigned long remainingBodySize;
00096 unsigned long remainingAttachNumber;
00097 unsigned long totalEmailSize;
00098 bool isMailPartial;
00099 ArrayList* remainingAttachments;
00100
00101 public:
00102
00103 MailData();
00104 ~MailData();
00105
00106
00107 bool getRead() { return read; }
00108 void setRead(bool v) { read=v; }
00109
00110 bool getForwarded() { return forwarded; }
00111 void setForwarded(bool v) { forwarded=v; }
00112
00113 bool getReplied() { return replied; }
00114 void setReplied(bool r) { replied=r; }
00115
00116 const char * getReceived() { return received; }
00117 void setReceived(const char * v) { received=v; }
00118
00119 const char * getCreated() { return created; }
00120 void setCreated(const char * v) { created=v; }
00121
00122 const char * getModified() { return modified; }
00123 void setModified(const char * v) { modified=v; }
00124
00125 bool getDeleted() { return deleted; }
00126 void setDeleted(bool v) { deleted=v; }
00127
00128 bool getFlagged() { return flagged; }
00129 void setFlagged(bool v) { flagged=v; }
00130
00131 MailMessage& getEmailItem() { return emailItem; }
00132 void setEmailItem(const MailMessage& v) { emailItem = v; }
00133
00134
00135 int parse(const char *syncmlData, size_t len = StringBuffer::npos) ;
00136 char *format() ;
00137
00138 ArrayElement* clone() { return new MailData(*this); }
00139
00140 unsigned long getRemainingBodySize() { return remainingBodySize; }
00141 void setRemainingBodySize(unsigned long v) { remainingBodySize = v; }
00142
00143 unsigned long getRemainingAttachNumber() { return remainingAttachNumber; }
00144 void setRemainingAttachNumber(unsigned long v) { remainingAttachNumber = v; }
00145
00146 unsigned long getTotalEmailSize() { return totalEmailSize; }
00147 void setTotalEmailSize(unsigned long v) { totalEmailSize = v; }
00148
00149 bool getIsMailPartial() { return isMailPartial; }
00150
00151 const char* getAttachmentName(unsigned int index) {
00152 if (remainingAttachments)
00153 return ((ExtMailData*)remainingAttachments->get(index))->attachName;
00154 else
00155 return NULL;
00156 }
00157 unsigned long getAttachmentSize(unsigned int index) {
00158 if (remainingAttachments)
00159 return ((ExtMailData*)remainingAttachments->get(index))->attachSize;
00160 else
00161 return 0;
00162 }
00163 const char* getAttachmentMime(unsigned int index) {
00164 if (remainingAttachments)
00165 return ((ExtMailData*)remainingAttachments->get(index))->attachMime;
00166 else
00167 return NULL;
00168 }
00169 const char* getAttachmentURL(unsigned int index) {
00170 if (remainingAttachments)
00171 return ((ExtMailData*)remainingAttachments->get(index))->attachURL;
00172 else
00173 return NULL;
00174 }
00175
00176
00177 };
00178
00179
00180 END_NAMESPACE
00181
00183 #endif
00184