author | alwin <alwin> | 2004-01-05 02:03:01 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-01-05 02:03:01 (UTC) |
commit | 4fca3779614c863443ff09295fd0af19b9d9310e (patch) (unidiff) | |
tree | 666ba052b9dd440f9b2a8df8913a01571e32444c | |
parent | 2cf0c79cb325bff1c869febdd83429a5572b1e38 (diff) | |
download | opie-4fca3779614c863443ff09295fd0af19b9d9310e.zip opie-4fca3779614c863443ff09295fd0af19b9d9310e.tar.gz opie-4fca3779614c863443ff09295fd0af19b9d9310e.tar.bz2 |
returns their type of connection (mbox,imap or pop3)
-rw-r--r-- | noncore/net/mail/libmailwrapper/abstractmail.h | 2 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.cpp | 5 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.h | 1 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mboxwrapper.cpp | 7 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mboxwrapper.h | 2 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/pop3wrapper.cpp | 5 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/pop3wrapper.h | 2 |
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 | |||
@@ -20,38 +20,40 @@ public: | |||
20 | AbstractMail(){}; | 20 | AbstractMail(){}; |
21 | virtual ~AbstractMail(){} | 21 | virtual ~AbstractMail(){} |
22 | virtual QList<Folder>* listFolders()=0; | 22 | virtual QList<Folder>* listFolders()=0; |
23 | virtual void listMessages(const QString & mailbox,QList<RecMail>&target )=0; | 23 | virtual void listMessages(const QString & mailbox,QList<RecMail>&target )=0; |
24 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX")=0; | 24 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX")=0; |
25 | virtual RecBody fetchBody(const RecMail&mail)=0; | 25 | virtual RecBody fetchBody(const RecMail&mail)=0; |
26 | virtual QString fetchTextPart(const RecMail&mail,const RecPart&part)=0; | 26 | virtual QString fetchTextPart(const RecMail&mail,const RecPart&part)=0; |
27 | virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part)=0; | 27 | virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part)=0; |
28 | virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part)=0; | 28 | virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part)=0; |
29 | 29 | ||
30 | virtual void deleteMail(const RecMail&mail)=0; | 30 | virtual void deleteMail(const RecMail&mail)=0; |
31 | virtual void answeredMail(const RecMail&mail)=0; | 31 | virtual void answeredMail(const RecMail&mail)=0; |
32 | virtual int deleteAllMail(const Folder*)=0; | 32 | virtual int deleteAllMail(const Folder*)=0; |
33 | virtual int deleteMbox(const Folder*)=0; | 33 | virtual int deleteMbox(const Folder*)=0; |
34 | virtual void storeMessage(const char*msg,size_t length, const QString&folder)=0; | 34 | virtual void storeMessage(const char*msg,size_t length, const QString&folder)=0; |
35 | 35 | ||
36 | virtual void cleanMimeCache(){}; | 36 | virtual void cleanMimeCache(){}; |
37 | /* mail box methods */ | 37 | /* mail box methods */ |
38 | /* parameter is the box to create. | 38 | /* parameter is the box to create. |
39 | * if the implementing subclass has prefixes, | 39 | * if the implementing subclass has prefixes, |
40 | * them has to be appended automatic. | 40 | * them has to be appended automatic. |
41 | */ | 41 | */ |
42 | virtual int createMbox(const QString&,const Folder*parentfolder=0,const QString& delemiter="/",bool getsubfolder=false); | 42 | virtual int createMbox(const QString&,const Folder*parentfolder=0,const QString& delemiter="/",bool getsubfolder=false); |
43 | virtual void logout()=0; | 43 | virtual void logout()=0; |
44 | 44 | ||
45 | static AbstractMail* getWrapper(IMAPaccount *a); | 45 | static AbstractMail* getWrapper(IMAPaccount *a); |
46 | static AbstractMail* getWrapper(POP3account *a); | 46 | static AbstractMail* getWrapper(POP3account *a); |
47 | /* mbox only! */ | 47 | /* mbox only! */ |
48 | static AbstractMail* getWrapper(const QString&a); | 48 | static AbstractMail* getWrapper(const QString&a); |
49 | 49 | ||
50 | static QString defaultLocalfolder(); | 50 | static QString defaultLocalfolder(); |
51 | 51 | ||
52 | virtual const QString&getType()const=0; | ||
53 | |||
52 | protected: | 54 | protected: |
53 | static encodedString*decode_String(const encodedString*text,const QString&enc); | 55 | static encodedString*decode_String(const encodedString*text,const QString&enc); |
54 | static QString convert_String(const char*text); | 56 | static QString convert_String(const char*text); |
55 | static QString gen_attachment_id(); | 57 | static QString gen_attachment_id(); |
56 | }; | 58 | }; |
57 | #endif | 59 | #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 | |||
@@ -956,32 +956,37 @@ void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) | |||
956 | r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_UNSEEN); | 956 | r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_UNSEEN); |
957 | r = mailimap_status(m_imap, mailbox.latin1(), att_list, &status); | 957 | r = mailimap_status(m_imap, mailbox.latin1(), att_list, &status); |
958 | for (cur = clist_begin(status->st_info_list); | 958 | for (cur = clist_begin(status->st_info_list); |
959 | cur != NULL ; cur = clist_next(cur)) { | 959 | cur != NULL ; cur = clist_next(cur)) { |
960 | mailimap_status_info * status_info; | 960 | mailimap_status_info * status_info; |
961 | status_info = (mailimap_status_info *)clist_content(cur); | 961 | status_info = (mailimap_status_info *)clist_content(cur); |
962 | switch (status_info->st_att) { | 962 | switch (status_info->st_att) { |
963 | case MAILIMAP_STATUS_ATT_MESSAGES: | 963 | case MAILIMAP_STATUS_ATT_MESSAGES: |
964 | target_stat.message_count = status_info->st_value; | 964 | target_stat.message_count = status_info->st_value; |
965 | break; | 965 | break; |
966 | case MAILIMAP_STATUS_ATT_RECENT: | 966 | case MAILIMAP_STATUS_ATT_RECENT: |
967 | target_stat.message_recent = status_info->st_value; | 967 | target_stat.message_recent = status_info->st_value; |
968 | break; | 968 | break; |
969 | case MAILIMAP_STATUS_ATT_UNSEEN: | 969 | case MAILIMAP_STATUS_ATT_UNSEEN: |
970 | target_stat.message_unseen = status_info->st_value; | 970 | target_stat.message_unseen = status_info->st_value; |
971 | break; | 971 | break; |
972 | } | 972 | } |
973 | } | 973 | } |
974 | mailimap_mailbox_data_status_free(status); | 974 | mailimap_mailbox_data_status_free(status); |
975 | mailimap_status_att_list_free(att_list); | 975 | mailimap_status_att_list_free(att_list); |
976 | } | 976 | } |
977 | 977 | ||
978 | void IMAPwrapper::storeMessage(const char*msg,size_t length, const QString&folder) | 978 | void IMAPwrapper::storeMessage(const char*msg,size_t length, const QString&folder) |
979 | { | 979 | { |
980 | login(); | 980 | login(); |
981 | if (!m_imap) return; | 981 | if (!m_imap) return; |
982 | if (!msg) return; | 982 | if (!msg) return; |
983 | int r = mailimap_append(m_imap,(char*)folder.latin1(),0,0,msg,length); | 983 | int r = mailimap_append(m_imap,(char*)folder.latin1(),0,0,msg,length); |
984 | if (r != MAILIMAP_NO_ERROR) { | 984 | if (r != MAILIMAP_NO_ERROR) { |
985 | Global::statusMessage("Error storing mail!"); | 985 | Global::statusMessage("Error storing mail!"); |
986 | } | 986 | } |
987 | } | 987 | } |
988 | |||
989 | const QString&IMAPwrapper::getType()const | ||
990 | { | ||
991 | return account->getType(); | ||
992 | } | ||
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 | |||
@@ -14,56 +14,57 @@ struct mailimap_body_type_basic; | |||
14 | struct mailimap_body_type_msg; | 14 | struct mailimap_body_type_msg; |
15 | struct mailimap_body_type_mpart; | 15 | struct mailimap_body_type_mpart; |
16 | struct mailimap_body_fields; | 16 | struct mailimap_body_fields; |
17 | struct mailimap_msg_att; | 17 | struct mailimap_msg_att; |
18 | class encodedString; | 18 | class encodedString; |
19 | 19 | ||
20 | class IMAPwrapper : public AbstractMail | 20 | class IMAPwrapper : public AbstractMail |
21 | { | 21 | { |
22 | Q_OBJECT | 22 | Q_OBJECT |
23 | public: | 23 | public: |
24 | IMAPwrapper( IMAPaccount *a ); | 24 | IMAPwrapper( IMAPaccount *a ); |
25 | virtual ~IMAPwrapper(); | 25 | virtual ~IMAPwrapper(); |
26 | virtual QList<Folder>* listFolders(); | 26 | virtual QList<Folder>* listFolders(); |
27 | virtual void listMessages(const QString & mailbox,QList<RecMail>&target ); | 27 | virtual void listMessages(const QString & mailbox,QList<RecMail>&target ); |
28 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); | 28 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); |
29 | 29 | ||
30 | virtual void deleteMail(const RecMail&mail); | 30 | virtual void deleteMail(const RecMail&mail); |
31 | virtual void answeredMail(const RecMail&mail); | 31 | virtual void answeredMail(const RecMail&mail); |
32 | virtual int deleteAllMail(const Folder*folder); | 32 | virtual int deleteAllMail(const Folder*folder); |
33 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); | 33 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); |
34 | 34 | ||
35 | virtual RecBody fetchBody(const RecMail&mail); | 35 | virtual RecBody fetchBody(const RecMail&mail); |
36 | virtual QString fetchTextPart(const RecMail&mail,const RecPart&part); | 36 | virtual QString fetchTextPart(const RecMail&mail,const RecPart&part); |
37 | virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part); | 37 | virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part); |
38 | virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part); | 38 | virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part); |
39 | 39 | ||
40 | virtual int createMbox(const QString&,const Folder*parentfolder=0,const QString& delemiter="/",bool getsubfolder=false); | 40 | virtual int createMbox(const QString&,const Folder*parentfolder=0,const QString& delemiter="/",bool getsubfolder=false); |
41 | virtual int deleteMbox(const Folder*folder); | 41 | virtual int deleteMbox(const Folder*folder); |
42 | 42 | ||
43 | static void imap_progress( size_t current, size_t maximum ); | 43 | static void imap_progress( size_t current, size_t maximum ); |
44 | 44 | ||
45 | virtual void logout(); | 45 | virtual void logout(); |
46 | virtual const QString&getType()const; | ||
46 | protected: | 47 | protected: |
47 | RecMail*parse_list_result(mailimap_msg_att*); | 48 | RecMail*parse_list_result(mailimap_msg_att*); |
48 | void login(); | 49 | void login(); |
49 | 50 | ||
50 | virtual QString fetchTextPart(const RecMail&mail,const QValueList<int>&path,bool internal_call=false,const QString&enc=""); | 51 | virtual QString fetchTextPart(const RecMail&mail,const QValueList<int>&path,bool internal_call=false,const QString&enc=""); |
51 | virtual encodedString*fetchRawPart(const RecMail&mail,const QValueList<int>&path,bool internal_call); | 52 | virtual encodedString*fetchRawPart(const RecMail&mail,const QValueList<int>&path,bool internal_call); |
52 | 53 | ||
53 | void fillSinglePart(RecPart&target_part,mailimap_body_type_1part*Description); | 54 | void fillSinglePart(RecPart&target_part,mailimap_body_type_1part*Description); |
54 | void fillSingleTextPart(RecPart&target_part,mailimap_body_type_text*which); | 55 | void fillSingleTextPart(RecPart&target_part,mailimap_body_type_text*which); |
55 | void fillSingleBasicPart(RecPart&target_part,mailimap_body_type_basic*which); | 56 | void fillSingleBasicPart(RecPart&target_part,mailimap_body_type_basic*which); |
56 | void fillSingleMsgPart(RecPart&target_part,mailimap_body_type_msg*which); | 57 | void fillSingleMsgPart(RecPart&target_part,mailimap_body_type_msg*which); |
57 | void fillMultiPart(RecPart&target_part,mailimap_body_type_mpart*which); | 58 | void fillMultiPart(RecPart&target_part,mailimap_body_type_mpart*which); |
58 | void traverseBody(const RecMail&mail,mailimap_body*body,RecBody&target_body,int current_recursion,QValueList<int>recList,int current_count=1); | 59 | void traverseBody(const RecMail&mail,mailimap_body*body,RecBody&target_body,int current_recursion,QValueList<int>recList,int current_count=1); |
59 | 60 | ||
60 | /* just helpers */ | 61 | /* just helpers */ |
61 | static void fillBodyFields(RecPart&target_part,mailimap_body_fields*which); | 62 | static void fillBodyFields(RecPart&target_part,mailimap_body_fields*which); |
62 | static QStringList address_list_to_stringlist(clist*list); | 63 | static QStringList address_list_to_stringlist(clist*list); |
63 | 64 | ||
64 | 65 | ||
65 | IMAPaccount *account; | 66 | IMAPaccount *account; |
66 | mailimap *m_imap; | 67 | mailimap *m_imap; |
67 | }; | 68 | }; |
68 | 69 | ||
69 | #endif | 70 | #endif |
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,40 +1,42 @@ | |||
1 | #include "mboxwrapper.h" | 1 | #include "mboxwrapper.h" |
2 | #include "mailtypes.h" | 2 | #include "mailtypes.h" |
3 | #include "mailwrapper.h" | 3 | #include "mailwrapper.h" |
4 | #include <libetpan/libetpan.h> | 4 | #include <libetpan/libetpan.h> |
5 | #include <qdir.h> | 5 | #include <qdir.h> |
6 | #include <stdlib.h> | 6 | #include <stdlib.h> |
7 | #include <qpe/global.h> | 7 | #include <qpe/global.h> |
8 | 8 | ||
9 | const QString MBOXwrapper::wrapperType="MBOX"; | ||
10 | |||
9 | MBOXwrapper::MBOXwrapper(const QString & mbox_dir) | 11 | MBOXwrapper::MBOXwrapper(const QString & mbox_dir) |
10 | : Genericwrapper(),MBOXPath(mbox_dir) | 12 | : Genericwrapper(),MBOXPath(mbox_dir) |
11 | { | 13 | { |
12 | QDir dir(MBOXPath); | 14 | QDir dir(MBOXPath); |
13 | if (!dir.exists()) { | 15 | if (!dir.exists()) { |
14 | dir.mkdir(MBOXPath); | 16 | dir.mkdir(MBOXPath); |
15 | } | 17 | } |
16 | } | 18 | } |
17 | 19 | ||
18 | MBOXwrapper::~MBOXwrapper() | 20 | MBOXwrapper::~MBOXwrapper() |
19 | { | 21 | { |
20 | } | 22 | } |
21 | 23 | ||
22 | void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) | 24 | void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) |
23 | { | 25 | { |
24 | mailstorage*storage = mailstorage_new(NULL); | 26 | mailstorage*storage = mailstorage_new(NULL); |
25 | QString p = MBOXPath+"/"; | 27 | QString p = MBOXPath+"/"; |
26 | p+=mailbox; | 28 | p+=mailbox; |
27 | 29 | ||
28 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); | 30 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); |
29 | mailfolder*folder; | 31 | mailfolder*folder; |
30 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); | 32 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); |
31 | r = mailfolder_connect(folder); | 33 | r = mailfolder_connect(folder); |
32 | if (r != MAIL_NO_ERROR) { | 34 | if (r != MAIL_NO_ERROR) { |
33 | qDebug("Error initializing mbox"); | 35 | qDebug("Error initializing mbox"); |
34 | mailfolder_free(folder); | 36 | mailfolder_free(folder); |
35 | mailstorage_free(storage); | 37 | mailstorage_free(storage); |
36 | return; | 38 | return; |
37 | } | 39 | } |
38 | 40 | ||
39 | parseList(target,folder->fld_session,mailbox); | 41 | parseList(target,folder->fld_session,mailbox); |
40 | 42 | ||
@@ -293,32 +295,37 @@ int MBOXwrapper::deleteMbox(const Folder*tfolder) | |||
293 | if (!fi.exists()) { | 295 | if (!fi.exists()) { |
294 | Global::statusMessage(tr("Mailbox doesn't exist.")); | 296 | Global::statusMessage(tr("Mailbox doesn't exist.")); |
295 | return 0; | 297 | return 0; |
296 | } | 298 | } |
297 | if (!fi.remove()) { | 299 | if (!fi.remove()) { |
298 | Global::statusMessage(tr("Error deleting Mailbox.")); | 300 | Global::statusMessage(tr("Error deleting Mailbox.")); |
299 | return 0; | 301 | return 0; |
300 | } | 302 | } |
301 | return 1; | 303 | return 1; |
302 | } | 304 | } |
303 | 305 | ||
304 | void MBOXwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) | 306 | void MBOXwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) |
305 | { | 307 | { |
306 | mailfolder*folder = 0; | 308 | mailfolder*folder = 0; |
307 | mailstorage*storage = mailstorage_new(NULL); | 309 | mailstorage*storage = mailstorage_new(NULL); |
308 | target_stat.message_count = 0; | 310 | target_stat.message_count = 0; |
309 | target_stat.message_unseen = 0; | 311 | target_stat.message_unseen = 0; |
310 | target_stat.message_recent = 0; | 312 | target_stat.message_recent = 0; |
311 | QString p = MBOXPath+"/"+mailbox; | 313 | QString p = MBOXPath+"/"+mailbox; |
312 | QFile fi(p); | 314 | QFile fi(p); |
313 | if (!fi.exists()) { | 315 | if (!fi.exists()) { |
314 | Global::statusMessage(tr("Mailbox doesn't exist.")); | 316 | Global::statusMessage(tr("Mailbox doesn't exist.")); |
315 | return; | 317 | return; |
316 | } | 318 | } |
317 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); | 319 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); |
318 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); | 320 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); |
319 | r = mailfolder_connect(folder); | 321 | r = mailfolder_connect(folder); |
320 | r = mailsession_status_folder(folder->fld_session,(char*)mailbox.latin1(),&target_stat.message_count, | 322 | r = mailsession_status_folder(folder->fld_session,(char*)mailbox.latin1(),&target_stat.message_count, |
321 | &target_stat.message_recent,&target_stat.message_unseen); | 323 | &target_stat.message_recent,&target_stat.message_unseen); |
322 | if (folder) mailfolder_free(folder); | 324 | if (folder) mailfolder_free(folder); |
323 | if (storage) mailstorage_free(storage); | 325 | if (storage) mailstorage_free(storage); |
324 | } | 326 | } |
327 | |||
328 | const QString&MBOXwrapper::getType()const | ||
329 | { | ||
330 | return wrapperType; | ||
331 | } | ||
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 | |||
@@ -4,39 +4,41 @@ | |||
4 | #include "genericwrapper.h" | 4 | #include "genericwrapper.h" |
5 | #include <qstring.h> | 5 | #include <qstring.h> |
6 | 6 | ||
7 | class RecMail; | 7 | class RecMail; |
8 | class RecBody; | 8 | class RecBody; |
9 | struct mailmbox_folder; | 9 | struct mailmbox_folder; |
10 | 10 | ||
11 | class MBOXwrapper : public Genericwrapper | 11 | class MBOXwrapper : public Genericwrapper |
12 | { | 12 | { |
13 | Q_OBJECT | 13 | Q_OBJECT |
14 | public: | 14 | public: |
15 | MBOXwrapper(const QString & dir); | 15 | MBOXwrapper(const QString & dir); |
16 | virtual ~MBOXwrapper(); | 16 | virtual ~MBOXwrapper(); |
17 | 17 | ||
18 | virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); | 18 | virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); |
19 | virtual QList<Folder>* listFolders(); | 19 | virtual QList<Folder>* listFolders(); |
20 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); | 20 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); |
21 | 21 | ||
22 | virtual void deleteMail(const RecMail&mail); | 22 | virtual void deleteMail(const RecMail&mail); |
23 | virtual void answeredMail(const RecMail&mail); | 23 | virtual void answeredMail(const RecMail&mail); |
24 | 24 | ||
25 | virtual int createMbox(const QString&folder,const Folder*f=0,const QString&d="",bool s=false); | 25 | virtual int createMbox(const QString&folder,const Folder*f=0,const QString&d="",bool s=false); |
26 | virtual int deleteMbox(const Folder*); | 26 | virtual int deleteMbox(const Folder*); |
27 | 27 | ||
28 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); | 28 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); |
29 | 29 | ||
30 | virtual RecBody fetchBody( const RecMail &mail ); | 30 | virtual RecBody fetchBody( const RecMail &mail ); |
31 | static void mbox_progress( size_t current, size_t maximum ); | 31 | static void mbox_progress( size_t current, size_t maximum ); |
32 | 32 | ||
33 | virtual void fetchRawBody(const RecMail&mail,char**target,size_t*length); | 33 | virtual void fetchRawBody(const RecMail&mail,char**target,size_t*length); |
34 | virtual void deleteMails(const QString & mailbox,QList<RecMail> &target); | 34 | virtual void deleteMails(const QString & mailbox,QList<RecMail> &target); |
35 | virtual int deleteAllMail(const Folder*); | 35 | virtual int deleteAllMail(const Folder*); |
36 | virtual const QString&getType()const; | ||
36 | 37 | ||
37 | protected: | 38 | protected: |
38 | static void deleteMails(mailmbox_folder*f,QList<RecMail> &target); | 39 | static void deleteMails(mailmbox_folder*f,QList<RecMail> &target); |
39 | QString MBOXPath; | 40 | QString MBOXPath; |
41 | static const QString wrapperType; | ||
40 | }; | 42 | }; |
41 | 43 | ||
42 | #endif | 44 | #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 | |||
@@ -206,32 +206,37 @@ int POP3wrapper::deleteAllMail(const Folder*) | |||
206 | Global::statusMessage(tr("Error getting folder info")); | 206 | Global::statusMessage(tr("Error getting folder info")); |
207 | return 0; | 207 | return 0; |
208 | } | 208 | } |
209 | for (unsigned int i = 0; i < result; ++i) { | 209 | for (unsigned int i = 0; i < result; ++i) { |
210 | err = mailsession_remove_message(m_folder->fld_session,i+1); | 210 | err = mailsession_remove_message(m_folder->fld_session,i+1); |
211 | if (err != MAIL_NO_ERROR) { | 211 | if (err != MAIL_NO_ERROR) { |
212 | Global::statusMessage(tr("Error deleting mail %1").arg(i+1)); | 212 | Global::statusMessage(tr("Error deleting mail %1").arg(i+1)); |
213 | res=0; | 213 | res=0; |
214 | } | 214 | } |
215 | break; | 215 | break; |
216 | } | 216 | } |
217 | return res; | 217 | return res; |
218 | } | 218 | } |
219 | 219 | ||
220 | void POP3wrapper::statusFolder(folderStat&target_stat,const QString&) | 220 | void POP3wrapper::statusFolder(folderStat&target_stat,const QString&) |
221 | { | 221 | { |
222 | login(); | 222 | login(); |
223 | target_stat.message_count = 0; | 223 | target_stat.message_count = 0; |
224 | target_stat.message_unseen = 0; | 224 | target_stat.message_unseen = 0; |
225 | target_stat.message_recent = 0; | 225 | target_stat.message_recent = 0; |
226 | if (!m_pop3) return; | 226 | if (!m_pop3) return; |
227 | int r = mailsession_status_folder(m_folder->fld_session,0,&target_stat.message_count, | 227 | int r = mailsession_status_folder(m_folder->fld_session,0,&target_stat.message_count, |
228 | &target_stat.message_recent,&target_stat.message_unseen); | 228 | &target_stat.message_recent,&target_stat.message_unseen); |
229 | } | 229 | } |
230 | 230 | ||
231 | void POP3wrapper::fetchRawBody(const RecMail&mail,char**target,size_t*length) | 231 | void POP3wrapper::fetchRawBody(const RecMail&mail,char**target,size_t*length) |
232 | { | 232 | { |
233 | mailmessage * mailmsg = 0; | 233 | mailmessage * mailmsg = 0; |
234 | int err = mailsession_get_message(m_folder->fld_session, mail.getNumber(), &mailmsg); | 234 | int err = mailsession_get_message(m_folder->fld_session, mail.getNumber(), &mailmsg); |
235 | err = mailmessage_fetch(mailmsg,target,length); | 235 | err = mailmessage_fetch(mailmsg,target,length); |
236 | if (mailmsg) mailmessage_free(mailmsg); | 236 | if (mailmsg) mailmessage_free(mailmsg); |
237 | } | 237 | } |
238 | |||
239 | const QString&POP3wrapper::getType()const | ||
240 | { | ||
241 | return account->getType(); | ||
242 | } | ||
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 | |||
@@ -1,41 +1,41 @@ | |||
1 | #ifndef __POP3WRAPPER | 1 | #ifndef __POP3WRAPPER |
2 | #define __POP3WRAPPER | 2 | #define __POP3WRAPPER |
3 | 3 | ||
4 | #include "mailwrapper.h" | 4 | #include "mailwrapper.h" |
5 | #include "genericwrapper.h" | 5 | #include "genericwrapper.h" |
6 | #include <qstring.h> | 6 | #include <qstring.h> |
7 | 7 | ||
8 | struct mailstorage; | 8 | struct mailstorage; |
9 | struct mailfolder; | 9 | struct mailfolder; |
10 | 10 | ||
11 | class POP3wrapper : public Genericwrapper | 11 | class POP3wrapper : public Genericwrapper |
12 | { | 12 | { |
13 | Q_OBJECT | 13 | Q_OBJECT |
14 | 14 | ||
15 | public: | 15 | public: |
16 | POP3wrapper( POP3account *a ); | 16 | POP3wrapper( POP3account *a ); |
17 | virtual ~POP3wrapper(); | 17 | virtual ~POP3wrapper(); |
18 | /* mailbox will be ignored */ | 18 | /* mailbox will be ignored */ |
19 | virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); | 19 | virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); |
20 | virtual QList<Folder>* listFolders(); | 20 | virtual QList<Folder>* listFolders(); |
21 | /* mailbox will be ignored */ | 21 | /* mailbox will be ignored */ |
22 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); | 22 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); |
23 | 23 | ||
24 | virtual void deleteMail(const RecMail&mail); | 24 | virtual void deleteMail(const RecMail&mail); |
25 | virtual void answeredMail(const RecMail&mail); | 25 | virtual void answeredMail(const RecMail&mail); |
26 | virtual int deleteAllMail(const Folder*); | 26 | virtual int deleteAllMail(const Folder*); |
27 | 27 | ||
28 | virtual RecBody fetchBody( const RecMail &mail ); | 28 | virtual RecBody fetchBody( const RecMail &mail ); |
29 | virtual void fetchRawBody(const RecMail&mail,char**target,size_t*length); | 29 | virtual void fetchRawBody(const RecMail&mail,char**target,size_t*length); |
30 | virtual void logout(); | 30 | virtual void logout(); |
31 | 31 | virtual const QString&getType()const; | |
32 | static void pop3_progress( size_t current, size_t maximum ); | 32 | static void pop3_progress( size_t current, size_t maximum ); |
33 | 33 | ||
34 | protected: | 34 | protected: |
35 | void login(); | 35 | void login(); |
36 | POP3account *account; | 36 | POP3account *account; |
37 | mailstorage*m_pop3; | 37 | mailstorage*m_pop3; |
38 | mailfolder*m_folder; | 38 | mailfolder*m_folder; |
39 | }; | 39 | }; |
40 | 40 | ||
41 | #endif | 41 | #endif |