Diffstat (limited to 'noncore/net/mail/libmailwrapper') (more/less context) (show 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 | |||
@@ -18,15 +18,15 @@ AbstractMail* AbstractMail::getWrapper(IMAPaccount *a) | |||
18 | 18 | ||
19 | AbstractMail* AbstractMail::getWrapper(POP3account *a) | 19 | AbstractMail* AbstractMail::getWrapper(POP3account *a) |
20 | { | 20 | { |
21 | return new POP3wrapper(a); | 21 | return new POP3wrapper(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 | ||
29 | encodedString* AbstractMail::decode_String(const encodedString*text,const QString&enc) | 29 | encodedString* AbstractMail::decode_String(const encodedString*text,const QString&enc) |
30 | { | 30 | { |
31 | qDebug("Decode string start"); | 31 | qDebug("Decode string start"); |
32 | char*result_text; | 32 | char*result_text; |
@@ -96,6 +96,11 @@ int AbstractMail::createMbox(const QString&,const Folder*,const QString& delemit | |||
96 | QString AbstractMail::defaultLocalfolder() | 96 | QString AbstractMail::defaultLocalfolder() |
97 | { | 97 | { |
98 | QString f = getenv( "HOME" ); | 98 | QString f = getenv( "HOME" ); |
99 | f += "/Applications/opiemail/localmail"; | 99 | f += "/Applications/opiemail/localmail"; |
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 | |||
@@ -28,12 +28,13 @@ public: | |||
28 | virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part)=0; | 28 | virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part)=0; |
29 | virtual encodedString* fetchRawBody(const RecMail&mail)=0; | 29 | virtual encodedString* fetchRawBody(const RecMail&mail)=0; |
30 | 30 | ||
31 | virtual void deleteMail(const RecMail&mail)=0; | 31 | virtual void deleteMail(const RecMail&mail)=0; |
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; |
36 | 37 | ||
37 | virtual void cleanMimeCache(){}; | 38 | virtual void cleanMimeCache(){}; |
38 | /* mail box methods */ | 39 | /* mail box methods */ |
39 | /* parameter is the box to create. | 40 | /* parameter is the box to create. |
@@ -43,17 +44,18 @@ public: | |||
43 | virtual int createMbox(const QString&,const Folder*parentfolder=0,const QString& delemiter="/",bool getsubfolder=false); | 44 | virtual int createMbox(const QString&,const Folder*parentfolder=0,const QString& delemiter="/",bool getsubfolder=false); |
44 | virtual void logout()=0; | 45 | virtual void logout()=0; |
45 | 46 | ||
46 | static AbstractMail* getWrapper(IMAPaccount *a); | 47 | static AbstractMail* getWrapper(IMAPaccount *a); |
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: |
56 | static encodedString*decode_String(const encodedString*text,const QString&enc); | 58 | static encodedString*decode_String(const encodedString*text,const QString&enc); |
57 | static QString convert_String(const char*text); | 59 | static QString convert_String(const char*text); |
58 | static QString gen_attachment_id(); | 60 | static QString gen_attachment_id(); |
59 | }; | 61 | }; |
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 | |||
@@ -26,12 +26,13 @@ void IMAPwrapper::imap_progress( size_t current, size_t maximum ) | |||
26 | void IMAPwrapper::login() | 26 | void IMAPwrapper::login() |
27 | { | 27 | { |
28 | const char *server, *user, *pass; | 28 | const char *server, *user, *pass; |
29 | uint16_t port; | 29 | uint16_t port; |
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 */ |
34 | if (m_imap) { | 35 | if (m_imap) { |
35 | err = mailimap_noop(m_imap); | 36 | err = mailimap_noop(m_imap); |
36 | if (err!=MAILIMAP_NO_ERROR) { | 37 | if (err!=MAILIMAP_NO_ERROR) { |
37 | logout(); | 38 | logout(); |
@@ -1003,12 +1004,17 @@ void IMAPwrapper::storeMessage(const char*msg,size_t length, const QString&folde | |||
1003 | 1004 | ||
1004 | const QString&IMAPwrapper::getType()const | 1005 | const QString&IMAPwrapper::getType()const |
1005 | { | 1006 | { |
1006 | return account->getType(); | 1007 | return account->getType(); |
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 | { |
1011 | // dummy | 1017 | // dummy |
1012 | QValueList<int> path; | 1018 | QValueList<int> path; |
1013 | return fetchRawPart(mail,path,false); | 1019 | return fetchRawPart(mail,path,false); |
1014 | } | 1020 | } |
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 | |||
@@ -42,12 +42,14 @@ public: | |||
42 | virtual int deleteMbox(const Folder*folder); | 42 | virtual int deleteMbox(const Folder*folder); |
43 | 43 | ||
44 | static void imap_progress( size_t current, size_t maximum ); | 44 | static void imap_progress( size_t current, size_t maximum ); |
45 | 45 | ||
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*); |
50 | void login(); | 52 | void login(); |
51 | 53 | ||
52 | virtual QString fetchTextPart(const RecMail&mail,const QValueList<int>&path,bool internal_call=false,const QString&enc=""); | 54 | virtual QString fetchTextPart(const RecMail&mail,const QValueList<int>&path,bool internal_call=false,const QString&enc=""); |
53 | virtual encodedString*fetchRawPart(const RecMail&mail,const QValueList<int>&path,bool internal_call); | 55 | virtual encodedString*fetchRawPart(const RecMail&mail,const QValueList<int>&path,bool internal_call); |
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 | |||
@@ -5,14 +5,14 @@ | |||
5 | #include <qdir.h> | 5 | #include <qdir.h> |
6 | #include <stdlib.h> | 6 | #include <stdlib.h> |
7 | #include <qpe/global.h> | 7 | #include <qpe/global.h> |
8 | 8 | ||
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); |
15 | if (!dir.exists()) { | 15 | if (!dir.exists()) { |
16 | dir.mkdir(MBOXPath); | 16 | dir.mkdir(MBOXPath); |
17 | } | 17 | } |
18 | } | 18 | } |
@@ -327,6 +327,11 @@ void MBOXwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) | |||
327 | } | 327 | } |
328 | 328 | ||
329 | const QString&MBOXwrapper::getType()const | 329 | const QString&MBOXwrapper::getType()const |
330 | { | 330 | { |
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 | |||
@@ -10,13 +10,13 @@ class encodedString; | |||
10 | struct mailmbox_folder; | 10 | struct mailmbox_folder; |
11 | 11 | ||
12 | class MBOXwrapper : public Genericwrapper | 12 | class MBOXwrapper : public Genericwrapper |
13 | { | 13 | { |
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 | ||
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 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); | 21 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); |
22 | 22 | ||
@@ -29,17 +29,19 @@ public: | |||
29 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); | 29 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); |
30 | 30 | ||
31 | virtual RecBody fetchBody( const RecMail &mail ); | 31 | virtual RecBody fetchBody( const RecMail &mail ); |
32 | static void mbox_progress( size_t current, size_t maximum ); | 32 | static void mbox_progress( size_t current, size_t maximum ); |
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 | }; |
44 | 46 | ||
45 | #endif | 47 | #endif |
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 | |||
@@ -105,12 +105,13 @@ void POP3wrapper::listMessages(const QString &, QList<RecMail> &target ) | |||
105 | parseList(target,m_folder->fld_session,"INBOX"); | 105 | parseList(target,m_folder->fld_session,"INBOX"); |
106 | Global::statusMessage( tr("Mailbox contains %1 mail(s)").arg(res_messages)); | 106 | Global::statusMessage( tr("Mailbox contains %1 mail(s)").arg(res_messages)); |
107 | } | 107 | } |
108 | 108 | ||
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; |
113 | 114 | ||
114 | const char *server, *user, *pass; | 115 | const char *server, *user, *pass; |
115 | uint16_t port; | 116 | uint16_t port; |
116 | int err = MAILPOP3_NO_ERROR; | 117 | int err = MAILPOP3_NO_ERROR; |
@@ -246,6 +247,11 @@ encodedString* POP3wrapper::fetchRawBody(const RecMail&mail) | |||
246 | } | 247 | } |
247 | 248 | ||
248 | const QString&POP3wrapper::getType()const | 249 | const QString&POP3wrapper::getType()const |
249 | { | 250 | { |
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 | |||
@@ -27,12 +27,13 @@ public: | |||
27 | virtual int deleteAllMail(const Folder*); | 27 | virtual int deleteAllMail(const Folder*); |
28 | 28 | ||
29 | virtual RecBody fetchBody( const RecMail &mail ); | 29 | virtual RecBody fetchBody( const RecMail &mail ); |
30 | virtual encodedString* fetchRawBody(const RecMail&mail); | 30 | virtual encodedString* fetchRawBody(const RecMail&mail); |
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 | ||
35 | protected: | 36 | protected: |
36 | void login(); | 37 | void login(); |
37 | POP3account *account; | 38 | POP3account *account; |
38 | mailstorage*m_pop3; | 39 | mailstorage*m_pop3; |
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 | |||
@@ -165,12 +165,14 @@ void IMAPaccount::read() | |||
165 | user = conf->readEntry( "User","" ); | 165 | user = conf->readEntry( "User","" ); |
166 | if (user.isNull()) user = ""; | 166 | if (user.isNull()) user = ""; |
167 | password = conf->readEntryCrypt( "Password","" ); | 167 | password = conf->readEntryCrypt( "Password","" ); |
168 | if (password.isNull()) password = ""; | 168 | if (password.isNull()) password = ""; |
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 | ||
173 | void IMAPaccount::save() | 175 | void IMAPaccount::save() |
174 | { | 176 | { |
175 | qDebug( "saving " + getFileName() ); | 177 | qDebug( "saving " + getFileName() ); |
176 | Settings::checkDirectory(); | 178 | Settings::checkDirectory(); |
@@ -181,13 +183,15 @@ void IMAPaccount::save() | |||
181 | conf->writeEntry( "Server", server ); | 183 | conf->writeEntry( "Server", server ); |
182 | conf->writeEntry( "Port", port ); | 184 | conf->writeEntry( "Port", port ); |
183 | conf->writeEntry( "SSL", ssl ); | 185 | conf->writeEntry( "SSL", ssl ); |
184 | conf->writeEntry( "User", user ); | 186 | conf->writeEntry( "User", user ); |
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 | ||
190 | 194 | ||
191 | QString IMAPaccount::getFileName() | 195 | QString IMAPaccount::getFileName() |
192 | { | 196 | { |
193 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/imap-" + file; | 197 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/imap-" + file; |
@@ -235,12 +239,14 @@ void POP3account::read() | |||
235 | accountName = conf->readEntry( "Account" ); | 239 | accountName = conf->readEntry( "Account" ); |
236 | server = conf->readEntry( "Server" ); | 240 | server = conf->readEntry( "Server" ); |
237 | port = conf->readEntry( "Port" ); | 241 | port = conf->readEntry( "Port" ); |
238 | ssl = conf->readBoolEntry( "SSL" ); | 242 | ssl = conf->readBoolEntry( "SSL" ); |
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 | ||
243 | void POP3account::save() | 249 | void POP3account::save() |
244 | { | 250 | { |
245 | qDebug( "saving " + getFileName() ); | 251 | qDebug( "saving " + getFileName() ); |
246 | Settings::checkDirectory(); | 252 | Settings::checkDirectory(); |
@@ -250,13 +256,15 @@ void POP3account::save() | |||
250 | conf->writeEntry( "Account", accountName ); | 256 | conf->writeEntry( "Account", accountName ); |
251 | conf->writeEntry( "Server", server ); | 257 | conf->writeEntry( "Server", server ); |
252 | conf->writeEntry( "Port", port ); | 258 | conf->writeEntry( "Port", port ); |
253 | conf->writeEntry( "SSL", ssl ); | 259 | conf->writeEntry( "SSL", ssl ); |
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 | ||
259 | 267 | ||
260 | QString POP3account::getFileName() | 268 | QString POP3account::getFileName() |
261 | { | 269 | { |
262 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/pop3-" + file; | 270 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/pop3-" + file; |
@@ -310,12 +318,13 @@ void SMTPaccount::read() | |||
310 | server = conf->readEntry( "Server" ); | 318 | server = conf->readEntry( "Server" ); |
311 | port = conf->readEntry( "Port" ); | 319 | port = conf->readEntry( "Port" ); |
312 | ssl = conf->readBoolEntry( "SSL" ); | 320 | ssl = conf->readBoolEntry( "SSL" ); |
313 | login = conf->readBoolEntry( "Login" ); | 321 | login = conf->readBoolEntry( "Login" ); |
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 | ||
318 | void SMTPaccount::save() | 327 | void SMTPaccount::save() |
319 | { | 328 | { |
320 | qDebug( "saving " + getFileName() ); | 329 | qDebug( "saving " + getFileName() ); |
321 | Settings::checkDirectory(); | 330 | Settings::checkDirectory(); |
@@ -327,12 +336,13 @@ void SMTPaccount::save() | |||
327 | conf->writeEntry( "Port", port ); | 336 | conf->writeEntry( "Port", port ); |
328 | conf->writeEntry( "SSL", ssl ); | 337 | conf->writeEntry( "SSL", ssl ); |
329 | conf->writeEntry( "Login", login ); | 338 | conf->writeEntry( "Login", login ); |
330 | conf->writeEntry( "User", user ); | 339 | conf->writeEntry( "User", user ); |
331 | conf->writeEntryCrypt( "Password", password ); | 340 | conf->writeEntryCrypt( "Password", password ); |
332 | conf->write(); | 341 | conf->write(); |
342 | delete conf; | ||
333 | } | 343 | } |
334 | 344 | ||
335 | 345 | ||
336 | QString SMTPaccount::getFileName() | 346 | QString SMTPaccount::getFileName() |
337 | { | 347 | { |
338 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/smtp-" + file; | 348 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/smtp-" + file; |
@@ -383,12 +393,13 @@ void NNTPaccount::read() | |||
383 | server = conf->readEntry( "Server" ); | 393 | server = conf->readEntry( "Server" ); |
384 | port = conf->readEntry( "Port" ); | 394 | port = conf->readEntry( "Port" ); |
385 | ssl = conf->readBoolEntry( "SSL" ); | 395 | ssl = conf->readBoolEntry( "SSL" ); |
386 | login = conf->readBoolEntry( "Login" ); | 396 | login = conf->readBoolEntry( "Login" ); |
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 | ||
391 | void NNTPaccount::save() | 402 | void NNTPaccount::save() |
392 | { | 403 | { |
393 | qDebug( "saving " + getFileName() ); | 404 | qDebug( "saving " + getFileName() ); |
394 | Settings::checkDirectory(); | 405 | Settings::checkDirectory(); |
@@ -400,12 +411,13 @@ void NNTPaccount::save() | |||
400 | conf->writeEntry( "Port", port ); | 411 | conf->writeEntry( "Port", port ); |
401 | conf->writeEntry( "SSL", ssl ); | 412 | conf->writeEntry( "SSL", ssl ); |
402 | conf->writeEntry( "Login", login ); | 413 | conf->writeEntry( "Login", login ); |
403 | conf->writeEntry( "User", user ); | 414 | conf->writeEntry( "User", user ); |
404 | conf->writeEntryCrypt( "Password", password ); | 415 | conf->writeEntryCrypt( "Password", password ); |
405 | conf->write(); | 416 | conf->write(); |
417 | delete conf; | ||
406 | } | 418 | } |
407 | 419 | ||
408 | 420 | ||
409 | QString NNTPaccount::getFileName() | 421 | QString NNTPaccount::getFileName() |
410 | { | 422 | { |
411 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/nntp-" + file; | 423 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/nntp-" + file; |
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 | |||
@@ -28,20 +28,23 @@ public: | |||
28 | void setPassword(const QString&str) { password = str; } | 28 | void setPassword(const QString&str) { password = str; } |
29 | const QString&getPassword()const { return password; } | 29 | const QString&getPassword()const { return password; } |
30 | 30 | ||
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 | 33 | ||
34 | void setOffline(bool b) {offline = b;} | ||
35 | bool getOffline()const{return offline;} | ||
36 | |||
34 | virtual QString getFileName() { return accountName; } | 37 | virtual QString getFileName() { return accountName; } |
35 | virtual void read() { qDebug( "base reading..." ); } | 38 | virtual void read() { qDebug( "base reading..." ); } |
36 | virtual void save() { qDebug( "base saving..." ); } | 39 | virtual void save() { qDebug( "base saving..." ); } |
37 | 40 | ||
38 | protected: | 41 | 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 | ||
44 | class IMAPaccount : public Account | 47 | class IMAPaccount : public Account |
45 | { | 48 | { |
46 | 49 | ||
47 | public: | 50 | public: |
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 | |||
@@ -486,13 +486,13 @@ void SMTPwrapper::progress( size_t current, size_t maximum ) | |||
486 | } | 486 | } |
487 | 487 | ||
488 | void SMTPwrapper::storeMail(const char*mail, size_t length, const QString&box) | 488 | void SMTPwrapper::storeMail(const char*mail, size_t length, const QString&box) |
489 | { | 489 | { |
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; |
495 | } | 495 | } |
496 | 496 | ||
497 | void SMTPwrapper::smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ) | 497 | void SMTPwrapper::smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ) |
498 | { | 498 | { |
@@ -513,17 +513,15 @@ void SMTPwrapper::smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ) | |||
513 | mailmessage_free(msg); | 513 | mailmessage_free(msg); |
514 | if (r != MAIL_NO_ERROR || !data) { | 514 | if (r != MAIL_NO_ERROR || !data) { |
515 | if (data) free(data); | 515 | if (data) free(data); |
516 | qDebug("Error fetching mime..."); | 516 | qDebug("Error fetching mime..."); |
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" ); |
526 | cfg.setGroup( "Status" ); | 524 | cfg.setGroup( "Status" ); |
527 | cfg.writeEntry( "outgoing", ++m_queuedMail ); | 525 | cfg.writeEntry( "outgoing", ++m_queuedMail ); |
528 | emit queuedMails( m_queuedMail ); | 526 | emit queuedMails( m_queuedMail ); |
529 | return; | 527 | return; |
@@ -633,13 +631,13 @@ void SMTPwrapper::sendMail(const Mail&mail,SMTPaccount*aSmtp,bool later ) | |||
633 | delete sendProgress; | 631 | delete sendProgress; |
634 | sendProgress = 0; | 632 | sendProgress = 0; |
635 | mailmime_free( mimeMail ); | 633 | mailmime_free( mimeMail ); |
636 | } | 634 | } |
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; |
642 | mailimf_fields *fields = 0; | 640 | mailimf_fields *fields = 0; |
643 | mailimf_field*ffrom = 0; | 641 | mailimf_field*ffrom = 0; |
644 | clist *rcpts = 0; | 642 | clist *rcpts = 0; |
645 | char*from = 0; | 643 | char*from = 0; |
@@ -682,13 +680,13 @@ bool SMTPwrapper::flushOutbox(SMTPaccount*smtp) | |||
682 | { | 680 | { |
683 | bool returnValue = true; | 681 | bool returnValue = true; |
684 | 682 | ||
685 | if (!smtp) return false; | 683 | if (!smtp) return false; |
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"); |
691 | return false; | 689 | return false; |
692 | } | 690 | } |
693 | QList<RecMail> mailsToSend; | 691 | QList<RecMail> mailsToSend; |
694 | QList<RecMail> mailsToRemove; | 692 | QList<RecMail> mailsToRemove; |
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 | |||
@@ -7,13 +7,13 @@ | |||
7 | #include <qdatetime.h> | 7 | #include <qdatetime.h> |
8 | #include <libetpan/clist.h> | 8 | #include <libetpan/clist.h> |
9 | 9 | ||
10 | #include "settings.h" | 10 | #include "settings.h" |
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; |
16 | struct mailimf_fields; | 16 | struct mailimf_fields; |
17 | struct mailimf_field; | 17 | struct mailimf_field; |
18 | struct mailimf_mailbox; | 18 | struct mailimf_mailbox; |
19 | struct mailmime; | 19 | struct mailmime; |
@@ -56,13 +56,13 @@ protected: | |||
56 | static mailimf_field *getField( mailimf_fields *fields, int type ); | 56 | static mailimf_field *getField( mailimf_fields *fields, int type ); |
57 | int smtpSend(char*from,clist*rcpts,const char*data,size_t size, SMTPaccount *smtp ); | 57 | int smtpSend(char*from,clist*rcpts,const char*data,size_t size, SMTPaccount *smtp ); |
58 | 58 | ||
59 | void storeMail(mailmime*mail, const QString&box); | 59 | void storeMail(mailmime*mail, const QString&box); |
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; |
65 | static const char* USER_AGENT; | 65 | static const char* USER_AGENT; |
66 | 66 | ||
67 | protected slots: | 67 | protected slots: |
68 | void emitQCop( int queued ); | 68 | void emitQCop( int queued ); |