-rw-r--r-- | kmicromail/libmailwrapper/mailwrapper.cpp | 7 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mailwrapper.h | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/kmicromail/libmailwrapper/mailwrapper.cpp b/kmicromail/libmailwrapper/mailwrapper.cpp index 9400649..2ee1ab3 100644 --- a/kmicromail/libmailwrapper/mailwrapper.cpp +++ b/kmicromail/libmailwrapper/mailwrapper.cpp @@ -1,101 +1,102 @@ #include <stdlib.h> #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> #include <fcntl.h> #include <string.h> #include <qdir.h> #include "mailwrapper.h" //#include "logindialog.h" //#include "defines.h" #define UNDEFINED 64 #define MAXLINE 76 #define UTF16MASK 0x03FFUL #define UTF16SHIFT 10 #define UTF16BASE 0x10000UL #define UTF16HIGHSTART 0xD800UL #define UTF16HIGHEND 0xDBFFUL #define UTF16LOSTART 0xDC00UL #define UTF16LOEND 0xDFFFUL using namespace Opie::Core; Attachment::Attachment( QString lnk ) { doc = lnk; size = QFileInfo( doc ).size(); mPix = SmallIcon( "files" ); } Folder::Folder(const QString&tmp_name, const QString&sep ) { name = tmp_name; nameDisplay = name; separator = sep; prefix = ""; } Folder::~Folder() { } const QString& Folder::Separator()const { return separator; } -IMAPFolder::IMAPFolder(const QString&name,const QString&sep, bool select,bool no_inf, const QString&aprefix ) - : Folder( name,sep ),m_MaySelect(select),m_NoInferior(no_inf) +IMAPFolder::IMAPFolder(const QString&t_name,const QString&sep, bool select,bool no_inf, const QString&aprefix ) + : Folder( t_name,sep ),m_MaySelect(select),m_NoInferior(no_inf) { // Decode IMAP foldername - nameDisplay = IMAPFolder::decodeFolderName( name ); + nameDisplay = IMAPFolder::decodeFolderName( t_name ); + name = nameDisplay ; /* odebug << "folder " + name + " - displayed as " + nameDisplay << oendl; */ prefix = aprefix; if (prefix.length()>0) { if (nameDisplay.startsWith(prefix) && nameDisplay.length()>prefix.length()) { nameDisplay=nameDisplay.right(nameDisplay.length()-prefix.length()); } } } IMAPFolder::~IMAPFolder() { } static unsigned char base64chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+,"; /** * Decodes base64 encoded parts of the imapfolder name * Code taken from kde cvs: kdebase/kioslave/imap4/rfcdecoder.cc */ QString IMAPFolder::decodeFolderName( const QString &name ) { unsigned char c, i, bitcount; unsigned long ucs4, utf16, bitbuf; unsigned char base64[256], utf8[6]; unsigned long srcPtr = 0; QCString dst = ""; QCString src = name.ascii(); /* initialize modified base64 decoding table */ memset(base64, UNDEFINED, sizeof(base64)); for (i = 0; i < sizeof(base64chars); ++i) { base64[(int)base64chars[i]] = i; } /* loop until end of string */ while (srcPtr < src.length ()) { c = src[srcPtr++]; /* deal with literal characters and &- */ if (c != '&' || src[srcPtr] == '-') { /* encode literally */ dst += c; /* skip over the '-' if this is an &- sequence */ if (c == '&') srcPtr++; diff --git a/kmicromail/libmailwrapper/mailwrapper.h b/kmicromail/libmailwrapper/mailwrapper.h index cefe64e..2ba908b 100644 --- a/kmicromail/libmailwrapper/mailwrapper.h +++ b/kmicromail/libmailwrapper/mailwrapper.h @@ -75,54 +75,54 @@ public: void setBCC( const QString&s ) { bcc = s; } const QString&getMessage()const { return message; } void setMessage( const QString&s ) { message = s; } const QString&getSubject()const { return subject; } void setSubject( const QString&s ) { subject = s; } const QString&getReply()const{ return reply; } void setReply( const QString&a ) { reply = a; } void setInreply(const QStringList&list){m_in_reply_to = list;} const QStringList&Inreply()const{return m_in_reply_to;} private: QList<Attachment> attList; QString name, mail, to, cc, bcc, reply, subject, message; QStringList m_in_reply_to; }; class Folder:public Opie::Core::ORefCount { public: Folder( const QString&init_name,const QString&sep ); virtual ~Folder(); const QString&getDisplayName()const { return nameDisplay; } const QString&getName()const { return name; } const QString&getPrefix()const{return prefix; } virtual bool may_select()const{return true;} virtual bool no_inferior()const{return true;} const QString&Separator()const; protected: QString nameDisplay, name, separator,prefix; }; typedef Opie::Core::OSmartPointer<Folder> FolderP; class MHFolder : public Folder { public: MHFolder(const QString&disp_name,const QString&mbox); virtual ~MHFolder(); }; class IMAPFolder : public Folder { public: IMAPFolder(const QString&name, const QString&sep, bool select=true,bool noinf=false,const QString&prefix="" ); virtual ~IMAPFolder(); virtual bool may_select()const{return m_MaySelect;} virtual bool no_inferior()const{return m_NoInferior;} - private: static QString decodeFolderName( const QString &name ); + private: bool m_MaySelect,m_NoInferior; }; #endif |