Go to the documentation of this file.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 #ifndef EMailH
00033 #define EMailH
00034
00035 #include <zeusbase/System/ZObject.h>
00036 #include <zeusbase/System/SingleLinkedList.hpp>
00037 #include <zeusbase/Net/Protocols/EMailAddress.h>
00038
00039 BEGIN_NAMESPACE_Zeus
00040
00041
00044
00045 zeusbase_class TEMail : public TZObject
00046 {
00047 public:
00048
00051
00052 enum EReceiverType
00053 {
00054 etNormal = 0,
00055 etCC = 1,
00056 etBCC = 2
00057 };
00058
00059 TEMail(const TString& rSenderAddress);
00060
00061 void addRecipient(const TString& rRecipientAddress, EReceiverType eType = etNormal);
00062 void addRecipient(const TEMailAddress& rRecipientAddress, EReceiverType eType = etNormal);
00063 void clearRecipientList(EReceiverType eType = etNormal);
00064
00065 TString formatMessage() const;
00066 TString getDate() const;
00067 const TEMailAddress& getSender() const;
00068 const TSingleLinkedList<TEMailAddress>& getRecipients() const;
00069 const TSingleLinkedList<TEMailAddress>& getCCRecipients() const;
00070 const TSingleLinkedList<TEMailAddress>& getBCCRecipients() const;
00071
00072 void setSubject(const TString& rSubject);
00073 void setTextBody(const TString& rBody);
00074
00075 protected:
00076 virtual ~TEMail();
00077
00078 private:
00080 TEMailAddress m_SenderAddress;
00082 TSingleLinkedList<TEMailAddress> m_lstRecipients;
00084 TSingleLinkedList<TEMailAddress> m_lstCCRecipients;
00086 TSingleLinkedList<TEMailAddress> m_lstBCCRecipients;
00088 TString m_strSubject;
00090 TString m_strTextBody;
00092 TString m_strDate;
00093 };
00094
00095
00099
00100 inline void TEMail::addRecipient(const TString& rRecipientAddress, EReceiverType eType )
00101 {
00102 switch(eType)
00103 {
00104 case etNormal:
00105 m_lstRecipients.add(rRecipientAddress);
00106 break;
00107
00108 case etCC:
00109 m_lstCCRecipients.add(rRecipientAddress);
00110 break;
00111
00112 case etBCC:
00113 m_lstBCCRecipients.add(rRecipientAddress);
00114 break;
00115 }
00116 }
00117
00118
00123
00124 inline void TEMail::addRecipient(const TEMailAddress& rRecipientAddress, EReceiverType eType )
00125 {
00126 switch(eType)
00127 {
00128 case etNormal:
00129 m_lstRecipients.add(rRecipientAddress);
00130 break;
00131
00132 case etCC:
00133 m_lstCCRecipients.add(rRecipientAddress);
00134 break;
00135
00136 case etBCC:
00137 m_lstBCCRecipients.add(rRecipientAddress);
00138 break;
00139 }
00140 }
00141
00142
00146
00147 inline void TEMail::clearRecipientList(EReceiverType eType )
00148 {
00149 switch(eType)
00150 {
00151 case etNormal:
00152 m_lstRecipients.clear();
00153 break;
00154
00155 case etCC:
00156 m_lstCCRecipients.clear();
00157 break;
00158
00159 case etBCC:
00160 m_lstBCCRecipients.clear();
00161 break;
00162 }
00163
00164 }
00165
00166
00169
00170 inline TString TEMail::getDate() const
00171 {
00172 return m_strDate;
00173 }
00174
00175
00176
00179
00180 inline const TEMailAddress& TEMail::getSender() const
00181 {
00182 return m_SenderAddress;
00183 }
00184
00185
00188
00189 inline const TSingleLinkedList<TEMailAddress>& TEMail::getRecipients() const
00190 {
00191 return m_lstRecipients;
00192 }
00193
00194
00197
00198 inline const TSingleLinkedList<TEMailAddress>& TEMail::getCCRecipients() const
00199 {
00200 return m_lstCCRecipients;
00201 }
00202
00203
00206
00207 inline const TSingleLinkedList<TEMailAddress>& TEMail::getBCCRecipients() const
00208 {
00209 return m_lstBCCRecipients;
00210 }
00211
00212
00216
00217 inline void TEMail::setTextBody(const TString& rBody)
00218 {
00219 m_strTextBody = rBody;
00220 }
00221
00222
00226
00227 inline void TEMail::setSubject(const TString& rSubject)
00228 {
00229 m_strSubject = rSubject;
00230 }
00231
00232
00233 END_NAMESPACE_Zeus
00234
00235 #endif