summaryrefslogtreecommitdiff
path: root/noncore/net/mail/libmailwrapper/mailwrapper.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/mail/libmailwrapper/mailwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/libmailwrapper/mailwrapper.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/net/mail/libmailwrapper/mailwrapper.cpp b/noncore/net/mail/libmailwrapper/mailwrapper.cpp
index eddc0b9..2b0d112 100644
--- a/noncore/net/mail/libmailwrapper/mailwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/mailwrapper.cpp
@@ -6,97 +6,97 @@
#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( DocLnk lnk )
{
doc = lnk;
size = QFileInfo( doc.file() ).size();
}
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)
{
// Decode IMAP foldername
nameDisplay = IMAPFolder::decodeFolderName( name );
/*
- qDebug( "folder " + name + " - displayed as " + 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++;
} else {
/* convert modified UTF-7 -> UTF-16 -> UCS-4 -> UTF-8 -> HEX */