summaryrefslogtreecommitdiff
Side-by-side diff
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:
virtual void deleteMail(const RecMail&mail)=0;
virtual void answeredMail(const RecMail&mail)=0;
- virtual void cleanMimeCache(){};
- virtual int deleteAllMail(const Folder*){return 1;}
- virtual int deleteMbox(const Folder*){return 1;}
-
+ virtual int deleteAllMail(const Folder*)=0;
+ virtual int deleteMbox(const Folder*)=0;
+ virtual void storeMessage(const char*msg,size_t length, const QString&folder)=0;
+
+ virtual void cleanMimeCache(){};
/* mail box methods */
/* parameter is the box to create.
* if the implementing subclass has prefixes,
* 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! */
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:
virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part);
virtual QString fetchTextPart(const RecMail&mail,const RecPart&part);
virtual void cleanMimeCache();
+ virtual int deleteMbox(const Folder*){return 1;}
+ virtual void logout(){};
+ virtual void storeMessage(const char*msg,size_t length, const QString&folder){};
protected:
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()
login.show();
if ( QDialog::Accepted == login.exec() ) {
// ok
- user = strdup( login.getUser().latin1() );
- pass = strdup( login.getPassword().latin1() );
+ user = login.getUser().latin1();
+ pass = login.getPassword().latin1();
} else {
// cancel
qDebug( "IMAP: Login canceled" );
@@ -974,3 +974,14 @@ void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox)
mailimap_mailbox_data_status_free(status);
mailimap_status_att_list_free(att_list);
}
+
+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!");
+ }
+}
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:
virtual void deleteMail(const RecMail&mail);
virtual void answeredMail(const RecMail&mail);
virtual int deleteAllMail(const Folder*folder);
+ virtual void storeMessage(const char*msg,size_t length, const QString&folder);
virtual RecBody fetchBody(const RecMail&mail);
virtual QString fetchTextPart(const RecMail&mail,const RecPart&part);
@@ -40,11 +41,11 @@ public:
virtual int deleteMbox(const Folder*folder);
static void imap_progress( size_t current, size_t maximum );
-
+
+ virtual void logout();
protected:
RecMail*parse_list_result(mailimap_msg_att*);
void login();
- void logout();
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);
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 \
smtpwrapper.h \
genericwrapper.h \
mboxwrapper.h \
- settings.h \
- logindialog.h \
- sendmailprogress.h
+ settings.h \
+ logindialog.h \
+ sendmailprogress.h \
+ statusmail.h
SOURCES = imapwrapper.cpp \
mailwrapper.cpp \
@@ -21,12 +22,13 @@ SOURCES = imapwrapper.cpp \
smtpwrapper.cpp \
genericwrapper.cpp \
mboxwrapper.cpp \
- settings.cpp \
- logindialog.cpp \
- sendmailprogress.cpp
+ settings.cpp \
+ logindialog.cpp \
+ sendmailprogress.cpp \
+ statusmail.cpp
INTERFACES = logindialogui.ui \
- sendmailprogressui.ui
+ sendmailprogressui.ui
INCLUDEPATH += $(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&)
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);
+}
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:
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();
+
static void pop3_progress( size_t current, size_t maximum );
protected:
void login();
- void logout();
POP3account *account;
mailstorage*m_pop3;
mailfolder*m_folder;