author | zecke <zecke> | 2004-03-14 13:22:42 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-03-14 13:22:42 (UTC) |
commit | 0f7217afa7cdcb108dd2afba0ff6b42c97ab6f44 (patch) (unidiff) | |
tree | f6a68afa76a9be4099c3de7a286caeadd250c966 /noncore/net/mail/libmailwrapper | |
parent | d9d68663164078b8dbdbfe70d291291b9fd5aacf (diff) | |
download | opie-0f7217afa7cdcb108dd2afba0ff6b42c97ab6f44.zip opie-0f7217afa7cdcb108dd2afba0ff6b42c97ab6f44.tar.gz opie-0f7217afa7cdcb108dd2afba0ff6b42c97ab6f44.tar.bz2 |
Convert net to ODP and QtAUX
Diffstat (limited to 'noncore/net/mail/libmailwrapper') (more/less context) (ignore whitespace changes)
24 files changed, 82 insertions, 68 deletions
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.cpp b/noncore/net/mail/libmailwrapper/abstractmail.cpp index 68a7a4d..6bebb7b 100644 --- a/noncore/net/mail/libmailwrapper/abstractmail.cpp +++ b/noncore/net/mail/libmailwrapper/abstractmail.cpp | |||
@@ -2,24 +2,25 @@ | |||
2 | #include "imapwrapper.h" | 2 | #include "imapwrapper.h" |
3 | #include "pop3wrapper.h" | 3 | #include "pop3wrapper.h" |
4 | #include "nntpwrapper.h" | 4 | #include "nntpwrapper.h" |
5 | #include "mhwrapper.h" | 5 | #include "mhwrapper.h" |
6 | #include "mailtypes.h" | 6 | #include "mailtypes.h" |
7 | 7 | ||
8 | #include <qfile.h> | 8 | #include <qfile.h> |
9 | #include <qtextstream.h> | 9 | #include <qtextstream.h> |
10 | #include <stdlib.h> | 10 | #include <stdlib.h> |
11 | #include <libetpan/mailmime_content.h> | 11 | #include <libetpan/mailmime_content.h> |
12 | #include <libetpan/mailmime.h> | 12 | #include <libetpan/mailmime.h> |
13 | 13 | ||
14 | using namespace Opie::Core; | ||
14 | AbstractMail* AbstractMail::getWrapper(IMAPaccount *a) | 15 | AbstractMail* AbstractMail::getWrapper(IMAPaccount *a) |
15 | { | 16 | { |
16 | return new IMAPwrapper(a); | 17 | return new IMAPwrapper(a); |
17 | } | 18 | } |
18 | 19 | ||
19 | AbstractMail* AbstractMail::getWrapper(POP3account *a) | 20 | AbstractMail* AbstractMail::getWrapper(POP3account *a) |
20 | { | 21 | { |
21 | return new POP3wrapper(a); | 22 | return new POP3wrapper(a); |
22 | } | 23 | } |
23 | 24 | ||
24 | AbstractMail* AbstractMail::getWrapper(NNTPaccount *a) | 25 | AbstractMail* AbstractMail::getWrapper(NNTPaccount *a) |
25 | { | 26 | { |
@@ -120,25 +121,25 @@ QString AbstractMail::defaultLocalfolder() | |||
120 | { | 121 | { |
121 | QString f = getenv( "HOME" ); | 122 | QString f = getenv( "HOME" ); |
122 | f += "/Applications/opiemail/localmail"; | 123 | f += "/Applications/opiemail/localmail"; |
123 | return f; | 124 | return f; |
124 | } | 125 | } |
125 | 126 | ||
126 | QString AbstractMail::draftFolder() | 127 | QString AbstractMail::draftFolder() |
127 | { | 128 | { |
128 | return QString("Drafts"); | 129 | return QString("Drafts"); |
129 | } | 130 | } |
130 | 131 | ||
131 | /* temporary - will be removed when implemented in all classes */ | 132 | /* temporary - will be removed when implemented in all classes */ |
132 | void AbstractMail::deleteMails(const QString &,const QValueList<Opie::OSmartPointer<RecMail> > &) | 133 | void AbstractMail::deleteMails(const QString &,const QValueList<Opie::Core::OSmartPointer<RecMail> > &) |
133 | { | 134 | { |
134 | } | 135 | } |
135 | 136 | ||
136 | void AbstractMail::mvcpAllMails(const FolderP&fromFolder, | 137 | void AbstractMail::mvcpAllMails(const FolderP&fromFolder, |
137 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) | 138 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) |
138 | { | 139 | { |
139 | QValueList<RecMailP> t; | 140 | QValueList<RecMailP> t; |
140 | listMessages(fromFolder->getName(),t); | 141 | listMessages(fromFolder->getName(),t); |
141 | encodedString*st = 0; | 142 | encodedString*st = 0; |
142 | while (t.count()>0) { | 143 | while (t.count()>0) { |
143 | RecMailP r = (*t.begin()); | 144 | RecMailP r = (*t.begin()); |
144 | st = fetchRawBody(r); | 145 | st = fetchRawBody(r); |
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.h b/noncore/net/mail/libmailwrapper/abstractmail.h index b03d757..2d55c83 100644 --- a/noncore/net/mail/libmailwrapper/abstractmail.h +++ b/noncore/net/mail/libmailwrapper/abstractmail.h | |||
@@ -12,51 +12,51 @@ | |||
12 | class IMAPwrapper; | 12 | class IMAPwrapper; |
13 | class POP3wrapper; | 13 | class POP3wrapper; |
14 | class Folder; | 14 | class Folder; |
15 | class encodedString; | 15 | class encodedString; |
16 | struct folderStat; | 16 | struct folderStat; |
17 | 17 | ||
18 | class AbstractMail:public QObject | 18 | class AbstractMail:public QObject |
19 | { | 19 | { |
20 | Q_OBJECT | 20 | Q_OBJECT |
21 | public: | 21 | public: |
22 | AbstractMail(){}; | 22 | AbstractMail(){}; |
23 | virtual ~AbstractMail(){} | 23 | virtual ~AbstractMail(){} |
24 | virtual QValueList<Opie::OSmartPointer<Folder> >* listFolders()=0; | 24 | virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders()=0; |
25 | virtual void listMessages(const QString & mailbox,QValueList<RecMailP>&target )=0; | 25 | virtual void listMessages(const QString & mailbox,QValueList<RecMailP>&target )=0; |
26 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX")=0; | 26 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX")=0; |
27 | virtual RecBody fetchBody(const RecMailP&mail)=0; | 27 | virtual RecBody fetchBody(const RecMailP&mail)=0; |
28 | virtual QString fetchTextPart(const RecMailP&mail,const RecPart&part)=0; | 28 | virtual QString fetchTextPart(const RecMailP&mail,const RecPart&part)=0; |
29 | virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPart&part)=0; | 29 | virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPart&part)=0; |
30 | virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPart&part)=0; | 30 | virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPart&part)=0; |
31 | virtual encodedString* fetchRawBody(const RecMailP&mail)=0; | 31 | virtual encodedString* fetchRawBody(const RecMailP&mail)=0; |
32 | 32 | ||
33 | virtual void deleteMail(const RecMailP&mail)=0; | 33 | virtual void deleteMail(const RecMailP&mail)=0; |
34 | virtual void answeredMail(const RecMailP&mail)=0; | 34 | virtual void answeredMail(const RecMailP&mail)=0; |
35 | virtual int deleteAllMail(const Opie::OSmartPointer<Folder>&)=0; | 35 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&)=0; |
36 | virtual void deleteMails(const QString & FolderName,const QValueList<Opie::OSmartPointer<RecMail> >&target); | 36 | virtual void deleteMails(const QString & FolderName,const QValueList<Opie::Core::OSmartPointer<RecMail> >&target); |
37 | virtual int deleteMbox(const Opie::OSmartPointer<Folder>&)=0; | 37 | virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&)=0; |
38 | virtual void storeMessage(const char*msg,size_t length, const QString&folder)=0; | 38 | virtual void storeMessage(const char*msg,size_t length, const QString&folder)=0; |
39 | 39 | ||
40 | virtual void mvcpAllMails(const Opie::OSmartPointer<Folder>&fromFolder, | 40 | virtual void mvcpAllMails(const Opie::Core::OSmartPointer<Folder>&fromFolder, |
41 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); | 41 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); |
42 | virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); | 42 | virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); |
43 | 43 | ||
44 | virtual void cleanMimeCache(){}; | 44 | virtual void cleanMimeCache(){}; |
45 | /* mail box methods */ | 45 | /* mail box methods */ |
46 | /* parameter is the box to create. | 46 | /* parameter is the box to create. |
47 | * if the implementing subclass has prefixes, | 47 | * if the implementing subclass has prefixes, |
48 | * them has to be appended automatic. | 48 | * them has to be appended automatic. |
49 | */ | 49 | */ |
50 | virtual int createMbox(const QString&,const Opie::OSmartPointer<Folder>&parentfolder=0, | 50 | virtual int createMbox(const QString&,const Opie::Core::OSmartPointer<Folder>&parentfolder=0, |
51 | const QString& delemiter="/",bool getsubfolder=false); | 51 | const QString& delemiter="/",bool getsubfolder=false); |
52 | virtual void logout()=0; | 52 | virtual void logout()=0; |
53 | 53 | ||
54 | static AbstractMail* getWrapper(IMAPaccount *a); | 54 | static AbstractMail* getWrapper(IMAPaccount *a); |
55 | static AbstractMail* getWrapper(POP3account *a); | 55 | static AbstractMail* getWrapper(POP3account *a); |
56 | static AbstractMail* getWrapper(NNTPaccount *a); | 56 | static AbstractMail* getWrapper(NNTPaccount *a); |
57 | /* mbox only! */ | 57 | /* mbox only! */ |
58 | static AbstractMail* getWrapper(const QString&a,const QString&name="Local Folders"); | 58 | static AbstractMail* getWrapper(const QString&a,const QString&name="Local Folders"); |
59 | static AbstractMail* getWrapper(Account*a); | 59 | static AbstractMail* getWrapper(Account*a); |
60 | 60 | ||
61 | static QString defaultLocalfolder(); | 61 | static QString defaultLocalfolder(); |
62 | static QString draftFolder(); | 62 | static QString draftFolder(); |
diff --git a/noncore/net/mail/libmailwrapper/generatemail.cpp b/noncore/net/mail/libmailwrapper/generatemail.cpp index cb7ccc0..cb58d82 100644 --- a/noncore/net/mail/libmailwrapper/generatemail.cpp +++ b/noncore/net/mail/libmailwrapper/generatemail.cpp | |||
@@ -1,19 +1,20 @@ | |||
1 | #include "generatemail.h" | 1 | #include "generatemail.h" |
2 | #include "mailwrapper.h" | 2 | #include "mailwrapper.h" |
3 | 3 | ||
4 | #include <libetpan/libetpan.h> | 4 | #include <libetpan/libetpan.h> |
5 | 5 | ||
6 | #include <qt.h> | 6 | #include <qt.h> |
7 | 7 | ||
8 | using namespace Opie::Core; | ||
8 | const char* Generatemail::USER_AGENT="OpieMail v0.6"; | 9 | const char* Generatemail::USER_AGENT="OpieMail v0.6"; |
9 | 10 | ||
10 | Generatemail::Generatemail() | 11 | Generatemail::Generatemail() |
11 | { | 12 | { |
12 | } | 13 | } |
13 | 14 | ||
14 | Generatemail::~Generatemail() | 15 | Generatemail::~Generatemail() |
15 | { | 16 | { |
16 | } | 17 | } |
17 | 18 | ||
18 | void Generatemail::addRcpts( clist *list, mailimf_address_list *addr_list ) { | 19 | void Generatemail::addRcpts( clist *list, mailimf_address_list *addr_list ) { |
19 | clistiter *it, *it2; | 20 | clistiter *it, *it2; |
@@ -270,25 +271,25 @@ err_free_param: | |||
270 | mailmime_parameter_free( param ); | 271 | mailmime_parameter_free( param ); |
271 | err_free: | 272 | err_free: |
272 | qDebug( "buildTxtPart - error" ); | 273 | qDebug( "buildTxtPart - error" ); |
273 | 274 | ||
274 | return NULL; // Error :( | 275 | return NULL; // Error :( |
275 | } | 276 | } |
276 | 277 | ||
277 | mailimf_mailbox *Generatemail::newMailbox(const QString&name, const QString&mail ) { | 278 | mailimf_mailbox *Generatemail::newMailbox(const QString&name, const QString&mail ) { |
278 | return mailimf_mailbox_new( strdup( name.latin1() ), | 279 | return mailimf_mailbox_new( strdup( name.latin1() ), |
279 | strdup( mail.latin1() ) ); | 280 | strdup( mail.latin1() ) ); |
280 | } | 281 | } |
281 | 282 | ||
282 | mailimf_fields *Generatemail::createImfFields(const Opie::OSmartPointer<Mail>&mail ) | 283 | mailimf_fields *Generatemail::createImfFields(const Opie::Core::OSmartPointer<Mail>&mail ) |
283 | { | 284 | { |
284 | mailimf_fields *fields = NULL; | 285 | mailimf_fields *fields = NULL; |
285 | mailimf_field *xmailer = NULL; | 286 | mailimf_field *xmailer = NULL; |
286 | mailimf_mailbox *sender=0,*fromBox=0; | 287 | mailimf_mailbox *sender=0,*fromBox=0; |
287 | mailimf_mailbox_list *from=0; | 288 | mailimf_mailbox_list *from=0; |
288 | mailimf_address_list *to=0, *cc=0, *bcc=0, *reply=0; | 289 | mailimf_address_list *to=0, *cc=0, *bcc=0, *reply=0; |
289 | clist*in_reply_to = 0; | 290 | clist*in_reply_to = 0; |
290 | char *subject = strdup( mail->getSubject().latin1() ); | 291 | char *subject = strdup( mail->getSubject().latin1() ); |
291 | int err; | 292 | int err; |
292 | int res = 1; | 293 | int res = 1; |
293 | 294 | ||
294 | sender = newMailbox( mail->getName(), mail->getMail() ); | 295 | sender = newMailbox( mail->getName(), mail->getMail() ); |
@@ -390,25 +391,25 @@ mailimf_fields *Generatemail::createImfFields(const Opie::OSmartPointer<Mail>&ma | |||
390 | } | 391 | } |
391 | if (sender) { | 392 | if (sender) { |
392 | mailimf_mailbox_free( sender ); | 393 | mailimf_mailbox_free( sender ); |
393 | } | 394 | } |
394 | if (subject) { | 395 | if (subject) { |
395 | free( subject ); | 396 | free( subject ); |
396 | } | 397 | } |
397 | } | 398 | } |
398 | } | 399 | } |
399 | return fields; | 400 | return fields; |
400 | } | 401 | } |
401 | 402 | ||
402 | mailmime *Generatemail::createMimeMail(const Opie::OSmartPointer<Mail> &mail ) { | 403 | mailmime *Generatemail::createMimeMail(const Opie::Core::OSmartPointer<Mail> &mail ) { |
403 | mailmime *message, *txtPart; | 404 | mailmime *message, *txtPart; |
404 | mailimf_fields *fields; | 405 | mailimf_fields *fields; |
405 | int err; | 406 | int err; |
406 | 407 | ||
407 | fields = createImfFields( mail ); | 408 | fields = createImfFields( mail ); |
408 | if ( fields == NULL ) | 409 | if ( fields == NULL ) |
409 | goto err_free; | 410 | goto err_free; |
410 | 411 | ||
411 | message = mailmime_new_message_data( NULL ); | 412 | message = mailmime_new_message_data( NULL ); |
412 | if ( message == NULL ) | 413 | if ( message == NULL ) |
413 | goto err_free_fields; | 414 | goto err_free_fields; |
414 | 415 | ||
diff --git a/noncore/net/mail/libmailwrapper/generatemail.h b/noncore/net/mail/libmailwrapper/generatemail.h index c246a2a..a767b61 100644 --- a/noncore/net/mail/libmailwrapper/generatemail.h +++ b/noncore/net/mail/libmailwrapper/generatemail.h | |||
@@ -27,20 +27,20 @@ public: | |||
27 | virtual ~Generatemail(); | 27 | virtual ~Generatemail(); |
28 | 28 | ||
29 | protected: | 29 | protected: |
30 | static void addRcpts( clist *list, mailimf_address_list *addr_list ); | 30 | static void addRcpts( clist *list, mailimf_address_list *addr_list ); |
31 | static char *getFrom( mailmime *mail ); | 31 | static char *getFrom( mailmime *mail ); |
32 | static char *getFrom( mailimf_field *ffrom); | 32 | static char *getFrom( mailimf_field *ffrom); |
33 | static mailimf_field *getField( mailimf_fields *fields, int type ); | 33 | static mailimf_field *getField( mailimf_fields *fields, int type ); |
34 | mailimf_address_list *parseAddresses(const QString&addr ); | 34 | mailimf_address_list *parseAddresses(const QString&addr ); |
35 | void addFileParts( mailmime *message,const QList<Attachment>&files ); | 35 | void addFileParts( mailmime *message,const QList<Attachment>&files ); |
36 | mailmime *buildFilePart(const QString&filename,const QString&mimetype,const QString&content); | 36 | mailmime *buildFilePart(const QString&filename,const QString&mimetype,const QString&content); |
37 | mailmime *buildTxtPart(const QString&str ); | 37 | mailmime *buildTxtPart(const QString&str ); |
38 | mailimf_mailbox *newMailbox(const QString&name,const QString&mail ); | 38 | mailimf_mailbox *newMailbox(const QString&name,const QString&mail ); |
39 | mailimf_fields *createImfFields(const Opie::OSmartPointer<Mail> &mail ); | 39 | mailimf_fields *createImfFields(const Opie::Core::OSmartPointer<Mail> &mail ); |
40 | mailmime *createMimeMail(const Opie::OSmartPointer<Mail>&mail ); | 40 | mailmime *createMimeMail(const Opie::Core::OSmartPointer<Mail>&mail ); |
41 | clist *createRcptList( mailimf_fields *fields ); | 41 | clist *createRcptList( mailimf_fields *fields ); |
42 | 42 | ||
43 | static const char* USER_AGENT; | 43 | static const char* USER_AGENT; |
44 | }; | 44 | }; |
45 | 45 | ||
46 | #endif | 46 | #endif |
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.cpp b/noncore/net/mail/libmailwrapper/genericwrapper.cpp index ee2c8cd..f428415 100644 --- a/noncore/net/mail/libmailwrapper/genericwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/genericwrapper.cpp | |||
@@ -1,16 +1,17 @@ | |||
1 | #include "genericwrapper.h" | 1 | #include "genericwrapper.h" |
2 | #include <libetpan/libetpan.h> | 2 | #include <libetpan/libetpan.h> |
3 | #include "mailtypes.h" | 3 | #include "mailtypes.h" |
4 | 4 | ||
5 | using namespace Opie::Core; | ||
5 | Genericwrapper::Genericwrapper() | 6 | Genericwrapper::Genericwrapper() |
6 | : AbstractMail() | 7 | : AbstractMail() |
7 | { | 8 | { |
8 | bodyCache.clear(); | 9 | bodyCache.clear(); |
9 | m_storage = 0; | 10 | m_storage = 0; |
10 | m_folder = 0; | 11 | m_folder = 0; |
11 | } | 12 | } |
12 | 13 | ||
13 | Genericwrapper::~Genericwrapper() | 14 | Genericwrapper::~Genericwrapper() |
14 | { | 15 | { |
15 | if (m_folder) { | 16 | if (m_folder) { |
16 | mailfolder_free(m_folder); | 17 | mailfolder_free(m_folder); |
@@ -378,25 +379,25 @@ QStringList Genericwrapper::parseInreplies(mailimf_in_reply_to * in_replies) | |||
378 | h.remove(0,1); | 379 | h.remove(0,1); |
379 | } | 380 | } |
380 | while (h.length()>0 && h[h.length()-1]=='>') { | 381 | while (h.length()>0 && h[h.length()-1]=='>') { |
381 | h.remove(h.length()-1,1); | 382 | h.remove(h.length()-1,1); |
382 | } | 383 | } |
383 | if (h.length()>0) { | 384 | if (h.length()>0) { |
384 | res.append(h); | 385 | res.append(h); |
385 | } | 386 | } |
386 | } | 387 | } |
387 | return res; | 388 | return res; |
388 | } | 389 | } |
389 | 390 | ||
390 | void Genericwrapper::parseList(QValueList<Opie::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to) | 391 | void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to) |
391 | { | 392 | { |
392 | int r; | 393 | int r; |
393 | mailmessage_list * env_list = 0; | 394 | mailmessage_list * env_list = 0; |
394 | r = mailsession_get_messages_list(session,&env_list); | 395 | r = mailsession_get_messages_list(session,&env_list); |
395 | if (r != MAIL_NO_ERROR) { | 396 | if (r != MAIL_NO_ERROR) { |
396 | qDebug("Error message list"); | 397 | qDebug("Error message list"); |
397 | return; | 398 | return; |
398 | } | 399 | } |
399 | r = mailsession_get_envelopes_list(session, env_list); | 400 | r = mailsession_get_envelopes_list(session, env_list); |
400 | if (r != MAIL_NO_ERROR) { | 401 | if (r != MAIL_NO_ERROR) { |
401 | qDebug("Error filling message list"); | 402 | qDebug("Error filling message list"); |
402 | if (env_list) { | 403 | if (env_list) { |
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.h b/noncore/net/mail/libmailwrapper/genericwrapper.h index f9968d1..f5b9504 100644 --- a/noncore/net/mail/libmailwrapper/genericwrapper.h +++ b/noncore/net/mail/libmailwrapper/genericwrapper.h | |||
@@ -29,39 +29,39 @@ struct mailimf_in_reply_to; | |||
29 | */ | 29 | */ |
30 | class Genericwrapper : public AbstractMail | 30 | class Genericwrapper : public AbstractMail |
31 | { | 31 | { |
32 | Q_OBJECT | 32 | Q_OBJECT |
33 | public: | 33 | public: |
34 | Genericwrapper(); | 34 | Genericwrapper(); |
35 | virtual ~Genericwrapper(); | 35 | virtual ~Genericwrapper(); |
36 | 36 | ||
37 | virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPart&part); | 37 | virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPart&part); |
38 | virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPart&part); | 38 | virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPart&part); |
39 | virtual QString fetchTextPart(const RecMailP&mail,const RecPart&part); | 39 | virtual QString fetchTextPart(const RecMailP&mail,const RecPart&part); |
40 | virtual void cleanMimeCache(); | 40 | virtual void cleanMimeCache(); |
41 | virtual int deleteMbox(const Opie::OSmartPointer<Folder>&){return 1;} | 41 | virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&){return 1;} |
42 | virtual void logout(){}; | 42 | virtual void logout(){}; |
43 | virtual void storeMessage(const char*msg,size_t length, const QString&folder){}; | 43 | virtual void storeMessage(const char*msg,size_t length, const QString&folder){}; |
44 | 44 | ||
45 | protected: | 45 | protected: |
46 | RecBody parseMail( mailmessage * msg ); | 46 | RecBody parseMail( mailmessage * msg ); |
47 | QString parseMailboxList( mailimf_mailbox_list *list ); | 47 | QString parseMailboxList( mailimf_mailbox_list *list ); |
48 | QString parseMailbox( mailimf_mailbox *box ); | 48 | QString parseMailbox( mailimf_mailbox *box ); |
49 | QString parseGroup( mailimf_group *group ); | 49 | QString parseGroup( mailimf_group *group ); |
50 | QString parseAddressList( mailimf_address_list *list ); | 50 | QString parseAddressList( mailimf_address_list *list ); |
51 | QString parseDateTime( mailimf_date_time *date ); | 51 | QString parseDateTime( mailimf_date_time *date ); |
52 | 52 | ||
53 | void traverseBody(RecBody&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rek=0,int current_count=1); | 53 | void traverseBody(RecBody&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rek=0,int current_count=1); |
54 | static void fillSingleBody(RecPart&target,mailmessage*message,mailmime*mime); | 54 | static void fillSingleBody(RecPart&target,mailmessage*message,mailmime*mime); |
55 | static void fillParameters(RecPart&target,clist*parameters); | 55 | static void fillParameters(RecPart&target,clist*parameters); |
56 | static QString getencoding(mailmime_mechanism*aEnc); | 56 | static QString getencoding(mailmime_mechanism*aEnc); |
57 | virtual void parseList(QValueList<Opie::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to=false); | 57 | virtual void parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to=false); |
58 | QStringList parseInreplies(mailimf_in_reply_to * in_replies); | 58 | QStringList parseInreplies(mailimf_in_reply_to * in_replies); |
59 | 59 | ||
60 | QString msgTempName; | 60 | QString msgTempName; |
61 | unsigned int last_msg_id; | 61 | unsigned int last_msg_id; |
62 | QMap<QString,encodedString*> bodyCache; | 62 | QMap<QString,encodedString*> bodyCache; |
63 | mailstorage * m_storage; | 63 | mailstorage * m_storage; |
64 | mailfolder*m_folder; | 64 | mailfolder*m_folder; |
65 | }; | 65 | }; |
66 | 66 | ||
67 | #endif | 67 | #endif |
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp index 071e734..56e7df9 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp | |||
@@ -1,20 +1,21 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | #include <libetpan/libetpan.h> | 2 | #include <libetpan/libetpan.h> |
3 | #include <qpe/global.h> | 3 | #include <qpe/global.h> |
4 | 4 | ||
5 | #include "imapwrapper.h" | 5 | #include "imapwrapper.h" |
6 | #include "mailtypes.h" | 6 | #include "mailtypes.h" |
7 | #include "logindialog.h" | 7 | #include "logindialog.h" |
8 | 8 | ||
9 | using namespace Opie::Core; | ||
9 | IMAPwrapper::IMAPwrapper( IMAPaccount *a ) | 10 | IMAPwrapper::IMAPwrapper( IMAPaccount *a ) |
10 | : AbstractMail() | 11 | : AbstractMail() |
11 | { | 12 | { |
12 | account = a; | 13 | account = a; |
13 | m_imap = 0; | 14 | m_imap = 0; |
14 | m_Lastmbox = ""; | 15 | m_Lastmbox = ""; |
15 | } | 16 | } |
16 | 17 | ||
17 | IMAPwrapper::~IMAPwrapper() | 18 | IMAPwrapper::~IMAPwrapper() |
18 | { | 19 | { |
19 | logout(); | 20 | logout(); |
20 | } | 21 | } |
@@ -196,25 +197,25 @@ void IMAPwrapper::login() | |||
196 | 197 | ||
197 | void IMAPwrapper::logout() | 198 | void IMAPwrapper::logout() |
198 | { | 199 | { |
199 | int err = MAILIMAP_NO_ERROR; | 200 | int err = MAILIMAP_NO_ERROR; |
200 | if (!m_imap) return; | 201 | if (!m_imap) return; |
201 | err = mailimap_logout( m_imap ); | 202 | err = mailimap_logout( m_imap ); |
202 | err = mailimap_close( m_imap ); | 203 | err = mailimap_close( m_imap ); |
203 | mailimap_free( m_imap ); | 204 | mailimap_free( m_imap ); |
204 | m_imap = 0; | 205 | m_imap = 0; |
205 | m_Lastmbox = ""; | 206 | m_Lastmbox = ""; |
206 | } | 207 | } |
207 | 208 | ||
208 | void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::OSmartPointer<RecMail> > &target ) | 209 | void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSmartPointer<RecMail> > &target ) |
209 | { | 210 | { |
210 | int err = MAILIMAP_NO_ERROR; | 211 | int err = MAILIMAP_NO_ERROR; |
211 | clist *result = 0; | 212 | clist *result = 0; |
212 | clistcell *current; | 213 | clistcell *current; |
213 | mailimap_fetch_type *fetchType = 0; | 214 | mailimap_fetch_type *fetchType = 0; |
214 | mailimap_set *set = 0; | 215 | mailimap_set *set = 0; |
215 | 216 | ||
216 | login(); | 217 | login(); |
217 | if (!m_imap) { | 218 | if (!m_imap) { |
218 | return; | 219 | return; |
219 | } | 220 | } |
220 | /* select mailbox READONLY for operations */ | 221 | /* select mailbox READONLY for operations */ |
@@ -257,25 +258,25 @@ void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::OSmartPoin | |||
257 | m->setMbox(mailbox); | 258 | m->setMbox(mailbox); |
258 | m->setWrapper(this); | 259 | m->setWrapper(this); |
259 | target.append(m); | 260 | target.append(m); |
260 | } | 261 | } |
261 | } | 262 | } |
262 | Global::statusMessage(tr("Mailbox has %1 mails").arg(target.count())); | 263 | Global::statusMessage(tr("Mailbox has %1 mails").arg(target.count())); |
263 | } else { | 264 | } else { |
264 | Global::statusMessage(tr("Error fetching headers: %1").arg(m_imap->imap_response)); | 265 | Global::statusMessage(tr("Error fetching headers: %1").arg(m_imap->imap_response)); |
265 | } | 266 | } |
266 | if (result) mailimap_fetch_list_free(result); | 267 | if (result) mailimap_fetch_list_free(result); |
267 | } | 268 | } |
268 | 269 | ||
269 | QValueList<Opie::OSmartPointer<Folder> >* IMAPwrapper::listFolders() | 270 | QValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders() |
270 | { | 271 | { |
271 | const char *path, *mask; | 272 | const char *path, *mask; |
272 | int err = MAILIMAP_NO_ERROR; | 273 | int err = MAILIMAP_NO_ERROR; |
273 | clist *result = 0; | 274 | clist *result = 0; |
274 | clistcell *current = 0; | 275 | clistcell *current = 0; |
275 | clistcell*cur_flag = 0; | 276 | clistcell*cur_flag = 0; |
276 | mailimap_mbx_list_flags*bflags = 0; | 277 | mailimap_mbx_list_flags*bflags = 0; |
277 | 278 | ||
278 | QValueList<FolderP>* folders = new QValueList<FolderP>(); | 279 | QValueList<FolderP>* folders = new QValueList<FolderP>(); |
279 | login(); | 280 | login(); |
280 | if (!m_imap) { | 281 | if (!m_imap) { |
281 | return folders; | 282 | return folders; |
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.h b/noncore/net/mail/libmailwrapper/imapwrapper.h index 3bd5967..7448acb 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.h +++ b/noncore/net/mail/libmailwrapper/imapwrapper.h | |||
@@ -14,45 +14,45 @@ struct mailimap_body_type_basic; | |||
14 | struct mailimap_body_type_msg; | 14 | struct mailimap_body_type_msg; |
15 | struct mailimap_body_type_mpart; | 15 | struct mailimap_body_type_mpart; |
16 | struct mailimap_body_fields; | 16 | struct mailimap_body_fields; |
17 | struct mailimap_msg_att; | 17 | struct mailimap_msg_att; |
18 | class encodedString; | 18 | class encodedString; |
19 | 19 | ||
20 | class IMAPwrapper : public AbstractMail | 20 | class IMAPwrapper : public AbstractMail |
21 | { | 21 | { |
22 | Q_OBJECT | 22 | Q_OBJECT |
23 | public: | 23 | public: |
24 | IMAPwrapper( IMAPaccount *a ); | 24 | IMAPwrapper( IMAPaccount *a ); |
25 | virtual ~IMAPwrapper(); | 25 | virtual ~IMAPwrapper(); |
26 | virtual QValueList<Opie::OSmartPointer<Folder> >* listFolders(); | 26 | virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders(); |
27 | virtual void listMessages(const QString & mailbox,QValueList<Opie::OSmartPointer<RecMail> >&target ); | 27 | virtual void listMessages(const QString & mailbox,QValueList<Opie::Core::OSmartPointer<RecMail> >&target ); |
28 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); | 28 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); |
29 | 29 | ||
30 | virtual void deleteMail(const RecMailP&mail); | 30 | virtual void deleteMail(const RecMailP&mail); |
31 | virtual void answeredMail(const RecMailP&mail); | 31 | virtual void answeredMail(const RecMailP&mail); |
32 | virtual int deleteAllMail(const Opie::OSmartPointer<Folder>&folder); | 32 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&folder); |
33 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); | 33 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); |
34 | virtual void mvcpAllMails(const Opie::OSmartPointer<Folder>&fromFolder, | 34 | virtual void mvcpAllMails(const Opie::Core::OSmartPointer<Folder>&fromFolder, |
35 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); | 35 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); |
36 | virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); | 36 | virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); |
37 | 37 | ||
38 | virtual RecBody fetchBody(const RecMailP&mail); | 38 | virtual RecBody fetchBody(const RecMailP&mail); |
39 | virtual QString fetchTextPart(const RecMailP&mail,const RecPart&part); | 39 | virtual QString fetchTextPart(const RecMailP&mail,const RecPart&part); |
40 | virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPart&part); | 40 | virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPart&part); |
41 | virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPart&part); | 41 | virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPart&part); |
42 | virtual encodedString* fetchRawBody(const RecMailP&mail); | 42 | virtual encodedString* fetchRawBody(const RecMailP&mail); |
43 | 43 | ||
44 | virtual int createMbox(const QString&,const Opie::OSmartPointer<Folder>&parentfolder=0, | 44 | virtual int createMbox(const QString&,const Opie::Core::OSmartPointer<Folder>&parentfolder=0, |
45 | const QString& delemiter="/",bool getsubfolder=false); | 45 | const QString& delemiter="/",bool getsubfolder=false); |
46 | virtual int deleteMbox(const Opie::OSmartPointer<Folder>&folder); | 46 | virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&folder); |
47 | 47 | ||
48 | static void imap_progress( size_t current, size_t maximum ); | 48 | static void imap_progress( size_t current, size_t maximum ); |
49 | 49 | ||
50 | virtual void logout(); | 50 | virtual void logout(); |
51 | virtual MAILLIB::ATYPE getType()const; | 51 | virtual MAILLIB::ATYPE getType()const; |
52 | virtual const QString&getName()const; | 52 | virtual const QString&getName()const; |
53 | 53 | ||
54 | protected: | 54 | protected: |
55 | RecMail*parse_list_result(mailimap_msg_att*); | 55 | RecMail*parse_list_result(mailimap_msg_att*); |
56 | void login(); | 56 | void login(); |
57 | bool start_tls(bool force=true); | 57 | bool start_tls(bool force=true); |
58 | 58 | ||
diff --git a/noncore/net/mail/libmailwrapper/mailtypes.cpp b/noncore/net/mail/libmailwrapper/mailtypes.cpp index 7dd7e58..fd91fe5 100644 --- a/noncore/net/mail/libmailwrapper/mailtypes.cpp +++ b/noncore/net/mail/libmailwrapper/mailtypes.cpp | |||
@@ -1,23 +1,24 @@ | |||
1 | #include "mailtypes.h" | 1 | #include "mailtypes.h" |
2 | #include <stdlib.h> | 2 | #include <stdlib.h> |
3 | 3 | ||
4 | using namespace Opie::Core; | ||
4 | RecMail::RecMail() | 5 | RecMail::RecMail() |
5 | :Opie::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7) | 6 | :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7) |
6 | { | 7 | { |
7 | init(); | 8 | init(); |
8 | } | 9 | } |
9 | 10 | ||
10 | RecMail::RecMail(const RecMail&old) | 11 | RecMail::RecMail(const RecMail&old) |
11 | :Opie::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7) | 12 | :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7) |
12 | { | 13 | { |
13 | init(); | 14 | init(); |
14 | copy_old(old); | 15 | copy_old(old); |
15 | qDebug("Copy constructor RecMail"); | 16 | qDebug("Copy constructor RecMail"); |
16 | } | 17 | } |
17 | 18 | ||
18 | RecMail::~RecMail() | 19 | RecMail::~RecMail() |
19 | { | 20 | { |
20 | wrapper = 0; | 21 | wrapper = 0; |
21 | } | 22 | } |
22 | 23 | ||
23 | void RecMail::copy_old(const RecMail&old) | 24 | void RecMail::copy_old(const RecMail&old) |
diff --git a/noncore/net/mail/libmailwrapper/mailtypes.h b/noncore/net/mail/libmailwrapper/mailtypes.h index dc10de6..941556a 100644 --- a/noncore/net/mail/libmailwrapper/mailtypes.h +++ b/noncore/net/mail/libmailwrapper/mailtypes.h | |||
@@ -20,25 +20,25 @@ class AbstractMail; | |||
20 | /* a class to describe mails in a mailbox */ | 20 | /* a class to describe mails in a mailbox */ |
21 | /* Attention! | 21 | /* Attention! |
22 | From programmers point of view it would make sense to | 22 | From programmers point of view it would make sense to |
23 | store the mail body into this class, too. | 23 | store the mail body into this class, too. |
24 | But: not from the point of view of the device. | 24 | But: not from the point of view of the device. |
25 | Mailbodies can be real large. So we request them when | 25 | Mailbodies can be real large. So we request them when |
26 | needed from the mail-wrapper class direct from the server itself | 26 | needed from the mail-wrapper class direct from the server itself |
27 | (imap) or from a file-based cache (pop3?) | 27 | (imap) or from a file-based cache (pop3?) |
28 | So there is no interface "const QString&body()" but you should | 28 | So there is no interface "const QString&body()" but you should |
29 | make a request to the mailwrapper with this class as parameter to | 29 | make a request to the mailwrapper with this class as parameter to |
30 | get the body. Same words for the attachments. | 30 | get the body. Same words for the attachments. |
31 | */ | 31 | */ |
32 | class RecMail:public Opie::ORefCount | 32 | class RecMail:public Opie::Core::ORefCount |
33 | { | 33 | { |
34 | public: | 34 | public: |
35 | RecMail(); | 35 | RecMail(); |
36 | RecMail(const RecMail&old); | 36 | RecMail(const RecMail&old); |
37 | virtual ~RecMail(); | 37 | virtual ~RecMail(); |
38 | 38 | ||
39 | const unsigned int getNumber()const{return msg_number;} | 39 | const unsigned int getNumber()const{return msg_number;} |
40 | void setNumber(unsigned int number){msg_number=number;} | 40 | void setNumber(unsigned int number){msg_number=number;} |
41 | const QString&getDate()const{ return date; } | 41 | const QString&getDate()const{ return date; } |
42 | void setDate( const QString&a ) { date = a; } | 42 | void setDate( const QString&a ) { date = a; } |
43 | const QString&getFrom()const{ return from; } | 43 | const QString&getFrom()const{ return from; } |
44 | void setFrom( const QString&a ) { from = a; } | 44 | void setFrom( const QString&a ) { from = a; } |
@@ -72,25 +72,25 @@ public: | |||
72 | AbstractMail* Wrapper(); | 72 | AbstractMail* Wrapper(); |
73 | 73 | ||
74 | protected: | 74 | protected: |
75 | QString subject,date,from,mbox,msg_id,replyto; | 75 | QString subject,date,from,mbox,msg_id,replyto; |
76 | unsigned int msg_number,msg_size; | 76 | unsigned int msg_number,msg_size; |
77 | QBitArray msg_flags; | 77 | QBitArray msg_flags; |
78 | QStringList to,cc,bcc,in_reply_to,references; | 78 | QStringList to,cc,bcc,in_reply_to,references; |
79 | AbstractMail*wrapper; | 79 | AbstractMail*wrapper; |
80 | void init(); | 80 | void init(); |
81 | void copy_old(const RecMail&old); | 81 | void copy_old(const RecMail&old); |
82 | }; | 82 | }; |
83 | 83 | ||
84 | typedef Opie::OSmartPointer<RecMail> RecMailP; | 84 | typedef Opie::Core::OSmartPointer<RecMail> RecMailP; |
85 | typedef QMap<QString,QString> part_plist_t; | 85 | typedef QMap<QString,QString> part_plist_t; |
86 | 86 | ||
87 | class RecPart | 87 | class RecPart |
88 | { | 88 | { |
89 | protected: | 89 | protected: |
90 | QString m_type,m_subtype,m_identifier,m_encoding,m_description; | 90 | QString m_type,m_subtype,m_identifier,m_encoding,m_description; |
91 | unsigned int m_lines,m_size; | 91 | unsigned int m_lines,m_size; |
92 | part_plist_t m_Parameters; | 92 | part_plist_t m_Parameters; |
93 | /* describes the position in the mail */ | 93 | /* describes the position in the mail */ |
94 | QValueList<int> m_poslist; | 94 | QValueList<int> m_poslist; |
95 | 95 | ||
96 | public: | 96 | public: |
diff --git a/noncore/net/mail/libmailwrapper/mailwrapper.cpp b/noncore/net/mail/libmailwrapper/mailwrapper.cpp index 9bf2fd3..eddc0b9 100644 --- a/noncore/net/mail/libmailwrapper/mailwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mailwrapper.cpp | |||
@@ -12,24 +12,25 @@ | |||
12 | 12 | ||
13 | #define UNDEFINED 64 | 13 | #define UNDEFINED 64 |
14 | #define MAXLINE 76 | 14 | #define MAXLINE 76 |
15 | #define UTF16MASK 0x03FFUL | 15 | #define UTF16MASK 0x03FFUL |
16 | #define UTF16SHIFT 10 | 16 | #define UTF16SHIFT 10 |
17 | #define UTF16BASE 0x10000UL | 17 | #define UTF16BASE 0x10000UL |
18 | #define UTF16HIGHSTART 0xD800UL | 18 | #define UTF16HIGHSTART 0xD800UL |
19 | #define UTF16HIGHEND 0xDBFFUL | 19 | #define UTF16HIGHEND 0xDBFFUL |
20 | #define UTF16LOSTART 0xDC00UL | 20 | #define UTF16LOSTART 0xDC00UL |
21 | #define UTF16LOEND 0xDFFFUL | 21 | #define UTF16LOEND 0xDFFFUL |
22 | 22 | ||
23 | 23 | ||
24 | using namespace Opie::Core; | ||
24 | Attachment::Attachment( DocLnk lnk ) | 25 | Attachment::Attachment( DocLnk lnk ) |
25 | { | 26 | { |
26 | doc = lnk; | 27 | doc = lnk; |
27 | size = QFileInfo( doc.file() ).size(); | 28 | size = QFileInfo( doc.file() ).size(); |
28 | } | 29 | } |
29 | 30 | ||
30 | Folder::Folder(const QString&tmp_name, const QString&sep ) | 31 | Folder::Folder(const QString&tmp_name, const QString&sep ) |
31 | { | 32 | { |
32 | name = tmp_name; | 33 | name = tmp_name; |
33 | nameDisplay = name; | 34 | nameDisplay = name; |
34 | separator = sep; | 35 | separator = sep; |
35 | prefix = ""; | 36 | prefix = ""; |
@@ -146,25 +147,25 @@ QString IMAPFolder::decodeFolderName( const QString &name ) | |||
146 | } | 147 | } |
147 | } | 148 | } |
148 | /* skip over trailing '-' in modified UTF-7 encoding */ | 149 | /* skip over trailing '-' in modified UTF-7 encoding */ |
149 | if (src[srcPtr] == '-') | 150 | if (src[srcPtr] == '-') |
150 | ++srcPtr; | 151 | ++srcPtr; |
151 | } | 152 | } |
152 | } | 153 | } |
153 | 154 | ||
154 | return QString::fromUtf8( dst.data() ); | 155 | return QString::fromUtf8( dst.data() ); |
155 | } | 156 | } |
156 | 157 | ||
157 | Mail::Mail() | 158 | Mail::Mail() |
158 | :Opie::ORefCount(),name(""), mail(""), to(""), cc(""), bcc(""), reply(""), subject(""), message("") | 159 | :Opie::Core::ORefCount(),name(""), mail(""), to(""), cc(""), bcc(""), reply(""), subject(""), message("") |
159 | { | 160 | { |
160 | } | 161 | } |
161 | 162 | ||
162 | MHFolder::MHFolder(const QString&disp_name,const QString&mbox) | 163 | MHFolder::MHFolder(const QString&disp_name,const QString&mbox) |
163 | : Folder( disp_name,"/" ) | 164 | : Folder( disp_name,"/" ) |
164 | { | 165 | { |
165 | separator = "/"; | 166 | separator = "/"; |
166 | name = mbox; | 167 | name = mbox; |
167 | if (!disp_name.startsWith("/") && disp_name.length()>0) | 168 | if (!disp_name.startsWith("/") && disp_name.length()>0) |
168 | name+="/"; | 169 | name+="/"; |
169 | name+=disp_name; | 170 | name+=disp_name; |
170 | if (disp_name.length()==0) { | 171 | if (disp_name.length()==0) { |
diff --git a/noncore/net/mail/libmailwrapper/mailwrapper.h b/noncore/net/mail/libmailwrapper/mailwrapper.h index 6bf0078..542de03 100644 --- a/noncore/net/mail/libmailwrapper/mailwrapper.h +++ b/noncore/net/mail/libmailwrapper/mailwrapper.h | |||
@@ -19,25 +19,25 @@ public: | |||
19 | const QString getName()const{ return doc.name(); } | 19 | const QString getName()const{ return doc.name(); } |
20 | const QString getMimeType()const{ return doc.type(); } | 20 | const QString getMimeType()const{ return doc.type(); } |
21 | const QPixmap getPixmap()const{ return doc.pixmap(); } | 21 | const QPixmap getPixmap()const{ return doc.pixmap(); } |
22 | const int getSize()const { return size; } | 22 | const int getSize()const { return size; } |
23 | DocLnk getDocLnk() { return doc; } | 23 | DocLnk getDocLnk() { return doc; } |
24 | 24 | ||
25 | protected: | 25 | protected: |
26 | DocLnk doc; | 26 | DocLnk doc; |
27 | int size; | 27 | int size; |
28 | 28 | ||
29 | }; | 29 | }; |
30 | 30 | ||
31 | class Mail:public Opie::ORefCount | 31 | class Mail:public Opie::Core::ORefCount |
32 | { | 32 | { |
33 | public: | 33 | public: |
34 | Mail(); | 34 | Mail(); |
35 | /* Possible that this destructor must not be declared virtual | 35 | /* Possible that this destructor must not be declared virtual |
36 | * 'cause it seems that it will never have some child classes. | 36 | * 'cause it seems that it will never have some child classes. |
37 | * in this case this object will not get a virtual table -> memory and | 37 | * in this case this object will not get a virtual table -> memory and |
38 | * speed will be a little bit better? | 38 | * speed will be a little bit better? |
39 | */ | 39 | */ |
40 | virtual ~Mail(){} | 40 | virtual ~Mail(){} |
41 | void addAttachment( Attachment *att ) { attList.append( att ); } | 41 | void addAttachment( Attachment *att ) { attList.append( att ); } |
42 | const QList<Attachment>& getAttachments()const { return attList; } | 42 | const QList<Attachment>& getAttachments()const { return attList; } |
43 | void removeAttachment( Attachment *att ) { attList.remove( att ); } | 43 | void removeAttachment( Attachment *att ) { attList.remove( att ); } |
@@ -57,41 +57,41 @@ public: | |||
57 | void setSubject( const QString&s ) { subject = s; } | 57 | void setSubject( const QString&s ) { subject = s; } |
58 | const QString&getReply()const{ return reply; } | 58 | const QString&getReply()const{ return reply; } |
59 | void setReply( const QString&a ) { reply = a; } | 59 | void setReply( const QString&a ) { reply = a; } |
60 | void setInreply(const QStringList&list){m_in_reply_to = list;} | 60 | void setInreply(const QStringList&list){m_in_reply_to = list;} |
61 | const QStringList&Inreply()const{return m_in_reply_to;} | 61 | const QStringList&Inreply()const{return m_in_reply_to;} |
62 | 62 | ||
63 | private: | 63 | private: |
64 | QList<Attachment> attList; | 64 | QList<Attachment> attList; |
65 | QString name, mail, to, cc, bcc, reply, subject, message; | 65 | QString name, mail, to, cc, bcc, reply, subject, message; |
66 | QStringList m_in_reply_to; | 66 | QStringList m_in_reply_to; |
67 | }; | 67 | }; |
68 | 68 | ||
69 | class Folder:public Opie::ORefCount | 69 | class Folder:public Opie::Core::ORefCount |
70 | { | 70 | { |
71 | public: | 71 | public: |
72 | Folder( const QString&init_name,const QString&sep ); | 72 | Folder( const QString&init_name,const QString&sep ); |
73 | virtual ~Folder(); | 73 | virtual ~Folder(); |
74 | const QString&getDisplayName()const { return nameDisplay; } | 74 | const QString&getDisplayName()const { return nameDisplay; } |
75 | const QString&getName()const { return name; } | 75 | const QString&getName()const { return name; } |
76 | const QString&getPrefix()const{return prefix; } | 76 | const QString&getPrefix()const{return prefix; } |
77 | virtual bool may_select()const{return true;} | 77 | virtual bool may_select()const{return true;} |
78 | virtual bool no_inferior()const{return true;} | 78 | virtual bool no_inferior()const{return true;} |
79 | const QString&Separator()const; | 79 | const QString&Separator()const; |
80 | 80 | ||
81 | protected: | 81 | protected: |
82 | QString nameDisplay, name, separator,prefix; | 82 | QString nameDisplay, name, separator,prefix; |
83 | }; | 83 | }; |
84 | 84 | ||
85 | typedef Opie::OSmartPointer<Folder> FolderP; | 85 | typedef Opie::Core::OSmartPointer<Folder> FolderP; |
86 | 86 | ||
87 | class MHFolder : public Folder | 87 | class MHFolder : public Folder |
88 | { | 88 | { |
89 | public: | 89 | public: |
90 | MHFolder(const QString&disp_name,const QString&mbox); | 90 | MHFolder(const QString&disp_name,const QString&mbox); |
91 | virtual ~MHFolder(); | 91 | virtual ~MHFolder(); |
92 | }; | 92 | }; |
93 | 93 | ||
94 | class IMAPFolder : public Folder | 94 | class IMAPFolder : public Folder |
95 | { | 95 | { |
96 | public: | 96 | public: |
97 | IMAPFolder(const QString&name, const QString&sep, bool select=true,bool noinf=false,const QString&prefix="" ); | 97 | IMAPFolder(const QString&name, const QString&sep, bool select=true,bool noinf=false,const QString&prefix="" ); |
diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp index 5e6b714..4aee0be 100644 --- a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp | |||
@@ -1,20 +1,21 @@ | |||
1 | #include "mboxwrapper.h" | 1 | #include "mboxwrapper.h" |
2 | #include "mailtypes.h" | 2 | #include "mailtypes.h" |
3 | #include "mailwrapper.h" | 3 | #include "mailwrapper.h" |
4 | #include <libetpan/libetpan.h> | 4 | #include <libetpan/libetpan.h> |
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 | using namespace Opie::Core; | ||
9 | MBOXwrapper::MBOXwrapper(const QString & mbox_dir,const QString&mbox_name) | 10 | MBOXwrapper::MBOXwrapper(const QString & mbox_dir,const QString&mbox_name) |
10 | : Genericwrapper(),MBOXPath(mbox_dir),MBOXName(mbox_name) | 11 | : Genericwrapper(),MBOXPath(mbox_dir),MBOXName(mbox_name) |
11 | { | 12 | { |
12 | QDir dir(MBOXPath); | 13 | QDir dir(MBOXPath); |
13 | if (!dir.exists()) { | 14 | if (!dir.exists()) { |
14 | dir.mkdir(MBOXPath); | 15 | dir.mkdir(MBOXPath); |
15 | } | 16 | } |
16 | } | 17 | } |
17 | 18 | ||
18 | MBOXwrapper::~MBOXwrapper() | 19 | MBOXwrapper::~MBOXwrapper() |
19 | { | 20 | { |
20 | } | 21 | } |
@@ -35,27 +36,27 @@ void MBOXwrapper::listMessages(const QString & mailbox, QValueList<RecMailP> &ta | |||
35 | mailstorage_free(storage); | 36 | mailstorage_free(storage); |
36 | return; | 37 | return; |
37 | } | 38 | } |
38 | 39 | ||
39 | parseList(target,folder->fld_session,mailbox); | 40 | parseList(target,folder->fld_session,mailbox); |
40 | 41 | ||
41 | mailfolder_disconnect(folder); | 42 | mailfolder_disconnect(folder); |
42 | mailfolder_free(folder); | 43 | mailfolder_free(folder); |
43 | mailstorage_free(storage); | 44 | mailstorage_free(storage); |
44 | Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count())); | 45 | Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count())); |
45 | } | 46 | } |
46 | 47 | ||
47 | QValueList<Opie::OSmartPointer<Folder> >* MBOXwrapper::listFolders() | 48 | QValueList<Opie::Core::OSmartPointer<Folder> >* MBOXwrapper::listFolders() |
48 | { | 49 | { |
49 | QValueList<Opie::OSmartPointer<Folder> >* folders = new QValueList<Opie::OSmartPointer<Folder> >(); | 50 | QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<Opie::Core::OSmartPointer<Folder> >(); |
50 | QDir dir(MBOXPath); | 51 | QDir dir(MBOXPath); |
51 | if (!dir.exists()) return folders; | 52 | if (!dir.exists()) return folders; |
52 | dir.setFilter(QDir::Files|QDir::Writable|QDir::Readable); | 53 | dir.setFilter(QDir::Files|QDir::Writable|QDir::Readable); |
53 | QStringList entries = dir.entryList(); | 54 | QStringList entries = dir.entryList(); |
54 | QStringList::ConstIterator it = entries.begin(); | 55 | QStringList::ConstIterator it = entries.begin(); |
55 | for (;it!=entries.end();++it) { | 56 | for (;it!=entries.end();++it) { |
56 | FolderP inb=new Folder(*it,"/"); | 57 | FolderP inb=new Folder(*it,"/"); |
57 | folders->append(inb); | 58 | folders->append(inb); |
58 | } | 59 | } |
59 | return folders; | 60 | return folders; |
60 | } | 61 | } |
61 | 62 | ||
diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.h b/noncore/net/mail/libmailwrapper/mboxwrapper.h index 33eeb1e..a2ecfee 100644 --- a/noncore/net/mail/libmailwrapper/mboxwrapper.h +++ b/noncore/net/mail/libmailwrapper/mboxwrapper.h | |||
@@ -7,40 +7,40 @@ | |||
7 | class encodedString; | 7 | class encodedString; |
8 | struct mailmbox_folder; | 8 | struct mailmbox_folder; |
9 | 9 | ||
10 | class MBOXwrapper : public Genericwrapper | 10 | class MBOXwrapper : public Genericwrapper |
11 | { | 11 | { |
12 | Q_OBJECT | 12 | Q_OBJECT |
13 | 13 | ||
14 | public: | 14 | public: |
15 | MBOXwrapper(const QString & dir,const QString&name); | 15 | MBOXwrapper(const QString & dir,const QString&name); |
16 | virtual ~MBOXwrapper(); | 16 | virtual ~MBOXwrapper(); |
17 | 17 | ||
18 | virtual void listMessages(const QString & mailbox, QValueList<RecMailP>&target ); | 18 | virtual void listMessages(const QString & mailbox, QValueList<RecMailP>&target ); |
19 | virtual QValueList<Opie::OSmartPointer<Folder> >* listFolders(); | 19 | virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders(); |
20 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); | 20 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); |
21 | 21 | ||
22 | virtual void deleteMail(const RecMailP&mail); | 22 | virtual void deleteMail(const RecMailP&mail); |
23 | virtual void answeredMail(const RecMailP&mail); | 23 | virtual void answeredMail(const RecMailP&mail); |
24 | 24 | ||
25 | virtual int createMbox(const QString&folder,const Opie::OSmartPointer<Folder>&f=0, | 25 | virtual int createMbox(const QString&folder,const Opie::Core::OSmartPointer<Folder>&f=0, |
26 | const QString&d="",bool s=false); | 26 | const QString&d="",bool s=false); |
27 | virtual int deleteMbox(const Opie::OSmartPointer<Folder>&); | 27 | virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&); |
28 | 28 | ||
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 RecMailP &mail ); | 31 | virtual RecBody fetchBody( const RecMailP &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 RecMailP&mail); | 34 | virtual encodedString* fetchRawBody(const RecMailP&mail); |
35 | virtual void deleteMails(const QString & FolderName,const QValueList<RecMailP> &target); | 35 | virtual void deleteMails(const QString & FolderName,const QValueList<RecMailP> &target); |
36 | virtual int deleteAllMail(const Opie::OSmartPointer<Folder>&); | 36 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&); |
37 | virtual MAILLIB::ATYPE getType()const; | 37 | virtual MAILLIB::ATYPE getType()const; |
38 | virtual const QString&getName()const; | 38 | virtual const QString&getName()const; |
39 | 39 | ||
40 | protected: | 40 | protected: |
41 | static void deleteMails(mailmbox_folder*f,const QValueList<RecMailP> &target); | 41 | static void deleteMails(mailmbox_folder*f,const QValueList<RecMailP> &target); |
42 | QString MBOXPath; | 42 | QString MBOXPath; |
43 | QString MBOXName; | 43 | QString MBOXName; |
44 | }; | 44 | }; |
45 | 45 | ||
46 | #endif | 46 | #endif |
diff --git a/noncore/net/mail/libmailwrapper/mhwrapper.cpp b/noncore/net/mail/libmailwrapper/mhwrapper.cpp index 0b00a2e..21e24a0 100644 --- a/noncore/net/mail/libmailwrapper/mhwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mhwrapper.cpp | |||
@@ -1,22 +1,25 @@ | |||
1 | #include "mhwrapper.h" | 1 | #include "mhwrapper.h" |
2 | #include "mailtypes.h" | 2 | #include "mailtypes.h" |
3 | #include "mailwrapper.h" | 3 | #include "mailwrapper.h" |
4 | #include <libetpan/libetpan.h> | 4 | #include <libetpan/libetpan.h> |
5 | #include <qdir.h> | 5 | #include <qdir.h> |
6 | #include <qmessagebox.h> | 6 | #include <qmessagebox.h> |
7 | #include <stdlib.h> | 7 | #include <stdlib.h> |
8 | #include <qpe/global.h> | 8 | #include <qpe/global.h> |
9 | #include <opie2/oprocess.h> | 9 | #include <opie2/oprocess.h> |
10 | 10 | ||
11 | using namespace Opie::Core; | ||
12 | using namespace Opie::Core; | ||
13 | using namespace Opie::Core; | ||
11 | MHwrapper::MHwrapper(const QString & mbox_dir,const QString&mbox_name) | 14 | MHwrapper::MHwrapper(const QString & mbox_dir,const QString&mbox_name) |
12 | : Genericwrapper(),MHPath(mbox_dir),MHName(mbox_name) | 15 | : Genericwrapper(),MHPath(mbox_dir),MHName(mbox_name) |
13 | { | 16 | { |
14 | if (MHPath.length()>0) { | 17 | if (MHPath.length()>0) { |
15 | if (MHPath[MHPath.length()-1]=='/') { | 18 | if (MHPath[MHPath.length()-1]=='/') { |
16 | MHPath=MHPath.left(MHPath.length()-1); | 19 | MHPath=MHPath.left(MHPath.length()-1); |
17 | } | 20 | } |
18 | qDebug(MHPath); | 21 | qDebug(MHPath); |
19 | QDir dir(MHPath); | 22 | QDir dir(MHPath); |
20 | if (!dir.exists()) { | 23 | if (!dir.exists()) { |
21 | dir.mkdir(MHPath); | 24 | dir.mkdir(MHPath); |
22 | } | 25 | } |
@@ -51,43 +54,43 @@ void MHwrapper::clean_storage() | |||
51 | if (m_storage) { | 54 | if (m_storage) { |
52 | mailstorage_disconnect(m_storage); | 55 | mailstorage_disconnect(m_storage); |
53 | mailstorage_free(m_storage); | 56 | mailstorage_free(m_storage); |
54 | m_storage = 0; | 57 | m_storage = 0; |
55 | } | 58 | } |
56 | } | 59 | } |
57 | 60 | ||
58 | MHwrapper::~MHwrapper() | 61 | MHwrapper::~MHwrapper() |
59 | { | 62 | { |
60 | clean_storage(); | 63 | clean_storage(); |
61 | } | 64 | } |
62 | 65 | ||
63 | void MHwrapper::listMessages(const QString & mailbox, QValueList<Opie::OSmartPointer<RecMail> > &target ) | 66 | void MHwrapper::listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target ) |
64 | { | 67 | { |
65 | init_storage(); | 68 | init_storage(); |
66 | if (!m_storage) { | 69 | if (!m_storage) { |
67 | return; | 70 | return; |
68 | } | 71 | } |
69 | QString f = buildPath(mailbox); | 72 | QString f = buildPath(mailbox); |
70 | int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); | 73 | int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); |
71 | if (r!=MAIL_NO_ERROR) { | 74 | if (r!=MAIL_NO_ERROR) { |
72 | qDebug("listMessages: error selecting folder!"); | 75 | qDebug("listMessages: error selecting folder!"); |
73 | return; | 76 | return; |
74 | } | 77 | } |
75 | parseList(target,m_storage->sto_session,f); | 78 | parseList(target,m_storage->sto_session,f); |
76 | Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count())); | 79 | Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count())); |
77 | } | 80 | } |
78 | 81 | ||
79 | QValueList<Opie::OSmartPointer<Folder> >* MHwrapper::listFolders() | 82 | QValueList<Opie::Core::OSmartPointer<Folder> >* MHwrapper::listFolders() |
80 | { | 83 | { |
81 | QValueList<Opie::OSmartPointer<Folder> >* folders = new QValueList<Opie::OSmartPointer<Folder> >(); | 84 | QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<Opie::Core::OSmartPointer<Folder> >(); |
82 | /* this is needed! */ | 85 | /* this is needed! */ |
83 | if (m_storage) mailstorage_disconnect(m_storage); | 86 | if (m_storage) mailstorage_disconnect(m_storage); |
84 | init_storage(); | 87 | init_storage(); |
85 | if (!m_storage) { | 88 | if (!m_storage) { |
86 | return folders; | 89 | return folders; |
87 | } | 90 | } |
88 | mail_list*flist = 0; | 91 | mail_list*flist = 0; |
89 | clistcell*current=0; | 92 | clistcell*current=0; |
90 | int r = mailsession_list_folders(m_storage->sto_session,NULL,&flist); | 93 | int r = mailsession_list_folders(m_storage->sto_session,NULL,&flist); |
91 | if (r != MAIL_NO_ERROR || !flist) { | 94 | if (r != MAIL_NO_ERROR || !flist) { |
92 | qDebug("error getting folder list"); | 95 | qDebug("error getting folder list"); |
93 | return folders; | 96 | return folders; |
@@ -308,27 +311,27 @@ int MHwrapper::deleteMbox(const FolderP&tfolder) | |||
308 | 311 | ||
309 | if (r != MAIL_NO_ERROR) { | 312 | if (r != MAIL_NO_ERROR) { |
310 | qDebug("error deleting mail box"); | 313 | qDebug("error deleting mail box"); |
311 | return 0; | 314 | return 0; |
312 | } | 315 | } |
313 | QString cmd = "rm -rf "+tfolder->getName(); | 316 | QString cmd = "rm -rf "+tfolder->getName(); |
314 | QStringList command; | 317 | QStringList command; |
315 | command << "/bin/sh"; | 318 | command << "/bin/sh"; |
316 | command << "-c"; | 319 | command << "-c"; |
317 | command << cmd.latin1(); | 320 | command << cmd.latin1(); |
318 | OProcess *process = new OProcess(); | 321 | OProcess *process = new OProcess(); |
319 | 322 | ||
320 | connect(process, SIGNAL(processExited(OProcess*)), | 323 | connect(process, SIGNAL(processExited(Opie::Core::OProcess*)), |
321 | this, SLOT( processEnded(OProcess*))); | 324 | this, SLOT( processEnded(OProcess*))); |
322 | connect(process, SIGNAL( receivedStderr(OProcess*,char*,int)), | 325 | connect(process, SIGNAL( receivedStderr(Opie::Core::OProcess*,char*,int)), |
323 | this, SLOT( oprocessStderr(OProcess*,char*,int))); | 326 | this, SLOT( oprocessStderr(OProcess*,char*,int))); |
324 | 327 | ||
325 | *process << command; | 328 | *process << command; |
326 | removeMboxfailed = false; | 329 | removeMboxfailed = false; |
327 | if(!process->start(OProcess::Block, OProcess::All) ) { | 330 | if(!process->start(OProcess::Block, OProcess::All) ) { |
328 | qDebug("could not start process"); | 331 | qDebug("could not start process"); |
329 | return 0; | 332 | return 0; |
330 | } | 333 | } |
331 | qDebug("mail box deleted"); | 334 | qDebug("mail box deleted"); |
332 | return 1; | 335 | return 1; |
333 | } | 336 | } |
334 | 337 | ||
diff --git a/noncore/net/mail/libmailwrapper/mhwrapper.h b/noncore/net/mail/libmailwrapper/mhwrapper.h index 208cf2f..1245507 100644 --- a/noncore/net/mail/libmailwrapper/mhwrapper.h +++ b/noncore/net/mail/libmailwrapper/mhwrapper.h | |||
@@ -1,60 +1,60 @@ | |||
1 | #ifndef __MH_WRAPPER_H | 1 | #ifndef __MH_WRAPPER_H |
2 | #define __MH_WRAPPER_H | 2 | #define __MH_WRAPPER_H |
3 | 3 | ||
4 | #include "maildefines.h" | 4 | #include "maildefines.h" |
5 | 5 | ||
6 | #include "genericwrapper.h" | 6 | #include "genericwrapper.h" |
7 | #include <qstring.h> | 7 | #include <qstring.h> |
8 | 8 | ||
9 | class encodedString; | 9 | class encodedString; |
10 | struct mailmbox_folder; | 10 | struct mailmbox_folder; |
11 | class OProcess; | 11 | namespace Opie {namespace Core {class Opie::Core::OProcess;}} |
12 | 12 | ||
13 | class MHwrapper : public Genericwrapper | 13 | class MHwrapper : public Genericwrapper |
14 | { | 14 | { |
15 | Q_OBJECT | 15 | Q_OBJECT |
16 | public: | 16 | public: |
17 | MHwrapper(const QString & dir,const QString&name); | 17 | MHwrapper(const QString & dir,const QString&name); |
18 | virtual ~MHwrapper(); | 18 | virtual ~MHwrapper(); |
19 | 19 | ||
20 | virtual void listMessages(const QString & mailbox, QValueList<Opie::OSmartPointer<RecMail> > &target ); | 20 | virtual void listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target ); |
21 | virtual QValueList<Opie::OSmartPointer<Folder> >* listFolders(); | 21 | virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders(); |
22 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); | 22 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); |
23 | 23 | ||
24 | virtual void deleteMail(const RecMailP&mail); | 24 | virtual void deleteMail(const RecMailP&mail); |
25 | virtual void answeredMail(const RecMailP&mail); | 25 | virtual void answeredMail(const RecMailP&mail); |
26 | virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); | 26 | virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); |
27 | virtual void mvcpAllMails(const Opie::OSmartPointer<Folder>&fromFolder, | 27 | virtual void mvcpAllMails(const Opie::Core::OSmartPointer<Folder>&fromFolder, |
28 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); | 28 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); |
29 | 29 | ||
30 | virtual int createMbox(const QString&folder,const Opie::OSmartPointer<Folder>&f=0, | 30 | virtual int createMbox(const QString&folder,const Opie::Core::OSmartPointer<Folder>&f=0, |
31 | const QString&d="",bool s=false); | 31 | const QString&d="",bool s=false); |
32 | virtual int deleteMbox(const Opie::OSmartPointer<Folder>&); | 32 | virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&); |
33 | 33 | ||
34 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); | 34 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); |
35 | 35 | ||
36 | virtual RecBody fetchBody( const RecMailP &mail ); | 36 | virtual RecBody fetchBody( const RecMailP &mail ); |
37 | static void mbox_progress( size_t current, size_t maximum ); | 37 | static void mbox_progress( size_t current, size_t maximum ); |
38 | 38 | ||
39 | virtual encodedString* fetchRawBody(const RecMailP&mail); | 39 | virtual encodedString* fetchRawBody(const RecMailP&mail); |
40 | virtual void deleteMails(const QString & FolderName,const QValueList<Opie::OSmartPointer<RecMail> > &target); | 40 | virtual void deleteMails(const QString & FolderName,const QValueList<Opie::Core::OSmartPointer<RecMail> > &target); |
41 | virtual int deleteAllMail(const Opie::OSmartPointer<Folder>&); | 41 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&); |
42 | virtual MAILLIB::ATYPE getType()const; | 42 | virtual MAILLIB::ATYPE getType()const; |
43 | virtual const QString&getName()const; | 43 | virtual const QString&getName()const; |
44 | 44 | ||
45 | public slots: | 45 | public slots: |
46 | /* for deleting maildirs we are using a system call */ | 46 | /* for deleting maildirs we are using a system call */ |
47 | virtual void oprocessStderr(OProcess*, char *buffer, int ); | 47 | virtual void oprocessStderr(Opie::Core::OProcess*, char *buffer, int ); |
48 | virtual void processEnded(OProcess *); | 48 | virtual void processEnded(Opie::Core::OProcess *); |
49 | protected: | 49 | protected: |
50 | QString buildPath(const QString&p); | 50 | QString buildPath(const QString&p); |
51 | QString MHPath; | 51 | QString MHPath; |
52 | QString MHName; | 52 | QString MHName; |
53 | 53 | ||
54 | void init_storage(); | 54 | void init_storage(); |
55 | void clean_storage(); | 55 | void clean_storage(); |
56 | 56 | ||
57 | bool removeMboxfailed; | 57 | bool removeMboxfailed; |
58 | }; | 58 | }; |
59 | 59 | ||
60 | #endif | 60 | #endif |
diff --git a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp index c0b3eec..9de958d 100644 --- a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp | |||
@@ -2,24 +2,25 @@ | |||
2 | #include "logindialog.h" | 2 | #include "logindialog.h" |
3 | #include "mailtypes.h" | 3 | #include "mailtypes.h" |
4 | 4 | ||
5 | #include <qfile.h> | 5 | #include <qfile.h> |
6 | 6 | ||
7 | #include <stdlib.h> | 7 | #include <stdlib.h> |
8 | 8 | ||
9 | #include <libetpan/libetpan.h> | 9 | #include <libetpan/libetpan.h> |
10 | 10 | ||
11 | 11 | ||
12 | #define HARD_MSG_SIZE_LIMIT 5242880 | 12 | #define HARD_MSG_SIZE_LIMIT 5242880 |
13 | 13 | ||
14 | using namespace Opie::Core; | ||
14 | NNTPwrapper::NNTPwrapper( NNTPaccount *a ) | 15 | NNTPwrapper::NNTPwrapper( NNTPaccount *a ) |
15 | : Genericwrapper() { | 16 | : Genericwrapper() { |
16 | account = a; | 17 | account = a; |
17 | m_nntp = NULL; | 18 | m_nntp = NULL; |
18 | msgTempName = a->getFileName()+"_msg_cache"; | 19 | msgTempName = a->getFileName()+"_msg_cache"; |
19 | last_msg_id = 0; | 20 | last_msg_id = 0; |
20 | } | 21 | } |
21 | 22 | ||
22 | NNTPwrapper::~NNTPwrapper() { | 23 | NNTPwrapper::~NNTPwrapper() { |
23 | logout(); | 24 | logout(); |
24 | QFile msg_cache(msgTempName); | 25 | QFile msg_cache(msgTempName); |
25 | if (msg_cache.exists()) { | 26 | if (msg_cache.exists()) { |
@@ -87,25 +88,25 @@ RecBody NNTPwrapper::fetchBody( const RecMailP &mail ) { | |||
87 | body = parseMail(mailmsg); | 88 | body = parseMail(mailmsg); |
88 | 89 | ||
89 | /* clean up */ | 90 | /* clean up */ |
90 | if (mailmsg) | 91 | if (mailmsg) |
91 | mailmessage_free(mailmsg); | 92 | mailmessage_free(mailmsg); |
92 | if (message) | 93 | if (message) |
93 | free(message); | 94 | free(message); |
94 | 95 | ||
95 | return body; | 96 | return body; |
96 | } | 97 | } |
97 | 98 | ||
98 | 99 | ||
99 | void NNTPwrapper::listMessages(const QString & which, QValueList<Opie::OSmartPointer<RecMail> > &target ) | 100 | void NNTPwrapper::listMessages(const QString & which, QValueList<Opie::Core::OSmartPointer<RecMail> > &target ) |
100 | { | 101 | { |
101 | login(); | 102 | login(); |
102 | if (!m_nntp) | 103 | if (!m_nntp) |
103 | return; | 104 | return; |
104 | uint32_t res_messages,res_recent,res_unseen; | 105 | uint32_t res_messages,res_recent,res_unseen; |
105 | mailsession_status_folder(m_nntp->sto_session,(char*)which.latin1(),&res_messages,&res_recent,&res_unseen); | 106 | mailsession_status_folder(m_nntp->sto_session,(char*)which.latin1(),&res_messages,&res_recent,&res_unseen); |
106 | parseList(target,m_nntp->sto_session,which,true); | 107 | parseList(target,m_nntp->sto_session,which,true); |
107 | } | 108 | } |
108 | 109 | ||
109 | void NNTPwrapper::login() | 110 | void NNTPwrapper::login() |
110 | { | 111 | { |
111 | if (account->getOffline()) | 112 | if (account->getOffline()) |
@@ -179,27 +180,27 @@ void NNTPwrapper::login() | |||
179 | 180 | ||
180 | } | 181 | } |
181 | 182 | ||
182 | void NNTPwrapper::logout() | 183 | void NNTPwrapper::logout() |
183 | { | 184 | { |
184 | int err = NEWSNNTP_NO_ERROR; | 185 | int err = NEWSNNTP_NO_ERROR; |
185 | if ( m_nntp == NULL ) | 186 | if ( m_nntp == NULL ) |
186 | return; | 187 | return; |
187 | mailstorage_free(m_nntp); | 188 | mailstorage_free(m_nntp); |
188 | m_nntp = 0; | 189 | m_nntp = 0; |
189 | } | 190 | } |
190 | 191 | ||
191 | QValueList<Opie::OSmartPointer<Folder> >* NNTPwrapper::listFolders() { | 192 | QValueList<Opie::Core::OSmartPointer<Folder> >* NNTPwrapper::listFolders() { |
192 | 193 | ||
193 | QValueList<Opie::OSmartPointer<Folder> >* folders = new QValueList<Opie::OSmartPointer<Folder> >(); | 194 | QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<Opie::Core::OSmartPointer<Folder> >(); |
194 | QStringList groups; | 195 | QStringList groups; |
195 | if (account) { | 196 | if (account) { |
196 | groups = account->getGroups(); | 197 | groups = account->getGroups(); |
197 | } | 198 | } |
198 | for ( QStringList::Iterator it = groups.begin(); it != groups.end(); ++it ) { | 199 | for ( QStringList::Iterator it = groups.begin(); it != groups.end(); ++it ) { |
199 | folders->append(new Folder((*it),".")); | 200 | folders->append(new Folder((*it),".")); |
200 | } | 201 | } |
201 | return folders; | 202 | return folders; |
202 | } | 203 | } |
203 | 204 | ||
204 | /* we made this method in raw nntp access of etpan and not via generic interface | 205 | /* we made this method in raw nntp access of etpan and not via generic interface |
205 | * 'cause in that case there will be doubled copy operations. eg. the etpan would | 206 | * 'cause in that case there will be doubled copy operations. eg. the etpan would |
diff --git a/noncore/net/mail/libmailwrapper/nntpwrapper.h b/noncore/net/mail/libmailwrapper/nntpwrapper.h index a7e4b95..a87a8e8 100644 --- a/noncore/net/mail/libmailwrapper/nntpwrapper.h +++ b/noncore/net/mail/libmailwrapper/nntpwrapper.h | |||
@@ -11,33 +11,33 @@ struct mailstorage; | |||
11 | struct mailfolder; | 11 | struct mailfolder; |
12 | 12 | ||
13 | class NNTPwrapper : public Genericwrapper | 13 | class NNTPwrapper : public Genericwrapper |
14 | { | 14 | { |
15 | 15 | ||
16 | Q_OBJECT | 16 | Q_OBJECT |
17 | 17 | ||
18 | public: | 18 | public: |
19 | NNTPwrapper( NNTPaccount *a ); | 19 | NNTPwrapper( NNTPaccount *a ); |
20 | virtual ~NNTPwrapper(); | 20 | virtual ~NNTPwrapper(); |
21 | 21 | ||
22 | /* mailbox will be ignored */ | 22 | /* mailbox will be ignored */ |
23 | virtual void listMessages(const QString & mailbox, QValueList<Opie::OSmartPointer<RecMail> > &target ); | 23 | virtual void listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target ); |
24 | /* should only get the subscribed one */ | 24 | /* should only get the subscribed one */ |
25 | virtual QValueList<Opie::OSmartPointer<Folder> >* listFolders(); | 25 | virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders(); |
26 | /* mailbox will be ignored */ | 26 | /* mailbox will be ignored */ |
27 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); | 27 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); |
28 | QStringList listAllNewsgroups(const QString&mask = QString::null); | 28 | QStringList listAllNewsgroups(const QString&mask = QString::null); |
29 | virtual void deleteMail(const RecMailP&mail); | 29 | virtual void deleteMail(const RecMailP&mail); |
30 | virtual void answeredMail(const RecMailP&mail); | 30 | virtual void answeredMail(const RecMailP&mail); |
31 | virtual int deleteAllMail(const Opie::OSmartPointer<Folder>&); | 31 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&); |
32 | 32 | ||
33 | virtual RecBody fetchBody( const RecMailP &mail ); | 33 | virtual RecBody fetchBody( const RecMailP &mail ); |
34 | virtual encodedString* fetchRawBody(const RecMailP&mail); | 34 | virtual encodedString* fetchRawBody(const RecMailP&mail); |
35 | virtual void logout(); | 35 | virtual void logout(); |
36 | virtual MAILLIB::ATYPE getType()const; | 36 | virtual MAILLIB::ATYPE getType()const; |
37 | virtual const QString&getName()const; | 37 | virtual const QString&getName()const; |
38 | static void nntp_progress( size_t current, size_t maximum ); | 38 | static void nntp_progress( size_t current, size_t maximum ); |
39 | 39 | ||
40 | protected: | 40 | protected: |
41 | void login(); | 41 | void login(); |
42 | NNTPaccount *account; | 42 | NNTPaccount *account; |
43 | mailstorage* m_nntp; | 43 | mailstorage* m_nntp; |
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp index 6737d6c..f5694fe 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp | |||
@@ -1,24 +1,25 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | #include "pop3wrapper.h" | 2 | #include "pop3wrapper.h" |
3 | #include "mailtypes.h" | 3 | #include "mailtypes.h" |
4 | #include "logindialog.h" | 4 | #include "logindialog.h" |
5 | #include <libetpan/libetpan.h> | 5 | #include <libetpan/libetpan.h> |
6 | #include <qpe/global.h> | 6 | #include <qpe/global.h> |
7 | #include <qfile.h> | 7 | #include <qfile.h> |
8 | //#include <qstring.h> | 8 | //#include <qstring.h> |
9 | 9 | ||
10 | /* we don't fetch messages larger than 5 MB */ | 10 | /* we don't fetch messages larger than 5 MB */ |
11 | #define HARD_MSG_SIZE_LIMIT 5242880 | 11 | #define HARD_MSG_SIZE_LIMIT 5242880 |
12 | 12 | ||
13 | using namespace Opie::Core; | ||
13 | POP3wrapper::POP3wrapper( POP3account *a ) | 14 | POP3wrapper::POP3wrapper( POP3account *a ) |
14 | : Genericwrapper() { | 15 | : Genericwrapper() { |
15 | account = a; | 16 | account = a; |
16 | m_pop3 = NULL; | 17 | m_pop3 = NULL; |
17 | msgTempName = a->getFileName()+"_msg_cache"; | 18 | msgTempName = a->getFileName()+"_msg_cache"; |
18 | last_msg_id = 0; | 19 | last_msg_id = 0; |
19 | } | 20 | } |
20 | 21 | ||
21 | POP3wrapper::~POP3wrapper() { | 22 | POP3wrapper::~POP3wrapper() { |
22 | logout(); | 23 | logout(); |
23 | QFile msg_cache(msgTempName); | 24 | QFile msg_cache(msgTempName); |
24 | if (msg_cache.exists()) { | 25 | if (msg_cache.exists()) { |
@@ -84,25 +85,25 @@ RecBody POP3wrapper::fetchBody( const RecMailP &mail ) { | |||
84 | } | 85 | } |
85 | body = parseMail(mailmsg); | 86 | body = parseMail(mailmsg); |
86 | 87 | ||
87 | /* clean up */ | 88 | /* clean up */ |
88 | if (mailmsg) | 89 | if (mailmsg) |
89 | mailmessage_free(mailmsg); | 90 | mailmessage_free(mailmsg); |
90 | if (message) | 91 | if (message) |
91 | free(message); | 92 | free(message); |
92 | 93 | ||
93 | return body; | 94 | return body; |
94 | } | 95 | } |
95 | 96 | ||
96 | void POP3wrapper::listMessages(const QString &, QValueList<Opie::OSmartPointer<RecMail> > &target ) | 97 | void POP3wrapper::listMessages(const QString &, QValueList<Opie::Core::OSmartPointer<RecMail> > &target ) |
97 | { | 98 | { |
98 | login(); | 99 | login(); |
99 | if (!m_pop3) | 100 | if (!m_pop3) |
100 | return; | 101 | return; |
101 | uint32_t res_messages,res_recent,res_unseen; | 102 | uint32_t res_messages,res_recent,res_unseen; |
102 | mailsession_status_folder(m_pop3->sto_session,"INBOX",&res_messages,&res_recent,&res_unseen); | 103 | mailsession_status_folder(m_pop3->sto_session,"INBOX",&res_messages,&res_recent,&res_unseen); |
103 | parseList(target,m_pop3->sto_session,"INBOX"); | 104 | parseList(target,m_pop3->sto_session,"INBOX"); |
104 | Global::statusMessage( tr("Mailbox contains %1 mail(s)").arg(res_messages)); | 105 | Global::statusMessage( tr("Mailbox contains %1 mail(s)").arg(res_messages)); |
105 | } | 106 | } |
106 | 107 | ||
107 | void POP3wrapper::login() | 108 | void POP3wrapper::login() |
108 | { | 109 | { |
@@ -167,26 +168,26 @@ void POP3wrapper::login() | |||
167 | } | 168 | } |
168 | } | 169 | } |
169 | 170 | ||
170 | void POP3wrapper::logout() | 171 | void POP3wrapper::logout() |
171 | { | 172 | { |
172 | if ( m_pop3 == NULL ) | 173 | if ( m_pop3 == NULL ) |
173 | return; | 174 | return; |
174 | mailstorage_free(m_pop3); | 175 | mailstorage_free(m_pop3); |
175 | m_pop3 = 0; | 176 | m_pop3 = 0; |
176 | } | 177 | } |
177 | 178 | ||
178 | 179 | ||
179 | QValueList<Opie::OSmartPointer<Folder> >* POP3wrapper::listFolders() { | 180 | QValueList<Opie::Core::OSmartPointer<Folder> >* POP3wrapper::listFolders() { |
180 | QValueList<Opie::OSmartPointer<Folder> >* folders = new QValueList<FolderP>(); | 181 | QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<FolderP>(); |
181 | FolderP inb=new Folder("INBOX","/"); | 182 | FolderP inb=new Folder("INBOX","/"); |
182 | folders->append(inb); | 183 | folders->append(inb); |
183 | return folders; | 184 | return folders; |
184 | } | 185 | } |
185 | 186 | ||
186 | void POP3wrapper::deleteMail(const RecMailP&mail) { | 187 | void POP3wrapper::deleteMail(const RecMailP&mail) { |
187 | login(); | 188 | login(); |
188 | if (!m_pop3) | 189 | if (!m_pop3) |
189 | return; | 190 | return; |
190 | int err = mailsession_remove_message(m_pop3->sto_session,mail->getNumber()); | 191 | int err = mailsession_remove_message(m_pop3->sto_session,mail->getNumber()); |
191 | if (err != MAIL_NO_ERROR) { | 192 | if (err != MAIL_NO_ERROR) { |
192 | Global::statusMessage(tr("error deleting mail")); | 193 | Global::statusMessage(tr("error deleting mail")); |
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.h b/noncore/net/mail/libmailwrapper/pop3wrapper.h index 31eb6f1..c46b941 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.h +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.h | |||
@@ -8,32 +8,32 @@ | |||
8 | class encodedString; | 8 | class encodedString; |
9 | struct mailstorage; | 9 | struct mailstorage; |
10 | struct mailfolder; | 10 | struct mailfolder; |
11 | 11 | ||
12 | class POP3wrapper : public Genericwrapper | 12 | class POP3wrapper : public Genericwrapper |
13 | { | 13 | { |
14 | Q_OBJECT | 14 | Q_OBJECT |
15 | 15 | ||
16 | public: | 16 | public: |
17 | POP3wrapper( POP3account *a ); | 17 | POP3wrapper( POP3account *a ); |
18 | virtual ~POP3wrapper(); | 18 | virtual ~POP3wrapper(); |
19 | /* mailbox will be ignored */ | 19 | /* mailbox will be ignored */ |
20 | virtual void listMessages(const QString & mailbox, QValueList<Opie::OSmartPointer<RecMail> > &target ); | 20 | virtual void listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target ); |
21 | virtual QValueList<Opie::OSmartPointer<Folder> >* listFolders(); | 21 | virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders(); |
22 | /* mailbox will be ignored */ | 22 | /* mailbox will be ignored */ |
23 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); | 23 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); |
24 | 24 | ||
25 | virtual void deleteMail(const RecMailP&mail); | 25 | virtual void deleteMail(const RecMailP&mail); |
26 | virtual void answeredMail(const RecMailP&mail); | 26 | virtual void answeredMail(const RecMailP&mail); |
27 | virtual int deleteAllMail(const Opie::OSmartPointer<Folder>&); | 27 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&); |
28 | 28 | ||
29 | virtual RecBody fetchBody( const RecMailP &mail ); | 29 | virtual RecBody fetchBody( const RecMailP &mail ); |
30 | virtual encodedString* fetchRawBody(const RecMailP&mail); | 30 | virtual encodedString* fetchRawBody(const RecMailP&mail); |
31 | virtual void logout(); | 31 | virtual void logout(); |
32 | virtual MAILLIB::ATYPE getType()const; | 32 | virtual MAILLIB::ATYPE getType()const; |
33 | virtual const QString&getName()const; | 33 | virtual const QString&getName()const; |
34 | static void pop3_progress( size_t current, size_t maximum ); | 34 | static void pop3_progress( size_t current, size_t maximum ); |
35 | 35 | ||
36 | protected: | 36 | protected: |
37 | void login(); | 37 | void login(); |
38 | POP3account *account; | 38 | POP3account *account; |
39 | mailstorage*m_pop3; | 39 | mailstorage*m_pop3; |
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp index 86673aa..e2cea7a 100644 --- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp | |||
@@ -4,24 +4,25 @@ | |||
4 | #include "logindialog.h" | 4 | #include "logindialog.h" |
5 | #include "mailtypes.h" | 5 | #include "mailtypes.h" |
6 | #include "sendmailprogress.h" | 6 | #include "sendmailprogress.h" |
7 | 7 | ||
8 | #include <qt.h> | 8 | #include <qt.h> |
9 | 9 | ||
10 | #include <qpe/config.h> | 10 | #include <qpe/config.h> |
11 | #include <qpe/qcopenvelope_qws.h> | 11 | #include <qpe/qcopenvelope_qws.h> |
12 | 12 | ||
13 | #include <libetpan/libetpan.h> | 13 | #include <libetpan/libetpan.h> |
14 | 14 | ||
15 | 15 | ||
16 | using namespace Opie::Core; | ||
16 | progressMailSend*SMTPwrapper::sendProgress = 0; | 17 | progressMailSend*SMTPwrapper::sendProgress = 0; |
17 | 18 | ||
18 | SMTPwrapper::SMTPwrapper(SMTPaccount * aSmtp ) | 19 | SMTPwrapper::SMTPwrapper(SMTPaccount * aSmtp ) |
19 | : Generatemail() | 20 | : Generatemail() |
20 | { | 21 | { |
21 | m_SmtpAccount = aSmtp; | 22 | m_SmtpAccount = aSmtp; |
22 | Config cfg( "mail" ); | 23 | Config cfg( "mail" ); |
23 | cfg.setGroup( "Status" ); | 24 | cfg.setGroup( "Status" ); |
24 | m_queuedMail = cfg.readNumEntry( "outgoing", 0 ); | 25 | m_queuedMail = cfg.readNumEntry( "outgoing", 0 ); |
25 | emit queuedMails( m_queuedMail ); | 26 | emit queuedMails( m_queuedMail ); |
26 | connect( this, SIGNAL( queuedMails(int) ), this, SLOT( emitQCop(int) ) ); | 27 | connect( this, SIGNAL( queuedMails(int) ), this, SLOT( emitQCop(int) ) ); |
27 | m_smtp = 0; | 28 | m_smtp = 0; |
@@ -303,25 +304,25 @@ int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size ) | |||
303 | result = 0; | 304 | result = 0; |
304 | } | 305 | } |
305 | 306 | ||
306 | if (!result) { | 307 | if (!result) { |
307 | storeFailedMail(data,size,failuretext); | 308 | storeFailedMail(data,size,failuretext); |
308 | } else { | 309 | } else { |
309 | qDebug( "Mail sent." ); | 310 | qDebug( "Mail sent." ); |
310 | storeMail(data,size,"Sent"); | 311 | storeMail(data,size,"Sent"); |
311 | } | 312 | } |
312 | return result; | 313 | return result; |
313 | } | 314 | } |
314 | 315 | ||
315 | void SMTPwrapper::sendMail(const Opie::OSmartPointer<Mail>&mail,bool later ) | 316 | void SMTPwrapper::sendMail(const Opie::Core::OSmartPointer<Mail>&mail,bool later ) |
316 | { | 317 | { |
317 | mailmime * mimeMail; | 318 | mailmime * mimeMail; |
318 | 319 | ||
319 | mimeMail = createMimeMail(mail ); | 320 | mimeMail = createMimeMail(mail ); |
320 | if ( mimeMail == NULL ) { | 321 | if ( mimeMail == NULL ) { |
321 | qDebug( "sendMail: error creating mime mail" ); | 322 | qDebug( "sendMail: error creating mime mail" ); |
322 | } else { | 323 | } else { |
323 | sendProgress = new progressMailSend(); | 324 | sendProgress = new progressMailSend(); |
324 | sendProgress->show(); | 325 | sendProgress->show(); |
325 | sendProgress->setMaxMails(1); | 326 | sendProgress->setMaxMails(1); |
326 | smtpSend( mimeMail,later); | 327 | smtpSend( mimeMail,later); |
327 | qDebug("Clean up done"); | 328 | qDebug("Clean up done"); |
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.h b/noncore/net/mail/libmailwrapper/smtpwrapper.h index 71ae35c..6c5bbe8 100644 --- a/noncore/net/mail/libmailwrapper/smtpwrapper.h +++ b/noncore/net/mail/libmailwrapper/smtpwrapper.h | |||
@@ -14,25 +14,25 @@ | |||
14 | #include <opie2/osmartpointer.h> | 14 | #include <opie2/osmartpointer.h> |
15 | 15 | ||
16 | class SMTPaccount; | 16 | class SMTPaccount; |
17 | class AbstractMail; | 17 | class AbstractMail; |
18 | 18 | ||
19 | class SMTPwrapper : public Generatemail | 19 | class SMTPwrapper : public Generatemail |
20 | { | 20 | { |
21 | Q_OBJECT | 21 | Q_OBJECT |
22 | 22 | ||
23 | public: | 23 | public: |
24 | SMTPwrapper(SMTPaccount * aSmtp); | 24 | SMTPwrapper(SMTPaccount * aSmtp); |
25 | virtual ~SMTPwrapper(); | 25 | virtual ~SMTPwrapper(); |
26 | void sendMail(const Opie::OSmartPointer<Mail>& mail,bool later=false ); | 26 | void sendMail(const Opie::Core::OSmartPointer<Mail>& mail,bool later=false ); |
27 | bool flushOutbox(); | 27 | bool flushOutbox(); |
28 | 28 | ||
29 | static progressMailSend*sendProgress; | 29 | static progressMailSend*sendProgress; |
30 | 30 | ||
31 | signals: | 31 | signals: |
32 | void queuedMails( int ); | 32 | void queuedMails( int ); |
33 | 33 | ||
34 | protected: | 34 | protected: |
35 | mailsmtp *m_smtp; | 35 | mailsmtp *m_smtp; |
36 | SMTPaccount * m_SmtpAccount; | 36 | SMTPaccount * m_SmtpAccount; |
37 | 37 | ||
38 | void connect_server(); | 38 | void connect_server(); |
@@ -41,23 +41,23 @@ protected: | |||
41 | 41 | ||
42 | 42 | ||
43 | void smtpSend( mailmime *mail,bool later); | 43 | void smtpSend( mailmime *mail,bool later); |
44 | 44 | ||
45 | static void storeMail(const char*mail, size_t length, const QString&box); | 45 | static void storeMail(const char*mail, size_t length, const QString&box); |
46 | static QString mailsmtpError( int err ); | 46 | static QString mailsmtpError( int err ); |
47 | static void progress( size_t current, size_t maximum ); | 47 | static void progress( size_t current, size_t maximum ); |
48 | 48 | ||
49 | int smtpSend(char*from,clist*rcpts,const char*data,size_t size); | 49 | int smtpSend(char*from,clist*rcpts,const char*data,size_t size); |
50 | 50 | ||
51 | void storeMail(mailmime*mail, const QString&box); | 51 | void storeMail(mailmime*mail, const QString&box); |
52 | 52 | ||
53 | int sendQueuedMail(AbstractMail*wrap,const Opie::OSmartPointer<RecMail>&which); | 53 | int sendQueuedMail(AbstractMail*wrap,const Opie::Core::OSmartPointer<RecMail>&which); |
54 | void storeFailedMail(const char*data,unsigned int size, const char*failuremessage); | 54 | void storeFailedMail(const char*data,unsigned int size, const char*failuremessage); |
55 | 55 | ||
56 | int m_queuedMail; | 56 | int m_queuedMail; |
57 | 57 | ||
58 | protected slots: | 58 | protected slots: |
59 | void emitQCop( int queued ); | 59 | void emitQCop( int queued ); |
60 | 60 | ||
61 | }; | 61 | }; |
62 | 62 | ||
63 | #endif | 63 | #endif |
diff --git a/noncore/net/mail/libmailwrapper/storemail.cpp b/noncore/net/mail/libmailwrapper/storemail.cpp index 595e7fc..914a11d 100644 --- a/noncore/net/mail/libmailwrapper/storemail.cpp +++ b/noncore/net/mail/libmailwrapper/storemail.cpp | |||
@@ -1,23 +1,24 @@ | |||
1 | #include "storemail.h" | 1 | #include "storemail.h" |
2 | #include "mailwrapper.h" | 2 | #include "mailwrapper.h" |
3 | #include "settings.h" | 3 | #include "settings.h" |
4 | #include "abstractmail.h" | 4 | #include "abstractmail.h" |
5 | 5 | ||
6 | #include <libetpan/libetpan.h> | 6 | #include <libetpan/libetpan.h> |
7 | 7 | ||
8 | #include <qstring.h> | 8 | #include <qstring.h> |
9 | 9 | ||
10 | #include <stdlib.h> | 10 | #include <stdlib.h> |
11 | 11 | ||
12 | using namespace Opie::Core; | ||
12 | Storemail::Storemail(Account*aAccount,const QString&aFolder) | 13 | Storemail::Storemail(Account*aAccount,const QString&aFolder) |
13 | : Generatemail() | 14 | : Generatemail() |
14 | { | 15 | { |
15 | wrapper = 0; | 16 | wrapper = 0; |
16 | m_Account = aAccount; | 17 | m_Account = aAccount; |
17 | m_tfolder = aFolder; | 18 | m_tfolder = aFolder; |
18 | wrapper = AbstractMail::getWrapper(m_Account); | 19 | wrapper = AbstractMail::getWrapper(m_Account); |
19 | if (wrapper) { | 20 | if (wrapper) { |
20 | wrapper->createMbox(m_tfolder); | 21 | wrapper->createMbox(m_tfolder); |
21 | } | 22 | } |
22 | } | 23 | } |
23 | 24 | ||
@@ -40,25 +41,25 @@ Storemail::Storemail(const QString&aFolder) | |||
40 | m_Account = 0; | 41 | m_Account = 0; |
41 | m_tfolder = aFolder; | 42 | m_tfolder = aFolder; |
42 | wrapper = AbstractMail::getWrapper(AbstractMail::defaultLocalfolder()); | 43 | wrapper = AbstractMail::getWrapper(AbstractMail::defaultLocalfolder()); |
43 | if (wrapper) { | 44 | if (wrapper) { |
44 | wrapper->createMbox(m_tfolder); | 45 | wrapper->createMbox(m_tfolder); |
45 | } | 46 | } |
46 | } | 47 | } |
47 | 48 | ||
48 | Storemail::~Storemail() | 49 | Storemail::~Storemail() |
49 | { | 50 | { |
50 | } | 51 | } |
51 | 52 | ||
52 | int Storemail::storeMail(const Opie::OSmartPointer<Mail>&mail) | 53 | int Storemail::storeMail(const Opie::Core::OSmartPointer<Mail>&mail) |
53 | { | 54 | { |
54 | if (!wrapper) return 0; | 55 | if (!wrapper) return 0; |
55 | int ret = 1; | 56 | int ret = 1; |
56 | 57 | ||
57 | mailmime * mimeMail = 0; | 58 | mailmime * mimeMail = 0; |
58 | mimeMail = createMimeMail(mail ); | 59 | mimeMail = createMimeMail(mail ); |
59 | if ( mimeMail == NULL ) { | 60 | if ( mimeMail == NULL ) { |
60 | qDebug( "storeMail: error creating mime mail" ); | 61 | qDebug( "storeMail: error creating mime mail" ); |
61 | return 0; | 62 | return 0; |
62 | } | 63 | } |
63 | char *data; | 64 | char *data; |
64 | size_t size; | 65 | size_t size; |
diff --git a/noncore/net/mail/libmailwrapper/storemail.h b/noncore/net/mail/libmailwrapper/storemail.h index 80c7431..4433de0 100644 --- a/noncore/net/mail/libmailwrapper/storemail.h +++ b/noncore/net/mail/libmailwrapper/storemail.h | |||
@@ -9,21 +9,21 @@ class Account; | |||
9 | class Mail; | 9 | class Mail; |
10 | class AbstractMail; | 10 | class AbstractMail; |
11 | 11 | ||
12 | class Storemail : public Generatemail | 12 | class Storemail : public Generatemail |
13 | { | 13 | { |
14 | Q_OBJECT | 14 | Q_OBJECT |
15 | public: | 15 | public: |
16 | Storemail(Account*aAccount,const QString&aFolder); | 16 | Storemail(Account*aAccount,const QString&aFolder); |
17 | Storemail(const QString&dir,const QString&aFolder); | 17 | Storemail(const QString&dir,const QString&aFolder); |
18 | Storemail(const QString&aFolder); | 18 | Storemail(const QString&aFolder); |
19 | virtual ~Storemail(); | 19 | virtual ~Storemail(); |
20 | 20 | ||
21 | int storeMail(const Opie::OSmartPointer<Mail>&mail); | 21 | int storeMail(const Opie::Core::OSmartPointer<Mail>&mail); |
22 | 22 | ||
23 | protected: | 23 | protected: |
24 | Account* m_Account; | 24 | Account* m_Account; |
25 | QString m_tfolder; | 25 | QString m_tfolder; |
26 | AbstractMail*wrapper; | 26 | AbstractMail*wrapper; |
27 | }; | 27 | }; |
28 | 28 | ||
29 | #endif | 29 | #endif |