author | alwin <alwin> | 2004-03-08 01:00:18 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-03-08 01:00:18 (UTC) |
commit | eddc5184f5be6a067b077d18e240a1fe982bbcf4 (patch) (unidiff) | |
tree | 0d9458a10520ca23e1d5d041d9d2ca4150bd8f1c | |
parent | eedafdf1a1d973c083cb108a913005d14a78a9ae (diff) | |
download | opie-eddc5184f5be6a067b077d18e240a1fe982bbcf4.zip opie-eddc5184f5be6a067b077d18e240a1fe982bbcf4.tar.gz opie-eddc5184f5be6a067b077d18e240a1fe982bbcf4.tar.bz2 |
type of mail account will be defined by a enum not with string - comparing
strings all the time makes no sense.
21 files changed, 93 insertions, 48 deletions
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp index 64557ee..4375044 100644 --- a/noncore/net/mail/accountview.cpp +++ b/noncore/net/mail/accountview.cpp | |||
@@ -62,20 +62,20 @@ void AccountView::populate( QList<Account> list ) | |||
62 | Account *it; | 62 | Account *it; |
63 | for ( it = list.first(); it; it = list.next() ) | 63 | for ( it = list.first(); it; it = list.next() ) |
64 | { | 64 | { |
65 | if ( it->getType().compare( "IMAP" ) == 0 ) | 65 | if ( it->getType() == MAILLIB::A_IMAP ) |
66 | { | 66 | { |
67 | IMAPaccount *imap = static_cast<IMAPaccount *>(it); | 67 | IMAPaccount *imap = static_cast<IMAPaccount *>(it); |
68 | qDebug( "added IMAP " + imap->getAccountName() ); | 68 | qDebug( "added IMAP " + imap->getAccountName() ); |
69 | imapAccounts.append(new IMAPviewItem( imap, this )); | 69 | imapAccounts.append(new IMAPviewItem( imap, this )); |
70 | } | 70 | } |
71 | else if ( it->getType().compare( "POP3" ) == 0 ) | 71 | else if ( it->getType() == MAILLIB::A_POP3 ) |
72 | { | 72 | { |
73 | POP3account *pop3 = static_cast<POP3account *>(it); | 73 | POP3account *pop3 = static_cast<POP3account *>(it); |
74 | qDebug( "added POP3 " + pop3->getAccountName() ); | 74 | qDebug( "added POP3 " + pop3->getAccountName() ); |
75 | /* must not be hold 'cause it isn't required */ | 75 | /* must not be hold 'cause it isn't required */ |
76 | (void) new POP3viewItem( pop3, this ); | 76 | (void) new POP3viewItem( pop3, this ); |
77 | } | 77 | } |
78 | else if ( it->getType().compare( "NNTP" ) == 0 ) | 78 | else if ( it->getType() == MAILLIB::A_NNTP ) |
79 | { | 79 | { |
80 | NNTPaccount *nntp = static_cast<NNTPaccount *>(it); | 80 | NNTPaccount *nntp = static_cast<NNTPaccount *>(it); |
81 | qDebug( "added NNTP " + nntp->getAccountName() ); | 81 | qDebug( "added NNTP " + nntp->getAccountName() ); |
diff --git a/noncore/net/mail/composemail.cpp b/noncore/net/mail/composemail.cpp index f51a8fe..f8ac76f 100644 --- a/noncore/net/mail/composemail.cpp +++ b/noncore/net/mail/composemail.cpp | |||
@@ -46,7 +46,7 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m | |||
46 | 46 | ||
47 | Account *it; | 47 | Account *it; |
48 | for ( it = accounts.first(); it; it = accounts.next() ) { | 48 | for ( it = accounts.first(); it; it = accounts.next() ) { |
49 | if ( it->getType().compare( "SMTP" ) == 0 ) { | 49 | if ( it->getType()==MAILLIB::A_SMTP ) { |
50 | SMTPaccount *smtp = static_cast<SMTPaccount *>(it); | 50 | SMTPaccount *smtp = static_cast<SMTPaccount *>(it); |
51 | smtpAccountBox->insertItem( smtp->getAccountName() ); | 51 | smtpAccountBox->insertItem( smtp->getAccountName() ); |
52 | smtpAccounts.append( smtp ); | 52 | smtpAccounts.append( smtp ); |
diff --git a/noncore/net/mail/editaccounts.cpp b/noncore/net/mail/editaccounts.cpp index 28d531b..5c4bdf7 100644 --- a/noncore/net/mail/editaccounts.cpp +++ b/noncore/net/mail/editaccounts.cpp | |||
@@ -16,7 +16,25 @@ AccountListItem::AccountListItem( QListView *parent, Account *a) | |||
16 | { | 16 | { |
17 | account = a; | 17 | account = a; |
18 | setText( 0, account->getAccountName() ); | 18 | setText( 0, account->getAccountName() ); |
19 | setText( 1, account->getType() ); | 19 | QString ttext = ""; |
20 | switch (account->getType()) { | ||
21 | case MAILLIB::A_NNTP: | ||
22 | ttext="NNTP"; | ||
23 | break; | ||
24 | case MAILLIB::A_POP3: | ||
25 | ttext = "POP3"; | ||
26 | break; | ||
27 | case MAILLIB::A_IMAP: | ||
28 | ttext = "IMAP"; | ||
29 | break; | ||
30 | case MAILLIB::A_SMTP: | ||
31 | ttext = "SMTP"; | ||
32 | break; | ||
33 | default: | ||
34 | ttext = "UNKNOWN"; | ||
35 | break; | ||
36 | } | ||
37 | setText( 1, ttext); | ||
20 | } | 38 | } |
21 | 39 | ||
22 | EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) | 40 | EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) |
@@ -49,7 +67,7 @@ void EditAccounts::slotFillLists() | |||
49 | Account *it; | 67 | Account *it; |
50 | for ( it = accounts.first(); it; it = accounts.next() ) | 68 | for ( it = accounts.first(); it; it = accounts.next() ) |
51 | { | 69 | { |
52 | if ( it->getType().compare( "NNTP" ) == 0 ) | 70 | if ( it->getType()==MAILLIB::A_NNTP ) |
53 | { | 71 | { |
54 | (void) new AccountListItem( newsList, it ); | 72 | (void) new AccountListItem( newsList, it ); |
55 | } | 73 | } |
@@ -143,7 +161,7 @@ void EditAccounts::slotNewAccount( const QString &type ) | |||
143 | 161 | ||
144 | void EditAccounts::slotEditAccount( Account *account ) | 162 | void EditAccounts::slotEditAccount( Account *account ) |
145 | { | 163 | { |
146 | if ( account->getType().compare( "IMAP" ) == 0 ) | 164 | if ( account->getType() == MAILLIB::A_IMAP ) |
147 | { | 165 | { |
148 | IMAPaccount *imapAcc = static_cast<IMAPaccount *>(account); | 166 | IMAPaccount *imapAcc = static_cast<IMAPaccount *>(account); |
149 | IMAPconfig imap( imapAcc, this, 0, true, WStyle_ContextHelp ); | 167 | IMAPconfig imap( imapAcc, this, 0, true, WStyle_ContextHelp ); |
@@ -152,7 +170,7 @@ void EditAccounts::slotEditAccount( Account *account ) | |||
152 | slotFillLists(); | 170 | slotFillLists(); |
153 | } | 171 | } |
154 | } | 172 | } |
155 | else if ( account->getType().compare( "POP3" ) == 0 ) | 173 | else if ( account->getType()==MAILLIB::A_POP3 ) |
156 | { | 174 | { |
157 | POP3account *pop3Acc = static_cast<POP3account *>(account); | 175 | POP3account *pop3Acc = static_cast<POP3account *>(account); |
158 | POP3config pop3( pop3Acc, this, 0, true, WStyle_ContextHelp ); | 176 | POP3config pop3( pop3Acc, this, 0, true, WStyle_ContextHelp ); |
@@ -161,7 +179,7 @@ void EditAccounts::slotEditAccount( Account *account ) | |||
161 | slotFillLists(); | 179 | slotFillLists(); |
162 | } | 180 | } |
163 | } | 181 | } |
164 | else if ( account->getType().compare( "SMTP" ) == 0 ) | 182 | else if ( account->getType()==MAILLIB::A_SMTP ) |
165 | { | 183 | { |
166 | SMTPaccount *smtpAcc = static_cast<SMTPaccount *>(account); | 184 | SMTPaccount *smtpAcc = static_cast<SMTPaccount *>(account); |
167 | SMTPconfig smtp( smtpAcc, this, 0, true, WStyle_ContextHelp ); | 185 | SMTPconfig smtp( smtpAcc, this, 0, true, WStyle_ContextHelp ); |
@@ -170,7 +188,7 @@ void EditAccounts::slotEditAccount( Account *account ) | |||
170 | slotFillLists(); | 188 | slotFillLists(); |
171 | } | 189 | } |
172 | } | 190 | } |
173 | else if ( account->getType().compare( "NNTP" ) == 0 ) | 191 | else if ( account->getType()==MAILLIB::A_NNTP) |
174 | { | 192 | { |
175 | NNTPaccount *nntpAcc = static_cast<NNTPaccount *>(account); | 193 | NNTPaccount *nntpAcc = static_cast<NNTPaccount *>(account); |
176 | NNTPconfig nntp( nntpAcc, this, 0, true, WStyle_ContextHelp ); | 194 | NNTPconfig nntp( nntpAcc, this, 0, true, WStyle_ContextHelp ); |
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.h b/noncore/net/mail/libmailwrapper/abstractmail.h index b6e1538..442ebfe 100644 --- a/noncore/net/mail/libmailwrapper/abstractmail.h +++ b/noncore/net/mail/libmailwrapper/abstractmail.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef __abstract_mail_ | 1 | #ifndef __abstract_mail_ |
2 | #define __abstract_mail_ | 2 | #define __abstract_mail_ |
3 | 3 | ||
4 | #include "maildefines.h" | ||
5 | |||
4 | #include <qobject.h> | 6 | #include <qobject.h> |
5 | #include "settings.h" | 7 | #include "settings.h" |
6 | 8 | ||
@@ -55,7 +57,7 @@ public: | |||
55 | 57 | ||
56 | static QString defaultLocalfolder(); | 58 | static QString defaultLocalfolder(); |
57 | 59 | ||
58 | virtual const QString&getType()const=0; | 60 | virtual MAILLIB::ATYPE getType()const=0; |
59 | virtual const QString&getName()const=0; | 61 | virtual const QString&getName()const=0; |
60 | 62 | ||
61 | protected: | 63 | protected: |
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.cpp b/noncore/net/mail/libmailwrapper/genericwrapper.cpp index 350808a..3fe319b 100644 --- a/noncore/net/mail/libmailwrapper/genericwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/genericwrapper.cpp | |||
@@ -444,7 +444,7 @@ void Genericwrapper::cleanMimeCache() | |||
444 | qDebug("Genericwrapper: cache cleaned"); | 444 | qDebug("Genericwrapper: cache cleaned"); |
445 | } | 445 | } |
446 | 446 | ||
447 | void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const QString&mailbox) | 447 | void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const QString&mailbox,bool mbox_as_to) |
448 | { | 448 | { |
449 | int r; | 449 | int r; |
450 | mailmessage_list * env_list = 0; | 450 | mailmessage_list * env_list = 0; |
@@ -488,8 +488,12 @@ void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const | |||
488 | mail->setSubject( convert_String(single_fields.fld_subject->sbj_value)); | 488 | mail->setSubject( convert_String(single_fields.fld_subject->sbj_value)); |
489 | if (single_fields.fld_from) | 489 | if (single_fields.fld_from) |
490 | mail->setFrom(parseMailboxList(single_fields.fld_from->frm_mb_list)); | 490 | mail->setFrom(parseMailboxList(single_fields.fld_from->frm_mb_list)); |
491 | if (single_fields.fld_to) | 491 | if (!mbox_as_to) { |
492 | mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) ); | 492 | if (single_fields.fld_to) |
493 | mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) ); | ||
494 | } else { | ||
495 | mail->setTo(mailbox); | ||
496 | } | ||
493 | if (single_fields.fld_cc) | 497 | if (single_fields.fld_cc) |
494 | mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) ); | 498 | mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) ); |
495 | if (single_fields.fld_bcc) | 499 | if (single_fields.fld_bcc) |
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.h b/noncore/net/mail/libmailwrapper/genericwrapper.h index e471dc8..b451416 100644 --- a/noncore/net/mail/libmailwrapper/genericwrapper.h +++ b/noncore/net/mail/libmailwrapper/genericwrapper.h | |||
@@ -54,7 +54,7 @@ protected: | |||
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(QList<RecMail> &target,mailsession*session,const QString&mailbox); | 57 | virtual void parseList(QList<RecMail> &target,mailsession*session,const QString&mailbox,bool mbox_as_to=false); |
58 | 58 | ||
59 | QString msgTempName; | 59 | QString msgTempName; |
60 | unsigned int last_msg_id; | 60 | unsigned int last_msg_id; |
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp index 1dfcc4c..3375e69 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp | |||
@@ -1090,7 +1090,7 @@ void IMAPwrapper::storeMessage(const char*msg,size_t length, const QString&folde | |||
1090 | } | 1090 | } |
1091 | } | 1091 | } |
1092 | 1092 | ||
1093 | const QString&IMAPwrapper::getType()const | 1093 | MAILLIB::ATYPE IMAPwrapper::getType()const |
1094 | { | 1094 | { |
1095 | return account->getType(); | 1095 | return account->getType(); |
1096 | } | 1096 | } |
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.h b/noncore/net/mail/libmailwrapper/imapwrapper.h index 0a1fe2c..2623725 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.h +++ b/noncore/net/mail/libmailwrapper/imapwrapper.h | |||
@@ -46,7 +46,7 @@ public: | |||
46 | static void imap_progress( size_t current, size_t maximum ); | 46 | static void imap_progress( size_t current, size_t maximum ); |
47 | 47 | ||
48 | virtual void logout(); | 48 | virtual void logout(); |
49 | virtual const QString&getType()const; | 49 | virtual MAILLIB::ATYPE getType()const; |
50 | virtual const QString&getName()const; | 50 | virtual const QString&getName()const; |
51 | 51 | ||
52 | protected: | 52 | protected: |
diff --git a/noncore/net/mail/libmailwrapper/maildefines.h b/noncore/net/mail/libmailwrapper/maildefines.h new file mode 100644 index 0000000..431f9ea --- a/dev/null +++ b/noncore/net/mail/libmailwrapper/maildefines.h | |||
@@ -0,0 +1,16 @@ | |||
1 | #ifndef __MAILDEFINES_H | ||
2 | #define __MAILDEFINES_H | ||
3 | |||
4 | namespace MAILLIB { | ||
5 | enum ATYPE { | ||
6 | A_UNDEFINED, | ||
7 | A_IMAP, | ||
8 | A_POP3, | ||
9 | A_SMTP, | ||
10 | A_MH, | ||
11 | A_MBOX, | ||
12 | A_NNTP, | ||
13 | }; | ||
14 | } | ||
15 | |||
16 | #endif | ||
diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp index 97f301e..11ffd92 100644 --- a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp | |||
@@ -6,7 +6,7 @@ | |||
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 MAILLIB::ATYPE MBOXwrapper::wrapperType=MAILLIB::MBOX; |
10 | 10 | ||
11 | MBOXwrapper::MBOXwrapper(const QString & mbox_dir,const QString&mbox_name) | 11 | MBOXwrapper::MBOXwrapper(const QString & mbox_dir,const QString&mbox_name) |
12 | : Genericwrapper(),MBOXPath(mbox_dir),MBOXName(mbox_name) | 12 | : Genericwrapper(),MBOXPath(mbox_dir),MBOXName(mbox_name) |
@@ -326,7 +326,7 @@ void MBOXwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) | |||
326 | if (storage) mailstorage_free(storage); | 326 | if (storage) mailstorage_free(storage); |
327 | } | 327 | } |
328 | 328 | ||
329 | const QString&MBOXwrapper::getType()const | 329 | MAILLIB::ATYPE MBOXwrapper::getType()const |
330 | { | 330 | { |
331 | return wrapperType; | 331 | return wrapperType; |
332 | } | 332 | } |
diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.h b/noncore/net/mail/libmailwrapper/mboxwrapper.h index a579a3d..a12a1dd 100644 --- a/noncore/net/mail/libmailwrapper/mboxwrapper.h +++ b/noncore/net/mail/libmailwrapper/mboxwrapper.h | |||
@@ -35,14 +35,14 @@ public: | |||
35 | virtual encodedString* fetchRawBody(const RecMail&mail); | 35 | virtual encodedString* fetchRawBody(const RecMail&mail); |
36 | virtual void deleteMails(const QString & FolderName,QList<RecMail> &target); | 36 | virtual void deleteMails(const QString & FolderName,QList<RecMail> &target); |
37 | virtual int deleteAllMail(const Folder*); | 37 | virtual int deleteAllMail(const Folder*); |
38 | virtual const QString&getType()const; | 38 | virtual MAILLIB::ATYPE getType()const; |
39 | virtual const QString&getName()const; | 39 | virtual const QString&getName()const; |
40 | 40 | ||
41 | protected: | 41 | protected: |
42 | static void deleteMails(mailmbox_folder*f,QList<RecMail> &target); | 42 | static void deleteMails(mailmbox_folder*f,QList<RecMail> &target); |
43 | QString MBOXPath; | 43 | QString MBOXPath; |
44 | QString MBOXName; | 44 | QString MBOXName; |
45 | static const QString wrapperType; | 45 | static const MAILLIB::ATYPE wrapperType; |
46 | }; | 46 | }; |
47 | 47 | ||
48 | #endif | 48 | #endif |
diff --git a/noncore/net/mail/libmailwrapper/mhwrapper.cpp b/noncore/net/mail/libmailwrapper/mhwrapper.cpp index df7f773..179bd34 100644 --- a/noncore/net/mail/libmailwrapper/mhwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mhwrapper.cpp | |||
@@ -8,7 +8,7 @@ | |||
8 | #include <qpe/global.h> | 8 | #include <qpe/global.h> |
9 | #include <opie2/oprocess.h> | 9 | #include <opie2/oprocess.h> |
10 | 10 | ||
11 | const QString MHwrapper::wrapperType="MH"; | 11 | const MAILLIB::ATYPE MHwrapper::wrapperType=MAILLIB::A_MH; |
12 | 12 | ||
13 | MHwrapper::MHwrapper(const QString & mbox_dir,const QString&mbox_name) | 13 | MHwrapper::MHwrapper(const QString & mbox_dir,const QString&mbox_name) |
14 | : Genericwrapper(),MHPath(mbox_dir),MHName(mbox_name) | 14 | : Genericwrapper(),MHPath(mbox_dir),MHName(mbox_name) |
@@ -366,7 +366,7 @@ void MHwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) | |||
366 | } | 366 | } |
367 | } | 367 | } |
368 | 368 | ||
369 | const QString&MHwrapper::getType()const | 369 | MAILLIB::ATYPE MHwrapper::getType()const |
370 | { | 370 | { |
371 | return wrapperType; | 371 | return wrapperType; |
372 | } | 372 | } |
diff --git a/noncore/net/mail/libmailwrapper/mhwrapper.h b/noncore/net/mail/libmailwrapper/mhwrapper.h index b8e380c..c1ba78d 100644 --- a/noncore/net/mail/libmailwrapper/mhwrapper.h +++ b/noncore/net/mail/libmailwrapper/mhwrapper.h | |||
@@ -1,6 +1,8 @@ | |||
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" | ||
5 | |||
4 | #include "genericwrapper.h" | 6 | #include "genericwrapper.h" |
5 | #include <qstring.h> | 7 | #include <qstring.h> |
6 | 8 | ||
@@ -37,7 +39,7 @@ public: | |||
37 | virtual encodedString* fetchRawBody(const RecMail&mail); | 39 | virtual encodedString* fetchRawBody(const RecMail&mail); |
38 | virtual void deleteMails(const QString & FolderName,QList<RecMail> &target); | 40 | virtual void deleteMails(const QString & FolderName,QList<RecMail> &target); |
39 | virtual int deleteAllMail(const Folder*); | 41 | virtual int deleteAllMail(const Folder*); |
40 | virtual const QString&getType()const; | 42 | virtual MAILLIB::ATYPE getType()const; |
41 | virtual const QString&getName()const; | 43 | virtual const QString&getName()const; |
42 | 44 | ||
43 | public slots: | 45 | public slots: |
@@ -48,7 +50,7 @@ protected: | |||
48 | QString buildPath(const QString&p); | 50 | QString buildPath(const QString&p); |
49 | QString MHPath; | 51 | QString MHPath; |
50 | QString MHName; | 52 | QString MHName; |
51 | static const QString wrapperType; | 53 | static const MAILLIB::ATYPE wrapperType; |
52 | 54 | ||
53 | void init_storage(); | 55 | void init_storage(); |
54 | void clean_storage(); | 56 | void clean_storage(); |
diff --git a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp index 5a8c224..1956c61 100644 --- a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp | |||
@@ -103,7 +103,7 @@ void NNTPwrapper::listMessages(const QString & which, QList<RecMail> &target ) | |||
103 | return; | 103 | return; |
104 | uint32_t res_messages,res_recent,res_unseen; | 104 | 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); | 105 | mailsession_status_folder(m_nntp->sto_session,(char*)which.latin1(),&res_messages,&res_recent,&res_unseen); |
106 | parseList(target,m_nntp->sto_session,which); | 106 | parseList(target,m_nntp->sto_session,which,true); |
107 | } | 107 | } |
108 | 108 | ||
109 | void NNTPwrapper::login() | 109 | void NNTPwrapper::login() |
@@ -269,7 +269,7 @@ encodedString* NNTPwrapper::fetchRawBody(const RecMail&mail) { | |||
269 | return res; | 269 | return res; |
270 | } | 270 | } |
271 | 271 | ||
272 | const QString&NNTPwrapper::getType()const { | 272 | MAILLIB::ATYPE NNTPwrapper::getType()const { |
273 | return account->getType(); | 273 | return account->getType(); |
274 | } | 274 | } |
275 | 275 | ||
@@ -277,7 +277,7 @@ const QString&NNTPwrapper::getName()const{ | |||
277 | return account->getAccountName(); | 277 | return account->getAccountName(); |
278 | } | 278 | } |
279 | 279 | ||
280 | void NNTPwrapper::deleteMail(const RecMail&mail) { | 280 | void NNTPwrapper::deleteMail(const RecMail&) { |
281 | } | 281 | } |
282 | 282 | ||
283 | int NNTPwrapper::deleteAllMail(const Folder*) { | 283 | int NNTPwrapper::deleteAllMail(const Folder*) { |
diff --git a/noncore/net/mail/libmailwrapper/nntpwrapper.h b/noncore/net/mail/libmailwrapper/nntpwrapper.h index d51c955..955b9f1 100644 --- a/noncore/net/mail/libmailwrapper/nntpwrapper.h +++ b/noncore/net/mail/libmailwrapper/nntpwrapper.h | |||
@@ -33,7 +33,7 @@ public: | |||
33 | virtual RecBody fetchBody( const RecMail &mail ); | 33 | virtual RecBody fetchBody( const RecMail &mail ); |
34 | virtual encodedString* fetchRawBody(const RecMail&mail); | 34 | virtual encodedString* fetchRawBody(const RecMail&mail); |
35 | virtual void logout(); | 35 | virtual void logout(); |
36 | virtual const QString&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 | ||
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp index 6fab401..0939b22 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp | |||
@@ -246,7 +246,7 @@ encodedString* POP3wrapper::fetchRawBody(const RecMail&mail) { | |||
246 | return res; | 246 | return res; |
247 | } | 247 | } |
248 | 248 | ||
249 | const QString&POP3wrapper::getType()const { | 249 | MAILLIB::ATYPE POP3wrapper::getType()const { |
250 | return account->getType(); | 250 | return account->getType(); |
251 | } | 251 | } |
252 | 252 | ||
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.h b/noncore/net/mail/libmailwrapper/pop3wrapper.h index a24b9cf..391c841 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.h +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.h | |||
@@ -29,7 +29,7 @@ public: | |||
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 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 | ||
diff --git a/noncore/net/mail/libmailwrapper/settings.cpp b/noncore/net/mail/libmailwrapper/settings.cpp index 0d34fd5..2c81963 100644 --- a/noncore/net/mail/libmailwrapper/settings.cpp +++ b/noncore/net/mail/libmailwrapper/settings.cpp | |||
@@ -106,7 +106,7 @@ void Settings::readAccounts() | |||
106 | Account::Account() | 106 | Account::Account() |
107 | { | 107 | { |
108 | accountName = "changeMe"; | 108 | accountName = "changeMe"; |
109 | type = "changeMe"; | 109 | type = MAILLIB::A_UNDEFINED; |
110 | ssl = false; | 110 | ssl = false; |
111 | connectionType = 1; | 111 | connectionType = 1; |
112 | offline = false; | 112 | offline = false; |
@@ -125,7 +125,7 @@ IMAPaccount::IMAPaccount() | |||
125 | accountName = "New IMAP Account"; | 125 | accountName = "New IMAP Account"; |
126 | ssl = false; | 126 | ssl = false; |
127 | connectionType = 1; | 127 | connectionType = 1; |
128 | type = "IMAP"; | 128 | type = MAILLIB::A_IMAP; |
129 | port = IMAP_PORT; | 129 | port = IMAP_PORT; |
130 | } | 130 | } |
131 | 131 | ||
@@ -136,7 +136,7 @@ IMAPaccount::IMAPaccount( QString filename ) | |||
136 | accountName = "New IMAP Account"; | 136 | accountName = "New IMAP Account"; |
137 | ssl = false; | 137 | ssl = false; |
138 | connectionType = 1; | 138 | connectionType = 1; |
139 | type = "IMAP"; | 139 | type = MAILLIB::A_IMAP; |
140 | port = IMAP_PORT; | 140 | port = IMAP_PORT; |
141 | } | 141 | } |
142 | 142 | ||
@@ -210,7 +210,7 @@ POP3account::POP3account() | |||
210 | accountName = "New POP3 Account"; | 210 | accountName = "New POP3 Account"; |
211 | ssl = false; | 211 | ssl = false; |
212 | connectionType = 1; | 212 | connectionType = 1; |
213 | type = "POP3"; | 213 | type = MAILLIB::A_POP3; |
214 | port = POP3_PORT; | 214 | port = POP3_PORT; |
215 | } | 215 | } |
216 | 216 | ||
@@ -221,7 +221,7 @@ POP3account::POP3account( QString filename ) | |||
221 | accountName = "New POP3 Account"; | 221 | accountName = "New POP3 Account"; |
222 | ssl = false; | 222 | ssl = false; |
223 | connectionType = 1; | 223 | connectionType = 1; |
224 | type = "POP3"; | 224 | type = MAILLIB::A_POP3; |
225 | port = POP3_PORT; | 225 | port = POP3_PORT; |
226 | } | 226 | } |
227 | 227 | ||
@@ -291,7 +291,7 @@ SMTPaccount::SMTPaccount() | |||
291 | useCC = false; | 291 | useCC = false; |
292 | useBCC = false; | 292 | useBCC = false; |
293 | useReply = false; | 293 | useReply = false; |
294 | type = "SMTP"; | 294 | type = MAILLIB::A_SMTP; |
295 | port = SMTP_PORT; | 295 | port = SMTP_PORT; |
296 | } | 296 | } |
297 | 297 | ||
@@ -303,7 +303,7 @@ SMTPaccount::SMTPaccount( QString filename ) | |||
303 | ssl = false; | 303 | ssl = false; |
304 | connectionType = 1; | 304 | connectionType = 1; |
305 | login = false; | 305 | login = false; |
306 | type = "SMTP"; | 306 | type = MAILLIB::A_SMTP; |
307 | port = SMTP_PORT; | 307 | port = SMTP_PORT; |
308 | } | 308 | } |
309 | 309 | ||
@@ -369,7 +369,7 @@ NNTPaccount::NNTPaccount() | |||
369 | accountName = "New NNTP Account"; | 369 | accountName = "New NNTP Account"; |
370 | ssl = false; | 370 | ssl = false; |
371 | login = false; | 371 | login = false; |
372 | type = "NNTP"; | 372 | type = MAILLIB::A_NNTP; |
373 | port = NNTP_PORT; | 373 | port = NNTP_PORT; |
374 | } | 374 | } |
375 | 375 | ||
@@ -380,7 +380,7 @@ NNTPaccount::NNTPaccount( QString filename ) | |||
380 | accountName = "New NNTP Account"; | 380 | accountName = "New NNTP Account"; |
381 | ssl = false; | 381 | ssl = false; |
382 | login = false; | 382 | login = false; |
383 | type = "NNTP"; | 383 | type = MAILLIB::A_NNTP; |
384 | port = NNTP_PORT; | 384 | port = NNTP_PORT; |
385 | } | 385 | } |
386 | 386 | ||
diff --git a/noncore/net/mail/libmailwrapper/settings.h b/noncore/net/mail/libmailwrapper/settings.h index 1feedbf..27e2823 100644 --- a/noncore/net/mail/libmailwrapper/settings.h +++ b/noncore/net/mail/libmailwrapper/settings.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef SETTINGS_H | 1 | #ifndef SETTINGS_H |
2 | #define SETTINGS_H | 2 | #define SETTINGS_H |
3 | 3 | ||
4 | #include "maildefines.h" | ||
5 | |||
4 | #include <qobject.h> | 6 | #include <qobject.h> |
5 | #include <qlist.h> | 7 | #include <qlist.h> |
6 | 8 | ||
@@ -14,7 +16,7 @@ public: | |||
14 | void remove(); | 16 | void remove(); |
15 | void setAccountName( QString name ) { accountName = name; } | 17 | void setAccountName( QString name ) { accountName = name; } |
16 | const QString&getAccountName()const{ return accountName; } | 18 | const QString&getAccountName()const{ return accountName; } |
17 | const QString&getType()const{ return type; } | 19 | MAILLIB::ATYPE getType()const{ return type; } |
18 | 20 | ||
19 | void setServer(const QString&str){ server = str; } | 21 | void setServer(const QString&str){ server = str; } |
20 | const QString&getServer()const{ return server; } | 22 | const QString&getServer()const{ return server; } |
@@ -41,12 +43,13 @@ public: | |||
41 | virtual QString getFileName() { return accountName; } | 43 | virtual QString getFileName() { return accountName; } |
42 | virtual void read() { qDebug( "base reading..." ); } | 44 | virtual void read() { qDebug( "base reading..." ); } |
43 | virtual void save() { qDebug( "base saving..." ); } | 45 | virtual void save() { qDebug( "base saving..." ); } |
44 | 46 | ||
45 | protected: | 47 | protected: |
46 | QString accountName, type, server, port, user, password; | 48 | QString accountName, server, port, user, password; |
47 | bool ssl; | 49 | bool ssl; |
48 | int connectionType; | 50 | int connectionType; |
49 | bool offline; | 51 | bool offline; |
52 | MAILLIB::ATYPE type; | ||
50 | }; | 53 | }; |
51 | 54 | ||
52 | class IMAPaccount : public Account | 55 | class IMAPaccount : public Account |
diff --git a/noncore/net/mail/libmailwrapper/statusmail.cpp b/noncore/net/mail/libmailwrapper/statusmail.cpp index 4134e79..b78244d 100644 --- a/noncore/net/mail/libmailwrapper/statusmail.cpp +++ b/noncore/net/mail/libmailwrapper/statusmail.cpp | |||
@@ -26,7 +26,7 @@ void StatusMail::initAccounts(QList<Account>&accounts) | |||
26 | currentPop3Stat.message_recent=0; | 26 | currentPop3Stat.message_recent=0; |
27 | currentPop3Stat.message_unseen=0; | 27 | currentPop3Stat.message_unseen=0; |
28 | for ( it = accounts.first(); it; it = accounts.next() ) { | 28 | for ( it = accounts.first(); it; it = accounts.next() ) { |
29 | if ( it->getType().compare( "IMAP" ) == 0 && !it->getOffline() ) { | 29 | if ( it->getType()==MAILLIB::A_IMAP && !it->getOffline() ) { |
30 | IMAPaccount*ima = static_cast<IMAPaccount *>(it); | 30 | IMAPaccount*ima = static_cast<IMAPaccount *>(it); |
31 | current = AbstractMail::getWrapper(ima); | 31 | current = AbstractMail::getWrapper(ima); |
32 | connectionList.append(current); | 32 | connectionList.append(current); |
@@ -34,7 +34,7 @@ void StatusMail::initAccounts(QList<Account>&accounts) | |||
34 | currentImapStat.message_count+=currentStat.message_unseen; | 34 | currentImapStat.message_count+=currentStat.message_unseen; |
35 | currentImapStat.message_count+=currentStat.message_recent; | 35 | currentImapStat.message_count+=currentStat.message_recent; |
36 | currentImapStat.message_count+=currentStat.message_count; | 36 | currentImapStat.message_count+=currentStat.message_count; |
37 | } else if ( it->getType().compare( "POP3" ) == 0 && !it->getOffline() ) { | 37 | } else if ( it->getType() == MAILLIB::A_POP3 && !it->getOffline() ) { |
38 | POP3account *pop3 = static_cast<POP3account *>(it); | 38 | POP3account *pop3 = static_cast<POP3account *>(it); |
39 | current = AbstractMail::getWrapper(pop3); | 39 | current = AbstractMail::getWrapper(pop3); |
40 | connectionList.append(current); | 40 | connectionList.append(current); |
@@ -66,11 +66,11 @@ void StatusMail::check_current_stat(folderStat&targetStat) | |||
66 | for ( it = connectionList.first(); it; it = connectionList.next() ) { | 66 | for ( it = connectionList.first(); it; it = connectionList.next() ) { |
67 | it->statusFolder(currentStat); | 67 | it->statusFolder(currentStat); |
68 | it->logout(); | 68 | it->logout(); |
69 | if (it->getType().lower()=="imap") { | 69 | if (it->getType() == MAILLIB::A_IMAP) { |
70 | currentImapStat.message_unseen+=currentStat.message_unseen; | 70 | currentImapStat.message_unseen+=currentStat.message_unseen; |
71 | currentImapStat.message_recent+=currentStat.message_recent; | 71 | currentImapStat.message_recent+=currentStat.message_recent; |
72 | currentImapStat.message_count+=currentStat.message_count; | 72 | currentImapStat.message_count+=currentStat.message_count; |
73 | } else if (it->getType().lower()=="pop3") { | 73 | } else if (it->getType() == MAILLIB::A_POP3) { |
74 | currentPop3Stat.message_count+=currentStat.message_count; | 74 | currentPop3Stat.message_count+=currentStat.message_count; |
75 | qDebug("Pop3 count: %i",currentPop3Stat.message_count); | 75 | qDebug("Pop3 count: %i",currentPop3Stat.message_count); |
76 | } | 76 | } |
diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp index 6bfc824..d8b58b6 100644 --- a/noncore/net/mail/opiemail.cpp +++ b/noncore/net/mail/opiemail.cpp | |||
@@ -82,7 +82,7 @@ void OpieMail::slotSendQueued() | |||
82 | Account *it; | 82 | Account *it; |
83 | for ( it = list.first(); it; it = list.next() ) | 83 | for ( it = list.first(); it; it = list.next() ) |
84 | { | 84 | { |
85 | if ( it->getType().compare( "SMTP" ) == 0 ) | 85 | if ( it->getType() == MAILLIB::A_SMTP ) |
86 | { | 86 | { |
87 | smtp = static_cast<SMTPaccount *>(it); | 87 | smtp = static_cast<SMTPaccount *>(it); |
88 | smtpList.append(smtp); | 88 | smtpList.append(smtp); |