summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/libmailwrapper/statusmail.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/net/mail/libmailwrapper/statusmail.cpp b/noncore/net/mail/libmailwrapper/statusmail.cpp
index 1d7d559..172c58f 100644
--- a/noncore/net/mail/libmailwrapper/statusmail.cpp
+++ b/noncore/net/mail/libmailwrapper/statusmail.cpp
@@ -1,91 +1,91 @@
1#include "statusmail.h" 1#include "statusmail.h"
2#include <qlist.h> 2#include <qlist.h>
3 3
4StatusMail::StatusMail(QList<Account>&list) 4StatusMail::StatusMail(QList<Account>&list)
5{ 5{
6 currentImapStat.message_count=0; 6 currentImapStat.message_count=0;
7 currentImapStat.message_unseen=0; 7 currentImapStat.message_unseen=0;
8 currentImapStat.message_recent=0; 8 currentImapStat.message_recent=0;
9 lastPop3Stat = currentImapStat; 9 lastPop3Stat = currentImapStat;
10 currentPop3Stat = currentImapStat; 10 currentPop3Stat = currentImapStat;
11 connectionList.setAutoDelete(true); 11 connectionList.setAutoDelete(true);
12 connectionList.clear(); 12 connectionList.clear();
13 initAccounts(list); 13 initAccounts(list);
14} 14}
15 15
16StatusMail::~StatusMail() 16StatusMail::~StatusMail()
17{ 17{
18} 18}
19 19
20void StatusMail::initAccounts(QList<Account>&accounts) 20void StatusMail::initAccounts(QList<Account>&accounts)
21{ 21{
22 22
23 Account *it; 23 Account *it;
24 folderStat currentStat; 24 folderStat currentStat;
25 AbstractMail * current = 0; 25 AbstractMail * current = 0;
26 currentPop3Stat.message_count=0; 26 currentPop3Stat.message_count=0;
27 currentPop3Stat.message_recent=0; 27 currentPop3Stat.message_recent=0;
28 currentPop3Stat.message_unseen=0; 28 currentPop3Stat.message_unseen=0;
29 for ( it = accounts.first(); it; it = accounts.next() ) { 29 for ( it = accounts.first(); it; it = accounts.next() ) {
30 if ( it->getType().compare( "IMAP" ) == 0 ) { 30 if ( it->getType().compare( "IMAP" ) == 0 && !it->getOffline() ) {
31 IMAPaccount*ima = static_cast<IMAPaccount *>(it); 31 IMAPaccount*ima = static_cast<IMAPaccount *>(it);
32 current = AbstractMail::getWrapper(ima); 32 current = AbstractMail::getWrapper(ima);
33 connectionList.append(current); 33 connectionList.append(current);
34 current->statusFolder(currentStat); 34 current->statusFolder(currentStat);
35 currentImapStat.message_count+=currentStat.message_unseen; 35 currentImapStat.message_count+=currentStat.message_unseen;
36 currentImapStat.message_count+=currentStat.message_recent; 36 currentImapStat.message_count+=currentStat.message_recent;
37 currentImapStat.message_count+=currentStat.message_count; 37 currentImapStat.message_count+=currentStat.message_count;
38 } else if ( it->getType().compare( "POP3" ) == 0 ) { 38 } else if ( it->getType().compare( "POP3" ) == 0 && !it->getOffline() ) {
39 POP3account *pop3 = static_cast<POP3account *>(it); 39 POP3account *pop3 = static_cast<POP3account *>(it);
40 current = AbstractMail::getWrapper(pop3); 40 current = AbstractMail::getWrapper(pop3);
41 connectionList.append(current); 41 connectionList.append(current);
42 current->statusFolder(currentStat); 42 current->statusFolder(currentStat);
43 currentPop3Stat.message_count+=currentStat.message_count; 43 currentPop3Stat.message_count+=currentStat.message_count;
44 } 44 }
45 current->logout(); 45 current->logout();
46 } 46 }
47 qDebug("Pop3 init count: %i",currentPop3Stat.message_count); 47 qDebug("Pop3 init count: %i",currentPop3Stat.message_count);
48 currentPop3Stat.message_recent = currentPop3Stat.message_unseen = 0; 48 currentPop3Stat.message_recent = currentPop3Stat.message_unseen = 0;
49 lastPop3Stat.message_unseen = currentPop3Stat.message_unseen; 49 lastPop3Stat.message_unseen = currentPop3Stat.message_unseen;
50 lastPop3Stat.message_recent = currentPop3Stat.message_recent; 50 lastPop3Stat.message_recent = currentPop3Stat.message_recent;
51 lastPop3Stat.message_count = currentPop3Stat.message_count; 51 lastPop3Stat.message_count = currentPop3Stat.message_count;
52} 52}
53 53
54void StatusMail::reset_status() 54void StatusMail::reset_status()
55{ 55{
56 lastPop3Stat = currentPop3Stat; 56 lastPop3Stat = currentPop3Stat;
57} 57}
58 58
59void StatusMail::check_current_stat(folderStat&targetStat) 59void StatusMail::check_current_stat(folderStat&targetStat)
60{ 60{
61 AbstractMail*it = 0; 61 AbstractMail*it = 0;
62 folderStat currentStat; 62 folderStat currentStat;
63 currentPop3Stat.message_recent = 0; 63 currentPop3Stat.message_recent = 0;
64 currentPop3Stat.message_count = 0; 64 currentPop3Stat.message_count = 0;
65 currentPop3Stat.message_unseen = 0; 65 currentPop3Stat.message_unseen = 0;
66 currentImapStat = currentPop3Stat; 66 currentImapStat = currentPop3Stat;
67 for ( it = connectionList.first(); it; it = connectionList.next() ) { 67 for ( it = connectionList.first(); it; it = connectionList.next() ) {
68 it->statusFolder(currentStat); 68 it->statusFolder(currentStat);
69 it->logout(); 69 it->logout();
70 if (it->getType().lower()=="imap") { 70 if (it->getType().lower()=="imap") {
71 currentImapStat.message_unseen+=currentStat.message_unseen; 71 currentImapStat.message_unseen+=currentStat.message_unseen;
72 currentImapStat.message_recent+=currentStat.message_recent; 72 currentImapStat.message_recent+=currentStat.message_recent;
73 currentImapStat.message_count+=currentStat.message_count; 73 currentImapStat.message_count+=currentStat.message_count;
74 } else if (it->getType().lower()=="pop3") { 74 } else if (it->getType().lower()=="pop3") {
75 currentPop3Stat.message_count+=currentStat.message_count; 75 currentPop3Stat.message_count+=currentStat.message_count;
76 qDebug("Pop3 count: %i",currentPop3Stat.message_count); 76 qDebug("Pop3 count: %i",currentPop3Stat.message_count);
77 } 77 }
78 } 78 }
79 qDebug("Pop3 last: %i",lastPop3Stat.message_count); 79 qDebug("Pop3 last: %i",lastPop3Stat.message_count);
80 if (currentPop3Stat.message_count > lastPop3Stat.message_count) { 80 if (currentPop3Stat.message_count > lastPop3Stat.message_count) {
81 currentPop3Stat.message_recent = currentPop3Stat.message_count - lastPop3Stat.message_count; 81 currentPop3Stat.message_recent = currentPop3Stat.message_count - lastPop3Stat.message_count;
82 currentPop3Stat.message_unseen = currentPop3Stat.message_recent; 82 currentPop3Stat.message_unseen = currentPop3Stat.message_recent;
83 } else { 83 } else {
84 lastPop3Stat.message_count = currentPop3Stat.message_count; 84 lastPop3Stat.message_count = currentPop3Stat.message_count;
85 currentPop3Stat.message_recent = currentPop3Stat.message_unseen = 0; 85 currentPop3Stat.message_recent = currentPop3Stat.message_unseen = 0;
86 } 86 }
87 targetStat = currentImapStat; 87 targetStat = currentImapStat;
88 targetStat.message_unseen+=currentPop3Stat.message_unseen; 88 targetStat.message_unseen+=currentPop3Stat.message_unseen;
89 targetStat.message_recent+=currentPop3Stat.message_recent; 89 targetStat.message_recent+=currentPop3Stat.message_recent;
90 targetStat.message_count+=currentPop3Stat.message_count; 90 targetStat.message_count+=currentPop3Stat.message_count;
91} 91}