Diffstat (limited to 'noncore/net/mail/libmailwrapper/mailtypes.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/mail/libmailwrapper/mailtypes.cpp | 90 |
1 files changed, 89 insertions, 1 deletions
diff --git a/noncore/net/mail/libmailwrapper/mailtypes.cpp b/noncore/net/mail/libmailwrapper/mailtypes.cpp index 8d9b247..d8a36e7 100644 --- a/noncore/net/mail/libmailwrapper/mailtypes.cpp +++ b/noncore/net/mail/libmailwrapper/mailtypes.cpp @@ -1,14 +1,14 @@ #include "mailtypes.h" - +#include <stdlib.h> RecMail::RecMail() :subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7) { init(); } RecMail::RecMail(const RecMail&old) :subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7) { init(); copy_old(old); @@ -236,12 +236,100 @@ void RecBody::addPart(const RecPart& part) m_PartsList.append(part); } void RecBody::setDescription(const RecPart&des) { m_description = des; } const RecPart& RecBody::Description()const { return m_description; } + +/* handling encoded content */ +encodedString::encodedString() +{ + init(); +} + +encodedString::encodedString(const char*nContent,unsigned int nSize) +{ + init(); + setContent(nContent,nSize); +} + +encodedString::encodedString(char*nContent,unsigned int nSize) +{ + init(); + setContent(nContent,nSize); +} + +encodedString::encodedString(const encodedString&old) +{ + init(); + copy_old(old); + qDebug("encodedeString: copy constructor!"); +} + +encodedString& encodedString::operator=(const encodedString&old) +{ + init(); + copy_old(old); + qDebug("encodedString: assign operator!"); + return *this; +} + +encodedString::~encodedString() +{ + clean(); +} + +void encodedString::init() +{ + content = 0; + size = 0; +} + +void encodedString::clean() +{ + if (content) { + free(content); + } + content = 0; + size = 0; +} + +void encodedString::copy_old(const encodedString&old) +{ + clean(); + if (old.size>0 && old.content) { + content = (char*)malloc(old.size*sizeof(char)); + memcpy(content,old.content,size); + size = old.size; + } +} + +const char*encodedString::Content()const +{ + return content; +} + +const int encodedString::Length()const +{ + return size; +} + +void encodedString::setContent(const char*nContent,int nSize) +{ + if (nSize>0 && nContent) { + content = (char*)malloc(nSize*sizeof(char)); + memcpy(content,nContent,nSize); + size = nSize; + } +} + +void encodedString::setContent(char*nContent,int nSize) +{ + content = nContent; + size = nSize; +} |