author | alwin <alwin> | 2004-01-04 16:33:39 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-01-04 16:33:39 (UTC) |
commit | 6ee1d5d35243f611e0a848d454bfa309b8de0fc9 (patch) (unidiff) | |
tree | a07cc2d85da3df79904f363da262834f64b64736 | |
parent | 59fee003137f5fd7782e3a42159e53424d100e67 (diff) | |
download | opie-6ee1d5d35243f611e0a848d454bfa309b8de0fc9.zip opie-6ee1d5d35243f611e0a848d454bfa309b8de0fc9.tar.gz opie-6ee1d5d35243f611e0a848d454bfa309b8de0fc9.tar.bz2 |
- added start of status class
- unification of (public) mailwrapper interfaces
- preparition for message store/transfer
-rw-r--r-- | noncore/net/mail/libmailwrapper/abstractmail.h | 12 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/genericwrapper.h | 3 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.cpp | 15 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.h | 5 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/libmailwrapper.pro | 16 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/pop3wrapper.cpp | 8 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/pop3wrapper.h | 4 |
7 files changed, 46 insertions, 17 deletions
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.h b/noncore/net/mail/libmailwrapper/abstractmail.h index ca9caed..a070fb0 100644 --- a/noncore/net/mail/libmailwrapper/abstractmail.h +++ b/noncore/net/mail/libmailwrapper/abstractmail.h | |||
@@ -16,40 +16,42 @@ struct folderStat; | |||
16 | class AbstractMail:public QObject | 16 | class AbstractMail:public QObject |
17 | { | 17 | { |
18 | Q_OBJECT | 18 | Q_OBJECT |
19 | public: | 19 | 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 void cleanMimeCache(){}; | 32 | virtual int deleteAllMail(const Folder*)=0; |
33 | virtual int deleteAllMail(const Folder*){return 1;} | 33 | virtual int deleteMbox(const Folder*)=0; |
34 | virtual int deleteMbox(const Folder*){return 1;} | 34 | virtual void storeMessage(const char*msg,size_t length, const QString&folder)=0; |
35 | 35 | ||
36 | virtual void cleanMimeCache(){}; | ||
36 | /* mail box methods */ | 37 | /* mail box methods */ |
37 | /* parameter is the box to create. | 38 | /* parameter is the box to create. |
38 | * if the implementing subclass has prefixes, | 39 | * if the implementing subclass has prefixes, |
39 | * them has to be appended automatic. | 40 | * them has to be appended automatic. |
40 | */ | 41 | */ |
41 | 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); |
42 | 43 | virtual void logout()=0; | |
44 | |||
43 | static AbstractMail* getWrapper(IMAPaccount *a); | 45 | static AbstractMail* getWrapper(IMAPaccount *a); |
44 | static AbstractMail* getWrapper(POP3account *a); | 46 | static AbstractMail* getWrapper(POP3account *a); |
45 | /* mbox only! */ | 47 | /* mbox only! */ |
46 | static AbstractMail* getWrapper(const QString&a); | 48 | static AbstractMail* getWrapper(const QString&a); |
47 | 49 | ||
48 | static QString defaultLocalfolder(); | 50 | static QString defaultLocalfolder(); |
49 | 51 | ||
50 | protected: | 52 | protected: |
51 | static encodedString*decode_String(const encodedString*text,const QString&enc); | 53 | static encodedString*decode_String(const encodedString*text,const QString&enc); |
52 | static QString convert_String(const char*text); | 54 | static QString convert_String(const char*text); |
53 | static QString gen_attachment_id(); | 55 | static QString gen_attachment_id(); |
54 | }; | 56 | }; |
55 | #endif | 57 | #endif |
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.h b/noncore/net/mail/libmailwrapper/genericwrapper.h index 32b75c8..1d65c0a 100644 --- a/noncore/net/mail/libmailwrapper/genericwrapper.h +++ b/noncore/net/mail/libmailwrapper/genericwrapper.h | |||
@@ -22,32 +22,35 @@ struct mailsession; | |||
22 | 22 | ||
23 | /* this class hold just the funs shared between | 23 | /* this class hold just the funs shared between |
24 | * mbox and pop3 (later mh, too) mail access. | 24 | * mbox and pop3 (later mh, too) mail access. |
25 | * it is not desigend to make a instance of it! | 25 | * it is not desigend to make a instance of it! |
26 | */ | 26 | */ |
27 | class Genericwrapper : public AbstractMail | 27 | class Genericwrapper : public AbstractMail |
28 | { | 28 | { |
29 | Q_OBJECT | 29 | Q_OBJECT |
30 | public: | 30 | public: |
31 | Genericwrapper(); | 31 | Genericwrapper(); |
32 | virtual ~Genericwrapper(); | 32 | virtual ~Genericwrapper(); |
33 | 33 | ||
34 | virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part); | 34 | virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part); |
35 | virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part); | 35 | virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part); |
36 | virtual QString fetchTextPart(const RecMail&mail,const RecPart&part); | 36 | virtual QString fetchTextPart(const RecMail&mail,const RecPart&part); |
37 | virtual void cleanMimeCache(); | 37 | virtual void cleanMimeCache(); |
38 | virtual int deleteMbox(const Folder*){return 1;} | ||
39 | virtual void logout(){}; | ||
40 | virtual void storeMessage(const char*msg,size_t length, const QString&folder){}; | ||
38 | 41 | ||
39 | protected: | 42 | protected: |
40 | RecMail *parseHeader( const char *header ); | 43 | RecMail *parseHeader( const char *header ); |
41 | RecBody parseMail( mailmessage * msg ); | 44 | RecBody parseMail( mailmessage * msg ); |
42 | QString parseMailboxList( mailimf_mailbox_list *list ); | 45 | QString parseMailboxList( mailimf_mailbox_list *list ); |
43 | QString parseMailbox( mailimf_mailbox *box ); | 46 | QString parseMailbox( mailimf_mailbox *box ); |
44 | QString parseGroup( mailimf_group *group ); | 47 | QString parseGroup( mailimf_group *group ); |
45 | QString parseAddressList( mailimf_address_list *list ); | 48 | QString parseAddressList( mailimf_address_list *list ); |
46 | QString parseDateTime( mailimf_date_time *date ); | 49 | QString parseDateTime( mailimf_date_time *date ); |
47 | 50 | ||
48 | void traverseBody(RecBody&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rek=0,int current_count=1); | 51 | void traverseBody(RecBody&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rek=0,int current_count=1); |
49 | static void fillSingleBody(RecPart&target,mailmessage*message,mailmime*mime); | 52 | static void fillSingleBody(RecPart&target,mailmessage*message,mailmime*mime); |
50 | static void fillParameters(RecPart&target,clist*parameters); | 53 | static void fillParameters(RecPart&target,clist*parameters); |
51 | static QString getencoding(mailmime_mechanism*aEnc); | 54 | static QString getencoding(mailmime_mechanism*aEnc); |
52 | virtual void parseList(QList<RecMail> &target,mailsession*session,const QString&mailbox); | 55 | virtual void parseList(QList<RecMail> &target,mailsession*session,const QString&mailbox); |
53 | 56 | ||
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp index f1d42c2..0c1e05e 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp | |||
@@ -34,34 +34,34 @@ void IMAPwrapper::login() | |||
34 | if (m_imap) { | 34 | if (m_imap) { |
35 | err = mailimap_noop(m_imap); | 35 | err = mailimap_noop(m_imap); |
36 | if (err!=MAILIMAP_NO_ERROR) { | 36 | if (err!=MAILIMAP_NO_ERROR) { |
37 | logout(); | 37 | logout(); |
38 | } else { | 38 | } else { |
39 | mailstream_flush(m_imap->imap_stream); | 39 | mailstream_flush(m_imap->imap_stream); |
40 | return; | 40 | return; |
41 | } | 41 | } |
42 | } | 42 | } |
43 | server = account->getServer().latin1(); | 43 | server = account->getServer().latin1(); |
44 | port = account->getPort().toUInt(); | 44 | port = account->getPort().toUInt(); |
45 | if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { | 45 | if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { |
46 | LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); | 46 | LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); |
47 | login.show(); | 47 | login.show(); |
48 | if ( QDialog::Accepted == login.exec() ) { | 48 | if ( QDialog::Accepted == login.exec() ) { |
49 | // ok | 49 | // ok |
50 | user = strdup( login.getUser().latin1() ); | 50 | user = login.getUser().latin1(); |
51 | pass = strdup( login.getPassword().latin1() ); | 51 | pass = login.getPassword().latin1(); |
52 | } else { | 52 | } else { |
53 | // cancel | 53 | // cancel |
54 | qDebug( "IMAP: Login canceled" ); | 54 | qDebug( "IMAP: Login canceled" ); |
55 | return; | 55 | return; |
56 | } | 56 | } |
57 | } else { | 57 | } else { |
58 | user = account->getUser().latin1(); | 58 | user = account->getUser().latin1(); |
59 | pass = account->getPassword().latin1(); | 59 | pass = account->getPassword().latin1(); |
60 | } | 60 | } |
61 | 61 | ||
62 | m_imap = mailimap_new( 20, &imap_progress ); | 62 | m_imap = mailimap_new( 20, &imap_progress ); |
63 | 63 | ||
64 | /* connect */ | 64 | /* connect */ |
65 | if (account->getSSL()) { | 65 | if (account->getSSL()) { |
66 | err = mailimap_ssl_connect( m_imap, (char*)server, port ); | 66 | err = mailimap_ssl_connect( m_imap, (char*)server, port ); |
67 | } else { | 67 | } else { |
@@ -961,16 +961,27 @@ void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) | |||
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 | |||
978 | void IMAPwrapper::storeMessage(const char*msg,size_t length, const QString&folder) | ||
979 | { | ||
980 | login(); | ||
981 | if (!m_imap) return; | ||
982 | if (!msg) return; | ||
983 | int r = mailimap_append(m_imap,(char*)folder.latin1(),0,0,msg,length); | ||
984 | if (r != MAILIMAP_NO_ERROR) { | ||
985 | Global::statusMessage("Error storing mail!"); | ||
986 | } | ||
987 | } | ||
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.h b/noncore/net/mail/libmailwrapper/imapwrapper.h index 8f5a2b5..a97f12d 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.h +++ b/noncore/net/mail/libmailwrapper/imapwrapper.h | |||
@@ -17,47 +17,48 @@ 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 | 34 | ||
34 | virtual RecBody fetchBody(const RecMail&mail); | 35 | virtual RecBody fetchBody(const RecMail&mail); |
35 | virtual QString fetchTextPart(const RecMail&mail,const RecPart&part); | 36 | virtual QString fetchTextPart(const RecMail&mail,const RecPart&part); |
36 | virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part); | 37 | virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part); |
37 | virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part); | 38 | virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part); |
38 | 39 | ||
39 | 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); |
40 | virtual int deleteMbox(const Folder*folder); | 41 | virtual int deleteMbox(const Folder*folder); |
41 | 42 | ||
42 | static void imap_progress( size_t current, size_t maximum ); | 43 | static void imap_progress( size_t current, size_t maximum ); |
43 | 44 | ||
45 | virtual void logout(); | ||
44 | protected: | 46 | protected: |
45 | RecMail*parse_list_result(mailimap_msg_att*); | 47 | RecMail*parse_list_result(mailimap_msg_att*); |
46 | void login(); | 48 | void login(); |
47 | void logout(); | ||
48 | 49 | ||
49 | virtual QString fetchTextPart(const RecMail&mail,const QValueList<int>&path,bool internal_call=false,const QString&enc=""); | 50 | virtual QString fetchTextPart(const RecMail&mail,const QValueList<int>&path,bool internal_call=false,const QString&enc=""); |
50 | virtual encodedString*fetchRawPart(const RecMail&mail,const QValueList<int>&path,bool internal_call); | 51 | virtual encodedString*fetchRawPart(const RecMail&mail,const QValueList<int>&path,bool internal_call); |
51 | 52 | ||
52 | void fillSinglePart(RecPart&target_part,mailimap_body_type_1part*Description); | 53 | void fillSinglePart(RecPart&target_part,mailimap_body_type_1part*Description); |
53 | void fillSingleTextPart(RecPart&target_part,mailimap_body_type_text*which); | 54 | void fillSingleTextPart(RecPart&target_part,mailimap_body_type_text*which); |
54 | void fillSingleBasicPart(RecPart&target_part,mailimap_body_type_basic*which); | 55 | void fillSingleBasicPart(RecPart&target_part,mailimap_body_type_basic*which); |
55 | void fillSingleMsgPart(RecPart&target_part,mailimap_body_type_msg*which); | 56 | void fillSingleMsgPart(RecPart&target_part,mailimap_body_type_msg*which); |
56 | void fillMultiPart(RecPart&target_part,mailimap_body_type_mpart*which); | 57 | void fillMultiPart(RecPart&target_part,mailimap_body_type_mpart*which); |
57 | void traverseBody(const RecMail&mail,mailimap_body*body,RecBody&target_body,int current_recursion,QValueList<int>recList,int current_count=1); | 58 | void traverseBody(const RecMail&mail,mailimap_body*body,RecBody&target_body,int current_recursion,QValueList<int>recList,int current_count=1); |
58 | 59 | ||
59 | /* just helpers */ | 60 | /* just helpers */ |
60 | static void fillBodyFields(RecPart&target_part,mailimap_body_fields*which); | 61 | static void fillBodyFields(RecPart&target_part,mailimap_body_fields*which); |
61 | static QStringList address_list_to_stringlist(clist*list); | 62 | static QStringList address_list_to_stringlist(clist*list); |
62 | 63 | ||
63 | 64 | ||
diff --git a/noncore/net/mail/libmailwrapper/libmailwrapper.pro b/noncore/net/mail/libmailwrapper/libmailwrapper.pro index 4b4a4f1..18583bb 100644 --- a/noncore/net/mail/libmailwrapper/libmailwrapper.pro +++ b/noncore/net/mail/libmailwrapper/libmailwrapper.pro | |||
@@ -1,44 +1,46 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt warn_on debug | 2 | CONFIG += qt warn_on debug |
3 | 3 | ||
4 | HEADERS = mailwrapper.h \ | 4 | HEADERS = mailwrapper.h \ |
5 | imapwrapper.h \ | 5 | imapwrapper.h \ |
6 | mailtypes.h \ | 6 | mailtypes.h \ |
7 | pop3wrapper.h \ | 7 | pop3wrapper.h \ |
8 | abstractmail.h \ | 8 | abstractmail.h \ |
9 | smtpwrapper.h \ | 9 | smtpwrapper.h \ |
10 | genericwrapper.h \ | 10 | genericwrapper.h \ |
11 | mboxwrapper.h \ | 11 | mboxwrapper.h \ |
12 | settings.h \ | 12 | settings.h \ |
13 | logindialog.h \ | 13 | logindialog.h \ |
14 | sendmailprogress.h | 14 | sendmailprogress.h \ |
15 | statusmail.h | ||
15 | 16 | ||
16 | SOURCES = imapwrapper.cpp \ | 17 | SOURCES = imapwrapper.cpp \ |
17 | mailwrapper.cpp \ | 18 | mailwrapper.cpp \ |
18 | mailtypes.cpp \ | 19 | mailtypes.cpp \ |
19 | pop3wrapper.cpp \ | 20 | pop3wrapper.cpp \ |
20 | abstractmail.cpp \ | 21 | abstractmail.cpp \ |
21 | smtpwrapper.cpp \ | 22 | smtpwrapper.cpp \ |
22 | genericwrapper.cpp \ | 23 | genericwrapper.cpp \ |
23 | mboxwrapper.cpp \ | 24 | mboxwrapper.cpp \ |
24 | settings.cpp \ | 25 | settings.cpp \ |
25 | logindialog.cpp \ | 26 | logindialog.cpp \ |
26 | sendmailprogress.cpp | 27 | sendmailprogress.cpp \ |
28 | statusmail.cpp | ||
27 | 29 | ||
28 | INTERFACES = logindialogui.ui \ | 30 | INTERFACES = logindialogui.ui \ |
29 | sendmailprogressui.ui | 31 | sendmailprogressui.ui |
30 | 32 | ||
31 | 33 | ||
32 | INCLUDEPATH += $(OPIEDIR)/include | 34 | INCLUDEPATH += $(OPIEDIR)/include |
33 | 35 | ||
34 | CONFTEST = $$system( echo $CONFIG_TARGET_MACOSX ) | 36 | CONFTEST = $$system( echo $CONFIG_TARGET_MACOSX ) |
35 | contains( CONFTEST, y ){ | 37 | contains( CONFTEST, y ){ |
36 | LIBS += -lqpe -letpan -lssl -lcrypto -liconv | 38 | LIBS += -lqpe -letpan -lssl -lcrypto -liconv |
37 | }else{ | 39 | }else{ |
38 | LIBS += -lqpe -letpan -lssl -lcrypto | 40 | LIBS += -lqpe -letpan -lssl -lcrypto |
39 | } | 41 | } |
40 | 42 | ||
41 | DESTDIR = $(OPIEDIR)/lib$(PROJMAK) | 43 | DESTDIR = $(OPIEDIR)/lib$(PROJMAK) |
42 | TARGET = mailwrapper | 44 | TARGET = mailwrapper |
43 | 45 | ||
44 | include ( $(OPIEDIR)/include.pro ) | 46 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp index d76d82a..b4eca6f 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp | |||
@@ -214,16 +214,24 @@ int POP3wrapper::deleteAllMail(const Folder*) | |||
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 | |||
231 | void POP3wrapper::fetchRawBody(const RecMail&mail,char**target,size_t*length) | ||
232 | { | ||
233 | mailmessage * mailmsg = 0; | ||
234 | int err = mailsession_get_message(m_folder->fld_session, mail.getNumber(), &mailmsg); | ||
235 | err = mailmessage_fetch(mailmsg,target,length); | ||
236 | if (mailmsg) mailmessage_free(mailmsg); | ||
237 | } | ||
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.h b/noncore/net/mail/libmailwrapper/pop3wrapper.h index 536cadc..9cba101 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.h +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.h | |||
@@ -13,27 +13,29 @@ class POP3wrapper : public Genericwrapper | |||
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); | ||
30 | virtual void logout(); | ||
31 | |||
29 | static void pop3_progress( size_t current, size_t maximum ); | 32 | static void pop3_progress( size_t current, size_t maximum ); |
30 | 33 | ||
31 | protected: | 34 | protected: |
32 | void login(); | 35 | void login(); |
33 | void logout(); | ||
34 | POP3account *account; | 36 | POP3account *account; |
35 | mailstorage*m_pop3; | 37 | mailstorage*m_pop3; |
36 | mailfolder*m_folder; | 38 | mailfolder*m_folder; |
37 | }; | 39 | }; |
38 | 40 | ||
39 | #endif | 41 | #endif |