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 /noncore/net/mail | |
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 | |||
@@ -30,8 +30,9 @@ public: | |||
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. |
@@ -40,5 +41,6 @@ public: | |||
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); |
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 | |||
@@ -36,4 +36,7 @@ public: | |||
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: |
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 | |||
@@ -48,6 +48,6 @@ void IMAPwrapper::login() | |||
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 |
@@ -975,2 +975,13 @@ void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) | |||
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 | |||
@@ -31,4 +31,5 @@ public: | |||
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); |
@@ -41,9 +42,9 @@ public: | |||
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=""); |
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 | |||
@@ -10,7 +10,8 @@ HEADERS = mailwrapper.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 \ |
@@ -22,10 +23,11 @@ SOURCES = imapwrapper.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 | ||
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 | |||
@@ -228,2 +228,10 @@ void POP3wrapper::statusFolder(folderStat&target_stat,const QString&) | |||
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 | |||
@@ -27,9 +27,11 @@ public: | |||
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; |