summaryrefslogtreecommitdiff
path: root/noncore/net/mail/libmailwrapper
Unidiff
Diffstat (limited to 'noncore/net/mail/libmailwrapper') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/libmailwrapper/abstractmail.cpp9
-rw-r--r--noncore/net/mail/libmailwrapper/abstractmail.h4
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.cpp6
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.h2
-rw-r--r--noncore/net/mail/libmailwrapper/mboxwrapper.cpp9
-rw-r--r--noncore/net/mail/libmailwrapper/mboxwrapper.h6
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.cpp6
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.h1
-rw-r--r--noncore/net/mail/libmailwrapper/settings.cpp12
-rw-r--r--noncore/net/mail/libmailwrapper/settings.h5
-rw-r--r--noncore/net/mail/libmailwrapper/smtpwrapper.cpp10
-rw-r--r--noncore/net/mail/libmailwrapper/smtpwrapper.h4
12 files changed, 58 insertions, 16 deletions
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.cpp b/noncore/net/mail/libmailwrapper/abstractmail.cpp
index 80d0b52..3dd2fce 100644
--- a/noncore/net/mail/libmailwrapper/abstractmail.cpp
+++ b/noncore/net/mail/libmailwrapper/abstractmail.cpp
@@ -1,50 +1,50 @@
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 "mboxwrapper.h" 4#include "mboxwrapper.h"
5#include "mailtypes.h" 5#include "mailtypes.h"
6 6
7#include <qstring.h> 7#include <qstring.h>
8#include <qfile.h> 8#include <qfile.h>
9#include <qtextstream.h> 9#include <qtextstream.h>
10#include <stdlib.h> 10#include <stdlib.h>
11#include <libetpan/mailmime_content.h> 11#include <libetpan/mailmime_content.h>
12#include <libetpan/mailmime.h> 12#include <libetpan/mailmime.h>
13 13
14AbstractMail* AbstractMail::getWrapper(IMAPaccount *a) 14AbstractMail* AbstractMail::getWrapper(IMAPaccount *a)
15{ 15{
16 return new IMAPwrapper(a); 16 return new IMAPwrapper(a);
17} 17}
18 18
19AbstractMail* AbstractMail::getWrapper(POP3account *a) 19AbstractMail* AbstractMail::getWrapper(POP3account *a)
20{ 20{
21 return new POP3wrapper(a); 21 return new POP3wrapper(a);
22} 22}
23 23
24AbstractMail* AbstractMail::getWrapper(const QString&a) 24AbstractMail* AbstractMail::getWrapper(const QString&a,const QString&name)
25{ 25{
26 return new MBOXwrapper(a); 26 return new MBOXwrapper(a,name);
27} 27}
28 28
29encodedString* AbstractMail::decode_String(const encodedString*text,const QString&enc) 29encodedString* AbstractMail::decode_String(const encodedString*text,const QString&enc)
30{ 30{
31 qDebug("Decode string start"); 31 qDebug("Decode string start");
32 char*result_text; 32 char*result_text;
33 size_t index = 0; 33 size_t index = 0;
34 /* reset for recursive use! */ 34 /* reset for recursive use! */
35 size_t target_length = 0; 35 size_t target_length = 0;
36 result_text = 0; 36 result_text = 0;
37 int mimetype = MAILMIME_MECHANISM_7BIT; 37 int mimetype = MAILMIME_MECHANISM_7BIT;
38 if (enc.lower()=="quoted-printable") { 38 if (enc.lower()=="quoted-printable") {
39 mimetype = MAILMIME_MECHANISM_QUOTED_PRINTABLE; 39 mimetype = MAILMIME_MECHANISM_QUOTED_PRINTABLE;
40 } else if (enc.lower()=="base64") { 40 } else if (enc.lower()=="base64") {
41 mimetype = MAILMIME_MECHANISM_BASE64; 41 mimetype = MAILMIME_MECHANISM_BASE64;
42 } else if (enc.lower()=="8bit") { 42 } else if (enc.lower()=="8bit") {
43 mimetype = MAILMIME_MECHANISM_8BIT; 43 mimetype = MAILMIME_MECHANISM_8BIT;
44 } else if (enc.lower()=="binary") { 44 } else if (enc.lower()=="binary") {
45 mimetype = MAILMIME_MECHANISM_BINARY; 45 mimetype = MAILMIME_MECHANISM_BINARY;
46 } 46 }
47 47
48 int err = mailmime_part_parse(text->Content(),text->Length(),&index,mimetype, 48 int err = mailmime_part_parse(text->Content(),text->Length(),&index,mimetype,
49 &result_text,&target_length); 49 &result_text,&target_length);
50 50
@@ -78,24 +78,29 @@ QString AbstractMail::convert_String(const char*text)
78 78
79/* cp & paste from launcher */ 79/* cp & paste from launcher */
80QString AbstractMail::gen_attachment_id() 80QString AbstractMail::gen_attachment_id()
81{ 81{
82 QFile file( "/proc/sys/kernel/random/uuid" ); 82 QFile file( "/proc/sys/kernel/random/uuid" );
83 if (!file.open(IO_ReadOnly ) ) 83 if (!file.open(IO_ReadOnly ) )
84 return QString::null; 84 return QString::null;
85 85
86 QTextStream stream(&file); 86 QTextStream stream(&file);
87 87
88 return "{" + stream.read().stripWhiteSpace() + "}"; 88 return "{" + stream.read().stripWhiteSpace() + "}";
89} 89}
90 90
91int AbstractMail::createMbox(const QString&,const Folder*,const QString& delemiter,bool) 91int AbstractMail::createMbox(const QString&,const Folder*,const QString& delemiter,bool)
92{ 92{
93 return 0; 93 return 0;
94} 94}
95 95
96QString AbstractMail::defaultLocalfolder() 96QString AbstractMail::defaultLocalfolder()
97{ 97{
98 QString f = getenv( "HOME" ); 98 QString f = getenv( "HOME" );
99 f += "/Applications/opiemail/localmail"; 99 f += "/Applications/opiemail/localmail";
100 return f; 100 return f;
101} 101}
102
103/* temporary - will be removed when implemented in all classes */
104void AbstractMail::deleteMails(const QString &,QList<RecMail> &)
105{
106}
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.h b/noncore/net/mail/libmailwrapper/abstractmail.h
index 9770991..15d83cb 100644
--- a/noncore/net/mail/libmailwrapper/abstractmail.h
+++ b/noncore/net/mail/libmailwrapper/abstractmail.h
@@ -10,51 +10,53 @@ class RecPart;
10class IMAPwrapper; 10class IMAPwrapper;
11class POP3wrapper; 11class POP3wrapper;
12class Folder; 12class Folder;
13class encodedString; 13class encodedString;
14struct folderStat; 14struct folderStat;
15 15
16class AbstractMail:public QObject 16class AbstractMail:public QObject
17{ 17{
18 Q_OBJECT 18 Q_OBJECT
19public: 19public:
20 AbstractMail(){}; 20 AbstractMail(){};
21 virtual ~AbstractMail(){} 21 virtual ~AbstractMail(){}
22 virtual QList<Folder>* listFolders()=0; 22 virtual QList<Folder>* listFolders()=0;
23 virtual void listMessages(const QString & mailbox,QList<RecMail>&target )=0; 23 virtual void listMessages(const QString & mailbox,QList<RecMail>&target )=0;
24 virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX")=0; 24 virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX")=0;
25 virtual RecBody fetchBody(const RecMail&mail)=0; 25 virtual RecBody fetchBody(const RecMail&mail)=0;
26 virtual QString fetchTextPart(const RecMail&mail,const RecPart&part)=0; 26 virtual QString fetchTextPart(const RecMail&mail,const RecPart&part)=0;
27 virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part)=0; 27 virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part)=0;
28 virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part)=0; 28 virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part)=0;
29 virtual encodedString* fetchRawBody(const RecMail&mail)=0; 29 virtual encodedString* fetchRawBody(const RecMail&mail)=0;
30 30
31 virtual void deleteMail(const RecMail&mail)=0; 31 virtual void deleteMail(const RecMail&mail)=0;
32 virtual void answeredMail(const RecMail&mail)=0; 32 virtual void answeredMail(const RecMail&mail)=0;
33 virtual int deleteAllMail(const Folder*)=0; 33 virtual int deleteAllMail(const Folder*)=0;
34 virtual void deleteMails(const QString & FolderName,QList<RecMail> &target);
34 virtual int deleteMbox(const Folder*)=0; 35 virtual int deleteMbox(const Folder*)=0;
35 virtual void storeMessage(const char*msg,size_t length, const QString&folder)=0; 36 virtual void storeMessage(const char*msg,size_t length, const QString&folder)=0;
36 37
37 virtual void cleanMimeCache(){}; 38 virtual void cleanMimeCache(){};
38 /* mail box methods */ 39 /* mail box methods */
39 /* parameter is the box to create. 40 /* parameter is the box to create.
40 * if the implementing subclass has prefixes, 41 * if the implementing subclass has prefixes,
41 * them has to be appended automatic. 42 * them has to be appended automatic.
42 */ 43 */
43 virtual int createMbox(const QString&,const Folder*parentfolder=0,const QString& delemiter="/",bool getsubfolder=false); 44 virtual int createMbox(const QString&,const Folder*parentfolder=0,const QString& delemiter="/",bool getsubfolder=false);
44 virtual void logout()=0; 45 virtual void logout()=0;
45 46
46 static AbstractMail* getWrapper(IMAPaccount *a); 47 static AbstractMail* getWrapper(IMAPaccount *a);
47 static AbstractMail* getWrapper(POP3account *a); 48 static AbstractMail* getWrapper(POP3account *a);
48 /* mbox only! */ 49 /* mbox only! */
49 static AbstractMail* getWrapper(const QString&a); 50 static AbstractMail* getWrapper(const QString&a,const QString&name="Local Folders");
50 51
51 static QString defaultLocalfolder(); 52 static QString defaultLocalfolder();
52 53
53 virtual const QString&getType()const=0; 54 virtual const QString&getType()const=0;
55 virtual const QString&getName()const=0;
54 56
55protected: 57protected:
56 static encodedString*decode_String(const encodedString*text,const QString&enc); 58 static encodedString*decode_String(const encodedString*text,const QString&enc);
57 static QString convert_String(const char*text); 59 static QString convert_String(const char*text);
58 static QString gen_attachment_id(); 60 static QString gen_attachment_id();
59}; 61};
60#endif 62#endif
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
index d252159..bb74de9 100644
--- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
@@ -8,48 +8,49 @@
8 8
9IMAPwrapper::IMAPwrapper( IMAPaccount *a ) 9IMAPwrapper::IMAPwrapper( IMAPaccount *a )
10 : AbstractMail() 10 : AbstractMail()
11{ 11{
12 account = a; 12 account = a;
13 m_imap = 0; 13 m_imap = 0;
14} 14}
15 15
16IMAPwrapper::~IMAPwrapper() 16IMAPwrapper::~IMAPwrapper()
17{ 17{
18 logout(); 18 logout();
19} 19}
20 20
21void IMAPwrapper::imap_progress( size_t current, size_t maximum ) 21void IMAPwrapper::imap_progress( size_t current, size_t maximum )
22{ 22{
23 qDebug( "IMAP: %i of %i", current, maximum ); 23 qDebug( "IMAP: %i of %i", current, maximum );
24} 24}
25 25
26void IMAPwrapper::login() 26void IMAPwrapper::login()
27{ 27{
28 const char *server, *user, *pass; 28 const char *server, *user, *pass;
29 uint16_t port; 29 uint16_t port;
30 int err = MAILIMAP_NO_ERROR; 30 int err = MAILIMAP_NO_ERROR;
31 31
32 if (account->getOffline()) return;
32 /* we are connected this moment */ 33 /* we are connected this moment */
33 /* TODO: setup a timer holding the line or if connection closed - delete the value */ 34 /* TODO: setup a timer holding the line or if connection closed - delete the value */
34 if (m_imap) { 35 if (m_imap) {
35 err = mailimap_noop(m_imap); 36 err = mailimap_noop(m_imap);
36 if (err!=MAILIMAP_NO_ERROR) { 37 if (err!=MAILIMAP_NO_ERROR) {
37 logout(); 38 logout();
38 } else { 39 } else {
39 mailstream_flush(m_imap->imap_stream); 40 mailstream_flush(m_imap->imap_stream);
40 return; 41 return;
41 } 42 }
42 } 43 }
43 server = account->getServer().latin1(); 44 server = account->getServer().latin1();
44 port = account->getPort().toUInt(); 45 port = account->getPort().toUInt();
45 if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { 46 if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) {
46 LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); 47 LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true );
47 login.show(); 48 login.show();
48 if ( QDialog::Accepted == login.exec() ) { 49 if ( QDialog::Accepted == login.exec() ) {
49 // ok 50 // ok
50 user = login.getUser().latin1(); 51 user = login.getUser().latin1();
51 pass = login.getPassword().latin1(); 52 pass = login.getPassword().latin1();
52 } else { 53 } else {
53 // cancel 54 // cancel
54 qDebug( "IMAP: Login canceled" ); 55 qDebug( "IMAP: Login canceled" );
55 return; 56 return;
@@ -985,30 +986,35 @@ void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox)
985 } 986 }
986 } else { 987 } else {
987 qDebug("Error retrieving status"); 988 qDebug("Error retrieving status");
988 } 989 }
989 if (status) mailimap_mailbox_data_status_free(status); 990 if (status) mailimap_mailbox_data_status_free(status);
990 if (att_list) mailimap_status_att_list_free(att_list); 991 if (att_list) mailimap_status_att_list_free(att_list);
991} 992}
992 993
993void IMAPwrapper::storeMessage(const char*msg,size_t length, const QString&folder) 994void IMAPwrapper::storeMessage(const char*msg,size_t length, const QString&folder)
994{ 995{
995 login(); 996 login();
996 if (!m_imap) return; 997 if (!m_imap) return;
997 if (!msg) return; 998 if (!msg) return;
998 int r = mailimap_append(m_imap,(char*)folder.latin1(),0,0,msg,length); 999 int r = mailimap_append(m_imap,(char*)folder.latin1(),0,0,msg,length);
999 if (r != MAILIMAP_NO_ERROR) { 1000 if (r != MAILIMAP_NO_ERROR) {
1000 Global::statusMessage("Error storing mail!"); 1001 Global::statusMessage("Error storing mail!");
1001 } 1002 }
1002} 1003}
1003 1004
1004const QString&IMAPwrapper::getType()const 1005const QString&IMAPwrapper::getType()const
1005{ 1006{
1006 return account->getType(); 1007 return account->getType();
1007} 1008}
1008 1009
1010const QString&IMAPwrapper::getName()const
1011{
1012 return account->getAccountName();
1013}
1014
1009encodedString* IMAPwrapper::fetchRawBody(const RecMail&mail) 1015encodedString* IMAPwrapper::fetchRawBody(const RecMail&mail)
1010{ 1016{
1011 // dummy 1017 // dummy
1012 QValueList<int> path; 1018 QValueList<int> path;
1013 return fetchRawPart(mail,path,false); 1019 return fetchRawPart(mail,path,false);
1014} 1020}
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.h b/noncore/net/mail/libmailwrapper/imapwrapper.h
index b246f58..b2bd7e9 100644
--- a/noncore/net/mail/libmailwrapper/imapwrapper.h
+++ b/noncore/net/mail/libmailwrapper/imapwrapper.h
@@ -24,48 +24,50 @@ public:
24 IMAPwrapper( IMAPaccount *a ); 24 IMAPwrapper( IMAPaccount *a );
25 virtual ~IMAPwrapper(); 25 virtual ~IMAPwrapper();
26 virtual QList<Folder>* listFolders(); 26 virtual QList<Folder>* listFolders();
27 virtual void listMessages(const QString & mailbox,QList<RecMail>&target ); 27 virtual void listMessages(const QString & mailbox,QList<RecMail>&target );
28 virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); 28 virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX");
29 29
30 virtual void deleteMail(const RecMail&mail); 30 virtual void deleteMail(const RecMail&mail);
31 virtual void answeredMail(const RecMail&mail); 31 virtual void answeredMail(const RecMail&mail);
32 virtual int deleteAllMail(const Folder*folder); 32 virtual int deleteAllMail(const Folder*folder);
33 virtual void storeMessage(const char*msg,size_t length, const QString&folder); 33 virtual void storeMessage(const char*msg,size_t length, const QString&folder);
34 34
35 virtual RecBody fetchBody(const RecMail&mail); 35 virtual RecBody fetchBody(const RecMail&mail);
36 virtual QString fetchTextPart(const RecMail&mail,const RecPart&part); 36 virtual QString fetchTextPart(const RecMail&mail,const RecPart&part);
37 virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part); 37 virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part);
38 virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part); 38 virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part);
39 virtual encodedString* fetchRawBody(const RecMail&mail); 39 virtual encodedString* fetchRawBody(const RecMail&mail);
40 40
41 virtual int createMbox(const QString&,const Folder*parentfolder=0,const QString& delemiter="/",bool getsubfolder=false); 41 virtual int createMbox(const QString&,const Folder*parentfolder=0,const QString& delemiter="/",bool getsubfolder=false);
42 virtual int deleteMbox(const Folder*folder); 42 virtual int deleteMbox(const Folder*folder);
43 43
44 static void imap_progress( size_t current, size_t maximum ); 44 static void imap_progress( size_t current, size_t maximum );
45 45
46 virtual void logout(); 46 virtual void logout();
47 virtual const QString&getType()const; 47 virtual const QString&getType()const;
48 virtual const QString&getName()const;
49
48protected: 50protected:
49 RecMail*parse_list_result(mailimap_msg_att*); 51 RecMail*parse_list_result(mailimap_msg_att*);
50 void login(); 52 void login();
51 53
52 virtual QString fetchTextPart(const RecMail&mail,const QValueList<int>&path,bool internal_call=false,const QString&enc=""); 54 virtual QString fetchTextPart(const RecMail&mail,const QValueList<int>&path,bool internal_call=false,const QString&enc="");
53 virtual encodedString*fetchRawPart(const RecMail&mail,const QValueList<int>&path,bool internal_call); 55 virtual encodedString*fetchRawPart(const RecMail&mail,const QValueList<int>&path,bool internal_call);
54 56
55 void fillSinglePart(RecPart&target_part,mailimap_body_type_1part*Description); 57 void fillSinglePart(RecPart&target_part,mailimap_body_type_1part*Description);
56 void fillSingleTextPart(RecPart&target_part,mailimap_body_type_text*which); 58 void fillSingleTextPart(RecPart&target_part,mailimap_body_type_text*which);
57 void fillSingleBasicPart(RecPart&target_part,mailimap_body_type_basic*which); 59 void fillSingleBasicPart(RecPart&target_part,mailimap_body_type_basic*which);
58 void fillSingleMsgPart(RecPart&target_part,mailimap_body_type_msg*which); 60 void fillSingleMsgPart(RecPart&target_part,mailimap_body_type_msg*which);
59 void fillMultiPart(RecPart&target_part,mailimap_body_type_mpart*which); 61 void fillMultiPart(RecPart&target_part,mailimap_body_type_mpart*which);
60 void traverseBody(const RecMail&mail,mailimap_body*body,RecBody&target_body,int current_recursion,QValueList<int>recList,int current_count=1); 62 void traverseBody(const RecMail&mail,mailimap_body*body,RecBody&target_body,int current_recursion,QValueList<int>recList,int current_count=1);
61 63
62 /* just helpers */ 64 /* just helpers */
63 static void fillBodyFields(RecPart&target_part,mailimap_body_fields*which); 65 static void fillBodyFields(RecPart&target_part,mailimap_body_fields*which);
64 static QStringList address_list_to_stringlist(clist*list); 66 static QStringList address_list_to_stringlist(clist*list);
65 67
66 68
67 IMAPaccount *account; 69 IMAPaccount *account;
68 mailimap *m_imap; 70 mailimap *m_imap;
69}; 71};
70 72
71#endif 73#endif
diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp
index bc496f7..97f301e 100644
--- a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp
@@ -1,36 +1,36 @@
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
9const QString MBOXwrapper::wrapperType="MBOX"; 9const QString MBOXwrapper::wrapperType="MBOX";
10 10
11MBOXwrapper::MBOXwrapper(const QString & mbox_dir) 11MBOXwrapper::MBOXwrapper(const QString & mbox_dir,const QString&mbox_name)
12 : Genericwrapper(),MBOXPath(mbox_dir) 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
20MBOXwrapper::~MBOXwrapper() 20MBOXwrapper::~MBOXwrapper()
21{ 21{
22} 22}
23 23
24void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) 24void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target )
25{ 25{
26 mailstorage*storage = mailstorage_new(NULL); 26 mailstorage*storage = mailstorage_new(NULL);
27 QString p = MBOXPath+"/"; 27 QString p = MBOXPath+"/";
28 p+=mailbox; 28 p+=mailbox;
29 29
30 int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); 30 int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0);
31 mailfolder*folder; 31 mailfolder*folder;
32 folder = mailfolder_new( storage,(char*)p.latin1(),NULL); 32 folder = mailfolder_new( storage,(char*)p.latin1(),NULL);
33 r = mailfolder_connect(folder); 33 r = mailfolder_connect(folder);
34 if (r != MAIL_NO_ERROR) { 34 if (r != MAIL_NO_ERROR) {
35 qDebug("Error initializing mbox"); 35 qDebug("Error initializing mbox");
36 mailfolder_free(folder); 36 mailfolder_free(folder);
@@ -309,24 +309,29 @@ void MBOXwrapper::statusFolder(folderStat&target_stat,const QString & mailbox)
309 mailfolder*folder = 0; 309 mailfolder*folder = 0;
310 mailstorage*storage = mailstorage_new(NULL); 310 mailstorage*storage = mailstorage_new(NULL);
311 target_stat.message_count = 0; 311 target_stat.message_count = 0;
312 target_stat.message_unseen = 0; 312 target_stat.message_unseen = 0;
313 target_stat.message_recent = 0; 313 target_stat.message_recent = 0;
314 QString p = MBOXPath+"/"+mailbox; 314 QString p = MBOXPath+"/"+mailbox;
315 QFile fi(p); 315 QFile fi(p);
316 if (!fi.exists()) { 316 if (!fi.exists()) {
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
329const QString&MBOXwrapper::getType()const 329const QString&MBOXwrapper::getType()const
330{ 330{
331 return wrapperType; 331 return wrapperType;
332} 332}
333
334const QString&MBOXwrapper::getName()const
335{
336 return MBOXName;
337}
diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.h b/noncore/net/mail/libmailwrapper/mboxwrapper.h
index 2794014..194ff86 100644
--- a/noncore/net/mail/libmailwrapper/mboxwrapper.h
+++ b/noncore/net/mail/libmailwrapper/mboxwrapper.h
@@ -1,45 +1,47 @@
1#ifndef __MBOX_WRAPPER_H 1#ifndef __MBOX_WRAPPER_H
2#define __MBOX_WRAPPER_H 2#define __MBOX_WRAPPER_H
3 3
4#include "genericwrapper.h" 4#include "genericwrapper.h"
5#include <qstring.h> 5#include <qstring.h>
6 6
7class RecMail; 7class RecMail;
8class RecBody; 8class RecBody;
9class encodedString; 9class encodedString;
10struct mailmbox_folder; 10struct mailmbox_folder;
11 11
12class MBOXwrapper : public Genericwrapper 12class MBOXwrapper : public Genericwrapper
13{ 13{
14 Q_OBJECT 14 Q_OBJECT
15public: 15public:
16 MBOXwrapper(const QString & dir); 16 MBOXwrapper(const QString & dir,const QString&name);
17 virtual ~MBOXwrapper(); 17 virtual ~MBOXwrapper();
18 18
19 virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); 19 virtual void listMessages(const QString & mailbox, QList<RecMail> &target );
20 virtual QList<Folder>* listFolders(); 20 virtual QList<Folder>* listFolders();
21 virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); 21 virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX");
22 22
23 virtual void deleteMail(const RecMail&mail); 23 virtual void deleteMail(const RecMail&mail);
24 virtual void answeredMail(const RecMail&mail); 24 virtual void answeredMail(const RecMail&mail);
25 25
26 virtual int createMbox(const QString&folder,const Folder*f=0,const QString&d="",bool s=false); 26 virtual int createMbox(const QString&folder,const Folder*f=0,const QString&d="",bool s=false);
27 virtual int deleteMbox(const Folder*); 27 virtual int deleteMbox(const Folder*);
28 28
29 virtual void storeMessage(const char*msg,size_t length, const QString&folder); 29 virtual void storeMessage(const char*msg,size_t length, const QString&folder);
30 30
31 virtual RecBody fetchBody( const RecMail &mail ); 31 virtual RecBody fetchBody( const RecMail &mail );
32 static void mbox_progress( size_t current, size_t maximum ); 32 static void mbox_progress( size_t current, size_t maximum );
33 33
34 virtual encodedString* fetchRawBody(const RecMail&mail); 34 virtual encodedString* fetchRawBody(const RecMail&mail);
35 virtual void deleteMails(const QString & mailbox,QList<RecMail> &target); 35 virtual void deleteMails(const QString & FolderName,QList<RecMail> &target);
36 virtual int deleteAllMail(const Folder*); 36 virtual int deleteAllMail(const Folder*);
37 virtual const QString&getType()const; 37 virtual const QString&getType()const;
38 virtual const QString&getName()const;
38 39
39protected: 40protected:
40 static void deleteMails(mailmbox_folder*f,QList<RecMail> &target); 41 static void deleteMails(mailmbox_folder*f,QList<RecMail> &target);
41 QString MBOXPath; 42 QString MBOXPath;
43 QString MBOXName;
42 static const QString wrapperType; 44 static const QString wrapperType;
43}; 45};
44 46
45#endif 47#endif
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
index cceb22e..67bde38 100644
--- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
@@ -87,48 +87,49 @@ RecBody POP3wrapper::fetchBody( const RecMail &mail )
87 msg_data->msg_message = message; 87 msg_data->msg_message = message;
88 msg_data->msg_length = strlen(message); 88 msg_data->msg_length = strlen(message);
89 } 89 }
90 body = parseMail(mailmsg); 90 body = parseMail(mailmsg);
91 91
92 /* clean up */ 92 /* clean up */
93 if (mailmsg) mailmessage_free(mailmsg); 93 if (mailmsg) mailmessage_free(mailmsg);
94 if (message) free(message); 94 if (message) free(message);
95 95
96 return body; 96 return body;
97} 97}
98 98
99void POP3wrapper::listMessages(const QString &, QList<RecMail> &target ) 99void POP3wrapper::listMessages(const QString &, QList<RecMail> &target )
100{ 100{
101 login(); 101 login();
102 if (!m_pop3) return; 102 if (!m_pop3) return;
103 uint32_t res_messages,res_recent,res_unseen; 103 uint32_t res_messages,res_recent,res_unseen;
104 mailsession_status_folder(m_folder->fld_session,"INBOX",&res_messages,&res_recent,&res_unseen); 104 mailsession_status_folder(m_folder->fld_session,"INBOX",&res_messages,&res_recent,&res_unseen);
105 parseList(target,m_folder->fld_session,"INBOX"); 105 parseList(target,m_folder->fld_session,"INBOX");
106 Global::statusMessage( tr("Mailbox contains %1 mail(s)").arg(res_messages)); 106 Global::statusMessage( tr("Mailbox contains %1 mail(s)").arg(res_messages));
107} 107}
108 108
109void POP3wrapper::login() 109void POP3wrapper::login()
110{ 110{
111 if (account->getOffline()) return;
111 /* we'll hold the line */ 112 /* we'll hold the line */
112 if ( m_pop3 != NULL ) return; 113 if ( m_pop3 != NULL ) return;
113 114
114 const char *server, *user, *pass; 115 const char *server, *user, *pass;
115 uint16_t port; 116 uint16_t port;
116 int err = MAILPOP3_NO_ERROR; 117 int err = MAILPOP3_NO_ERROR;
117 118
118 server = account->getServer().latin1(); 119 server = account->getServer().latin1();
119 port = account->getPort().toUInt(); 120 port = account->getPort().toUInt();
120 121
121 if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { 122 if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) {
122 LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); 123 LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true );
123 login.show(); 124 login.show();
124 if ( QDialog::Accepted == login.exec() ) { 125 if ( QDialog::Accepted == login.exec() ) {
125 // ok 126 // ok
126 user = login.getUser().latin1(); 127 user = login.getUser().latin1();
127 pass = login.getPassword().latin1(); 128 pass = login.getPassword().latin1();
128 } else { 129 } else {
129 // cancel 130 // cancel
130 qDebug( "POP3: Login canceled" ); 131 qDebug( "POP3: Login canceled" );
131 return; 132 return;
132 } 133 }
133 } else { 134 } else {
134 user = account->getUser().latin1(); 135 user = account->getUser().latin1();
@@ -228,24 +229,29 @@ void POP3wrapper::statusFolder(folderStat&target_stat,const QString&)
228 if (!m_pop3) return; 229 if (!m_pop3) return;
229 int r = mailsession_status_folder(m_folder->fld_session,0,&target_stat.message_count, 230 int r = mailsession_status_folder(m_folder->fld_session,0,&target_stat.message_count,
230 &target_stat.message_recent,&target_stat.message_unseen); 231 &target_stat.message_recent,&target_stat.message_unseen);
231} 232}
232 233
233encodedString* POP3wrapper::fetchRawBody(const RecMail&mail) 234encodedString* POP3wrapper::fetchRawBody(const RecMail&mail)
234{ 235{
235 char*target=0; 236 char*target=0;
236 size_t length=0; 237 size_t length=0;
237 encodedString*res = 0; 238 encodedString*res = 0;
238 mailmessage * mailmsg = 0; 239 mailmessage * mailmsg = 0;
239 int err = mailsession_get_message(m_folder->fld_session, mail.getNumber(), &mailmsg); 240 int err = mailsession_get_message(m_folder->fld_session, mail.getNumber(), &mailmsg);
240 err = mailmessage_fetch(mailmsg,&target,&length); 241 err = mailmessage_fetch(mailmsg,&target,&length);
241 if (mailmsg) mailmessage_free(mailmsg); 242 if (mailmsg) mailmessage_free(mailmsg);
242 if (target) { 243 if (target) {
243 res = new encodedString(target,length); 244 res = new encodedString(target,length);
244 } 245 }
245 return res; 246 return res;
246} 247}
247 248
248const QString&POP3wrapper::getType()const 249const QString&POP3wrapper::getType()const
249{ 250{
250 return account->getType(); 251 return account->getType();
251} 252}
253
254const QString&POP3wrapper::getName()const
255{
256 return account->getAccountName();
257}
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.h b/noncore/net/mail/libmailwrapper/pop3wrapper.h
index f0307b6..d2b708d 100644
--- a/noncore/net/mail/libmailwrapper/pop3wrapper.h
+++ b/noncore/net/mail/libmailwrapper/pop3wrapper.h
@@ -9,34 +9,35 @@ class encodedString;
9struct mailstorage; 9struct mailstorage;
10struct mailfolder; 10struct mailfolder;
11 11
12class POP3wrapper : public Genericwrapper 12class POP3wrapper : public Genericwrapper
13{ 13{
14 Q_OBJECT 14 Q_OBJECT
15 15
16public: 16public:
17 POP3wrapper( POP3account *a ); 17 POP3wrapper( POP3account *a );
18 virtual ~POP3wrapper(); 18 virtual ~POP3wrapper();
19 /* mailbox will be ignored */ 19 /* mailbox will be ignored */
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 const QString&getType()const;
33 virtual const QString&getName()const;
33 static void pop3_progress( size_t current, size_t maximum ); 34 static void pop3_progress( size_t current, size_t maximum );
34 35
35protected: 36protected:
36 void login(); 37 void login();
37 POP3account *account; 38 POP3account *account;
38 mailstorage*m_pop3; 39 mailstorage*m_pop3;
39 mailfolder*m_folder; 40 mailfolder*m_folder;
40}; 41};
41 42
42#endif 43#endif
diff --git a/noncore/net/mail/libmailwrapper/settings.cpp b/noncore/net/mail/libmailwrapper/settings.cpp
index c5187f5..02a80a3 100644
--- a/noncore/net/mail/libmailwrapper/settings.cpp
+++ b/noncore/net/mail/libmailwrapper/settings.cpp
@@ -147,65 +147,69 @@ QString IMAPaccount::getUniqueFileName()
147 do { 147 do {
148 unique.setNum( num++ ); 148 unique.setNum( num++ );
149 } while ( imap.contains( "imap-" + unique ) > 0 ); 149 } while ( imap.contains( "imap-" + unique ) > 0 );
150 150
151 return unique; 151 return unique;
152} 152}
153 153
154void IMAPaccount::read() 154void IMAPaccount::read()
155{ 155{
156 Config *conf = new Config( getFileName(), Config::File ); 156 Config *conf = new Config( getFileName(), Config::File );
157 conf->setGroup( "IMAP Account" ); 157 conf->setGroup( "IMAP Account" );
158 accountName = conf->readEntry( "Account","" ); 158 accountName = conf->readEntry( "Account","" );
159 if (accountName.isNull()) accountName = ""; 159 if (accountName.isNull()) accountName = "";
160 server = conf->readEntry( "Server","" ); 160 server = conf->readEntry( "Server","" );
161 if (server.isNull()) server=""; 161 if (server.isNull()) server="";
162 port = conf->readEntry( "Port","" ); 162 port = conf->readEntry( "Port","" );
163 if (port.isNull()) port="143"; 163 if (port.isNull()) port="143";
164 ssl = conf->readBoolEntry( "SSL",false ); 164 ssl = conf->readBoolEntry( "SSL",false );
165 user = conf->readEntry( "User","" ); 165 user = conf->readEntry( "User","" );
166 if (user.isNull()) user = ""; 166 if (user.isNull()) user = "";
167 password = conf->readEntryCrypt( "Password","" ); 167 password = conf->readEntryCrypt( "Password","" );
168 if (password.isNull()) password = ""; 168 if (password.isNull()) password = "";
169 prefix = conf->readEntry("MailPrefix",""); 169 prefix = conf->readEntry("MailPrefix","");
170 if (prefix.isNull()) prefix = ""; 170 if (prefix.isNull()) prefix = "";
171 offline = conf->readBoolEntry("Offline",false);
172 delete conf;
171} 173}
172 174
173void IMAPaccount::save() 175void IMAPaccount::save()
174{ 176{
175 qDebug( "saving " + getFileName() ); 177 qDebug( "saving " + getFileName() );
176 Settings::checkDirectory(); 178 Settings::checkDirectory();
177 179
178 Config *conf = new Config( getFileName(), Config::File ); 180 Config *conf = new Config( getFileName(), Config::File );
179 conf->setGroup( "IMAP Account" ); 181 conf->setGroup( "IMAP Account" );
180 conf->writeEntry( "Account", accountName ); 182 conf->writeEntry( "Account", accountName );
181 conf->writeEntry( "Server", server ); 183 conf->writeEntry( "Server", server );
182 conf->writeEntry( "Port", port ); 184 conf->writeEntry( "Port", port );
183 conf->writeEntry( "SSL", ssl ); 185 conf->writeEntry( "SSL", ssl );
184 conf->writeEntry( "User", user ); 186 conf->writeEntry( "User", user );
185 conf->writeEntryCrypt( "Password", password ); 187 conf->writeEntryCrypt( "Password", password );
186 conf->writeEntry( "MailPrefix",prefix); 188 conf->writeEntry( "MailPrefix",prefix);
189 conf->writeEntry( "Offline",offline);
187 conf->write(); 190 conf->write();
191 delete conf;
188} 192}
189 193
190 194
191QString IMAPaccount::getFileName() 195QString IMAPaccount::getFileName()
192{ 196{
193 return (QString) getenv( "HOME" ) + "/Applications/opiemail/imap-" + file; 197 return (QString) getenv( "HOME" ) + "/Applications/opiemail/imap-" + file;
194} 198}
195 199
196POP3account::POP3account() 200POP3account::POP3account()
197 : Account() 201 : Account()
198{ 202{
199 file = POP3account::getUniqueFileName(); 203 file = POP3account::getUniqueFileName();
200 accountName = "New POP3 Account"; 204 accountName = "New POP3 Account";
201 ssl = false; 205 ssl = false;
202 type = "POP3"; 206 type = "POP3";
203 port = POP3_PORT; 207 port = POP3_PORT;
204} 208}
205 209
206POP3account::POP3account( QString filename ) 210POP3account::POP3account( QString filename )
207 : Account() 211 : Account()
208{ 212{
209 file = filename; 213 file = filename;
210 accountName = "New POP3 Account"; 214 accountName = "New POP3 Account";
211 ssl = false; 215 ssl = false;
@@ -217,64 +221,68 @@ QString POP3account::getUniqueFileName()
217{ 221{
218 int num = 0; 222 int num = 0;
219 QString unique; 223 QString unique;
220 224
221 QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); 225 QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" );
222 226
223 QStringList imap = dir.entryList( "pop3-*" ); 227 QStringList imap = dir.entryList( "pop3-*" );
224 do { 228 do {
225 unique.setNum( num++ ); 229 unique.setNum( num++ );
226 } while ( imap.contains( "pop3-" + unique ) > 0 ); 230 } while ( imap.contains( "pop3-" + unique ) > 0 );
227 231
228 return unique; 232 return unique;
229} 233}
230 234
231void POP3account::read() 235void POP3account::read()
232{ 236{
233 Config *conf = new Config( getFileName(), Config::File ); 237 Config *conf = new Config( getFileName(), Config::File );
234 conf->setGroup( "POP3 Account" ); 238 conf->setGroup( "POP3 Account" );
235 accountName = conf->readEntry( "Account" ); 239 accountName = conf->readEntry( "Account" );
236 server = conf->readEntry( "Server" ); 240 server = conf->readEntry( "Server" );
237 port = conf->readEntry( "Port" ); 241 port = conf->readEntry( "Port" );
238 ssl = conf->readBoolEntry( "SSL" ); 242 ssl = conf->readBoolEntry( "SSL" );
239 user = conf->readEntry( "User" ); 243 user = conf->readEntry( "User" );
240 password = conf->readEntryCrypt( "Password" ); 244 password = conf->readEntryCrypt( "Password" );
245 offline = conf->readBoolEntry("Offline",false);
246 delete conf;
241} 247}
242 248
243void POP3account::save() 249void POP3account::save()
244{ 250{
245 qDebug( "saving " + getFileName() ); 251 qDebug( "saving " + getFileName() );
246 Settings::checkDirectory(); 252 Settings::checkDirectory();
247 253
248 Config *conf = new Config( getFileName(), Config::File ); 254 Config *conf = new Config( getFileName(), Config::File );
249 conf->setGroup( "POP3 Account" ); 255 conf->setGroup( "POP3 Account" );
250 conf->writeEntry( "Account", accountName ); 256 conf->writeEntry( "Account", accountName );
251 conf->writeEntry( "Server", server ); 257 conf->writeEntry( "Server", server );
252 conf->writeEntry( "Port", port ); 258 conf->writeEntry( "Port", port );
253 conf->writeEntry( "SSL", ssl ); 259 conf->writeEntry( "SSL", ssl );
254 conf->writeEntry( "User", user ); 260 conf->writeEntry( "User", user );
255 conf->writeEntryCrypt( "Password", password ); 261 conf->writeEntryCrypt( "Password", password );
262 conf->writeEntry( "Offline",offline);
256 conf->write(); 263 conf->write();
264 delete conf;
257} 265}
258 266
259 267
260QString POP3account::getFileName() 268QString POP3account::getFileName()
261{ 269{
262 return (QString) getenv( "HOME" ) + "/Applications/opiemail/pop3-" + file; 270 return (QString) getenv( "HOME" ) + "/Applications/opiemail/pop3-" + file;
263} 271}
264 272
265SMTPaccount::SMTPaccount() 273SMTPaccount::SMTPaccount()
266 : Account() 274 : Account()
267{ 275{
268 file = SMTPaccount::getUniqueFileName(); 276 file = SMTPaccount::getUniqueFileName();
269 accountName = "New SMTP Account"; 277 accountName = "New SMTP Account";
270 ssl = false; 278 ssl = false;
271 login = false; 279 login = false;
272 useCC = false; 280 useCC = false;
273 useBCC = false; 281 useBCC = false;
274 useReply = false; 282 useReply = false;
275 type = "SMTP"; 283 type = "SMTP";
276 port = SMTP_PORT; 284 port = SMTP_PORT;
277} 285}
278 286
279SMTPaccount::SMTPaccount( QString filename ) 287SMTPaccount::SMTPaccount( QString filename )
280 : Account() 288 : Account()
@@ -292,65 +300,67 @@ QString SMTPaccount::getUniqueFileName()
292 int num = 0; 300 int num = 0;
293 QString unique; 301 QString unique;
294 302
295 QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); 303 QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" );
296 304
297 QStringList imap = dir.entryList( "smtp-*" ); 305 QStringList imap = dir.entryList( "smtp-*" );
298 do { 306 do {
299 unique.setNum( num++ ); 307 unique.setNum( num++ );
300 } while ( imap.contains( "smtp-" + unique ) > 0 ); 308 } while ( imap.contains( "smtp-" + unique ) > 0 );
301 309
302 return unique; 310 return unique;
303} 311}
304 312
305void SMTPaccount::read() 313void SMTPaccount::read()
306{ 314{
307 Config *conf = new Config( getFileName(), Config::File ); 315 Config *conf = new Config( getFileName(), Config::File );
308 conf->setGroup( "SMTP Account" ); 316 conf->setGroup( "SMTP Account" );
309 accountName = conf->readEntry( "Account" ); 317 accountName = conf->readEntry( "Account" );
310 server = conf->readEntry( "Server" ); 318 server = conf->readEntry( "Server" );
311 port = conf->readEntry( "Port" ); 319 port = conf->readEntry( "Port" );
312 ssl = conf->readBoolEntry( "SSL" ); 320 ssl = conf->readBoolEntry( "SSL" );
313 login = conf->readBoolEntry( "Login" ); 321 login = conf->readBoolEntry( "Login" );
314 user = conf->readEntry( "User" ); 322 user = conf->readEntry( "User" );
315 password = conf->readEntryCrypt( "Password" ); 323 password = conf->readEntryCrypt( "Password" );
324 delete conf;
316} 325}
317 326
318void SMTPaccount::save() 327void SMTPaccount::save()
319{ 328{
320 qDebug( "saving " + getFileName() ); 329 qDebug( "saving " + getFileName() );
321 Settings::checkDirectory(); 330 Settings::checkDirectory();
322 331
323 Config *conf = new Config( getFileName(), Config::File ); 332 Config *conf = new Config( getFileName(), Config::File );
324 conf->setGroup( "SMTP Account" ); 333 conf->setGroup( "SMTP Account" );
325 conf->writeEntry( "Account", accountName ); 334 conf->writeEntry( "Account", accountName );
326 conf->writeEntry( "Server", server ); 335 conf->writeEntry( "Server", server );
327 conf->writeEntry( "Port", port ); 336 conf->writeEntry( "Port", port );
328 conf->writeEntry( "SSL", ssl ); 337 conf->writeEntry( "SSL", ssl );
329 conf->writeEntry( "Login", login ); 338 conf->writeEntry( "Login", login );
330 conf->writeEntry( "User", user ); 339 conf->writeEntry( "User", user );
331 conf->writeEntryCrypt( "Password", password ); 340 conf->writeEntryCrypt( "Password", password );
332 conf->write(); 341 conf->write();
342 delete conf;
333} 343}
334 344
335 345
336QString SMTPaccount::getFileName() 346QString SMTPaccount::getFileName()
337{ 347{
338 return (QString) getenv( "HOME" ) + "/Applications/opiemail/smtp-" + file; 348 return (QString) getenv( "HOME" ) + "/Applications/opiemail/smtp-" + file;
339} 349}
340 350
341NNTPaccount::NNTPaccount() 351NNTPaccount::NNTPaccount()
342 : Account() 352 : Account()
343{ 353{
344 file = NNTPaccount::getUniqueFileName(); 354 file = NNTPaccount::getUniqueFileName();
345 accountName = "New NNTP Account"; 355 accountName = "New NNTP Account";
346 ssl = false; 356 ssl = false;
347 login = false; 357 login = false;
348 type = "NNTP"; 358 type = "NNTP";
349 port = NNTP_PORT; 359 port = NNTP_PORT;
350} 360}
351 361
352NNTPaccount::NNTPaccount( QString filename ) 362NNTPaccount::NNTPaccount( QString filename )
353 : Account() 363 : Account()
354{ 364{
355 file = filename; 365 file = filename;
356 accountName = "New NNTP Account"; 366 accountName = "New NNTP Account";
@@ -365,49 +375,51 @@ QString NNTPaccount::getUniqueFileName()
365 int num = 0; 375 int num = 0;
366 QString unique; 376 QString unique;
367 377
368 QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); 378 QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" );
369 379
370 QStringList imap = dir.entryList( "nntp-*" ); 380 QStringList imap = dir.entryList( "nntp-*" );
371 do { 381 do {
372 unique.setNum( num++ ); 382 unique.setNum( num++ );
373 } while ( imap.contains( "nntp-" + unique ) > 0 ); 383 } while ( imap.contains( "nntp-" + unique ) > 0 );
374 384
375 return unique; 385 return unique;
376} 386}
377 387
378void NNTPaccount::read() 388void NNTPaccount::read()
379{ 389{
380 Config *conf = new Config( getFileName(), Config::File ); 390 Config *conf = new Config( getFileName(), Config::File );
381 conf->setGroup( "NNTP Account" ); 391 conf->setGroup( "NNTP Account" );
382 accountName = conf->readEntry( "Account" ); 392 accountName = conf->readEntry( "Account" );
383 server = conf->readEntry( "Server" ); 393 server = conf->readEntry( "Server" );
384 port = conf->readEntry( "Port" ); 394 port = conf->readEntry( "Port" );
385 ssl = conf->readBoolEntry( "SSL" ); 395 ssl = conf->readBoolEntry( "SSL" );
386 login = conf->readBoolEntry( "Login" ); 396 login = conf->readBoolEntry( "Login" );
387 user = conf->readEntry( "User" ); 397 user = conf->readEntry( "User" );
388 password = conf->readEntryCrypt( "Password" ); 398 password = conf->readEntryCrypt( "Password" );
399 delete conf;
389} 400}
390 401
391void NNTPaccount::save() 402void NNTPaccount::save()
392{ 403{
393 qDebug( "saving " + getFileName() ); 404 qDebug( "saving " + getFileName() );
394 Settings::checkDirectory(); 405 Settings::checkDirectory();
395 406
396 Config *conf = new Config( getFileName(), Config::File ); 407 Config *conf = new Config( getFileName(), Config::File );
397 conf->setGroup( "NNTP Account" ); 408 conf->setGroup( "NNTP Account" );
398 conf->writeEntry( "Account", accountName ); 409 conf->writeEntry( "Account", accountName );
399 conf->writeEntry( "Server", server ); 410 conf->writeEntry( "Server", server );
400 conf->writeEntry( "Port", port ); 411 conf->writeEntry( "Port", port );
401 conf->writeEntry( "SSL", ssl ); 412 conf->writeEntry( "SSL", ssl );
402 conf->writeEntry( "Login", login ); 413 conf->writeEntry( "Login", login );
403 conf->writeEntry( "User", user ); 414 conf->writeEntry( "User", user );
404 conf->writeEntryCrypt( "Password", password ); 415 conf->writeEntryCrypt( "Password", password );
405 conf->write(); 416 conf->write();
417 delete conf;
406} 418}
407 419
408 420
409QString NNTPaccount::getFileName() 421QString NNTPaccount::getFileName()
410{ 422{
411 return (QString) getenv( "HOME" ) + "/Applications/opiemail/nntp-" + file; 423 return (QString) getenv( "HOME" ) + "/Applications/opiemail/nntp-" + file;
412} 424}
413 425
diff --git a/noncore/net/mail/libmailwrapper/settings.h b/noncore/net/mail/libmailwrapper/settings.h
index caa5dfc..2104997 100644
--- a/noncore/net/mail/libmailwrapper/settings.h
+++ b/noncore/net/mail/libmailwrapper/settings.h
@@ -9,57 +9,60 @@ class Account
9 9
10public: 10public:
11 Account(); 11 Account();
12 virtual ~Account() {} 12 virtual ~Account() {}
13 13
14 void remove(); 14 void remove();
15 void setAccountName( QString name ) { accountName = name; } 15 void setAccountName( QString name ) { accountName = name; }
16 const QString&getAccountName()const{ return accountName; } 16 const QString&getAccountName()const{ return accountName; }
17 const QString&getType()const{ return type; } 17 const QString&getType()const{ return type; }
18 18
19 void setServer(const QString&str){ server = str; } 19 void setServer(const QString&str){ server = str; }
20 const QString&getServer()const{ return server; } 20 const QString&getServer()const{ return server; }
21 21
22 void setPort(const QString&str) { port = str; } 22 void setPort(const QString&str) { port = str; }
23 const QString&getPort()const{ return port; } 23 const QString&getPort()const{ return port; }
24 24
25 void setUser(const QString&str){ user = str; } 25 void setUser(const QString&str){ user = str; }
26 const QString&getUser()const{ return user; } 26 const QString&getUser()const{ return user; }
27 27
28 void setPassword(const QString&str) { password = str; } 28 void setPassword(const QString&str) { password = str; }
29 const QString&getPassword()const { return password; } 29 const QString&getPassword()const { return password; }
30 30
31 void setSSL( bool b ) { ssl = b; } 31 void setSSL( bool b ) { ssl = b; }
32 bool getSSL() { return ssl; } 32 bool getSSL() { return ssl; }
33
34 void setOffline(bool b) {offline = b;}
35 bool getOffline()const{return offline;}
33 36
34 virtual QString getFileName() { return accountName; } 37 virtual QString getFileName() { return accountName; }
35 virtual void read() { qDebug( "base reading..." ); } 38 virtual void read() { qDebug( "base reading..." ); }
36 virtual void save() { qDebug( "base saving..." ); } 39 virtual void save() { qDebug( "base saving..." ); }
37 40
38protected: 41protected:
39 QString accountName, type, server, port, user, password; 42 QString accountName, type, server, port, user, password;
40 bool ssl; 43 bool ssl;
41 44 bool offline;
42}; 45};
43 46
44class IMAPaccount : public Account 47class IMAPaccount : public Account
45{ 48{
46 49
47public: 50public:
48 IMAPaccount(); 51 IMAPaccount();
49 IMAPaccount( QString filename ); 52 IMAPaccount( QString filename );
50 53
51 static QString getUniqueFileName(); 54 static QString getUniqueFileName();
52 55
53 virtual void read(); 56 virtual void read();
54 virtual void save(); 57 virtual void save();
55 virtual QString getFileName(); 58 virtual QString getFileName();
56 59
57 void setPrefix(const QString&str) {prefix=str;} 60 void setPrefix(const QString&str) {prefix=str;}
58 const QString&getPrefix()const{return prefix;} 61 const QString&getPrefix()const{return prefix;}
59 62
60private: 63private:
61 QString file,prefix; 64 QString file,prefix;
62 65
63}; 66};
64 67
65class POP3account : public Account 68class POP3account : public Account
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
index 4764b77..281b88e 100644
--- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
@@ -468,80 +468,78 @@ char *SMTPwrapper::getFrom( mailimf_field *ffrom)
468 468
469 return from; 469 return from;
470} 470}
471 471
472char *SMTPwrapper::getFrom( mailmime *mail ) 472char *SMTPwrapper::getFrom( mailmime *mail )
473{ 473{
474 /* no need to delete - its just a pointer to structure content */ 474 /* no need to delete - its just a pointer to structure content */
475 mailimf_field *ffrom = 0; 475 mailimf_field *ffrom = 0;
476 ffrom = getField( mail->mm_data.mm_message.mm_fields, MAILIMF_FIELD_FROM ); 476 ffrom = getField( mail->mm_data.mm_message.mm_fields, MAILIMF_FIELD_FROM );
477 return getFrom(ffrom); 477 return getFrom(ffrom);
478} 478}
479 479
480void SMTPwrapper::progress( size_t current, size_t maximum ) 480void SMTPwrapper::progress( size_t current, size_t maximum )
481{ 481{
482 if (SMTPwrapper::sendProgress) { 482 if (SMTPwrapper::sendProgress) {
483 SMTPwrapper::sendProgress->setSingleMail(current, maximum ); 483 SMTPwrapper::sendProgress->setSingleMail(current, maximum );
484 qApp->processEvents(); 484 qApp->processEvents();
485 } 485 }
486} 486}
487 487
488void SMTPwrapper::storeMail(const char*mail, size_t length, const QString&box) 488void SMTPwrapper::storeMail(const char*mail, size_t length, const QString&box)
489{ 489{
490 if (!mail) return; 490 if (!mail) return;
491 QString localfolders = AbstractMail::defaultLocalfolder(); 491 QString localfolders = AbstractMail::defaultLocalfolder();
492 MBOXwrapper*wrap = new MBOXwrapper(localfolders); 492 AbstractMail*wrap = AbstractMail::getWrapper(localfolders);
493 wrap->storeMessage(mail,length,box); 493 wrap->storeMessage(mail,length,box);
494 delete wrap; 494 delete wrap;
495} 495}
496 496
497void SMTPwrapper::smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ) 497void SMTPwrapper::smtpSend( mailmime *mail,bool later, SMTPaccount *smtp )
498{ 498{
499 clist *rcpts = 0; 499 clist *rcpts = 0;
500 char *from, *data; 500 char *from, *data;
501 size_t size; 501 size_t size;
502 502
503 if ( smtp == NULL ) { 503 if ( smtp == NULL ) {
504 return; 504 return;
505 } 505 }
506 from = data = 0; 506 from = data = 0;
507 507
508 mailmessage * msg = 0; 508 mailmessage * msg = 0;
509 msg = mime_message_init(mail); 509 msg = mime_message_init(mail);
510 mime_message_set_tmpdir(msg,getenv( "HOME" )); 510 mime_message_set_tmpdir(msg,getenv( "HOME" ));
511 int r = mailmessage_fetch(msg,&data,&size); 511 int r = mailmessage_fetch(msg,&data,&size);
512 mime_message_detach_mime(msg); 512 mime_message_detach_mime(msg);
513 mailmessage_free(msg); 513 mailmessage_free(msg);
514 if (r != MAIL_NO_ERROR || !data) { 514 if (r != MAIL_NO_ERROR || !data) {
515 if (data) free(data); 515 if (data) free(data);
516 qDebug("Error fetching mime..."); 516 qDebug("Error fetching mime...");
517 return; 517 return;
518 } 518 }
519 QString tmp = data;
520 tmp.replace(QRegExp("\r+",true,false),"");
521 msg = 0; 519 msg = 0;
522 if (later) { 520 if (later) {
523 storeMail((char*)tmp.data(),tmp.length(),"Outgoing"); 521 storeMail(data,size,"Outgoing");
524 if (data) free( data ); 522 if (data) free( data );
525 Config cfg( "mail" ); 523 Config cfg( "mail" );
526 cfg.setGroup( "Status" ); 524 cfg.setGroup( "Status" );
527 cfg.writeEntry( "outgoing", ++m_queuedMail ); 525 cfg.writeEntry( "outgoing", ++m_queuedMail );
528 emit queuedMails( m_queuedMail ); 526 emit queuedMails( m_queuedMail );
529 return; 527 return;
530 } 528 }
531 from = getFrom( mail ); 529 from = getFrom( mail );
532 rcpts = createRcptList( mail->mm_data.mm_message.mm_fields ); 530 rcpts = createRcptList( mail->mm_data.mm_message.mm_fields );
533 smtpSend(from,rcpts,data,size,smtp); 531 smtpSend(from,rcpts,data,size,smtp);
534 if (data) {free(data);} 532 if (data) {free(data);}
535 if (from) {free(from);} 533 if (from) {free(from);}
536 if (rcpts) smtp_address_list_free( rcpts ); 534 if (rcpts) smtp_address_list_free( rcpts );
537} 535}
538 536
539int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size, SMTPaccount *smtp ) 537int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size, SMTPaccount *smtp )
540{ 538{
541 const char *server, *user, *pass; 539 const char *server, *user, *pass;
542 bool ssl; 540 bool ssl;
543 uint16_t port; 541 uint16_t port;
544 mailsmtp *session; 542 mailsmtp *session;
545 int err,result; 543 int err,result;
546 544
547 result = 1; 545 result = 1;
@@ -615,98 +613,98 @@ void SMTPwrapper::sendMail(const Mail&mail,SMTPaccount*aSmtp,bool later )
615 mailmime * mimeMail; 613 mailmime * mimeMail;
616 614
617 SMTPaccount *smtp = aSmtp; 615 SMTPaccount *smtp = aSmtp;
618 616
619 if (!later && !smtp) { 617 if (!later && !smtp) {
620 qDebug("Didn't get any send method - giving up"); 618 qDebug("Didn't get any send method - giving up");
621 return; 619 return;
622 } 620 }
623 mimeMail = createMimeMail(mail ); 621 mimeMail = createMimeMail(mail );
624 if ( mimeMail == NULL ) { 622 if ( mimeMail == NULL ) {
625 qDebug( "sendMail: error creating mime mail" ); 623 qDebug( "sendMail: error creating mime mail" );
626 } else { 624 } else {
627 sendProgress = new progressMailSend(); 625 sendProgress = new progressMailSend();
628 sendProgress->show(); 626 sendProgress->show();
629 sendProgress->setMaxMails(1); 627 sendProgress->setMaxMails(1);
630 smtpSend( mimeMail,later,smtp); 628 smtpSend( mimeMail,later,smtp);
631 qDebug("Clean up done"); 629 qDebug("Clean up done");
632 sendProgress->hide(); 630 sendProgress->hide();
633 delete sendProgress; 631 delete sendProgress;
634 sendProgress = 0; 632 sendProgress = 0;
635 mailmime_free( mimeMail ); 633 mailmime_free( mimeMail );
636 } 634 }
637} 635}
638 636
639int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which) 637int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,SMTPaccount*smtp,RecMail*which)
640{ 638{
641 size_t curTok = 0; 639 size_t curTok = 0;
642 mailimf_fields *fields = 0; 640 mailimf_fields *fields = 0;
643 mailimf_field*ffrom = 0; 641 mailimf_field*ffrom = 0;
644 clist *rcpts = 0; 642 clist *rcpts = 0;
645 char*from = 0; 643 char*from = 0;
646 int res = 0; 644 int res = 0;
647 645
648 encodedString * data = wrap->fetchRawBody(*which); 646 encodedString * data = wrap->fetchRawBody(*which);
649 if (!data) return 0; 647 if (!data) return 0;
650 int err = mailimf_fields_parse( data->Content(), data->Length(), &curTok, &fields ); 648 int err = mailimf_fields_parse( data->Content(), data->Length(), &curTok, &fields );
651 if (err != MAILIMF_NO_ERROR) { 649 if (err != MAILIMF_NO_ERROR) {
652 delete data; 650 delete data;
653 delete wrap; 651 delete wrap;
654 return 0; 652 return 0;
655 } 653 }
656 654
657 rcpts = createRcptList( fields ); 655 rcpts = createRcptList( fields );
658 ffrom = getField(fields, MAILIMF_FIELD_FROM ); 656 ffrom = getField(fields, MAILIMF_FIELD_FROM );
659 from = getFrom(ffrom); 657 from = getFrom(ffrom);
660 658
661 if (rcpts && from) { 659 if (rcpts && from) {
662 res = smtpSend(from,rcpts,data->Content(),data->Length(),smtp ); 660 res = smtpSend(from,rcpts,data->Content(),data->Length(),smtp );
663 } 661 }
664 if (fields) { 662 if (fields) {
665 mailimf_fields_free(fields); 663 mailimf_fields_free(fields);
666 fields = 0; 664 fields = 0;
667 } 665 }
668 if (data) { 666 if (data) {
669 delete data; 667 delete data;
670 } 668 }
671 if (from) { 669 if (from) {
672 free(from); 670 free(from);
673 } 671 }
674 if (rcpts) { 672 if (rcpts) {
675 smtp_address_list_free( rcpts ); 673 smtp_address_list_free( rcpts );
676 } 674 }
677 return res; 675 return res;
678} 676}
679 677
680/* this is a special fun */ 678/* this is a special fun */
681bool SMTPwrapper::flushOutbox(SMTPaccount*smtp) 679bool SMTPwrapper::flushOutbox(SMTPaccount*smtp)
682{ 680{
683 bool returnValue = true; 681 bool returnValue = true;
684 682
685 if (!smtp) return false; 683 if (!smtp) return false;
686 684
687 QString localfolders = AbstractMail::defaultLocalfolder(); 685 QString localfolders = AbstractMail::defaultLocalfolder();
688 MBOXwrapper*wrap = new MBOXwrapper(localfolders); 686 AbstractMail*wrap = AbstractMail::getWrapper(localfolders);
689 if (!wrap) { 687 if (!wrap) {
690 qDebug("memory error"); 688 qDebug("memory error");
691 return false; 689 return false;
692 } 690 }
693 QList<RecMail> mailsToSend; 691 QList<RecMail> mailsToSend;
694 QList<RecMail> mailsToRemove; 692 QList<RecMail> mailsToRemove;
695 QString mbox("Outgoing"); 693 QString mbox("Outgoing");
696 wrap->listMessages(mbox,mailsToSend); 694 wrap->listMessages(mbox,mailsToSend);
697 if (mailsToSend.count()==0) { 695 if (mailsToSend.count()==0) {
698 delete wrap; 696 delete wrap;
699 return false; 697 return false;
700 } 698 }
701 mailsToSend.setAutoDelete(false); 699 mailsToSend.setAutoDelete(false);
702 sendProgress = new progressMailSend(); 700 sendProgress = new progressMailSend();
703 sendProgress->show(); 701 sendProgress->show();
704 sendProgress->setMaxMails(mailsToSend.count()); 702 sendProgress->setMaxMails(mailsToSend.count());
705 703
706 while (mailsToSend.count()>0) { 704 while (mailsToSend.count()>0) {
707 if (sendQueuedMail(wrap,smtp,mailsToSend.at(0))==0) { 705 if (sendQueuedMail(wrap,smtp,mailsToSend.at(0))==0) {
708 QMessageBox::critical(0,tr("Error sending mail"), 706 QMessageBox::critical(0,tr("Error sending mail"),
709 tr("Error sending queued mail - breaking")); 707 tr("Error sending queued mail - breaking"));
710 returnValue = false; 708 returnValue = false;
711 break; 709 break;
712 } 710 }
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.h b/noncore/net/mail/libmailwrapper/smtpwrapper.h
index 04fc4b0..7dcdbfd 100644
--- a/noncore/net/mail/libmailwrapper/smtpwrapper.h
+++ b/noncore/net/mail/libmailwrapper/smtpwrapper.h
@@ -1,72 +1,72 @@
1#ifndef SMTPwrapper_H 1#ifndef SMTPwrapper_H
2#define SMTPwrapper_H 2#define SMTPwrapper_H
3 3
4#include <qpe/applnk.h> 4#include <qpe/applnk.h>
5 5
6#include <qbitarray.h> 6#include <qbitarray.h>
7#include <qdatetime.h> 7#include <qdatetime.h>
8#include <libetpan/clist.h> 8#include <libetpan/clist.h>
9 9
10#include "settings.h" 10#include "settings.h"
11 11
12class Mail; 12class Mail;
13class MBOXwrapper; 13class AbstractMail;
14class RecMail; 14class RecMail;
15class Attachment; 15class Attachment;
16struct mailimf_fields; 16struct mailimf_fields;
17struct mailimf_field; 17struct mailimf_field;
18struct mailimf_mailbox; 18struct mailimf_mailbox;
19struct mailmime; 19struct mailmime;
20struct mailimf_address_list; 20struct mailimf_address_list;
21class progressMailSend; 21class progressMailSend;
22 22
23class SMTPwrapper : public QObject 23class SMTPwrapper : public QObject
24{ 24{
25 Q_OBJECT 25 Q_OBJECT
26 26
27public: 27public:
28 SMTPwrapper( Settings *s ); 28 SMTPwrapper( Settings *s );
29 virtual ~SMTPwrapper(){} 29 virtual ~SMTPwrapper(){}
30 void sendMail(const Mail& mail,SMTPaccount*smtp,bool later=false ); 30 void sendMail(const Mail& mail,SMTPaccount*smtp,bool later=false );
31 bool flushOutbox(SMTPaccount*smtp); 31 bool flushOutbox(SMTPaccount*smtp);
32 32
33 static progressMailSend*sendProgress; 33 static progressMailSend*sendProgress;
34 34
35signals: 35signals:
36 void queuedMails( int ); 36 void queuedMails( int );
37 37
38protected: 38protected:
39 mailimf_mailbox *newMailbox(const QString&name,const QString&mail ); 39 mailimf_mailbox *newMailbox(const QString&name,const QString&mail );
40 mailimf_fields *createImfFields(const Mail &mail ); 40 mailimf_fields *createImfFields(const Mail &mail );
41 mailmime *createMimeMail(const Mail&mail ); 41 mailmime *createMimeMail(const Mail&mail );
42 42
43 mailimf_address_list *parseAddresses(const QString&addr ); 43 mailimf_address_list *parseAddresses(const QString&addr );
44 void addFileParts( mailmime *message,const QList<Attachment>&files ); 44 void addFileParts( mailmime *message,const QList<Attachment>&files );
45 mailmime *buildTxtPart(const QString&str ); 45 mailmime *buildTxtPart(const QString&str );
46 mailmime *buildFilePart(const QString&filename,const QString&mimetype,const QString&content); 46 mailmime *buildFilePart(const QString&filename,const QString&mimetype,const QString&content);
47 void smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ); 47 void smtpSend( mailmime *mail,bool later, SMTPaccount *smtp );
48 clist *createRcptList( mailimf_fields *fields ); 48 clist *createRcptList( mailimf_fields *fields );
49 49
50 static void storeMail(const char*mail, size_t length, const QString&box); 50 static void storeMail(const char*mail, size_t length, const QString&box);
51 static QString mailsmtpError( int err ); 51 static QString mailsmtpError( int err );
52 static void progress( size_t current, size_t maximum ); 52 static void progress( size_t current, size_t maximum );
53 static void addRcpts( clist *list, mailimf_address_list *addr_list ); 53 static void addRcpts( clist *list, mailimf_address_list *addr_list );
54 static char *getFrom( mailmime *mail ); 54 static char *getFrom( mailmime *mail );
55 static char *getFrom( mailimf_field *ffrom); 55 static char *getFrom( mailimf_field *ffrom);
56 static mailimf_field *getField( mailimf_fields *fields, int type ); 56 static mailimf_field *getField( mailimf_fields *fields, int type );
57 int smtpSend(char*from,clist*rcpts,const char*data,size_t size, SMTPaccount *smtp ); 57 int smtpSend(char*from,clist*rcpts,const char*data,size_t size, SMTPaccount *smtp );
58 58
59 void storeMail(mailmime*mail, const QString&box); 59 void storeMail(mailmime*mail, const QString&box);
60 Settings *settings; 60 Settings *settings;
61 61
62 int sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which); 62 int sendQueuedMail(AbstractMail*wrap,SMTPaccount*smtp,RecMail*which);
63 63
64 int m_queuedMail; 64 int m_queuedMail;
65 static const char* USER_AGENT; 65 static const char* USER_AGENT;
66 66
67protected slots: 67protected slots:
68 void emitQCop( int queued ); 68 void emitQCop( int queued );
69 69
70}; 70};
71 71
72#endif 72#endif