summaryrefslogtreecommitdiff
authoralwin <alwin>2004-01-04 16:33:39 (UTC)
committer alwin <alwin>2004-01-04 16:33:39 (UTC)
commit6ee1d5d35243f611e0a848d454bfa309b8de0fc9 (patch) (unidiff)
treea07cc2d85da3df79904f363da262834f64b64736
parent59fee003137f5fd7782e3a42159e53424d100e67 (diff)
downloadopie-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
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/libmailwrapper/abstractmail.h12
-rw-r--r--noncore/net/mail/libmailwrapper/genericwrapper.h3
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.cpp15
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.h5
-rw-r--r--noncore/net/mail/libmailwrapper/libmailwrapper.pro16
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.cpp8
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.h4
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
@@ -29,17 +29,19 @@ public:
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! */
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
@@ -35,6 +35,9 @@ public:
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
39protected: 42protected:
40 RecMail *parseHeader( const char *header ); 43 RecMail *parseHeader( const char *header );
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
@@ -47,8 +47,8 @@ void IMAPwrapper::login()
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" );
@@ -974,3 +974,14 @@ void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox)
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
978void 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
@@ -30,6 +30,7 @@ public:
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);
@@ -40,11 +41,11 @@ public:
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();
44protected: 46protected:
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);
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
@@ -9,9 +9,10 @@ HEADERS = mailwrapper.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
16SOURCES = imapwrapper.cpp \ 17SOURCES = imapwrapper.cpp \
17 mailwrapper.cpp \ 18 mailwrapper.cpp \
@@ -21,12 +22,13 @@ SOURCES = imapwrapper.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
32INCLUDEPATH += $(OPIEDIR)/include 34INCLUDEPATH += $(OPIEDIR)/include
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
@@ -227,3 +227,11 @@ void POP3wrapper::statusFolder(folderStat&target_stat,const QString&)
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
231void 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
@@ -26,11 +26,13 @@ public:
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
31protected: 34protected:
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;