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 | |||
@@ -53,38 +53,38 @@ void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int) | |||
53 | void AccountView::populate( QList<Account> list ) | 53 | void AccountView::populate( QList<Account> list ) |
54 | { | 54 | { |
55 | clear(); | 55 | clear(); |
56 | 56 | ||
57 | imapAccounts.clear(); | 57 | imapAccounts.clear(); |
58 | mhAccounts.clear(); | 58 | mhAccounts.clear(); |
59 | 59 | ||
60 | mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this)); | 60 | mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this)); |
61 | 61 | ||
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() ); |
82 | /* must not be hold 'cause it isn't required */ | 82 | /* must not be hold 'cause it isn't required */ |
83 | (void) new NNTPviewItem( nntp, this ); | 83 | (void) new NNTPviewItem( nntp, this ); |
84 | } | 84 | } |
85 | } | 85 | } |
86 | } | 86 | } |
87 | 87 | ||
88 | void AccountView::refresh(QListViewItem *item) | 88 | void AccountView::refresh(QListViewItem *item) |
89 | { | 89 | { |
90 | 90 | ||
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 | |||
@@ -37,25 +37,25 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m | |||
37 | senderNameEdit->setText(c.firstName()+" "+c.lastName()); | 37 | senderNameEdit->setText(c.firstName()+" "+c.lastName()); |
38 | Config cfg( "mail" ); | 38 | Config cfg( "mail" ); |
39 | cfg.setGroup( "Compose" ); | 39 | cfg.setGroup( "Compose" ); |
40 | checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); | 40 | checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); |
41 | 41 | ||
42 | attList->addColumn( tr( "Name" ) ); | 42 | attList->addColumn( tr( "Name" ) ); |
43 | attList->addColumn( tr( "Size" ) ); | 43 | attList->addColumn( tr( "Size" ) ); |
44 | 44 | ||
45 | QList<Account> accounts = settings->getAccounts(); | 45 | QList<Account> accounts = settings->getAccounts(); |
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 ); |
53 | } | 53 | } |
54 | } | 54 | } |
55 | 55 | ||
56 | if ( smtpAccounts.count() > 0 ) { | 56 | if ( smtpAccounts.count() > 0 ) { |
57 | fillValues( smtpAccountBox->currentItem() ); | 57 | fillValues( smtpAccountBox->currentItem() ); |
58 | } else { | 58 | } else { |
59 | QMessageBox::information( this, tr( "Problem" ), | 59 | QMessageBox::information( this, tr( "Problem" ), |
60 | tr( "<p>Please create an SMTP account first.</p>" ), | 60 | tr( "<p>Please create an SMTP account first.</p>" ), |
61 | tr( "Ok" ) ); | 61 | tr( "Ok" ) ); |
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 | |||
@@ -7,25 +7,43 @@ | |||
7 | 7 | ||
8 | /* QT */ | 8 | /* QT */ |
9 | #include <qt.h> | 9 | #include <qt.h> |
10 | #include <qstringlist.h> | 10 | #include <qstringlist.h> |
11 | 11 | ||
12 | #include <libmailwrapper/nntpwrapper.h> | 12 | #include <libmailwrapper/nntpwrapper.h> |
13 | 13 | ||
14 | AccountListItem::AccountListItem( QListView *parent, Account *a) | 14 | AccountListItem::AccountListItem( QListView *parent, Account *a) |
15 | : QListViewItem( parent ) | 15 | : QListViewItem( parent ) |
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 ) |
23 | : EditAccountsUI( parent, name, modal, flags ) | 41 | : EditAccountsUI( parent, name, modal, flags ) |
24 | { | 42 | { |
25 | qDebug( "New Account Configuration Widget" ); | 43 | qDebug( "New Account Configuration Widget" ); |
26 | settings = s; | 44 | settings = s; |
27 | 45 | ||
28 | mailList->addColumn( tr( "Account" ) ); | 46 | mailList->addColumn( tr( "Account" ) ); |
29 | mailList->addColumn( tr( "Type" ) ); | 47 | mailList->addColumn( tr( "Type" ) ); |
30 | 48 | ||
31 | newsList->addColumn( tr( "Account" ) ); | 49 | newsList->addColumn( tr( "Account" ) ); |
@@ -40,25 +58,25 @@ EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool | |||
40 | slotFillLists(); | 58 | slotFillLists(); |
41 | } | 59 | } |
42 | 60 | ||
43 | void EditAccounts::slotFillLists() | 61 | void EditAccounts::slotFillLists() |
44 | { | 62 | { |
45 | mailList->clear(); | 63 | mailList->clear(); |
46 | newsList->clear(); | 64 | newsList->clear(); |
47 | 65 | ||
48 | QList<Account> accounts = settings->getAccounts(); | 66 | QList<Account> accounts = settings->getAccounts(); |
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 | } |
56 | else | 74 | else |
57 | { | 75 | { |
58 | (void) new AccountListItem( mailList, it ); | 76 | (void) new AccountListItem( mailList, it ); |
59 | } | 77 | } |
60 | } | 78 | } |
61 | } | 79 | } |
62 | 80 | ||
63 | void EditAccounts::slotNewMail() | 81 | void EditAccounts::slotNewMail() |
64 | { | 82 | { |
@@ -134,52 +152,52 @@ void EditAccounts::slotNewAccount( const QString &type ) | |||
134 | account->save(); | 152 | account->save(); |
135 | slotFillLists(); | 153 | slotFillLists(); |
136 | } | 154 | } |
137 | else | 155 | else |
138 | { | 156 | { |
139 | account->remove(); | 157 | account->remove(); |
140 | } | 158 | } |
141 | } | 159 | } |
142 | } | 160 | } |
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 ); |
150 | if ( QDialog::Accepted == QPEApplication::execDialog( &imap ) ) | 168 | if ( QDialog::Accepted == QPEApplication::execDialog( &imap ) ) |
151 | { | 169 | { |
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 ); |
159 | if ( QDialog::Accepted == QPEApplication::execDialog( &pop3 ) ) | 177 | if ( QDialog::Accepted == QPEApplication::execDialog( &pop3 ) ) |
160 | { | 178 | { |
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 ); |
168 | if ( QDialog::Accepted == QPEApplication::execDialog( &smtp ) ) | 186 | if ( QDialog::Accepted == QPEApplication::execDialog( &smtp ) ) |
169 | { | 187 | { |
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 ); |
177 | if ( QDialog::Accepted == QPEApplication::execDialog( &nntp ) ) | 195 | if ( QDialog::Accepted == QPEApplication::execDialog( &nntp ) ) |
178 | { | 196 | { |
179 | slotFillLists(); | 197 | slotFillLists(); |
180 | } | 198 | } |
181 | } | 199 | } |
182 | } | 200 | } |
183 | 201 | ||
184 | void EditAccounts::slotDeleteAccount( Account *account ) | 202 | void EditAccounts::slotDeleteAccount( Account *account ) |
185 | { | 203 | { |
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,15 +1,17 @@ | |||
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 | ||
7 | class RecMail; | 9 | class RecMail; |
8 | class RecBody; | 10 | class RecBody; |
9 | class RecPart; | 11 | class RecPart; |
10 | class IMAPwrapper; | 12 | class IMAPwrapper; |
11 | class POP3wrapper; | 13 | class POP3wrapper; |
12 | class Folder; | 14 | class Folder; |
13 | class encodedString; | 15 | class encodedString; |
14 | struct folderStat; | 16 | struct folderStat; |
15 | 17 | ||
@@ -46,21 +48,21 @@ public: | |||
46 | */ | 48 | */ |
47 | virtual int createMbox(const QString&,const Folder*parentfolder=0,const QString& delemiter="/",bool getsubfolder=false); | 49 | virtual int createMbox(const QString&,const Folder*parentfolder=0,const QString& delemiter="/",bool getsubfolder=false); |
48 | virtual void logout()=0; | 50 | virtual void logout()=0; |
49 | 51 | ||
50 | static AbstractMail* getWrapper(IMAPaccount *a); | 52 | static AbstractMail* getWrapper(IMAPaccount *a); |
51 | static AbstractMail* getWrapper(POP3account *a); | 53 | static AbstractMail* getWrapper(POP3account *a); |
52 | static AbstractMail* getWrapper(NNTPaccount *a); | 54 | static AbstractMail* getWrapper(NNTPaccount *a); |
53 | /* mbox only! */ | 55 | /* mbox only! */ |
54 | static AbstractMail* getWrapper(const QString&a,const QString&name="Local Folders"); | 56 | static AbstractMail* getWrapper(const QString&a,const QString&name="Local Folders"); |
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: |
62 | static encodedString*decode_String(const encodedString*text,const QString&enc); | 64 | static encodedString*decode_String(const encodedString*text,const QString&enc); |
63 | static QString convert_String(const char*text); | 65 | static QString convert_String(const char*text); |
64 | static QString gen_attachment_id(); | 66 | static QString gen_attachment_id(); |
65 | }; | 67 | }; |
66 | #endif | 68 | #endif |
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 | |||
@@ -435,25 +435,25 @@ QString Genericwrapper::fetchTextPart(const RecMail&mail,const RecPart&part) | |||
435 | void Genericwrapper::cleanMimeCache() | 435 | void Genericwrapper::cleanMimeCache() |
436 | { | 436 | { |
437 | QMap<QString,encodedString*>::Iterator it = bodyCache.begin(); | 437 | QMap<QString,encodedString*>::Iterator it = bodyCache.begin(); |
438 | for (;it!=bodyCache.end();++it) { | 438 | for (;it!=bodyCache.end();++it) { |
439 | encodedString*t = it.data(); | 439 | encodedString*t = it.data(); |
440 | //it.setValue(0); | 440 | //it.setValue(0); |
441 | if (t) delete t; | 441 | if (t) delete t; |
442 | } | 442 | } |
443 | bodyCache.clear(); | 443 | bodyCache.clear(); |
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; |
451 | r = mailsession_get_messages_list(session,&env_list); | 451 | r = mailsession_get_messages_list(session,&env_list); |
452 | if (r != MAIL_NO_ERROR) { | 452 | if (r != MAIL_NO_ERROR) { |
453 | qDebug("Error message list"); | 453 | qDebug("Error message list"); |
454 | return; | 454 | return; |
455 | } | 455 | } |
456 | r = mailsession_get_envelopes_list(session, env_list); | 456 | r = mailsession_get_envelopes_list(session, env_list); |
457 | if (r != MAIL_NO_ERROR) { | 457 | if (r != MAIL_NO_ERROR) { |
458 | qDebug("Error filling message list"); | 458 | qDebug("Error filling message list"); |
459 | if (env_list) { | 459 | if (env_list) { |
@@ -479,26 +479,30 @@ void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const | |||
479 | mFlags.setBit(FLAG_SEEN); | 479 | mFlags.setBit(FLAG_SEEN); |
480 | } | 480 | } |
481 | mailimf_single_fields single_fields; | 481 | mailimf_single_fields single_fields; |
482 | mailimf_single_fields_init(&single_fields, msg->msg_fields); | 482 | mailimf_single_fields_init(&single_fields, msg->msg_fields); |
483 | mail->setMsgsize(msg->msg_size); | 483 | mail->setMsgsize(msg->msg_size); |
484 | mail->setFlags(mFlags); | 484 | mail->setFlags(mFlags); |
485 | mail->setMbox(mailbox); | 485 | mail->setMbox(mailbox); |
486 | mail->setNumber(msg->msg_index); | 486 | mail->setNumber(msg->msg_index); |
487 | if (single_fields.fld_subject) | 487 | if (single_fields.fld_subject) |
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) |
496 | mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); | 500 | mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); |
497 | if (single_fields.fld_orig_date) | 501 | if (single_fields.fld_orig_date) |
498 | mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) ); | 502 | mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) ); |
499 | // crashes when accessing pop3 account | 503 | // crashes when accessing pop3 account |
500 | // if (single_fields.fld_message_id->mid_value) | 504 | // if (single_fields.fld_message_id->mid_value) |
501 | // mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); | 505 | // mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); |
502 | refs = single_fields.fld_references; | 506 | refs = single_fields.fld_references; |
503 | if (refs && refs->mid_list && clist_count(refs->mid_list)) { | 507 | if (refs && refs->mid_list && clist_count(refs->mid_list)) { |
504 | char * text = (char*)refs->mid_list->first->data; | 508 | char * text = (char*)refs->mid_list->first->data; |
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 | |||
@@ -45,22 +45,22 @@ protected: | |||
45 | RecMail *parseHeader( const char *header ); | 45 | RecMail *parseHeader( const char *header ); |
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(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; |
61 | QMap<QString,encodedString*> bodyCache; | 61 | QMap<QString,encodedString*> bodyCache; |
62 | mailstorage * m_storage; | 62 | mailstorage * m_storage; |
63 | mailfolder*m_folder; | 63 | mailfolder*m_folder; |
64 | }; | 64 | }; |
65 | 65 | ||
66 | #endif | 66 | #endif |
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 | |||
@@ -1081,25 +1081,25 @@ void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) | |||
1081 | 1081 | ||
1082 | void IMAPwrapper::storeMessage(const char*msg,size_t length, const QString&folder) | 1082 | void IMAPwrapper::storeMessage(const char*msg,size_t length, const QString&folder) |
1083 | { | 1083 | { |
1084 | login(); | 1084 | login(); |
1085 | if (!m_imap) return; | 1085 | if (!m_imap) return; |
1086 | if (!msg) return; | 1086 | if (!msg) return; |
1087 | int r = mailimap_append(m_imap,(char*)folder.latin1(),0,0,msg,length); | 1087 | int r = mailimap_append(m_imap,(char*)folder.latin1(),0,0,msg,length); |
1088 | if (r != MAILIMAP_NO_ERROR) { | 1088 | if (r != MAILIMAP_NO_ERROR) { |
1089 | Global::statusMessage("Error storing mail!"); | 1089 | Global::statusMessage("Error storing mail!"); |
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 | } |
1097 | 1097 | ||
1098 | const QString&IMAPwrapper::getName()const | 1098 | const QString&IMAPwrapper::getName()const |
1099 | { | 1099 | { |
1100 | qDebug("Get name: %s",account->getAccountName().latin1()); | 1100 | qDebug("Get name: %s",account->getAccountName().latin1()); |
1101 | return account->getAccountName(); | 1101 | return account->getAccountName(); |
1102 | } | 1102 | } |
1103 | 1103 | ||
1104 | encodedString* IMAPwrapper::fetchRawBody(const RecMail&mail) | 1104 | encodedString* IMAPwrapper::fetchRawBody(const RecMail&mail) |
1105 | { | 1105 | { |
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 | |||
@@ -37,25 +37,25 @@ public: | |||
37 | virtual RecBody fetchBody(const RecMail&mail); | 37 | virtual RecBody fetchBody(const RecMail&mail); |
38 | virtual QString fetchTextPart(const RecMail&mail,const RecPart&part); | 38 | virtual QString fetchTextPart(const RecMail&mail,const RecPart&part); |
39 | virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part); | 39 | virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part); |
40 | virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part); | 40 | virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part); |
41 | virtual encodedString* fetchRawBody(const RecMail&mail); | 41 | virtual encodedString* fetchRawBody(const RecMail&mail); |
42 | 42 | ||
43 | virtual int createMbox(const QString&,const Folder*parentfolder=0,const QString& delemiter="/",bool getsubfolder=false); | 43 | virtual int createMbox(const QString&,const Folder*parentfolder=0,const QString& delemiter="/",bool getsubfolder=false); |
44 | virtual int deleteMbox(const Folder*folder); | 44 | virtual int deleteMbox(const Folder*folder); |
45 | 45 | ||
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: |
53 | RecMail*parse_list_result(mailimap_msg_att*); | 53 | RecMail*parse_list_result(mailimap_msg_att*); |
54 | void login(); | 54 | void login(); |
55 | bool start_tls(bool force=true); | 55 | bool start_tls(bool force=true); |
56 | 56 | ||
57 | virtual QString fetchTextPart(const RecMail&mail,const QValueList<int>&path,bool internal_call=false,const QString&enc=""); | 57 | virtual QString fetchTextPart(const RecMail&mail,const QValueList<int>&path,bool internal_call=false,const QString&enc=""); |
58 | virtual encodedString*fetchRawPart(const RecMail&mail,const QValueList<int>&path,bool internal_call); | 58 | virtual encodedString*fetchRawPart(const RecMail&mail,const QValueList<int>&path,bool internal_call); |
59 | int selectMbox(const QString&mbox); | 59 | int selectMbox(const QString&mbox); |
60 | 60 | ||
61 | void fillSinglePart(RecPart&target_part,mailimap_body_type_1part*Description); | 61 | void fillSinglePart(RecPart&target_part,mailimap_body_type_1part*Description); |
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 | |||
@@ -1,21 +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 | 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) |
13 | { | 13 | { |
14 | QDir dir(MBOXPath); | 14 | QDir dir(MBOXPath); |
15 | if (!dir.exists()) { | 15 | if (!dir.exists()) { |
16 | dir.mkdir(MBOXPath); | 16 | dir.mkdir(MBOXPath); |
17 | } | 17 | } |
18 | } | 18 | } |
19 | 19 | ||
20 | MBOXwrapper::~MBOXwrapper() | 20 | MBOXwrapper::~MBOXwrapper() |
21 | { | 21 | { |
@@ -317,21 +317,21 @@ void MBOXwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) | |||
317 | Global::statusMessage(tr("Mailbox doesn't exist.")); | 317 | Global::statusMessage(tr("Mailbox doesn't exist.")); |
318 | return; | 318 | return; |
319 | } | 319 | } |
320 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); | 320 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); |
321 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); | 321 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); |
322 | r = mailfolder_connect(folder); | 322 | r = mailfolder_connect(folder); |
323 | r = mailsession_status_folder(folder->fld_session,(char*)mailbox.latin1(),&target_stat.message_count, | 323 | r = mailsession_status_folder(folder->fld_session,(char*)mailbox.latin1(),&target_stat.message_count, |
324 | &target_stat.message_recent,&target_stat.message_unseen); | 324 | &target_stat.message_recent,&target_stat.message_unseen); |
325 | if (folder) mailfolder_free(folder); | 325 | if (folder) mailfolder_free(folder); |
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 | } |
333 | 333 | ||
334 | const QString&MBOXwrapper::getName()const | 334 | const QString&MBOXwrapper::getName()const |
335 | { | 335 | { |
336 | return MBOXName; | 336 | return MBOXName; |
337 | } | 337 | } |
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 | |||
@@ -26,23 +26,23 @@ public: | |||
26 | 26 | ||
27 | virtual int createMbox(const QString&folder,const Folder*f=0,const QString&d="",bool s=false); | 27 | virtual int createMbox(const QString&folder,const Folder*f=0,const QString&d="",bool s=false); |
28 | virtual int deleteMbox(const Folder*); | 28 | virtual int deleteMbox(const Folder*); |
29 | 29 | ||
30 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); | 30 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); |
31 | 31 | ||
32 | virtual RecBody fetchBody( const RecMail &mail ); | 32 | virtual RecBody fetchBody( const RecMail &mail ); |
33 | static void mbox_progress( size_t current, size_t maximum ); | 33 | static void mbox_progress( size_t current, size_t maximum ); |
34 | 34 | ||
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 | |||
@@ -1,23 +1,23 @@ | |||
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 | 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) |
15 | { | 15 | { |
16 | if (MHPath.length()>0) { | 16 | if (MHPath.length()>0) { |
17 | if (MHPath[MHPath.length()-1]=='/') { | 17 | if (MHPath[MHPath.length()-1]=='/') { |
18 | MHPath=MHPath.left(MHPath.length()-1); | 18 | MHPath=MHPath.left(MHPath.length()-1); |
19 | } | 19 | } |
20 | qDebug(MHPath); | 20 | qDebug(MHPath); |
21 | QDir dir(MHPath); | 21 | QDir dir(MHPath); |
22 | if (!dir.exists()) { | 22 | if (!dir.exists()) { |
23 | dir.mkdir(MHPath); | 23 | dir.mkdir(MHPath); |
@@ -357,25 +357,25 @@ void MHwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) | |||
357 | } | 357 | } |
358 | target_stat.message_count = 0; | 358 | target_stat.message_count = 0; |
359 | target_stat.message_unseen = 0; | 359 | target_stat.message_unseen = 0; |
360 | target_stat.message_recent = 0; | 360 | target_stat.message_recent = 0; |
361 | QString f = buildPath(mailbox); | 361 | QString f = buildPath(mailbox); |
362 | int r = mailsession_status_folder(m_storage->sto_session,(char*)f.latin1(),&target_stat.message_count, | 362 | int r = mailsession_status_folder(m_storage->sto_session,(char*)f.latin1(),&target_stat.message_count, |
363 | &target_stat.message_recent,&target_stat.message_unseen); | 363 | &target_stat.message_recent,&target_stat.message_unseen); |
364 | if (r != MAIL_NO_ERROR) { | 364 | if (r != MAIL_NO_ERROR) { |
365 | Global::statusMessage(tr("Error retrieving status")); | 365 | Global::statusMessage(tr("Error retrieving status")); |
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 | } |
373 | 373 | ||
374 | const QString&MHwrapper::getName()const | 374 | const QString&MHwrapper::getName()const |
375 | { | 375 | { |
376 | return MHName; | 376 | return MHName; |
377 | } | 377 | } |
378 | void MHwrapper::mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) | 378 | void MHwrapper::mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) |
379 | { | 379 | { |
380 | init_storage(); | 380 | init_storage(); |
381 | if (!m_storage) { | 381 | if (!m_storage) { |
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,15 +1,17 @@ | |||
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 | ||
7 | class RecMail; | 9 | class RecMail; |
8 | class RecBody; | 10 | class RecBody; |
9 | class encodedString; | 11 | class encodedString; |
10 | struct mailmbox_folder; | 12 | struct mailmbox_folder; |
11 | class OProcess; | 13 | class OProcess; |
12 | 14 | ||
13 | class MHwrapper : public Genericwrapper | 15 | class MHwrapper : public Genericwrapper |
14 | { | 16 | { |
15 | Q_OBJECT | 17 | Q_OBJECT |
@@ -28,32 +30,32 @@ public: | |||
28 | 30 | ||
29 | virtual int createMbox(const QString&folder,const Folder*f=0,const QString&d="",bool s=false); | 31 | virtual int createMbox(const QString&folder,const Folder*f=0,const QString&d="",bool s=false); |
30 | virtual int deleteMbox(const Folder*); | 32 | virtual int deleteMbox(const Folder*); |
31 | 33 | ||
32 | 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); |
33 | 35 | ||
34 | virtual RecBody fetchBody( const RecMail &mail ); | 36 | virtual RecBody fetchBody( const RecMail &mail ); |
35 | static void mbox_progress( size_t current, size_t maximum ); | 37 | static void mbox_progress( size_t current, size_t maximum ); |
36 | 38 | ||
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: |
44 | /* for deleting maildirs we are using a system call */ | 46 | /* for deleting maildirs we are using a system call */ |
45 | virtual void oprocessStderr(OProcess*, char *buffer, int ); | 47 | virtual void oprocessStderr(OProcess*, char *buffer, int ); |
46 | virtual void processEnded(OProcess *); | 48 | virtual void processEnded(OProcess *); |
47 | protected: | 49 | 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(); |
55 | 57 | ||
56 | bool removeMboxfailed; | 58 | bool removeMboxfailed; |
57 | }; | 59 | }; |
58 | 60 | ||
59 | #endif | 61 | #endif |
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 | |||
@@ -94,25 +94,25 @@ RecBody NNTPwrapper::fetchBody( const RecMail &mail ) { | |||
94 | 94 | ||
95 | return body; | 95 | return body; |
96 | } | 96 | } |
97 | 97 | ||
98 | 98 | ||
99 | void NNTPwrapper::listMessages(const QString & which, QList<RecMail> &target ) | 99 | void NNTPwrapper::listMessages(const QString & which, QList<RecMail> &target ) |
100 | { | 100 | { |
101 | login(); | 101 | login(); |
102 | if (!m_nntp) | 102 | if (!m_nntp) |
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() |
110 | { | 110 | { |
111 | if (account->getOffline()) | 111 | if (account->getOffline()) |
112 | return; | 112 | return; |
113 | /* we'll hold the line */ | 113 | /* we'll hold the line */ |
114 | if ( m_nntp != NULL ) | 114 | if ( m_nntp != NULL ) |
115 | return; | 115 | return; |
116 | 116 | ||
117 | const char *server, *user, *pass; | 117 | const char *server, *user, *pass; |
118 | QString User,Pass; | 118 | QString User,Pass; |
@@ -260,25 +260,25 @@ encodedString* NNTPwrapper::fetchRawBody(const RecMail&mail) { | |||
260 | encodedString*res = 0; | 260 | encodedString*res = 0; |
261 | mailmessage * mailmsg = 0; | 261 | mailmessage * mailmsg = 0; |
262 | int err = mailsession_get_message(m_nntp->sto_session, mail.getNumber(), &mailmsg); | 262 | int err = mailsession_get_message(m_nntp->sto_session, mail.getNumber(), &mailmsg); |
263 | err = mailmessage_fetch(mailmsg,&target,&length); | 263 | err = mailmessage_fetch(mailmsg,&target,&length); |
264 | if (mailmsg) | 264 | if (mailmsg) |
265 | mailmessage_free(mailmsg); | 265 | mailmessage_free(mailmsg); |
266 | if (target) { | 266 | if (target) { |
267 | res = new encodedString(target,length); | 267 | res = new encodedString(target,length); |
268 | } | 268 | } |
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 | ||
276 | const QString&NNTPwrapper::getName()const{ | 276 | 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*) { |
284 | } | 284 | } |
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 | |||
@@ -24,25 +24,25 @@ public: | |||
24 | /* should only get the subscribed one */ | 24 | /* should only get the subscribed one */ |
25 | virtual QList<Folder>* listFolders(); | 25 | virtual QList<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 RecMail&mail); | 29 | virtual void deleteMail(const RecMail&mail); |
30 | virtual void answeredMail(const RecMail&mail); | 30 | virtual void answeredMail(const RecMail&mail); |
31 | virtual int deleteAllMail(const Folder*); | 31 | virtual int deleteAllMail(const Folder*); |
32 | 32 | ||
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 | ||
40 | protected: | 40 | protected: |
41 | void login(); | 41 | void login(); |
42 | NNTPaccount *account; | 42 | NNTPaccount *account; |
43 | mailstorage* m_nntp; | 43 | mailstorage* m_nntp; |
44 | 44 | ||
45 | 45 | ||
46 | }; | 46 | }; |
47 | 47 | ||
48 | #endif | 48 | #endif |
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 | |||
@@ -237,19 +237,19 @@ encodedString* POP3wrapper::fetchRawBody(const RecMail&mail) { | |||
237 | encodedString*res = 0; | 237 | encodedString*res = 0; |
238 | mailmessage * mailmsg = 0; | 238 | mailmessage * mailmsg = 0; |
239 | int err = mailsession_get_message(m_pop3->sto_session, mail.getNumber(), &mailmsg); | 239 | int err = mailsession_get_message(m_pop3->sto_session, mail.getNumber(), &mailmsg); |
240 | err = mailmessage_fetch(mailmsg,&target,&length); | 240 | err = mailmessage_fetch(mailmsg,&target,&length); |
241 | if (mailmsg) | 241 | if (mailmsg) |
242 | mailmessage_free(mailmsg); | 242 | mailmessage_free(mailmsg); |
243 | if (target) { | 243 | if (target) { |
244 | res = new encodedString(target,length); | 244 | res = new encodedString(target,length); |
245 | } | 245 | } |
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 | ||
253 | const QString&POP3wrapper::getName()const{ | 253 | const QString&POP3wrapper::getName()const{ |
254 | return account->getAccountName(); | 254 | return account->getAccountName(); |
255 | } | 255 | } |
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 | |||
@@ -20,23 +20,23 @@ public: | |||
20 | virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); | 20 | virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); |
21 | virtual QList<Folder>* listFolders(); | 21 | virtual QList<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 RecMail&mail); | 25 | virtual void deleteMail(const RecMail&mail); |
26 | virtual void answeredMail(const RecMail&mail); | 26 | virtual void answeredMail(const RecMail&mail); |
27 | virtual int deleteAllMail(const Folder*); | 27 | virtual int deleteAllMail(const Folder*); |
28 | 28 | ||
29 | virtual RecBody fetchBody( const RecMail &mail ); | 29 | virtual RecBody fetchBody( const RecMail &mail ); |
30 | virtual encodedString* fetchRawBody(const RecMail&mail); | 30 | virtual encodedString* fetchRawBody(const RecMail&mail); |
31 | virtual void logout(); | 31 | virtual void logout(); |
32 | virtual const QString&getType()const; | 32 | virtual 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; |
40 | }; | 40 | }; |
41 | 41 | ||
42 | #endif | 42 | #endif |
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 | |||
@@ -97,55 +97,55 @@ void Settings::readAccounts() | |||
97 | { | 97 | { |
98 | checkDirectory(); | 98 | checkDirectory(); |
99 | Account *it; | 99 | Account *it; |
100 | 100 | ||
101 | for ( it = accounts.first(); it; it = accounts.next() ) { | 101 | for ( it = accounts.first(); it; it = accounts.next() ) { |
102 | it->read(); | 102 | it->read(); |
103 | } | 103 | } |
104 | } | 104 | } |
105 | 105 | ||
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; |
113 | } | 113 | } |
114 | 114 | ||
115 | void Account::remove() | 115 | void Account::remove() |
116 | { | 116 | { |
117 | QFile file( getFileName() ); | 117 | QFile file( getFileName() ); |
118 | file.remove(); | 118 | file.remove(); |
119 | } | 119 | } |
120 | 120 | ||
121 | IMAPaccount::IMAPaccount() | 121 | IMAPaccount::IMAPaccount() |
122 | : Account() | 122 | : Account() |
123 | { | 123 | { |
124 | file = IMAPaccount::getUniqueFileName(); | 124 | file = IMAPaccount::getUniqueFileName(); |
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 | ||
132 | IMAPaccount::IMAPaccount( QString filename ) | 132 | IMAPaccount::IMAPaccount( QString filename ) |
133 | : Account() | 133 | : Account() |
134 | { | 134 | { |
135 | file = filename; | 135 | file = 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 | ||
143 | QString IMAPaccount::getUniqueFileName() | 143 | QString IMAPaccount::getUniqueFileName() |
144 | { | 144 | { |
145 | int num = 0; | 145 | int num = 0; |
146 | QString unique; | 146 | QString unique; |
147 | 147 | ||
148 | QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); | 148 | QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); |
149 | 149 | ||
150 | QStringList imap = dir.entryList( "imap-*" ); | 150 | QStringList imap = dir.entryList( "imap-*" ); |
151 | do { | 151 | do { |
@@ -201,36 +201,36 @@ void IMAPaccount::save() | |||
201 | QString IMAPaccount::getFileName() | 201 | QString IMAPaccount::getFileName() |
202 | { | 202 | { |
203 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/imap-" + file; | 203 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/imap-" + file; |
204 | } | 204 | } |
205 | 205 | ||
206 | POP3account::POP3account() | 206 | POP3account::POP3account() |
207 | : Account() | 207 | : Account() |
208 | { | 208 | { |
209 | file = POP3account::getUniqueFileName(); | 209 | file = POP3account::getUniqueFileName(); |
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 | ||
217 | POP3account::POP3account( QString filename ) | 217 | POP3account::POP3account( QString filename ) |
218 | : Account() | 218 | : Account() |
219 | { | 219 | { |
220 | file = filename; | 220 | file = 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 | ||
228 | QString POP3account::getUniqueFileName() | 228 | QString POP3account::getUniqueFileName() |
229 | { | 229 | { |
230 | int num = 0; | 230 | int num = 0; |
231 | QString unique; | 231 | QString unique; |
232 | 232 | ||
233 | QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); | 233 | QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); |
234 | 234 | ||
235 | QStringList imap = dir.entryList( "pop3-*" ); | 235 | QStringList imap = dir.entryList( "pop3-*" ); |
236 | do { | 236 | do { |
@@ -282,37 +282,37 @@ QString POP3account::getFileName() | |||
282 | 282 | ||
283 | SMTPaccount::SMTPaccount() | 283 | SMTPaccount::SMTPaccount() |
284 | : Account() | 284 | : Account() |
285 | { | 285 | { |
286 | file = SMTPaccount::getUniqueFileName(); | 286 | file = SMTPaccount::getUniqueFileName(); |
287 | accountName = "New SMTP Account"; | 287 | accountName = "New SMTP Account"; |
288 | ssl = false; | 288 | ssl = false; |
289 | connectionType = 1; | 289 | connectionType = 1; |
290 | login = false; | 290 | login = false; |
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 | ||
298 | SMTPaccount::SMTPaccount( QString filename ) | 298 | SMTPaccount::SMTPaccount( QString filename ) |
299 | : Account() | 299 | : Account() |
300 | { | 300 | { |
301 | file = filename; | 301 | file = filename; |
302 | accountName = "New SMTP Account"; | 302 | accountName = "New SMTP Account"; |
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 | ||
310 | QString SMTPaccount::getUniqueFileName() | 310 | QString SMTPaccount::getUniqueFileName() |
311 | { | 311 | { |
312 | int num = 0; | 312 | int num = 0; |
313 | QString unique; | 313 | QString unique; |
314 | 314 | ||
315 | QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); | 315 | QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); |
316 | 316 | ||
317 | QStringList imap = dir.entryList( "smtp-*" ); | 317 | QStringList imap = dir.entryList( "smtp-*" ); |
318 | do { | 318 | do { |
@@ -360,36 +360,36 @@ void SMTPaccount::save() | |||
360 | QString SMTPaccount::getFileName() | 360 | QString SMTPaccount::getFileName() |
361 | { | 361 | { |
362 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/smtp-" + file; | 362 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/smtp-" + file; |
363 | } | 363 | } |
364 | 364 | ||
365 | NNTPaccount::NNTPaccount() | 365 | NNTPaccount::NNTPaccount() |
366 | : Account() | 366 | : Account() |
367 | { | 367 | { |
368 | file = NNTPaccount::getUniqueFileName(); | 368 | file = NNTPaccount::getUniqueFileName(); |
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 | ||
376 | NNTPaccount::NNTPaccount( QString filename ) | 376 | NNTPaccount::NNTPaccount( QString filename ) |
377 | : Account() | 377 | : Account() |
378 | { | 378 | { |
379 | file = filename; | 379 | file = 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 | ||
387 | QString NNTPaccount::getUniqueFileName() | 387 | QString NNTPaccount::getUniqueFileName() |
388 | { | 388 | { |
389 | int num = 0; | 389 | int num = 0; |
390 | QString unique; | 390 | QString unique; |
391 | 391 | ||
392 | QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); | 392 | QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); |
393 | 393 | ||
394 | QStringList imap = dir.entryList( "nntp-*" ); | 394 | QStringList imap = dir.entryList( "nntp-*" ); |
395 | do { | 395 | do { |
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,29 +1,31 @@ | |||
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 | ||
7 | class Account | 9 | class Account |
8 | { | 10 | { |
9 | 11 | ||
10 | public: | 12 | public: |
11 | Account(); | 13 | Account(); |
12 | virtual ~Account() {} | 14 | virtual ~Account() {} |
13 | 15 | ||
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; } |
21 | 23 | ||
22 | void setPort(const QString&str) { port = str; } | 24 | void setPort(const QString&str) { port = str; } |
23 | const QString&getPort()const{ return port; } | 25 | const QString&getPort()const{ return port; } |
24 | 26 | ||
25 | void setUser(const QString&str){ user = str; } | 27 | void setUser(const QString&str){ user = str; } |
26 | const QString&getUser()const{ return user; } | 28 | const QString&getUser()const{ return user; } |
27 | 29 | ||
28 | void setPassword(const QString&str) { password = str; } | 30 | void setPassword(const QString&str) { password = str; } |
29 | const QString&getPassword()const { return password; } | 31 | const QString&getPassword()const { return password; } |
@@ -32,30 +34,31 @@ public: | |||
32 | bool getSSL() { return ssl; } | 34 | bool getSSL() { return ssl; } |
33 | 35 | ||
34 | void setConnectionType( int x ) { connectionType = x; } | 36 | void setConnectionType( int x ) { connectionType = x; } |
35 | int ConnectionType() { return connectionType; } | 37 | int ConnectionType() { return connectionType; } |
36 | 38 | ||
37 | 39 | ||
38 | void setOffline(bool b) {offline = b;} | 40 | void setOffline(bool b) {offline = b;} |
39 | bool getOffline()const{return offline;} | 41 | bool getOffline()const{return offline;} |
40 | 42 | ||
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 |
53 | { | 56 | { |
54 | 57 | ||
55 | public: | 58 | public: |
56 | IMAPaccount(); | 59 | IMAPaccount(); |
57 | IMAPaccount( QString filename ); | 60 | IMAPaccount( QString filename ); |
58 | 61 | ||
59 | static QString getUniqueFileName(); | 62 | static QString getUniqueFileName(); |
60 | 63 | ||
61 | virtual void read(); | 64 | virtual void read(); |
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 | |||
@@ -17,33 +17,33 @@ StatusMail::~StatusMail() | |||
17 | } | 17 | } |
18 | 18 | ||
19 | void StatusMail::initAccounts(QList<Account>&accounts) | 19 | void StatusMail::initAccounts(QList<Account>&accounts) |
20 | { | 20 | { |
21 | 21 | ||
22 | Account *it; | 22 | Account *it; |
23 | folderStat currentStat; | 23 | folderStat currentStat; |
24 | AbstractMail * current = 0; | 24 | AbstractMail * current = 0; |
25 | currentPop3Stat.message_count=0; | 25 | currentPop3Stat.message_count=0; |
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); |
33 | current->statusFolder(currentStat); | 33 | current->statusFolder(currentStat); |
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); |
41 | current->statusFolder(currentStat); | 41 | current->statusFolder(currentStat); |
42 | currentPop3Stat.message_count+=currentStat.message_count; | 42 | currentPop3Stat.message_count+=currentStat.message_count; |
43 | } | 43 | } |
44 | current->logout(); | 44 | current->logout(); |
45 | } | 45 | } |
46 | qDebug("Pop3 init count: %i",currentPop3Stat.message_count); | 46 | qDebug("Pop3 init count: %i",currentPop3Stat.message_count); |
47 | currentPop3Stat.message_recent = currentPop3Stat.message_unseen = 0; | 47 | currentPop3Stat.message_recent = currentPop3Stat.message_unseen = 0; |
48 | lastPop3Stat.message_unseen = currentPop3Stat.message_unseen; | 48 | lastPop3Stat.message_unseen = currentPop3Stat.message_unseen; |
49 | lastPop3Stat.message_recent = currentPop3Stat.message_recent; | 49 | lastPop3Stat.message_recent = currentPop3Stat.message_recent; |
@@ -57,29 +57,29 @@ void StatusMail::reset_status() | |||
57 | 57 | ||
58 | void StatusMail::check_current_stat(folderStat&targetStat) | 58 | void StatusMail::check_current_stat(folderStat&targetStat) |
59 | { | 59 | { |
60 | AbstractMail*it = 0; | 60 | AbstractMail*it = 0; |
61 | folderStat currentStat; | 61 | folderStat currentStat; |
62 | currentPop3Stat.message_recent = 0; | 62 | currentPop3Stat.message_recent = 0; |
63 | currentPop3Stat.message_count = 0; | 63 | currentPop3Stat.message_count = 0; |
64 | currentPop3Stat.message_unseen = 0; | 64 | currentPop3Stat.message_unseen = 0; |
65 | currentImapStat = currentPop3Stat; | 65 | currentImapStat = currentPop3Stat; |
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 | } |
77 | } | 77 | } |
78 | qDebug("Pop3 last: %i",lastPop3Stat.message_count); | 78 | qDebug("Pop3 last: %i",lastPop3Stat.message_count); |
79 | if (currentPop3Stat.message_count > lastPop3Stat.message_count) { | 79 | if (currentPop3Stat.message_count > lastPop3Stat.message_count) { |
80 | currentPop3Stat.message_recent = currentPop3Stat.message_count - lastPop3Stat.message_count; | 80 | currentPop3Stat.message_recent = currentPop3Stat.message_count - lastPop3Stat.message_count; |
81 | currentPop3Stat.message_unseen = currentPop3Stat.message_recent; | 81 | currentPop3Stat.message_unseen = currentPop3Stat.message_recent; |
82 | } else { | 82 | } else { |
83 | lastPop3Stat.message_count = currentPop3Stat.message_count; | 83 | lastPop3Stat.message_count = currentPop3Stat.message_count; |
84 | currentPop3Stat.message_recent = currentPop3Stat.message_unseen = 0; | 84 | currentPop3Stat.message_recent = currentPop3Stat.message_unseen = 0; |
85 | } | 85 | } |
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 | |||
@@ -73,25 +73,25 @@ void OpieMail::slotComposeMail() | |||
73 | 73 | ||
74 | void OpieMail::slotSendQueued() | 74 | void OpieMail::slotSendQueued() |
75 | { | 75 | { |
76 | qDebug( "Send Queued" ); | 76 | qDebug( "Send Queued" ); |
77 | SMTPaccount *smtp = 0; | 77 | SMTPaccount *smtp = 0; |
78 | 78 | ||
79 | QList<Account> list = settings->getAccounts(); | 79 | QList<Account> list = settings->getAccounts(); |
80 | QList<SMTPaccount> smtpList; | 80 | QList<SMTPaccount> smtpList; |
81 | smtpList.setAutoDelete(false); | 81 | smtpList.setAutoDelete(false); |
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); |
89 | } | 89 | } |
90 | } | 90 | } |
91 | if (smtpList.count()==0) | 91 | if (smtpList.count()==0) |
92 | { | 92 | { |
93 | QMessageBox::information(0,tr("Info"),tr("Define a smtp account first")); | 93 | QMessageBox::information(0,tr("Info"),tr("Define a smtp account first")); |
94 | return; | 94 | return; |
95 | } | 95 | } |
96 | if (smtpList.count()==1) | 96 | if (smtpList.count()==1) |
97 | { | 97 | { |