Diffstat (limited to 'noncore/net/mail/libmailwrapper') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/libmailwrapper/abstractmail.cpp | 9 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/abstractmail.h | 4 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.cpp | 6 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.h | 2 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mboxwrapper.cpp | 9 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mboxwrapper.h | 6 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/pop3wrapper.cpp | 6 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/pop3wrapper.h | 1 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/settings.cpp | 12 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/settings.h | 5 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/smtpwrapper.cpp | 10 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/smtpwrapper.h | 4 |
12 files changed, 58 insertions, 16 deletions
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.cpp b/noncore/net/mail/libmailwrapper/abstractmail.cpp index 80d0b52..3dd2fce 100644 --- a/noncore/net/mail/libmailwrapper/abstractmail.cpp +++ b/noncore/net/mail/libmailwrapper/abstractmail.cpp | |||
@@ -22,7 +22,7 @@ AbstractMail* AbstractMail::getWrapper(POP3account *a) | |||
22 | } | 22 | } |
23 | 23 | ||
24 | AbstractMail* AbstractMail::getWrapper(const QString&a) | 24 | AbstractMail* AbstractMail::getWrapper(const QString&a,const QString&name) |
25 | { | 25 | { |
26 | return new MBOXwrapper(a); | 26 | return new MBOXwrapper(a,name); |
27 | } | 27 | } |
28 | 28 | ||
@@ -100,2 +100,7 @@ QString AbstractMail::defaultLocalfolder() | |||
100 | return f; | 100 | return f; |
101 | } | 101 | } |
102 | |||
103 | /* temporary - will be removed when implemented in all classes */ | ||
104 | void AbstractMail::deleteMails(const QString &,QList<RecMail> &) | ||
105 | { | ||
106 | } | ||
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.h b/noncore/net/mail/libmailwrapper/abstractmail.h index 9770991..15d83cb 100644 --- a/noncore/net/mail/libmailwrapper/abstractmail.h +++ b/noncore/net/mail/libmailwrapper/abstractmail.h | |||
@@ -32,4 +32,5 @@ public: | |||
32 | virtual void answeredMail(const RecMail&mail)=0; | 32 | virtual void answeredMail(const RecMail&mail)=0; |
33 | virtual int deleteAllMail(const Folder*)=0; | 33 | virtual int deleteAllMail(const Folder*)=0; |
34 | virtual void deleteMails(const QString & FolderName,QList<RecMail> &target); | ||
34 | virtual int deleteMbox(const Folder*)=0; | 35 | virtual int deleteMbox(const Folder*)=0; |
35 | virtual void storeMessage(const char*msg,size_t length, const QString&folder)=0; | 36 | virtual void storeMessage(const char*msg,size_t length, const QString&folder)=0; |
@@ -47,9 +48,10 @@ public: | |||
47 | static AbstractMail* getWrapper(POP3account *a); | 48 | static AbstractMail* getWrapper(POP3account *a); |
48 | /* mbox only! */ | 49 | /* mbox only! */ |
49 | static AbstractMail* getWrapper(const QString&a); | 50 | static AbstractMail* getWrapper(const QString&a,const QString&name="Local Folders"); |
50 | 51 | ||
51 | static QString defaultLocalfolder(); | 52 | static QString defaultLocalfolder(); |
52 | 53 | ||
53 | virtual const QString&getType()const=0; | 54 | virtual const QString&getType()const=0; |
55 | virtual const QString&getName()const=0; | ||
54 | 56 | ||
55 | protected: | 57 | protected: |
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp index d252159..bb74de9 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp | |||
@@ -30,4 +30,5 @@ void IMAPwrapper::login() | |||
30 | int err = MAILIMAP_NO_ERROR; | 30 | int err = MAILIMAP_NO_ERROR; |
31 | 31 | ||
32 | if (account->getOffline()) return; | ||
32 | /* we are connected this moment */ | 33 | /* we are connected this moment */ |
33 | /* TODO: setup a timer holding the line or if connection closed - delete the value */ | 34 | /* TODO: setup a timer holding the line or if connection closed - delete the value */ |
@@ -1007,4 +1008,9 @@ const QString&IMAPwrapper::getType()const | |||
1007 | } | 1008 | } |
1008 | 1009 | ||
1010 | const QString&IMAPwrapper::getName()const | ||
1011 | { | ||
1012 | return account->getAccountName(); | ||
1013 | } | ||
1014 | |||
1009 | encodedString* IMAPwrapper::fetchRawBody(const RecMail&mail) | 1015 | encodedString* IMAPwrapper::fetchRawBody(const RecMail&mail) |
1010 | { | 1016 | { |
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.h b/noncore/net/mail/libmailwrapper/imapwrapper.h index b246f58..b2bd7e9 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.h +++ b/noncore/net/mail/libmailwrapper/imapwrapper.h | |||
@@ -46,4 +46,6 @@ public: | |||
46 | virtual void logout(); | 46 | virtual void logout(); |
47 | virtual const QString&getType()const; | 47 | virtual const QString&getType()const; |
48 | virtual const QString&getName()const; | ||
49 | |||
48 | protected: | 50 | protected: |
49 | RecMail*parse_list_result(mailimap_msg_att*); | 51 | RecMail*parse_list_result(mailimap_msg_att*); |
diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp index bc496f7..97f301e 100644 --- a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp | |||
@@ -9,6 +9,6 @@ | |||
9 | const QString MBOXwrapper::wrapperType="MBOX"; | 9 | const QString MBOXwrapper::wrapperType="MBOX"; |
10 | 10 | ||
11 | MBOXwrapper::MBOXwrapper(const QString & mbox_dir) | 11 | MBOXwrapper::MBOXwrapper(const QString & mbox_dir,const QString&mbox_name) |
12 | : Genericwrapper(),MBOXPath(mbox_dir) | 12 | : Genericwrapper(),MBOXPath(mbox_dir),MBOXName(mbox_name) |
13 | { | 13 | { |
14 | QDir dir(MBOXPath); | 14 | QDir dir(MBOXPath); |
@@ -331,2 +331,7 @@ const QString&MBOXwrapper::getType()const | |||
331 | return wrapperType; | 331 | return wrapperType; |
332 | } | 332 | } |
333 | |||
334 | const QString&MBOXwrapper::getName()const | ||
335 | { | ||
336 | return MBOXName; | ||
337 | } | ||
diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.h b/noncore/net/mail/libmailwrapper/mboxwrapper.h index 2794014..194ff86 100644 --- a/noncore/net/mail/libmailwrapper/mboxwrapper.h +++ b/noncore/net/mail/libmailwrapper/mboxwrapper.h | |||
@@ -14,5 +14,5 @@ class MBOXwrapper : public Genericwrapper | |||
14 | Q_OBJECT | 14 | Q_OBJECT |
15 | public: | 15 | public: |
16 | MBOXwrapper(const QString & dir); | 16 | MBOXwrapper(const QString & dir,const QString&name); |
17 | virtual ~MBOXwrapper(); | 17 | virtual ~MBOXwrapper(); |
18 | 18 | ||
@@ -33,11 +33,13 @@ public: | |||
33 | 33 | ||
34 | virtual encodedString* fetchRawBody(const RecMail&mail); | 34 | virtual encodedString* fetchRawBody(const RecMail&mail); |
35 | virtual void deleteMails(const QString & mailbox,QList<RecMail> &target); | 35 | virtual void deleteMails(const QString & FolderName,QList<RecMail> &target); |
36 | virtual int deleteAllMail(const Folder*); | 36 | virtual int deleteAllMail(const Folder*); |
37 | virtual const QString&getType()const; | 37 | virtual const QString&getType()const; |
38 | virtual const QString&getName()const; | ||
38 | 39 | ||
39 | protected: | 40 | protected: |
40 | static void deleteMails(mailmbox_folder*f,QList<RecMail> &target); | 41 | static void deleteMails(mailmbox_folder*f,QList<RecMail> &target); |
41 | QString MBOXPath; | 42 | QString MBOXPath; |
43 | QString MBOXName; | ||
42 | static const QString wrapperType; | 44 | static const QString wrapperType; |
43 | }; | 45 | }; |
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp index cceb22e..67bde38 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp | |||
@@ -109,4 +109,5 @@ void POP3wrapper::listMessages(const QString &, QList<RecMail> &target ) | |||
109 | void POP3wrapper::login() | 109 | void POP3wrapper::login() |
110 | { | 110 | { |
111 | if (account->getOffline()) return; | ||
111 | /* we'll hold the line */ | 112 | /* we'll hold the line */ |
112 | if ( m_pop3 != NULL ) return; | 113 | if ( m_pop3 != NULL ) return; |
@@ -250,2 +251,7 @@ const QString&POP3wrapper::getType()const | |||
250 | return account->getType(); | 251 | return account->getType(); |
251 | } | 252 | } |
253 | |||
254 | const QString&POP3wrapper::getName()const | ||
255 | { | ||
256 | return account->getAccountName(); | ||
257 | } | ||
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.h b/noncore/net/mail/libmailwrapper/pop3wrapper.h index f0307b6..d2b708d 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.h +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.h | |||
@@ -31,4 +31,5 @@ public: | |||
31 | virtual void logout(); | 31 | virtual void logout(); |
32 | virtual const QString&getType()const; | 32 | virtual const QString&getType()const; |
33 | virtual const QString&getName()const; | ||
33 | static void pop3_progress( size_t current, size_t maximum ); | 34 | static void pop3_progress( size_t current, size_t maximum ); |
34 | 35 | ||
diff --git a/noncore/net/mail/libmailwrapper/settings.cpp b/noncore/net/mail/libmailwrapper/settings.cpp index c5187f5..02a80a3 100644 --- a/noncore/net/mail/libmailwrapper/settings.cpp +++ b/noncore/net/mail/libmailwrapper/settings.cpp | |||
@@ -169,4 +169,6 @@ void IMAPaccount::read() | |||
169 | prefix = conf->readEntry("MailPrefix",""); | 169 | prefix = conf->readEntry("MailPrefix",""); |
170 | if (prefix.isNull()) prefix = ""; | 170 | if (prefix.isNull()) prefix = ""; |
171 | offline = conf->readBoolEntry("Offline",false); | ||
172 | delete conf; | ||
171 | } | 173 | } |
172 | 174 | ||
@@ -185,5 +187,7 @@ void IMAPaccount::save() | |||
185 | conf->writeEntryCrypt( "Password", password ); | 187 | conf->writeEntryCrypt( "Password", password ); |
186 | conf->writeEntry( "MailPrefix",prefix); | 188 | conf->writeEntry( "MailPrefix",prefix); |
189 | conf->writeEntry( "Offline",offline); | ||
187 | conf->write(); | 190 | conf->write(); |
191 | delete conf; | ||
188 | } | 192 | } |
189 | 193 | ||
@@ -239,4 +243,6 @@ void POP3account::read() | |||
239 | user = conf->readEntry( "User" ); | 243 | user = conf->readEntry( "User" ); |
240 | password = conf->readEntryCrypt( "Password" ); | 244 | password = conf->readEntryCrypt( "Password" ); |
245 | offline = conf->readBoolEntry("Offline",false); | ||
246 | delete conf; | ||
241 | } | 247 | } |
242 | 248 | ||
@@ -254,5 +260,7 @@ void POP3account::save() | |||
254 | conf->writeEntry( "User", user ); | 260 | conf->writeEntry( "User", user ); |
255 | conf->writeEntryCrypt( "Password", password ); | 261 | conf->writeEntryCrypt( "Password", password ); |
262 | conf->writeEntry( "Offline",offline); | ||
256 | conf->write(); | 263 | conf->write(); |
264 | delete conf; | ||
257 | } | 265 | } |
258 | 266 | ||
@@ -314,4 +322,5 @@ void SMTPaccount::read() | |||
314 | user = conf->readEntry( "User" ); | 322 | user = conf->readEntry( "User" ); |
315 | password = conf->readEntryCrypt( "Password" ); | 323 | password = conf->readEntryCrypt( "Password" ); |
324 | delete conf; | ||
316 | } | 325 | } |
317 | 326 | ||
@@ -331,4 +340,5 @@ void SMTPaccount::save() | |||
331 | conf->writeEntryCrypt( "Password", password ); | 340 | conf->writeEntryCrypt( "Password", password ); |
332 | conf->write(); | 341 | conf->write(); |
342 | delete conf; | ||
333 | } | 343 | } |
334 | 344 | ||
@@ -387,4 +397,5 @@ void NNTPaccount::read() | |||
387 | user = conf->readEntry( "User" ); | 397 | user = conf->readEntry( "User" ); |
388 | password = conf->readEntryCrypt( "Password" ); | 398 | password = conf->readEntryCrypt( "Password" ); |
399 | delete conf; | ||
389 | } | 400 | } |
390 | 401 | ||
@@ -404,4 +415,5 @@ void NNTPaccount::save() | |||
404 | conf->writeEntryCrypt( "Password", password ); | 415 | conf->writeEntryCrypt( "Password", password ); |
405 | conf->write(); | 416 | conf->write(); |
417 | delete conf; | ||
406 | } | 418 | } |
407 | 419 | ||
diff --git a/noncore/net/mail/libmailwrapper/settings.h b/noncore/net/mail/libmailwrapper/settings.h index caa5dfc..2104997 100644 --- a/noncore/net/mail/libmailwrapper/settings.h +++ b/noncore/net/mail/libmailwrapper/settings.h | |||
@@ -31,4 +31,7 @@ public: | |||
31 | void setSSL( bool b ) { ssl = b; } | 31 | void setSSL( bool b ) { ssl = b; } |
32 | bool getSSL() { return ssl; } | 32 | bool getSSL() { return ssl; } |
33 | |||
34 | void setOffline(bool b) {offline = b;} | ||
35 | bool getOffline()const{return offline;} | ||
33 | 36 | ||
34 | virtual QString getFileName() { return accountName; } | 37 | virtual QString getFileName() { return accountName; } |
@@ -39,5 +42,5 @@ protected: | |||
39 | QString accountName, type, server, port, user, password; | 42 | QString accountName, type, server, port, user, password; |
40 | bool ssl; | 43 | bool ssl; |
41 | 44 | bool offline; | |
42 | }; | 45 | }; |
43 | 46 | ||
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp index 4764b77..281b88e 100644 --- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp | |||
@@ -490,5 +490,5 @@ void SMTPwrapper::storeMail(const char*mail, size_t length, const QString&box) | |||
490 | if (!mail) return; | 490 | if (!mail) return; |
491 | QString localfolders = AbstractMail::defaultLocalfolder(); | 491 | QString localfolders = AbstractMail::defaultLocalfolder(); |
492 | MBOXwrapper*wrap = new MBOXwrapper(localfolders); | 492 | AbstractMail*wrap = AbstractMail::getWrapper(localfolders); |
493 | wrap->storeMessage(mail,length,box); | 493 | wrap->storeMessage(mail,length,box); |
494 | delete wrap; | 494 | delete wrap; |
@@ -517,9 +517,7 @@ void SMTPwrapper::smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ) | |||
517 | return; | 517 | return; |
518 | } | 518 | } |
519 | QString tmp = data; | ||
520 | tmp.replace(QRegExp("\r+",true,false),""); | ||
521 | msg = 0; | 519 | msg = 0; |
522 | if (later) { | 520 | if (later) { |
523 | storeMail((char*)tmp.data(),tmp.length(),"Outgoing"); | 521 | storeMail(data,size,"Outgoing"); |
524 | if (data) free( data ); | 522 | if (data) free( data ); |
525 | Config cfg( "mail" ); | 523 | Config cfg( "mail" ); |
@@ -637,5 +635,5 @@ void SMTPwrapper::sendMail(const Mail&mail,SMTPaccount*aSmtp,bool later ) | |||
637 | } | 635 | } |
638 | 636 | ||
639 | int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which) | 637 | int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,SMTPaccount*smtp,RecMail*which) |
640 | { | 638 | { |
641 | size_t curTok = 0; | 639 | size_t curTok = 0; |
@@ -686,5 +684,5 @@ bool SMTPwrapper::flushOutbox(SMTPaccount*smtp) | |||
686 | 684 | ||
687 | QString localfolders = AbstractMail::defaultLocalfolder(); | 685 | QString localfolders = AbstractMail::defaultLocalfolder(); |
688 | MBOXwrapper*wrap = new MBOXwrapper(localfolders); | 686 | AbstractMail*wrap = AbstractMail::getWrapper(localfolders); |
689 | if (!wrap) { | 687 | if (!wrap) { |
690 | qDebug("memory error"); | 688 | qDebug("memory error"); |
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.h b/noncore/net/mail/libmailwrapper/smtpwrapper.h index 04fc4b0..7dcdbfd 100644 --- a/noncore/net/mail/libmailwrapper/smtpwrapper.h +++ b/noncore/net/mail/libmailwrapper/smtpwrapper.h | |||
@@ -11,5 +11,5 @@ | |||
11 | 11 | ||
12 | class Mail; | 12 | class Mail; |
13 | class MBOXwrapper; | 13 | class AbstractMail; |
14 | class RecMail; | 14 | class RecMail; |
15 | class Attachment; | 15 | class Attachment; |
@@ -60,5 +60,5 @@ protected: | |||
60 | Settings *settings; | 60 | Settings *settings; |
61 | 61 | ||
62 | int sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which); | 62 | int sendQueuedMail(AbstractMail*wrap,SMTPaccount*smtp,RecMail*which); |
63 | 63 | ||
64 | int m_queuedMail; | 64 | int m_queuedMail; |