summaryrefslogtreecommitdiffabout
path: root/kmicromail/libmailwrapper
Side-by-side diff
Diffstat (limited to 'kmicromail/libmailwrapper') (more/less context) (show whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/genericwrapper.cpp1
-rw-r--r--kmicromail/libmailwrapper/imapwrapper.cpp9
-rw-r--r--kmicromail/libmailwrapper/mailtypes.cpp11
-rw-r--r--kmicromail/libmailwrapper/mailtypes.h3
-rw-r--r--kmicromail/libmailwrapper/mailwrapper.h5
-rw-r--r--kmicromail/libmailwrapper/storemail.cpp10
6 files changed, 33 insertions, 6 deletions
diff --git a/kmicromail/libmailwrapper/genericwrapper.cpp b/kmicromail/libmailwrapper/genericwrapper.cpp
index 49227dd..28d45ce 100644
--- a/kmicromail/libmailwrapper/genericwrapper.cpp
+++ b/kmicromail/libmailwrapper/genericwrapper.cpp
@@ -226,6 +226,7 @@ void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*m
QString charset = part->searchParamter( "charset");
qDebug("CHARSET %s ",charset.latin1() );
if ( !charset.isEmpty() ) {
+ target->setCharset( charset );
err = mailmime_encoded_phrase_parse(charset.latin1(),
b.latin1(), b.length(),&index, "utf-8",&resu);
if (err == MAILIMF_NO_ERROR && resu && strlen(resu)) {
diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp
index eb2b47d..2a54381 100644
--- a/kmicromail/libmailwrapper/imapwrapper.cpp
+++ b/kmicromail/libmailwrapper/imapwrapper.cpp
@@ -50,7 +50,7 @@ void IMAPwrapper::imap_progress( size_t current, size_t maximum )
//qDebug("imap progress %d of %d ",current,maximum );
//Global::statusMessage(i18n("Downloading message %1 of %2").arg( current).arg(maximum));
//qApp->processEvents()
- static int last = 0;
+ static unsigned int last = 0;
if ( last != current )
IMAPwrapper::progress();
last = current;
@@ -292,7 +292,7 @@ void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSma
msg_att = (mailimap_msg_att*)current->data;
RecMail*m = parse_list_result(msg_att);
if (m) {
- if ( maxSizeInKb == 0 || m->Msgsize()<=maxSizeInKb*1024 ) {
+ if ( maxSizeInKb == 0 || m->Msgsize()<=(unsigned int ) maxSizeInKb*1024 ) {
m->setNumber(i);
m->setMbox(mailbox);
m->setWrapper(this);
@@ -415,7 +415,7 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
clistcell *current,*c,*cf;
mailimap_msg_att_dynamic*flist;
mailimap_flag_fetch*cflag;
- int size;
+ int size = 0;
QBitArray mFlags(7);
QStringList addresslist;
@@ -761,6 +761,7 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&t
qDebug("CHARSET %s ",charset.latin1() );
//if ( false ) {
if ( !charset.isEmpty() ) {
+ target_body->setCharset( charset );
//err = mailmime_encoded_phrase_parse("iso-8859-1",
// text, strlen(text),&index, "iso-8859-1",&res);
err = mailmime_encoded_phrase_parse(charset.latin1(),
@@ -1182,7 +1183,7 @@ int IMAPwrapper::createMbox(const QString&folder,const FolderP&parentfolder,cons
login();
if (!m_imap) {return 0;}
QString pre = account->getPrefix();
- if (delemiter.length()>0 && pre.findRev(delemiter)!=pre.length()-1) {
+ if (delemiter.length()>0 && pre.findRev(delemiter)!=((int)pre.length())-1) {
pre+=delemiter;
}
if (parentfolder) {
diff --git a/kmicromail/libmailwrapper/mailtypes.cpp b/kmicromail/libmailwrapper/mailtypes.cpp
index af3b9d0..89150ad 100644
--- a/kmicromail/libmailwrapper/mailtypes.cpp
+++ b/kmicromail/libmailwrapper/mailtypes.cpp
@@ -287,6 +287,7 @@ RecBody::RecBody(const RecBody&old)
m_BodyText = old.m_BodyText;
m_PartsList = old.m_PartsList;
m_description = old.m_description;
+ mCharset = old.mCharset;
// odebug << "Recbody copy constructor" << oendl;
}
@@ -330,6 +331,16 @@ const RecPartP& RecBody::Description()const
return m_description;
}
+void RecBody::setCharset(const QString& str)
+{
+ mCharset = str;
+}
+
+QString RecBody::getCharset()const
+{
+ return mCharset;
+}
+
/* handling encoded content */
encodedString::encodedString()
{
diff --git a/kmicromail/libmailwrapper/mailtypes.h b/kmicromail/libmailwrapper/mailtypes.h
index c1c1a74..32d92c0 100644
--- a/kmicromail/libmailwrapper/mailtypes.h
+++ b/kmicromail/libmailwrapper/mailtypes.h
@@ -133,6 +133,7 @@ class RecBody:public Opie::Core::ORefCount
{
protected:
QString m_BodyText;
+ QString mCharset;
QValueList<RecPartP> m_PartsList;
RecPartP m_description;
@@ -142,6 +143,8 @@ public:
virtual ~RecBody();
void setBodytext(const QString&);
const QString& Bodytext()const;
+ void setCharset(const QString&);
+ QString getCharset()const;
void setDescription(const RecPartP&des);
const RecPartP& Description()const;
diff --git a/kmicromail/libmailwrapper/mailwrapper.h b/kmicromail/libmailwrapper/mailwrapper.h
index 88f10da..ea6bf36 100644
--- a/kmicromail/libmailwrapper/mailwrapper.h
+++ b/kmicromail/libmailwrapper/mailwrapper.h
@@ -82,9 +82,12 @@ public:
void setInreply(const QStringList&list){m_in_reply_to = list;}
const QStringList&Inreply()const{return m_in_reply_to;}
+ void setCharset( const QString&a ) { charset= a; }
+ const QString& getCharset() { return charset; }
+
private:
QList<Attachment> attList;
- QString name, mail, to, cc, bcc, reply, subject, message;
+ QString name, mail, to, cc, bcc, reply, subject, message, charset;
QStringList m_in_reply_to;
};
diff --git a/kmicromail/libmailwrapper/storemail.cpp b/kmicromail/libmailwrapper/storemail.cpp
index ed1d44a..9d1735f 100644
--- a/kmicromail/libmailwrapper/storemail.cpp
+++ b/kmicromail/libmailwrapper/storemail.cpp
@@ -7,6 +7,7 @@
#include <qstring.h>
#include <stdlib.h>
+#include <kglobal.h>
using namespace Opie::Core;
Storemail::Storemail(Account*aAccount,const QString&aFolder)
@@ -66,7 +67,14 @@ int Storemail::storeMail(const Opie::Core::OSmartPointer<Mail>&mail)
mailmessage * msg = 0;
msg = mime_message_init(mimeMail);
- mime_message_set_tmpdir(msg,getenv( "HOME" ));
+ QString fileName;
+#ifdef DESKTOP_VERSION
+ fileName = locateLocal("tmp", "");
+#else
+ fileName = "/tmp/";
+#endif
+ //mime_message_set_tmpdir(msg,getenv( "HOME" ));
+ mime_message_set_tmpdir(msg,(char*)fileName.latin1());
int r = mailmessage_fetch(msg,&data,&size);
mime_message_detach_mime(msg);
mailmessage_free(msg);