summaryrefslogtreecommitdiff
path: root/noncore/net/mail/libmailwrapper
authorchicken <chicken>2004-03-02 16:24:30 (UTC)
committer chicken <chicken>2004-03-02 16:24:30 (UTC)
commit10d627d55eaab6cda26b03879f1b0fe31d1b273b (patch) (unidiff)
treeeb04a35ba5e359eb808bf0bd85b1be51dcb4b0a9 /noncore/net/mail/libmailwrapper
parent49bee7ab52b819a07e9b6de4576eda467d632a66 (diff)
downloadopie-10d627d55eaab6cda26b03879f1b0fe31d1b273b.zip
opie-10d627d55eaab6cda26b03879f1b0fe31d1b273b.tar.gz
opie-10d627d55eaab6cda26b03879f1b0fe31d1b273b.tar.bz2
fix includes
Diffstat (limited to 'noncore/net/mail/libmailwrapper') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/libmailwrapper/abstractmail.cpp2
-rw-r--r--noncore/net/mail/libmailwrapper/sendmailprogress.cpp1
-rw-r--r--noncore/net/mail/libmailwrapper/smtpwrapper.cpp2
-rw-r--r--noncore/net/mail/libmailwrapper/statusmail.cpp1
4 files changed, 0 insertions, 6 deletions
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.cpp b/noncore/net/mail/libmailwrapper/abstractmail.cpp
index 741a8e1..9960f88 100644
--- a/noncore/net/mail/libmailwrapper/abstractmail.cpp
+++ b/noncore/net/mail/libmailwrapper/abstractmail.cpp
@@ -1,105 +1,103 @@
1#include "abstractmail.h" 1#include "abstractmail.h"
2#include "imapwrapper.h" 2#include "imapwrapper.h"
3#include "pop3wrapper.h" 3#include "pop3wrapper.h"
4#include "nntpwrapper.h" 4#include "nntpwrapper.h"
5#include "mhwrapper.h" 5#include "mhwrapper.h"
6#include "mboxwrapper.h"
7#include "mailtypes.h" 6#include "mailtypes.h"
8 7
9#include <qstring.h>
10#include <qfile.h> 8#include <qfile.h>
11#include <qtextstream.h> 9#include <qtextstream.h>
12#include <stdlib.h> 10#include <stdlib.h>
13#include <libetpan/mailmime_content.h> 11#include <libetpan/mailmime_content.h>
14#include <libetpan/mailmime.h> 12#include <libetpan/mailmime.h>
15 13
16AbstractMail* AbstractMail::getWrapper(IMAPaccount *a) 14AbstractMail* AbstractMail::getWrapper(IMAPaccount *a)
17{ 15{
18 return new IMAPwrapper(a); 16 return new IMAPwrapper(a);
19} 17}
20 18
21AbstractMail* AbstractMail::getWrapper(POP3account *a) 19AbstractMail* AbstractMail::getWrapper(POP3account *a)
22{ 20{
23 return new POP3wrapper(a); 21 return new POP3wrapper(a);
24} 22}
25 23
26AbstractMail* AbstractMail::getWrapper(NNTPaccount *a) 24AbstractMail* AbstractMail::getWrapper(NNTPaccount *a)
27{ 25{
28 return new NNTPwrapper(a); 26 return new NNTPwrapper(a);
29} 27}
30 28
31AbstractMail* AbstractMail::getWrapper(const QString&a,const QString&name) 29AbstractMail* AbstractMail::getWrapper(const QString&a,const QString&name)
32{ 30{
33 return new MHwrapper(a,name); 31 return new MHwrapper(a,name);
34} 32}
35 33
36encodedString* AbstractMail::decode_String(const encodedString*text,const QString&enc) 34encodedString* AbstractMail::decode_String(const encodedString*text,const QString&enc)
37{ 35{
38 qDebug("Decode string start"); 36 qDebug("Decode string start");
39 char*result_text; 37 char*result_text;
40 size_t index = 0; 38 size_t index = 0;
41 /* reset for recursive use! */ 39 /* reset for recursive use! */
42 size_t target_length = 0; 40 size_t target_length = 0;
43 result_text = 0; 41 result_text = 0;
44 int mimetype = MAILMIME_MECHANISM_7BIT; 42 int mimetype = MAILMIME_MECHANISM_7BIT;
45 if (enc.lower()=="quoted-printable") { 43 if (enc.lower()=="quoted-printable") {
46 mimetype = MAILMIME_MECHANISM_QUOTED_PRINTABLE; 44 mimetype = MAILMIME_MECHANISM_QUOTED_PRINTABLE;
47 } else if (enc.lower()=="base64") { 45 } else if (enc.lower()=="base64") {
48 mimetype = MAILMIME_MECHANISM_BASE64; 46 mimetype = MAILMIME_MECHANISM_BASE64;
49 } else if (enc.lower()=="8bit") { 47 } else if (enc.lower()=="8bit") {
50 mimetype = MAILMIME_MECHANISM_8BIT; 48 mimetype = MAILMIME_MECHANISM_8BIT;
51 } else if (enc.lower()=="binary") { 49 } else if (enc.lower()=="binary") {
52 mimetype = MAILMIME_MECHANISM_BINARY; 50 mimetype = MAILMIME_MECHANISM_BINARY;
53 } 51 }
54 52
55 int err = mailmime_part_parse(text->Content(),text->Length(),&index,mimetype, 53 int err = mailmime_part_parse(text->Content(),text->Length(),&index,mimetype,
56 &result_text,&target_length); 54 &result_text,&target_length);
57 55
58 encodedString* result = new encodedString(); 56 encodedString* result = new encodedString();
59 if (err == MAILIMF_NO_ERROR) { 57 if (err == MAILIMF_NO_ERROR) {
60 result->setContent(result_text,target_length); 58 result->setContent(result_text,target_length);
61 } 59 }
62 qDebug("Decode string finished"); 60 qDebug("Decode string finished");
63 return result; 61 return result;
64} 62}
65 63
66QString AbstractMail::convert_String(const char*text) 64QString AbstractMail::convert_String(const char*text)
67{ 65{
68 size_t index = 0; 66 size_t index = 0;
69 char*res = 0; 67 char*res = 0;
70 68
71 /* attention - doesn't work with arm systems! */ 69 /* attention - doesn't work with arm systems! */
72 int err = mailmime_encoded_phrase_parse("iso-8859-1", 70 int err = mailmime_encoded_phrase_parse("iso-8859-1",
73 text, strlen(text),&index, "iso-8859-1",&res); 71 text, strlen(text),&index, "iso-8859-1",&res);
74 if (err != MAILIMF_NO_ERROR) { 72 if (err != MAILIMF_NO_ERROR) {
75 if (res) free(res); 73 if (res) free(res);
76 return QString(text); 74 return QString(text);
77 } 75 }
78 if (res) { 76 if (res) {
79 QString result(res); 77 QString result(res);
80 free(res); 78 free(res);
81 return result; 79 return result;
82 } 80 }
83 return QString(text); 81 return QString(text);
84} 82}
85 83
86/* cp & paste from launcher */ 84/* cp & paste from launcher */
87QString AbstractMail::gen_attachment_id() 85QString AbstractMail::gen_attachment_id()
88{ 86{
89 QFile file( "/proc/sys/kernel/random/uuid" ); 87 QFile file( "/proc/sys/kernel/random/uuid" );
90 if (!file.open(IO_ReadOnly ) ) 88 if (!file.open(IO_ReadOnly ) )
91 return QString::null; 89 return QString::null;
92 90
93 QTextStream stream(&file); 91 QTextStream stream(&file);
94 92
95 return "{" + stream.read().stripWhiteSpace() + "}"; 93 return "{" + stream.read().stripWhiteSpace() + "}";
96} 94}
97 95
98int AbstractMail::createMbox(const QString&,const Folder*,const QString& delemiter,bool) 96int AbstractMail::createMbox(const QString&,const Folder*,const QString& delemiter,bool)
99{ 97{
100 return 0; 98 return 0;
101} 99}
102 100
103QString AbstractMail::defaultLocalfolder() 101QString AbstractMail::defaultLocalfolder()
104{ 102{
105 QString f = getenv( "HOME" ); 103 QString f = getenv( "HOME" );
diff --git a/noncore/net/mail/libmailwrapper/sendmailprogress.cpp b/noncore/net/mail/libmailwrapper/sendmailprogress.cpp
index ef22750..dc0c75a 100644
--- a/noncore/net/mail/libmailwrapper/sendmailprogress.cpp
+++ b/noncore/net/mail/libmailwrapper/sendmailprogress.cpp
@@ -1,48 +1,47 @@
1#include "sendmailprogress.h" 1#include "sendmailprogress.h"
2#include <qprogressbar.h> 2#include <qprogressbar.h>
3#include <qlabel.h> 3#include <qlabel.h>
4#include <qstring.h>
5 4
6progressMailSend::progressMailSend(QWidget*parent, const char * name) 5progressMailSend::progressMailSend(QWidget*parent, const char * name)
7 :progressMailSendUI(parent,name,true),m_current_mail(0),m_current_single(0),m_max_mail(0),m_max_single(0) 6 :progressMailSendUI(parent,name,true),m_current_mail(0),m_current_single(0),m_max_mail(0),m_max_single(0)
8{ 7{
9} 8}
10 9
11progressMailSend::~progressMailSend() 10progressMailSend::~progressMailSend()
12{ 11{
13} 12}
14 13
15void progressMailSend::setMaxMails(unsigned int aMaxMails) 14void progressMailSend::setMaxMails(unsigned int aMaxMails)
16{ 15{
17 m_max_mail = aMaxMails; 16 m_max_mail = aMaxMails;
18 allMailProgressBar->setTotalSteps(aMaxMails); 17 allMailProgressBar->setTotalSteps(aMaxMails);
19 setMails(); 18 setMails();
20} 19}
21 20
22void progressMailSend::setCurrentMails(unsigned int aCurrent) 21void progressMailSend::setCurrentMails(unsigned int aCurrent)
23{ 22{
24 m_current_mail = aCurrent; 23 m_current_mail = aCurrent;
25 allMailProgressBar->setProgress(aCurrent); 24 allMailProgressBar->setProgress(aCurrent);
26 setMails(); 25 setMails();
27} 26}
28 27
29void progressMailSend::setSingleMail(unsigned int aCurrent,unsigned int aMax) 28void progressMailSend::setSingleMail(unsigned int aCurrent,unsigned int aMax)
30{ 29{
31 m_current_single = aCurrent; 30 m_current_single = aCurrent;
32 m_max_single = aMax; 31 m_max_single = aMax;
33 setSingle(); 32 setSingle();
34} 33}
35 34
36void progressMailSend::setSingle() 35void progressMailSend::setSingle()
37{ 36{
38 QString text = QString(tr("%1 of %2 bytes send")).arg(m_current_single).arg(m_max_single); 37 QString text = QString(tr("%1 of %2 bytes send")).arg(m_current_single).arg(m_max_single);
39 singleMailLabel->setText(text); 38 singleMailLabel->setText(text);
40 singleMailProgressBar->setTotalSteps(m_max_single); 39 singleMailProgressBar->setTotalSteps(m_max_single);
41 singleMailProgressBar->setProgress(m_current_single); 40 singleMailProgressBar->setProgress(m_current_single);
42} 41}
43 42
44void progressMailSend::setMails() 43void progressMailSend::setMails()
45{ 44{
46 QString text = QString(tr("Sending mail %1 of %2")).arg(m_current_mail+1).arg(m_max_mail); 45 QString text = QString(tr("Sending mail %1 of %2")).arg(m_current_mail+1).arg(m_max_mail);
47 allMailLabel->setText(text); 46 allMailLabel->setText(text);
48} 47}
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
index d75d52a..d7a005e 100644
--- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
@@ -1,105 +1,103 @@
1#include <stdlib.h> 1#include <stdlib.h>
2#include <sys/stat.h> 2#include <sys/stat.h>
3#include <sys/types.h> 3#include <sys/types.h>
4#include <unistd.h> 4#include <unistd.h>
5#include <fcntl.h> 5#include <fcntl.h>
6#include <string.h> 6#include <string.h>
7#include <qdir.h>
8#include <qt.h> 7#include <qt.h>
9#include <qmessagebox.h>
10 8
11#include <qpe/config.h> 9#include <qpe/config.h>
12#include <qpe/qcopenvelope_qws.h> 10#include <qpe/qcopenvelope_qws.h>
13 11
14#include <libetpan/libetpan.h> 12#include <libetpan/libetpan.h>
15 13
16#include "smtpwrapper.h" 14#include "smtpwrapper.h"
17#include "mailwrapper.h" 15#include "mailwrapper.h"
18#include "abstractmail.h" 16#include "abstractmail.h"
19#include "logindialog.h" 17#include "logindialog.h"
20#include "mailtypes.h" 18#include "mailtypes.h"
21#include "sendmailprogress.h" 19#include "sendmailprogress.h"
22 20
23const char* SMTPwrapper::USER_AGENT="OpieMail v0.4"; 21const char* SMTPwrapper::USER_AGENT="OpieMail v0.4";
24 22
25progressMailSend*SMTPwrapper::sendProgress = 0; 23progressMailSend*SMTPwrapper::sendProgress = 0;
26 24
27SMTPwrapper::SMTPwrapper(SMTPaccount * aSmtp ) 25SMTPwrapper::SMTPwrapper(SMTPaccount * aSmtp )
28 : QObject() 26 : QObject()
29{ 27{
30 m_SmtpAccount = aSmtp; 28 m_SmtpAccount = aSmtp;
31 Config cfg( "mail" ); 29 Config cfg( "mail" );
32 cfg.setGroup( "Status" ); 30 cfg.setGroup( "Status" );
33 m_queuedMail = cfg.readNumEntry( "outgoing", 0 ); 31 m_queuedMail = cfg.readNumEntry( "outgoing", 0 );
34 emit queuedMails( m_queuedMail ); 32 emit queuedMails( m_queuedMail );
35 connect( this, SIGNAL( queuedMails(int) ), this, SLOT( emitQCop(int) ) ); 33 connect( this, SIGNAL( queuedMails(int) ), this, SLOT( emitQCop(int) ) );
36 m_smtp = 0; 34 m_smtp = 0;
37} 35}
38 36
39SMTPwrapper::~SMTPwrapper() 37SMTPwrapper::~SMTPwrapper()
40{ 38{
41 disc_server(); 39 disc_server();
42} 40}
43 41
44void SMTPwrapper::emitQCop( int queued ) { 42void SMTPwrapper::emitQCop( int queued ) {
45 QCopEnvelope env( "QPE/Pim", "outgoingMails(int)" ); 43 QCopEnvelope env( "QPE/Pim", "outgoingMails(int)" );
46 env << queued; 44 env << queued;
47} 45}
48 46
49QString SMTPwrapper::mailsmtpError( int errnum ) { 47QString SMTPwrapper::mailsmtpError( int errnum ) {
50 switch ( errnum ) { 48 switch ( errnum ) {
51 case MAILSMTP_NO_ERROR: 49 case MAILSMTP_NO_ERROR:
52 return tr( "No error" ); 50 return tr( "No error" );
53 case MAILSMTP_ERROR_UNEXPECTED_CODE: 51 case MAILSMTP_ERROR_UNEXPECTED_CODE:
54 return tr( "Unexpected error code" ); 52 return tr( "Unexpected error code" );
55 case MAILSMTP_ERROR_SERVICE_NOT_AVAILABLE: 53 case MAILSMTP_ERROR_SERVICE_NOT_AVAILABLE:
56 return tr( "Service not available" ); 54 return tr( "Service not available" );
57 case MAILSMTP_ERROR_STREAM: 55 case MAILSMTP_ERROR_STREAM:
58 return tr( "Stream error" ); 56 return tr( "Stream error" );
59 case MAILSMTP_ERROR_HOSTNAME: 57 case MAILSMTP_ERROR_HOSTNAME:
60 return tr( "gethostname() failed" ); 58 return tr( "gethostname() failed" );
61 case MAILSMTP_ERROR_NOT_IMPLEMENTED: 59 case MAILSMTP_ERROR_NOT_IMPLEMENTED:
62 return tr( "Not implemented" ); 60 return tr( "Not implemented" );
63 case MAILSMTP_ERROR_ACTION_NOT_TAKEN: 61 case MAILSMTP_ERROR_ACTION_NOT_TAKEN:
64 return tr( "Error, action not taken" ); 62 return tr( "Error, action not taken" );
65 case MAILSMTP_ERROR_EXCEED_STORAGE_ALLOCATION: 63 case MAILSMTP_ERROR_EXCEED_STORAGE_ALLOCATION:
66 return tr( "Data exceeds storage allocation" ); 64 return tr( "Data exceeds storage allocation" );
67 case MAILSMTP_ERROR_IN_PROCESSING: 65 case MAILSMTP_ERROR_IN_PROCESSING:
68 return tr( "Error in processing" ); 66 return tr( "Error in processing" );
69 case MAILSMTP_ERROR_STARTTLS_NOT_SUPPORTED: 67 case MAILSMTP_ERROR_STARTTLS_NOT_SUPPORTED:
70 return tr( "Starttls not supported" ); 68 return tr( "Starttls not supported" );
71 // case MAILSMTP_ERROR_INSUFFISANT_SYSTEM_STORAGE: 69 // case MAILSMTP_ERROR_INSUFFISANT_SYSTEM_STORAGE:
72 // return tr( "Insufficient system storage" ); 70 // return tr( "Insufficient system storage" );
73 case MAILSMTP_ERROR_MAILBOX_UNAVAILABLE: 71 case MAILSMTP_ERROR_MAILBOX_UNAVAILABLE:
74 return tr( "Mailbox unavailable" ); 72 return tr( "Mailbox unavailable" );
75 case MAILSMTP_ERROR_MAILBOX_NAME_NOT_ALLOWED: 73 case MAILSMTP_ERROR_MAILBOX_NAME_NOT_ALLOWED:
76 return tr( "Mailbox name not allowed" ); 74 return tr( "Mailbox name not allowed" );
77 case MAILSMTP_ERROR_BAD_SEQUENCE_OF_COMMAND: 75 case MAILSMTP_ERROR_BAD_SEQUENCE_OF_COMMAND:
78 return tr( "Bad command sequence" ); 76 return tr( "Bad command sequence" );
79 case MAILSMTP_ERROR_USER_NOT_LOCAL: 77 case MAILSMTP_ERROR_USER_NOT_LOCAL:
80 return tr( "User not local" ); 78 return tr( "User not local" );
81 case MAILSMTP_ERROR_TRANSACTION_FAILED: 79 case MAILSMTP_ERROR_TRANSACTION_FAILED:
82 return tr( "Transaction failed" ); 80 return tr( "Transaction failed" );
83 case MAILSMTP_ERROR_MEMORY: 81 case MAILSMTP_ERROR_MEMORY:
84 return tr( "Memory error" ); 82 return tr( "Memory error" );
85 case MAILSMTP_ERROR_CONNECTION_REFUSED: 83 case MAILSMTP_ERROR_CONNECTION_REFUSED:
86 return tr( "Connection refused" ); 84 return tr( "Connection refused" );
87 default: 85 default:
88 return tr( "Unknown error code" ); 86 return tr( "Unknown error code" );
89 } 87 }
90} 88}
91 89
92mailimf_mailbox *SMTPwrapper::newMailbox(const QString&name, const QString&mail ) { 90mailimf_mailbox *SMTPwrapper::newMailbox(const QString&name, const QString&mail ) {
93 return mailimf_mailbox_new( strdup( name.latin1() ), 91 return mailimf_mailbox_new( strdup( name.latin1() ),
94 strdup( mail.latin1() ) ); 92 strdup( mail.latin1() ) );
95} 93}
96 94
97mailimf_address_list *SMTPwrapper::parseAddresses(const QString&addr ) { 95mailimf_address_list *SMTPwrapper::parseAddresses(const QString&addr ) {
98 mailimf_address_list *addresses; 96 mailimf_address_list *addresses;
99 97
100 if ( addr.isEmpty() ) 98 if ( addr.isEmpty() )
101 return NULL; 99 return NULL;
102 100
103 addresses = mailimf_address_list_new_empty(); 101 addresses = mailimf_address_list_new_empty();
104 102
105 bool literal_open = false; 103 bool literal_open = false;
diff --git a/noncore/net/mail/libmailwrapper/statusmail.cpp b/noncore/net/mail/libmailwrapper/statusmail.cpp
index 172c58f..4134e79 100644
--- a/noncore/net/mail/libmailwrapper/statusmail.cpp
+++ b/noncore/net/mail/libmailwrapper/statusmail.cpp
@@ -1,91 +1,90 @@
1#include "statusmail.h" 1#include "statusmail.h"
2#include <qlist.h>
3 2
4StatusMail::StatusMail(QList<Account>&list) 3StatusMail::StatusMail(QList<Account>&list)
5{ 4{
6 currentImapStat.message_count=0; 5 currentImapStat.message_count=0;
7 currentImapStat.message_unseen=0; 6 currentImapStat.message_unseen=0;
8 currentImapStat.message_recent=0; 7 currentImapStat.message_recent=0;
9 lastPop3Stat = currentImapStat; 8 lastPop3Stat = currentImapStat;
10 currentPop3Stat = currentImapStat; 9 currentPop3Stat = currentImapStat;
11 connectionList.setAutoDelete(true); 10 connectionList.setAutoDelete(true);
12 connectionList.clear(); 11 connectionList.clear();
13 initAccounts(list); 12 initAccounts(list);
14} 13}
15 14
16StatusMail::~StatusMail() 15StatusMail::~StatusMail()
17{ 16{
18} 17}
19 18
20void StatusMail::initAccounts(QList<Account>&accounts) 19void StatusMail::initAccounts(QList<Account>&accounts)
21{ 20{
22 21
23 Account *it; 22 Account *it;
24 folderStat currentStat; 23 folderStat currentStat;
25 AbstractMail * current = 0; 24 AbstractMail * current = 0;
26 currentPop3Stat.message_count=0; 25 currentPop3Stat.message_count=0;
27 currentPop3Stat.message_recent=0; 26 currentPop3Stat.message_recent=0;
28 currentPop3Stat.message_unseen=0; 27 currentPop3Stat.message_unseen=0;
29 for ( it = accounts.first(); it; it = accounts.next() ) { 28 for ( it = accounts.first(); it; it = accounts.next() ) {
30 if ( it->getType().compare( "IMAP" ) == 0 && !it->getOffline() ) { 29 if ( it->getType().compare( "IMAP" ) == 0 && !it->getOffline() ) {
31 IMAPaccount*ima = static_cast<IMAPaccount *>(it); 30 IMAPaccount*ima = static_cast<IMAPaccount *>(it);
32 current = AbstractMail::getWrapper(ima); 31 current = AbstractMail::getWrapper(ima);
33 connectionList.append(current); 32 connectionList.append(current);
34 current->statusFolder(currentStat); 33 current->statusFolder(currentStat);
35 currentImapStat.message_count+=currentStat.message_unseen; 34 currentImapStat.message_count+=currentStat.message_unseen;
36 currentImapStat.message_count+=currentStat.message_recent; 35 currentImapStat.message_count+=currentStat.message_recent;
37 currentImapStat.message_count+=currentStat.message_count; 36 currentImapStat.message_count+=currentStat.message_count;
38 } else if ( it->getType().compare( "POP3" ) == 0 && !it->getOffline() ) { 37 } else if ( it->getType().compare( "POP3" ) == 0 && !it->getOffline() ) {
39 POP3account *pop3 = static_cast<POP3account *>(it); 38 POP3account *pop3 = static_cast<POP3account *>(it);
40 current = AbstractMail::getWrapper(pop3); 39 current = AbstractMail::getWrapper(pop3);
41 connectionList.append(current); 40 connectionList.append(current);
42 current->statusFolder(currentStat); 41 current->statusFolder(currentStat);
43 currentPop3Stat.message_count+=currentStat.message_count; 42 currentPop3Stat.message_count+=currentStat.message_count;
44 } 43 }
45 current->logout(); 44 current->logout();
46 } 45 }
47 qDebug("Pop3 init count: %i",currentPop3Stat.message_count); 46 qDebug("Pop3 init count: %i",currentPop3Stat.message_count);
48 currentPop3Stat.message_recent = currentPop3Stat.message_unseen = 0; 47 currentPop3Stat.message_recent = currentPop3Stat.message_unseen = 0;
49 lastPop3Stat.message_unseen = currentPop3Stat.message_unseen; 48 lastPop3Stat.message_unseen = currentPop3Stat.message_unseen;
50 lastPop3Stat.message_recent = currentPop3Stat.message_recent; 49 lastPop3Stat.message_recent = currentPop3Stat.message_recent;
51 lastPop3Stat.message_count = currentPop3Stat.message_count; 50 lastPop3Stat.message_count = currentPop3Stat.message_count;
52} 51}
53 52
54void StatusMail::reset_status() 53void StatusMail::reset_status()
55{ 54{
56 lastPop3Stat = currentPop3Stat; 55 lastPop3Stat = currentPop3Stat;
57} 56}
58 57
59void StatusMail::check_current_stat(folderStat&targetStat) 58void StatusMail::check_current_stat(folderStat&targetStat)
60{ 59{
61 AbstractMail*it = 0; 60 AbstractMail*it = 0;
62 folderStat currentStat; 61 folderStat currentStat;
63 currentPop3Stat.message_recent = 0; 62 currentPop3Stat.message_recent = 0;
64 currentPop3Stat.message_count = 0; 63 currentPop3Stat.message_count = 0;
65 currentPop3Stat.message_unseen = 0; 64 currentPop3Stat.message_unseen = 0;
66 currentImapStat = currentPop3Stat; 65 currentImapStat = currentPop3Stat;
67 for ( it = connectionList.first(); it; it = connectionList.next() ) { 66 for ( it = connectionList.first(); it; it = connectionList.next() ) {
68 it->statusFolder(currentStat); 67 it->statusFolder(currentStat);
69 it->logout(); 68 it->logout();
70 if (it->getType().lower()=="imap") { 69 if (it->getType().lower()=="imap") {
71 currentImapStat.message_unseen+=currentStat.message_unseen; 70 currentImapStat.message_unseen+=currentStat.message_unseen;
72 currentImapStat.message_recent+=currentStat.message_recent; 71 currentImapStat.message_recent+=currentStat.message_recent;
73 currentImapStat.message_count+=currentStat.message_count; 72 currentImapStat.message_count+=currentStat.message_count;
74 } else if (it->getType().lower()=="pop3") { 73 } else if (it->getType().lower()=="pop3") {
75 currentPop3Stat.message_count+=currentStat.message_count; 74 currentPop3Stat.message_count+=currentStat.message_count;
76 qDebug("Pop3 count: %i",currentPop3Stat.message_count); 75 qDebug("Pop3 count: %i",currentPop3Stat.message_count);
77 } 76 }
78 } 77 }
79 qDebug("Pop3 last: %i",lastPop3Stat.message_count); 78 qDebug("Pop3 last: %i",lastPop3Stat.message_count);
80 if (currentPop3Stat.message_count > lastPop3Stat.message_count) { 79 if (currentPop3Stat.message_count > lastPop3Stat.message_count) {
81 currentPop3Stat.message_recent = currentPop3Stat.message_count - lastPop3Stat.message_count; 80 currentPop3Stat.message_recent = currentPop3Stat.message_count - lastPop3Stat.message_count;
82 currentPop3Stat.message_unseen = currentPop3Stat.message_recent; 81 currentPop3Stat.message_unseen = currentPop3Stat.message_recent;
83 } else { 82 } else {
84 lastPop3Stat.message_count = currentPop3Stat.message_count; 83 lastPop3Stat.message_count = currentPop3Stat.message_count;
85 currentPop3Stat.message_recent = currentPop3Stat.message_unseen = 0; 84 currentPop3Stat.message_recent = currentPop3Stat.message_unseen = 0;
86 } 85 }
87 targetStat = currentImapStat; 86 targetStat = currentImapStat;
88 targetStat.message_unseen+=currentPop3Stat.message_unseen; 87 targetStat.message_unseen+=currentPop3Stat.message_unseen;
89 targetStat.message_recent+=currentPop3Stat.message_recent; 88 targetStat.message_recent+=currentPop3Stat.message_recent;
90 targetStat.message_count+=currentPop3Stat.message_count; 89 targetStat.message_count+=currentPop3Stat.message_count;
91} 90}