Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

mailtypes.cpp

Go to the documentation of this file.
00001 #include "mailtypes.h"
00002 
00003 #include <opie2/odebug.h>
00004 #include <qpe/timestring.h>
00005 
00006 #include <stdlib.h>
00007 
00008 using namespace Opie::Core;
00009 RecMail::RecMail()
00010     :Opie::Core::ORefCount(),subject(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7),maildate(),date("")
00011 {
00012     init();
00013 }
00014 
00015 RecMail::RecMail(const RecMail&old)
00016     :Opie::Core::ORefCount(),subject(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7),maildate(),date("")
00017 {
00018     init();
00019     copy_old(old);
00020     odebug << "Copy constructor RecMail" << oendl;
00021 }
00022 
00023 RecMail::~RecMail()
00024 {
00025     wrapper = 0;
00026 }
00027 
00028 void RecMail::copy_old(const RecMail&old)
00029 {
00030     subject = old.subject;
00031     maildate = old.maildate;
00032     date = old.date;
00033     mbox = old.mbox;
00034     msg_id = old.msg_id;
00035     msg_size = old.msg_size;
00036     msg_number = old.msg_number;
00037     from = old.from;
00038     msg_flags = old.msg_flags;
00039     to = old.to;
00040     cc = old.cc;
00041     bcc = old.bcc;
00042     wrapper = old.wrapper;
00043     in_reply_to = old.in_reply_to;
00044     references = old.references;
00045     replyto = old.replyto;
00046 }
00047 
00048 void RecMail::init()
00049 {
00050     to.clear();
00051     cc.clear();
00052     bcc.clear();
00053     in_reply_to.clear();
00054     references.clear();
00055     wrapper = 0;
00056 }
00057 
00058 void RecMail::setDate( const QDateTime&a,int offset)
00059 {
00060     QString timestring = TimeString::numberDateString(a.date())+" ";
00061     timestring+=TimeString::timeString(a.time());
00062     if (offset > 0) {
00063         timestring.sprintf(timestring+" %+05i",offset);
00064     }
00065     date = timestring;
00066     maildate = a;
00067 }
00068 
00069 void RecMail::setWrapper(AbstractMail*awrapper)
00070 {
00071     wrapper = awrapper;
00072 }
00073 
00074 AbstractMail* RecMail::Wrapper()
00075 {
00076     return wrapper;
00077 }
00078 
00079 void RecMail::setTo(const QStringList&list)
00080 {
00081     to = list;
00082 }
00083 
00084 const QStringList&RecMail::To()const
00085 {
00086     return to;
00087 }
00088 
00089 void RecMail::setCC(const QStringList&list)
00090 {
00091     cc = list;
00092 }
00093 
00094 const QStringList&RecMail::CC()const
00095 {
00096     return cc;
00097 }
00098 
00099 void RecMail::setBcc(const QStringList&list)
00100 {
00101     bcc = list;
00102 }
00103 
00104 const QStringList& RecMail::Bcc()const
00105 {
00106     return bcc;
00107 }
00108 
00109 void RecMail::setInreply(const QStringList&list)
00110 {
00111     in_reply_to = list;
00112 }
00113 
00114 const QStringList& RecMail::Inreply()const
00115 {
00116     return in_reply_to;
00117 }
00118 
00119 void RecMail::setReferences(const QStringList&list)
00120 {
00121     references = list;
00122 }
00123 
00124 const QStringList& RecMail::References()const
00125 {
00126     return references;
00127 }
00128 
00129 RecPart::RecPart()
00130     : Opie::Core::ORefCount(),
00131      m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_description(""),m_lines(0),m_size(0)
00132 {
00133     m_Parameters.clear();
00134     m_poslist.clear();
00135 }
00136 
00137 RecPart::RecPart(const RecPart&old)
00138     : Opie::Core::ORefCount(),
00139     m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_description(""),m_lines(0),m_size(0)
00140 {
00141     m_type = old.m_type;
00142     m_subtype = old.m_subtype;
00143     m_identifier = old.m_identifier;
00144     m_encoding = old.m_encoding;
00145     m_description = old.m_description;
00146     m_lines = old.m_lines;
00147     m_size = old.m_size;
00148     m_Parameters = old.m_Parameters;
00149     m_poslist = old.m_poslist;
00150     odebug << "RecPart copy constructor" << oendl;
00151 }
00152 
00153 RecPart::~RecPart()
00154 {
00155 }
00156 
00157 void RecPart::setSize(unsigned int size)
00158 {
00159     m_size = size;
00160 }
00161 
00162 const unsigned int RecPart::Size()const
00163 {
00164     return m_size;
00165 }
00166 
00167 void RecPart::setLines(unsigned int lines)
00168 {
00169     m_lines = lines;
00170 }
00171 
00172 const unsigned int RecPart::Lines()const
00173 {
00174     return m_lines;
00175 }
00176 
00177 const QString& RecPart::Type()const
00178 {
00179     return m_type;
00180 }
00181 
00182 void RecPart::setType(const QString&type)
00183 {
00184     m_type = type;
00185 }
00186 
00187 const QString& RecPart::Subtype()const
00188 {
00189     return m_subtype;
00190 }
00191 
00192 void RecPart::setSubtype(const QString&subtype)
00193 {
00194     m_subtype = subtype;
00195 }
00196 
00197 const QString& RecPart::Identifier()const
00198 {
00199     return m_identifier;
00200 }
00201 
00202 void RecPart::setIdentifier(const QString&identifier)
00203 {
00204     m_identifier = identifier;
00205 }
00206 
00207 const QString& RecPart::Encoding()const
00208 {
00209     return m_encoding;
00210 }
00211 
00212 void RecPart::setEncoding(const QString&encoding)
00213 {
00214     m_encoding = encoding;
00215 }
00216 
00217 const QString& RecPart::Description()const
00218 {
00219     return m_description;
00220 }
00221 
00222 void RecPart::setDescription(const QString&desc)
00223 {
00224     m_description = desc;
00225 }
00226 
00227 void RecPart::setParameters(const part_plist_t&list)
00228 {
00229     m_Parameters = list;
00230 }
00231 
00232 const part_plist_t& RecPart::Parameters()const
00233 {
00234     return m_Parameters;
00235 }
00236 
00237 void RecPart::addParameter(const QString&key,const QString&value)
00238 {
00239     m_Parameters[key]=value;
00240 }
00241 
00242 const QString RecPart::searchParamter(const QString&key)const
00243 {
00244     QString value("");
00245     part_plist_t::ConstIterator it = m_Parameters.find(key);
00246     if (it != m_Parameters.end()) {
00247         value = it.data();
00248     }
00249     return value;
00250 }
00251 
00252 void RecPart::setPositionlist(const QValueList<int>&poslist)
00253 {
00254     m_poslist = poslist;
00255 }
00256 
00257 const QValueList<int>& RecPart::Positionlist()const
00258 {
00259     return m_poslist;
00260 }
00261 
00262 RecBody::RecBody()
00263     : Opie::Core::ORefCount(),m_BodyText(),m_description(new RecPart())
00264 {
00265     m_PartsList.clear();
00266 }
00267 
00268 RecBody::RecBody(const RecBody&old)
00269     :Opie::Core::ORefCount(),m_BodyText(),m_PartsList(),m_description(new RecPart())
00270 {
00271     m_BodyText = old.m_BodyText;
00272     m_PartsList = old.m_PartsList;
00273     m_description = old.m_description;
00274     odebug << "Recbody copy constructor" << oendl;
00275 }
00276 
00277 RecBody::~RecBody()
00278 {
00279 }
00280 
00281 void RecBody::setBodytext(const QString&bodyText)
00282 {
00283     m_BodyText = bodyText;
00284 }
00285 
00286 const QString& RecBody::Bodytext()const
00287 {
00288     return m_BodyText;
00289 }
00290 
00291 void RecBody::setParts(const QValueList<RecPartP>&parts)
00292 {
00293     m_PartsList.clear();
00294     m_PartsList = parts;
00295 }
00296 
00297 const QValueList<RecPartP>& RecBody::Parts()const
00298 {
00299     return m_PartsList;
00300 }
00301 
00302 void RecBody::addPart(const RecPartP& part)
00303 {
00304     m_PartsList.append(part);
00305 }
00306 
00307 void RecBody::setDescription(const RecPartP&des)
00308 {
00309     m_description = des;
00310 }
00311 
00312 const RecPartP& RecBody::Description()const
00313 {
00314     return m_description;
00315 }
00316 
00317 /* handling encoded content */
00318 encodedString::encodedString()
00319 {
00320     init();
00321 }
00322 
00323 encodedString::encodedString(const char*nContent,unsigned int nSize)
00324 {
00325     init();
00326     setContent(nContent,nSize);
00327 }
00328 
00329 encodedString::encodedString(char*nContent,unsigned int nSize)
00330 {
00331     init();
00332     setContent(nContent,nSize);
00333 }
00334 
00335 encodedString::encodedString(const encodedString&old)
00336 {
00337     init();
00338     copy_old(old);
00339     odebug << "encodedeString: copy constructor!" << oendl;
00340 }
00341 
00342 encodedString& encodedString::operator=(const encodedString&old)
00343 {
00344     init();
00345     copy_old(old);
00346     odebug << "encodedString: assign operator!" << oendl;
00347     return *this;
00348 }
00349 
00350 encodedString::~encodedString()
00351 {
00352     clean();
00353 }
00354 
00355 void encodedString::init()
00356 {
00357     content = 0;
00358     size = 0;
00359 }
00360 
00361 void encodedString::clean()
00362 {
00363     if (content) {
00364         free(content);
00365     }
00366     content = 0;
00367     size = 0;
00368 }
00369 
00370 void encodedString::copy_old(const encodedString&old)
00371 {
00372     clean();
00373     if (old.size>0 && old.content) {
00374         content = (char*)malloc(old.size*sizeof(char));
00375         memcpy(content,old.content,size);
00376         size = old.size;
00377     }
00378 }
00379 
00380 const char*encodedString::Content()const
00381 {
00382     return content;
00383 }
00384 
00385 const int encodedString::Length()const
00386 {
00387     return size;
00388 }
00389 
00390 void encodedString::setContent(const char*nContent,int nSize)
00391 {
00392     if (nSize>0 && nContent) {
00393         content = (char*)malloc(nSize*sizeof(char));
00394         memcpy(content,nContent,nSize);
00395         size = nSize;
00396     }
00397 }
00398 
00399 void encodedString::setContent(char*nContent,int nSize)
00400 {
00401     content = nContent;
00402     size = nSize;
00403 }
00404 
00405 folderStat&folderStat::operator=(const folderStat&old)
00406 {
00407     message_count = old.message_count;
00408     message_unseen = old.message_unseen;
00409     message_recent = old.message_recent;
00410     return *this;
00411 }

Generated on Sat Nov 5 16:17:38 2005 for OPIE by  doxygen 1.4.2