summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/mail/libmailwrapper/abstractmail.h2
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.cpp5
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.h1
-rw-r--r--noncore/net/mail/libmailwrapper/mboxwrapper.cpp7
-rw-r--r--noncore/net/mail/libmailwrapper/mboxwrapper.h2
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.cpp5
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.h2
7 files changed, 23 insertions, 1 deletions
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.h b/noncore/net/mail/libmailwrapper/abstractmail.h
index a070fb0..7c060db 100644
--- a/noncore/net/mail/libmailwrapper/abstractmail.h
+++ b/noncore/net/mail/libmailwrapper/abstractmail.h
@@ -40,18 +40,20 @@ public:
* them has to be appended automatic.
*/
virtual int createMbox(const QString&,const Folder*parentfolder=0,const QString& delemiter="/",bool getsubfolder=false);
virtual void logout()=0;
static AbstractMail* getWrapper(IMAPaccount *a);
static AbstractMail* getWrapper(POP3account *a);
/* mbox only! */
static AbstractMail* getWrapper(const QString&a);
static QString defaultLocalfolder();
+ virtual const QString&getType()const=0;
+
protected:
static encodedString*decode_String(const encodedString*text,const QString&enc);
static QString convert_String(const char*text);
static QString gen_attachment_id();
};
#endif
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
index 0c1e05e..95b317a 100644
--- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
@@ -976,12 +976,17 @@ void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox)
}
void IMAPwrapper::storeMessage(const char*msg,size_t length, const QString&folder)
{
login();
if (!m_imap) return;
if (!msg) return;
int r = mailimap_append(m_imap,(char*)folder.latin1(),0,0,msg,length);
if (r != MAILIMAP_NO_ERROR) {
Global::statusMessage("Error storing mail!");
}
}
+
+const QString&IMAPwrapper::getType()const
+{
+ return account->getType();
+}
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.h b/noncore/net/mail/libmailwrapper/imapwrapper.h
index a97f12d..6a9c411 100644
--- a/noncore/net/mail/libmailwrapper/imapwrapper.h
+++ b/noncore/net/mail/libmailwrapper/imapwrapper.h
@@ -34,24 +34,25 @@ public:
virtual RecBody fetchBody(const RecMail&mail);
virtual QString fetchTextPart(const RecMail&mail,const RecPart&part);
virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part);
virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part);
virtual int createMbox(const QString&,const Folder*parentfolder=0,const QString& delemiter="/",bool getsubfolder=false);
virtual int deleteMbox(const Folder*folder);
static void imap_progress( size_t current, size_t maximum );
virtual void logout();
+ virtual const QString&getType()const;
protected:
RecMail*parse_list_result(mailimap_msg_att*);
void login();
virtual QString fetchTextPart(const RecMail&mail,const QValueList<int>&path,bool internal_call=false,const QString&enc="");
virtual encodedString*fetchRawPart(const RecMail&mail,const QValueList<int>&path,bool internal_call);
void fillSinglePart(RecPart&target_part,mailimap_body_type_1part*Description);
void fillSingleTextPart(RecPart&target_part,mailimap_body_type_text*which);
void fillSingleBasicPart(RecPart&target_part,mailimap_body_type_basic*which);
void fillSingleMsgPart(RecPart&target_part,mailimap_body_type_msg*which);
void fillMultiPart(RecPart&target_part,mailimap_body_type_mpart*which);
diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp
index 540a971..60f7507 100644
--- a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp
@@ -1,20 +1,22 @@
#include "mboxwrapper.h"
#include "mailtypes.h"
#include "mailwrapper.h"
#include <libetpan/libetpan.h>
#include <qdir.h>
#include <stdlib.h>
#include <qpe/global.h>
+const QString MBOXwrapper::wrapperType="MBOX";
+
MBOXwrapper::MBOXwrapper(const QString & mbox_dir)
: Genericwrapper(),MBOXPath(mbox_dir)
{
QDir dir(MBOXPath);
if (!dir.exists()) {
dir.mkdir(MBOXPath);
}
}
MBOXwrapper::~MBOXwrapper()
{
}
@@ -313,12 +315,17 @@ void MBOXwrapper::statusFolder(folderStat&target_stat,const QString & mailbox)
if (!fi.exists()) {
Global::statusMessage(tr("Mailbox doesn't exist."));
return;
}
int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0);
folder = mailfolder_new( storage,(char*)p.latin1(),NULL);
r = mailfolder_connect(folder);
r = mailsession_status_folder(folder->fld_session,(char*)mailbox.latin1(),&target_stat.message_count,
&target_stat.message_recent,&target_stat.message_unseen);
if (folder) mailfolder_free(folder);
if (storage) mailstorage_free(storage);
}
+
+const QString&MBOXwrapper::getType()const
+{
+ return wrapperType;
+}
diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.h b/noncore/net/mail/libmailwrapper/mboxwrapper.h
index f822997..f97fce2 100644
--- a/noncore/net/mail/libmailwrapper/mboxwrapper.h
+++ b/noncore/net/mail/libmailwrapper/mboxwrapper.h
@@ -24,19 +24,21 @@ public:
virtual int createMbox(const QString&folder,const Folder*f=0,const QString&d="",bool s=false);
virtual int deleteMbox(const Folder*);
virtual void storeMessage(const char*msg,size_t length, const QString&folder);
virtual RecBody fetchBody( const RecMail &mail );
static void mbox_progress( size_t current, size_t maximum );
virtual void fetchRawBody(const RecMail&mail,char**target,size_t*length);
virtual void deleteMails(const QString & mailbox,QList<RecMail> &target);
virtual int deleteAllMail(const Folder*);
+ virtual const QString&getType()const;
protected:
static void deleteMails(mailmbox_folder*f,QList<RecMail> &target);
QString MBOXPath;
+ static const QString wrapperType;
};
#endif
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
index b4eca6f..45408dd 100644
--- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
@@ -226,12 +226,17 @@ void POP3wrapper::statusFolder(folderStat&target_stat,const QString&)
if (!m_pop3) return;
int r = mailsession_status_folder(m_folder->fld_session,0,&target_stat.message_count,
&target_stat.message_recent,&target_stat.message_unseen);
}
void POP3wrapper::fetchRawBody(const RecMail&mail,char**target,size_t*length)
{
mailmessage * mailmsg = 0;
int err = mailsession_get_message(m_folder->fld_session, mail.getNumber(), &mailmsg);
err = mailmessage_fetch(mailmsg,target,length);
if (mailmsg) mailmessage_free(mailmsg);
}
+
+const QString&POP3wrapper::getType()const
+{
+ return account->getType();
+}
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.h b/noncore/net/mail/libmailwrapper/pop3wrapper.h
index 9cba101..b7e8f27 100644
--- a/noncore/net/mail/libmailwrapper/pop3wrapper.h
+++ b/noncore/net/mail/libmailwrapper/pop3wrapper.h
@@ -19,23 +19,23 @@ public:
virtual void listMessages(const QString & mailbox, QList<RecMail> &target );
virtual QList<Folder>* listFolders();
/* mailbox will be ignored */
virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX");
virtual void deleteMail(const RecMail&mail);
virtual void answeredMail(const RecMail&mail);
virtual int deleteAllMail(const Folder*);
virtual RecBody fetchBody( const RecMail &mail );
virtual void fetchRawBody(const RecMail&mail,char**target,size_t*length);
virtual void logout();
-
+ virtual const QString&getType()const;
static void pop3_progress( size_t current, size_t maximum );
protected:
void login();
POP3account *account;
mailstorage*m_pop3;
mailfolder*m_folder;
};
#endif