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,57 +1,55 @@
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
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,57 +1,55 @@
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:
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,50 +1,49 @@
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;