summaryrefslogtreecommitdiffabout
path: root/kmicromail/libmailwrapper
Unidiff
Diffstat (limited to 'kmicromail/libmailwrapper') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/generatemail.h5
-rw-r--r--kmicromail/libmailwrapper/libmailwrapper.pro64
-rw-r--r--kmicromail/libmailwrapper/mailwrapper.h2
-rw-r--r--kmicromail/libmailwrapper/mhwrapper.cpp22
-rw-r--r--kmicromail/libmailwrapper/mhwrapper.h6
-rw-r--r--kmicromail/libmailwrapper/settings.h1
-rw-r--r--kmicromail/libmailwrapper/smtpwrapper.cpp15
-rw-r--r--kmicromail/libmailwrapper/smtpwrapper.h2
-rw-r--r--kmicromail/libmailwrapper/storemail.h2
9 files changed, 90 insertions, 29 deletions
diff --git a/kmicromail/libmailwrapper/generatemail.h b/kmicromail/libmailwrapper/generatemail.h
index a767b61..b9f8285 100644
--- a/kmicromail/libmailwrapper/generatemail.h
+++ b/kmicromail/libmailwrapper/generatemail.h
@@ -1,46 +1,47 @@
1#ifndef __GENERATE_MAIL_H 1#ifndef __GENERATE_MAIL_H
2#define __GENERATE_MAIL_H 2#define __GENERATE_MAIL_H
3 3
4#include <qpe/applnk.h> 4//#include <qpe/applnk.h>
5 5
6#include <qobject.h> 6#include <qobject.h>
7#include <libetpan/clist.h> 7#include <libetpan/clist.h>
8#include "mailwrapper.h"
8 9
9#include <opie2/osmartpointer.h> 10#include <opie2/osmartpointer.h>
10 11
11class Mail; 12class Mail;
12class RecMail; 13class RecMail;
13class Attachment; 14
14struct mailimf_fields; 15struct mailimf_fields;
15struct mailimf_field; 16struct mailimf_field;
16struct mailimf_mailbox; 17struct mailimf_mailbox;
17struct mailmime; 18struct mailmime;
18struct mailimf_address_list; 19struct mailimf_address_list;
19class progressMailSend; 20class progressMailSend;
20struct mailsmtp; 21struct mailsmtp;
21 22
22class Generatemail : public QObject 23class Generatemail : public QObject
23{ 24{
24 Q_OBJECT 25 Q_OBJECT
25public: 26public:
26 Generatemail(); 27 Generatemail();
27 virtual ~Generatemail(); 28 virtual ~Generatemail();
28 29
29protected: 30protected:
30 static void addRcpts( clist *list, mailimf_address_list *addr_list ); 31 static void addRcpts( clist *list, mailimf_address_list *addr_list );
31 static char *getFrom( mailmime *mail ); 32 static char *getFrom( mailmime *mail );
32 static char *getFrom( mailimf_field *ffrom); 33 static char *getFrom( mailimf_field *ffrom);
33 static mailimf_field *getField( mailimf_fields *fields, int type ); 34 static mailimf_field *getField( mailimf_fields *fields, int type );
34 mailimf_address_list *parseAddresses(const QString&addr ); 35 mailimf_address_list *parseAddresses(const QString&addr );
35 void addFileParts( mailmime *message,const QList<Attachment>&files ); 36 void addFileParts( mailmime *message,const QList<Attachment>&files );
36 mailmime *buildFilePart(const QString&filename,const QString&mimetype,const QString&content); 37 mailmime *buildFilePart(const QString&filename,const QString&mimetype,const QString&content);
37 mailmime *buildTxtPart(const QString&str ); 38 mailmime *buildTxtPart(const QString&str );
38 mailimf_mailbox *newMailbox(const QString&name,const QString&mail ); 39 mailimf_mailbox *newMailbox(const QString&name,const QString&mail );
39 mailimf_fields *createImfFields(const Opie::Core::OSmartPointer<Mail> &mail ); 40 mailimf_fields *createImfFields(const Opie::Core::OSmartPointer<Mail> &mail );
40 mailmime *createMimeMail(const Opie::Core::OSmartPointer<Mail>&mail ); 41 mailmime *createMimeMail(const Opie::Core::OSmartPointer<Mail>&mail );
41 clist *createRcptList( mailimf_fields *fields ); 42 clist *createRcptList( mailimf_fields *fields );
42 43
43 static const char* USER_AGENT; 44 static const char* USER_AGENT;
44}; 45};
45 46
46#endif 47#endif
diff --git a/kmicromail/libmailwrapper/libmailwrapper.pro b/kmicromail/libmailwrapper/libmailwrapper.pro
new file mode 100644
index 0000000..2b005d8
--- a/dev/null
+++ b/kmicromail/libmailwrapper/libmailwrapper.pro
@@ -0,0 +1,64 @@
1TEMPLATE = lib
2CONFIG += qt warn_on
3
4HEADERS = mailwrapper.h \
5 imapwrapper.h \
6 mailtypes.h \
7 pop3wrapper.h \
8 abstractmail.h \
9 smtpwrapper.h \
10 genericwrapper.h \
11 mboxwrapper.h \
12 settings.h \
13 logindialog.h \
14 sendmailprogress.h \
15 statusmail.h \
16 mhwrapper.h \
17 nntpwrapper.h \
18 generatemail.h \
19 storemail.h \
20 ../qpe/global.h
21
22SOURCES = imapwrapper.cpp \
23 mailwrapper.cpp \
24 mailtypes.cpp \
25 pop3wrapper.cpp \
26 abstractmail.cpp \
27 smtpwrapper.cpp \
28 genericwrapper.cpp \
29 mboxwrapper.cpp \
30 settings.cpp \
31 logindialog.cpp \
32 sendmailprogress.cpp \
33 statusmail.cpp \
34 mhwrapper.cpp \
35 nntpwrapper.cpp \
36 generatemail.cpp \
37 storemail.cpp \
38 ../qpe/global.cpp
39
40INTERFACES = logindialogui.ui \
41 sendmailprogressui.ui
42
43INCLUDEPATH += .. ../../microkde ../../microkde/kdecore ../libetpan/include
44LIBS += -lssl -lcrypto
45
46#-lqpe -letpan
47
48DESTDIR = ../../bin
49TARGET = micromailwrapper
50
51DEFINES += DESKTOP_VERSION
52unix : {
53OBJECTS_DIR = obj/unix
54MOC_DIR = moc/unix
55}
56win32: {
57DEFINES += _WIN32_
58LIBS += mfc71u.lib
59QMAKE_LINK += /NODEFAULTLIB:LIBC
60#QMAKE_LINK += /NODEFAULTLIB:MSVCRT
61#QMAKE_LINK += /NODEFAULTLIB:uafxcw.lib
62OBJECTS_DIR = obj/win
63MOC_DIR = moc/win
64}
diff --git a/kmicromail/libmailwrapper/mailwrapper.h b/kmicromail/libmailwrapper/mailwrapper.h
index 2ba908b..88f10da 100644
--- a/kmicromail/libmailwrapper/mailwrapper.h
+++ b/kmicromail/libmailwrapper/mailwrapper.h
@@ -1,128 +1,128 @@
1#ifndef MAILWRAPPER_H 1#ifndef MAILWRAPPER_H
2#define MAILWRAPPER_H 2#define MAILWRAPPER_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 <qfileinfo.h> 8#include <qfileinfo.h>
9#include <kiconloader.h> 9#include <kiconloader.h>
10 10
11#include "settings.h" 11#include "settings.h"
12 12
13#include <opie2/osmartpointer.h> 13#include <opie2/osmartpointer.h>
14/* 14/*
15class Attachment 15class Attachment
16{ 16{
17public: 17public:
18 Attachment( DocLnk lnk ); 18 Attachment( DocLnk lnk );
19 virtual ~Attachment(){} 19 virtual ~Attachment(){}
20 const QString getFileName()const{ return doc.file(); } 20 const QString getFileName()const{ return doc.file(); }
21 const QString getName()const{ return doc.name(); } 21 const QString getName()const{ return doc.name(); }
22 const QString getMimeType()const{ return doc.type(); } 22 const QString getMimeType()const{ return doc.type(); }
23 const QPixmap getPixmap()const{ return doc.pixmap(); } 23 const QPixmap getPixmap()const{ return doc.pixmap(); }
24 const int getSize()const { return size; } 24 const int getSize()const { return size; }
25 DocLnk getDocLnk() { return doc; } 25 DocLnk getDocLnk() { return doc; }
26 26
27protected: 27protected:
28 DocLnk doc; 28 DocLnk doc;
29 int size; 29 int size;
30 30
31}; 31};
32*/ 32*/
33 33
34class Attachment 34class Attachment
35{ 35{
36public: 36public:
37 Attachment( QString lnk ); 37 Attachment( QString lnk );
38 virtual ~Attachment(){} 38 virtual ~Attachment(){}
39 const QString getFileName()const{ return doc; } 39 const QString getFileName()const{ return doc; }
40 const QString getName()const{ return QFileInfo( doc ).baseName (); } 40 const QString getName()const{ return QFileInfo( doc ).baseName (); }
41 const QString getMimeType()const{ return QFileInfo( doc ).extension(false); } 41 const QString getMimeType()const{ return QFileInfo( doc ).extension(false); }
42 const QPixmap getPixmap()const{ return mPix; } 42 const QPixmap getPixmap()const{ return mPix; }
43 const int getSize()const { return size; } 43 const int getSize()const { return size; }
44 QString getDocLnk() { return doc; } 44 QString getDocLnk() { return doc; }
45 45
46protected: 46protected:
47 QPixmap mPix; 47 QPixmap mPix;
48 QString doc; 48 QString doc;
49 int size; 49 int size;
50 50
51}; 51};
52 52
53class Mail:public Opie::Core::ORefCount 53class Mail:public Opie::Core::ORefCount
54{ 54{
55public: 55public:
56 Mail(); 56 Mail();
57 /* Possible that this destructor must not be declared virtual 57 /* Possible that this destructor must not be declared virtual
58 * 'cause it seems that it will never have some child classes. 58 * 'cause it seems that it will never have some child classes.
59 * in this case this object will not get a virtual table -> memory and 59 * in this case this object will not get a virtual table -> memory and
60 * speed will be a little bit better? 60 * speed will be a little bit better?
61 */ 61 */
62 virtual ~Mail(){} 62 virtual ~Mail(){}
63 void addAttachment( Attachment *att ) { attList.append( att ); } 63 void addAttachment( Attachment *att ) { attList.append( att ); }
64 const QList<Attachment>& getAttachments()const { return attList; } 64 const QList<Attachment>& getAttachments()const { return attList; }
65 void removeAttachment( Attachment *att ) { attList.remove( att ); } 65 void removeAttachment( Attachment *att ) { attList.remove( att ); }
66 const QString&getName()const { return name; } 66 const QString&getName()const { return name; }
67 void setName( QString s ) { name = s; } 67 void setName( QString s ) { name = s; }
68 const QString&getMail()const{ return mail; } 68 const QString&getMail()const{ return mail; }
69 void setMail( const QString&s ) { mail = s; } 69 void setMail( const QString&s ) { mail = s; }
70 const QString&getTo()const{ return to; } 70 const QString&getTo()const{ return to; }
71 void setTo( const QString&s ) { to = s; } 71 void setTo( const QString&s ) { to = s; }
72 const QString&getCC()const{ return cc; } 72 const QString&getCC()const{ return cc; }
73 void setCC( const QString&s ) { cc = s; } 73 void setCC( const QString&s ) { cc = s; }
74 const QString&getBCC()const { return bcc; } 74 const QString&getBCC()const { return bcc; }
75 void setBCC( const QString&s ) { bcc = s; } 75 void setBCC( const QString&s ) { bcc = s; }
76 const QString&getMessage()const { return message; } 76 const QString&getMessage()const { return message; }
77 void setMessage( const QString&s ) { message = s; } 77 void setMessage( const QString&s ) { message = s; }
78 const QString&getSubject()const { return subject; } 78 const QString&getSubject()const { return subject; }
79 void setSubject( const QString&s ) { subject = s; } 79 void setSubject( const QString&s ) { subject = s; }
80 const QString&getReply()const{ return reply; } 80 const QString&getReply()const{ return reply; }
81 void setReply( const QString&a ) { reply = a; } 81 void setReply( const QString&a ) { reply = a; }
82 void setInreply(const QStringList&list){m_in_reply_to = list;} 82 void setInreply(const QStringList&list){m_in_reply_to = list;}
83 const QStringList&Inreply()const{return m_in_reply_to;} 83 const QStringList&Inreply()const{return m_in_reply_to;}
84 84
85private: 85private:
86 QList<Attachment> attList; 86 QList<Attachment> attList;
87 QString name, mail, to, cc, bcc, reply, subject, message; 87 QString name, mail, to, cc, bcc, reply, subject, message;
88 QStringList m_in_reply_to; 88 QStringList m_in_reply_to;
89}; 89};
90 90
91class Folder:public Opie::Core::ORefCount 91class Folder:public Opie::Core::ORefCount
92{ 92{
93public: 93public:
94 Folder( const QString&init_name,const QString&sep ); 94 Folder( const QString&init_name,const QString&sep );
95 virtual ~Folder(); 95 virtual ~Folder();
96 const QString&getDisplayName()const { return nameDisplay; } 96 const QString&getDisplayName()const { return nameDisplay; }
97 const QString&getName()const { return name; } 97 const QString&getName()const { return name; }
98 const QString&getPrefix()const{return prefix; } 98 const QString&getPrefix()const{return prefix; }
99 virtual bool may_select()const{return true;} 99 virtual bool may_select()const{return true;}
100 virtual bool no_inferior()const{return true;} 100 virtual bool no_inferior()const{return true;}
101 const QString&Separator()const; 101 const QString&Separator()const;
102 102
103protected: 103protected:
104 QString nameDisplay, name, separator,prefix; 104 QString nameDisplay, name, separator,prefix;
105}; 105};
106 106
107typedef Opie::Core::OSmartPointer<Folder> FolderP; 107typedef Opie::Core::OSmartPointer<Folder> FolderP;
108 108
109class MHFolder : public Folder 109class MHFolder : public Folder
110{ 110{
111public: 111public:
112 MHFolder(const QString&disp_name,const QString&mbox); 112 MHFolder(const QString&disp_name,const QString&mbox);
113 virtual ~MHFolder(); 113 virtual ~MHFolder();
114}; 114};
115 115
116class IMAPFolder : public Folder 116class IMAPFolder : public Folder
117{ 117{
118 public: 118 public:
119 IMAPFolder(const QString&name, const QString&sep, bool select=true,bool noinf=false,const QString&prefix="" ); 119 IMAPFolder(const QString&name, const QString&sep, bool select=true,bool noinf=false,const QString&prefix="" );
120 virtual ~IMAPFolder(); 120 virtual ~IMAPFolder();
121 virtual bool may_select()const{return m_MaySelect;} 121 virtual bool may_select()const{return m_MaySelect;}
122 virtual bool no_inferior()const{return m_NoInferior;} 122 virtual bool no_inferior()const{return m_NoInferior;}
123 static QString decodeFolderName( const QString &name ); 123 static QString decodeFolderName( const QString &name );
124 private: 124 private:
125 bool m_MaySelect,m_NoInferior; 125 bool m_MaySelect,m_NoInferior;
126}; 126};
127 127
128#endif 128#endif
diff --git a/kmicromail/libmailwrapper/mhwrapper.cpp b/kmicromail/libmailwrapper/mhwrapper.cpp
index f4133c0..de6d220 100644
--- a/kmicromail/libmailwrapper/mhwrapper.cpp
+++ b/kmicromail/libmailwrapper/mhwrapper.cpp
@@ -1,447 +1,441 @@
1// CHANGED 2004-09-31 Lutz Rogowski 1// CHANGED 2004-09-31 Lutz Rogowski
2#include "mhwrapper.h" 2#include "mhwrapper.h"
3#include "mailtypes.h" 3#include "mailtypes.h"
4#include "mailwrapper.h" 4#include "mailwrapper.h"
5#include <libetpan/libetpan.h> 5#include <libetpan/libetpan.h>
6#include <qdir.h> 6#include <qdir.h>
7#include <qmessagebox.h> 7#include <qmessagebox.h>
8#include <stdlib.h> 8#include <stdlib.h>
9#include <qpe/global.h> 9#include <qpe/global.h>
10#include <oprocess.h>
11#include <klocale.h> 10#include <klocale.h>
12//#include <opie2/odebug.h> 11#include <kglobal.h>
12//#include <opie2/odebug.h>
13 13
14using namespace Opie::Core; 14using namespace Opie::Core;
15MHwrapper::MHwrapper(const QString & mbox_dir,const QString&mbox_name) 15MHwrapper::MHwrapper(const QString & mbox_dir,const QString&mbox_name)
16 : Genericwrapper(),MHPath(mbox_dir),MHName(mbox_name) 16 : Genericwrapper(),MHPath(mbox_dir),MHName(mbox_name)
17{ 17{
18 if (MHPath.length()>0) { 18 if (MHPath.length()>0) {
19 if (MHPath[MHPath.length()-1]=='/') { 19 if (MHPath[MHPath.length()-1]=='/') {
20 MHPath=MHPath.left(MHPath.length()-1); 20 MHPath=MHPath.left(MHPath.length()-1);
21 } 21 }
22 //odebug << MHPath << oendl; 22 //odebug << MHPath << oendl;
23 QDir dir(MHPath); 23 QDir dir(MHPath);
24 if (!dir.exists()) { 24 if (!dir.exists()) {
25 dir.mkdir(MHPath); 25 dir.mkdir(MHPath);
26 } 26 }
27 init_storage(); 27 init_storage();
28 } 28 }
29} 29}
30 30
31void MHwrapper::init_storage() 31void MHwrapper::init_storage()
32{ 32{
33 int r; 33 int r;
34 QString pre = MHPath; 34 QString pre = MHPath;
35 if (!m_storage) { 35 if (!m_storage) {
36 m_storage = mailstorage_new(NULL); 36 m_storage = mailstorage_new(NULL);
37 r = mh_mailstorage_init(m_storage,(char*)pre.latin1(),0,0,0); 37 r = mh_mailstorage_init(m_storage,(char*)pre.latin1(),0,0,0);
38 if (r != MAIL_NO_ERROR) { 38 if (r != MAIL_NO_ERROR) {
39 qDebug(" error init storage "); 39 qDebug(" error init storage ");
40 mailstorage_free(m_storage); 40 mailstorage_free(m_storage);
41 m_storage = 0; 41 m_storage = 0;
42 return; 42 return;
43 } 43 }
44 } 44 }
45 r = mailstorage_connect(m_storage); 45 r = mailstorage_connect(m_storage);
46 if (r!=MAIL_NO_ERROR) { 46 if (r!=MAIL_NO_ERROR) {
47 qDebug("error connecting storage "); 47 qDebug("error connecting storage ");
48 mailstorage_free(m_storage); 48 mailstorage_free(m_storage);
49 m_storage = 0; 49 m_storage = 0;
50 } 50 }
51} 51}
52 52
53void MHwrapper::clean_storage() 53void MHwrapper::clean_storage()
54{ 54{
55 if (m_storage) { 55 if (m_storage) {
56 mailstorage_disconnect(m_storage); 56 mailstorage_disconnect(m_storage);
57 mailstorage_free(m_storage); 57 mailstorage_free(m_storage);
58 m_storage = 0; 58 m_storage = 0;
59 } 59 }
60} 60}
61 61
62MHwrapper::~MHwrapper() 62MHwrapper::~MHwrapper()
63{ 63{
64 clean_storage(); 64 clean_storage();
65} 65}
66 66
67void MHwrapper::listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb ) 67void MHwrapper::listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb )
68{ 68{
69 init_storage(); 69 init_storage();
70 if (!m_storage) { 70 if (!m_storage) {
71 return; 71 return;
72 } 72 }
73 QString f = buildPath(mailbox); 73 QString f = buildPath(mailbox);
74 int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); 74 int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1());
75 if (r!=MAIL_NO_ERROR) { 75 if (r!=MAIL_NO_ERROR) {
76 qDebug("listMessages: error selecting folder! "); 76 qDebug("listMessages: error selecting folder! ");
77 return; 77 return;
78 } 78 }
79 parseList(target,m_storage->sto_session,f, false, maxSizeInKb ); 79 parseList(target,m_storage->sto_session,f, false, maxSizeInKb );
80 Global::statusMessage(i18n("Mailbox has %1 mail(s)").arg(target.count())); 80 Global::statusMessage(i18n("Mailbox has %1 mail(s)").arg(target.count()));
81} 81}
82 82
83QValueList<Opie::Core::OSmartPointer<Folder> >* MHwrapper::listFolders() 83QValueList<Opie::Core::OSmartPointer<Folder> >* MHwrapper::listFolders()
84{ 84{
85 QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<Opie::Core::OSmartPointer<Folder> >(); 85 QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<Opie::Core::OSmartPointer<Folder> >();
86 /* this is needed! */ 86 /* this is needed! */
87 if (m_storage) mailstorage_disconnect(m_storage); 87 if (m_storage) mailstorage_disconnect(m_storage);
88 init_storage(); 88 init_storage();
89 if (!m_storage) { 89 if (!m_storage) {
90 return folders; 90 return folders;
91 } 91 }
92 mail_list*flist = 0; 92 mail_list*flist = 0;
93 clistcell*current=0; 93 clistcell*current=0;
94 int r = mailsession_list_folders(m_storage->sto_session,NULL,&flist); 94 int r = mailsession_list_folders(m_storage->sto_session,NULL,&flist);
95 if (r != MAIL_NO_ERROR || !flist) { 95 if (r != MAIL_NO_ERROR || !flist) {
96 qDebug("error getting folder list "); 96 qDebug("error getting folder list ");
97 return folders; 97 return folders;
98 } 98 }
99 for (current=clist_begin(flist->mb_list);current!=0;current=clist_next(current)) { 99 for (current=clist_begin(flist->mb_list);current!=0;current=clist_next(current)) {
100 QString t = (char*)current->data; 100 QString t = (char*)current->data;
101 t.replace(0,MHPath.length(),""); 101 t.replace(0,MHPath.length(),"");
102 folders->append(new MHFolder(t,MHPath)); 102 folders->append(new MHFolder(t,MHPath));
103 } 103 }
104 mail_list_free(flist); 104 mail_list_free(flist);
105 return folders; 105 return folders;
106} 106}
107 107
108void MHwrapper::deleteMail(const RecMailP&mail) 108void MHwrapper::deleteMail(const RecMailP&mail)
109{ 109{
110 init_storage(); 110 init_storage();
111 if (!m_storage) { 111 if (!m_storage) {
112 return; 112 return;
113 } 113 }
114 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1()); 114 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1());
115 if (r!=MAIL_NO_ERROR) { 115 if (r!=MAIL_NO_ERROR) {
116 qDebug("error selecting folder! "); 116 qDebug("error selecting folder! ");
117 return; 117 return;
118 } 118 }
119 r = mailsession_remove_message(m_storage->sto_session,mail->getNumber()); 119 r = mailsession_remove_message(m_storage->sto_session,mail->getNumber());
120 if (r != MAIL_NO_ERROR) { 120 if (r != MAIL_NO_ERROR) {
121 qDebug("error deleting mail "); 121 qDebug("error deleting mail ");
122 } 122 }
123} 123}
124 124
125void MHwrapper::answeredMail(const RecMailP&) 125void MHwrapper::answeredMail(const RecMailP&)
126{ 126{
127} 127}
128 128
129RecBodyP MHwrapper::fetchBody( const RecMailP &mail ) 129RecBodyP MHwrapper::fetchBody( const RecMailP &mail )
130{ 130{
131 RecBodyP body = new RecBody(); 131 RecBodyP body = new RecBody();
132 init_storage(); 132 init_storage();
133 if (!m_storage) { 133 if (!m_storage) {
134 return body; 134 return body;
135 } 135 }
136 mailmessage * msg; 136 mailmessage * msg;
137 char*data=0; 137 char*data=0;
138 138
139 /* mail should hold the complete path! */ 139 /* mail should hold the complete path! */
140 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1()); 140 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1());
141 if (r != MAIL_NO_ERROR) { 141 if (r != MAIL_NO_ERROR) {
142 return body; 142 return body;
143 } 143 }
144 r = mailsession_get_message(m_storage->sto_session, mail->getNumber(), &msg); 144 r = mailsession_get_message(m_storage->sto_session, mail->getNumber(), &msg);
145 if (r != MAIL_NO_ERROR) { 145 if (r != MAIL_NO_ERROR) {
146 qDebug("Error fetching mail "); 146 qDebug("Error fetching mail ");
147 147
148 return body; 148 return body;
149 } 149 }
150 body = parseMail(msg); 150 body = parseMail(msg);
151 mailmessage_fetch_result_free(msg,data); 151 mailmessage_fetch_result_free(msg,data);
152 return body; 152 return body;
153} 153}
154 154
155void MHwrapper::mbox_progress( size_t current, size_t maximum ) 155void MHwrapper::mbox_progress( size_t current, size_t maximum )
156{ 156{
157 qDebug("MBox Progress %d of %d",current,maximum ); 157 qDebug("MBox Progress %d of %d",current,maximum );
158 //odebug << "MH " << current << " von " << maximum << "" << oendl; 158 //odebug << "MH " << current << " von " << maximum << "" << oendl;
159} 159}
160 160
161QString MHwrapper::buildPath(const QString&p) 161QString MHwrapper::buildPath(const QString&p)
162{ 162{
163 QString f=""; 163 QString f="";
164 if (p.length()==0||p=="/") 164 if (p.length()==0||p=="/")
165 return MHPath; 165 return MHPath;
166 if (!p.startsWith(MHPath)) { 166 if (!p.startsWith(MHPath)) {
167 f+=MHPath; 167 f+=MHPath;
168 } 168 }
169 if (!p.startsWith("/")) { 169 if (!p.startsWith("/")) {
170 f+="/"; 170 f+="/";
171 } 171 }
172 f+=p; 172 f+=p;
173 return f; 173 return f;
174} 174}
175 175
176int MHwrapper::createMbox(const QString&folder,const FolderP&pfolder,const QString&,bool ) 176int MHwrapper::createMbox(const QString&folder,const FolderP&pfolder,const QString&,bool )
177{ 177{
178 init_storage(); 178 init_storage();
179 if (!m_storage) { 179 if (!m_storage) {
180 return 0; 180 return 0;
181 } 181 }
182 QString f; 182 QString f;
183 if (!pfolder) { 183 if (!pfolder) {
184 // toplevel folder 184 // toplevel folder
185 f = buildPath(folder); 185 f = buildPath(folder);
186 } else { 186 } else {
187 f = pfolder->getName(); 187 f = pfolder->getName();
188 f+="/"; 188 f+="/";
189 f+=folder; 189 f+=folder;
190 } 190 }
191 191
192 int r = mailsession_create_folder(m_storage->sto_session,(char*)f.latin1()); 192 int r = mailsession_create_folder(m_storage->sto_session,(char*)f.latin1());
193 if (r != MAIL_NO_ERROR) { 193 if (r != MAIL_NO_ERROR) {
194 qDebug("error creating folder "); 194 qDebug("error creating folder ");
195 return 0; 195 return 0;
196 } 196 }
197 return 1; 197 return 1;
198} 198}
199 199
200void MHwrapper::storeMessage(const char*msg,size_t length, const QString&Folder) 200void MHwrapper::storeMessage(const char*msg,size_t length, const QString&Folder)
201{ 201{
202 init_storage(); 202 init_storage();
203 if (!m_storage) { 203 if (!m_storage) {
204 return; 204 return;
205 } 205 }
206 QString f = buildPath(Folder); 206 QString f = buildPath(Folder);
207 int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); 207 int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1());
208 if (r!=MAIL_NO_ERROR) { 208 if (r!=MAIL_NO_ERROR) {
209 qDebug("error selecting folder! "); 209 qDebug("error selecting folder! ");
210 return; 210 return;
211 } 211 }
212 r = mailsession_append_message(m_storage->sto_session,(char*)msg,length); 212 r = mailsession_append_message(m_storage->sto_session,(char*)msg,length);
213 if (r!=MAIL_NO_ERROR) { 213 if (r!=MAIL_NO_ERROR) {
214 qDebug("error storing mail "); 214 qDebug("error storing mail ");
215 } 215 }
216 return; 216 return;
217} 217}
218 218
219encodedString* MHwrapper::fetchRawBody(const RecMailP&mail) 219encodedString* MHwrapper::fetchRawBody(const RecMailP&mail)
220{ 220{
221 encodedString*result = 0; 221 encodedString*result = 0;
222 init_storage(); 222 init_storage();
223 if (!m_storage) { 223 if (!m_storage) {
224 return result; 224 return result;
225 } 225 }
226 mailmessage * msg = 0; 226 mailmessage * msg = 0;
227 char*data=0; 227 char*data=0;
228 size_t size; 228 size_t size;
229 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1()); 229 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1());
230 if (r!=MAIL_NO_ERROR) { 230 if (r!=MAIL_NO_ERROR) {
231 qDebug("error selecting folder! "); 231 qDebug("error selecting folder! ");
232 return result; 232 return result;
233 } 233 }
234 r = mailsession_get_message(m_storage->sto_session, mail->getNumber(), &msg); 234 r = mailsession_get_message(m_storage->sto_session, mail->getNumber(), &msg);
235 if (r != MAIL_NO_ERROR) { 235 if (r != MAIL_NO_ERROR) {
236 Global::statusMessage(i18n("Error fetching mail %i").arg(mail->getNumber())); 236 Global::statusMessage(i18n("Error fetching mail %i").arg(mail->getNumber()));
237 return 0; 237 return 0;
238 } 238 }
239 r = mailmessage_fetch(msg,&data,&size); 239 r = mailmessage_fetch(msg,&data,&size);
240 if (r != MAIL_NO_ERROR) { 240 if (r != MAIL_NO_ERROR) {
241 Global::statusMessage(i18n("Error fetching mail %i").arg(mail->getNumber())); 241 Global::statusMessage(i18n("Error fetching mail %i").arg(mail->getNumber()));
242 if (msg) mailmessage_free(msg); 242 if (msg) mailmessage_free(msg);
243 return 0; 243 return 0;
244 } 244 }
245 result = new encodedString(data,size); 245 result = new encodedString(data,size);
246 if (msg) mailmessage_free(msg); 246 if (msg) mailmessage_free(msg);
247 return result; 247 return result;
248} 248}
249 249
250void MHwrapper::deleteMails(const QString & mailbox,const QValueList<RecMailP> &target) 250void MHwrapper::deleteMails(const QString & mailbox,const QValueList<RecMailP> &target)
251{ 251{
252 QString f = buildPath(mailbox); 252 QString f = buildPath(mailbox);
253 int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); 253 int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1());
254 if (r!=MAIL_NO_ERROR) { 254 if (r!=MAIL_NO_ERROR) {
255 qDebug("deleteMails: error selecting folder! "); 255 qDebug("deleteMails: error selecting folder! ");
256 return; 256 return;
257 } 257 }
258 QValueList<RecMailP>::ConstIterator it; 258 QValueList<RecMailP>::ConstIterator it;
259 for (it=target.begin(); it!=target.end();++it) { 259 for (it=target.begin(); it!=target.end();++it) {
260 r = mailsession_remove_message(m_storage->sto_session,(*it)->getNumber()); 260 r = mailsession_remove_message(m_storage->sto_session,(*it)->getNumber());
261 if (r != MAIL_NO_ERROR) { 261 if (r != MAIL_NO_ERROR) {
262 qDebug("error deleting mail "); 262 qDebug("error deleting mail ");
263 break; 263 break;
264 } 264 }
265 } 265 }
266} 266}
267 267
268int MHwrapper::deleteAllMail(const FolderP&tfolder) 268int MHwrapper::deleteAllMail(const FolderP&tfolder)
269{ 269{
270 init_storage(); 270 init_storage();
271 if (!m_storage) { 271 if (!m_storage) {
272 return 0; 272 return 0;
273 } 273 }
274 int res = 1; 274 int res = 1;
275 if (!tfolder) return 0; 275 if (!tfolder) return 0;
276 int r = mailsession_select_folder(m_storage->sto_session,(char*)tfolder->getName().latin1()); 276 int r = mailsession_select_folder(m_storage->sto_session,(char*)tfolder->getName().latin1());
277 if (r!=MAIL_NO_ERROR) { 277 if (r!=MAIL_NO_ERROR) {
278 qDebug("error selecting folder! "); 278 qDebug("error selecting folder! ");
279 return 0; 279 return 0;
280 } 280 }
281 mailmessage_list*l=0; 281 mailmessage_list*l=0;
282 r = mailsession_get_messages_list(m_storage->sto_session,&l); 282 r = mailsession_get_messages_list(m_storage->sto_session,&l);
283 if (r != MAIL_NO_ERROR) { 283 if (r != MAIL_NO_ERROR) {
284 qDebug("Error message list "); 284 qDebug("Error message list ");
285 res = 0; 285 res = 0;
286 } 286 }
287 unsigned j = 0; 287 unsigned j = 0;
288 for(unsigned int i = 0 ; l!= 0 && res==1 && i < carray_count(l->msg_tab) ; ++i) { 288 for(unsigned int i = 0 ; l!= 0 && res==1 && i < carray_count(l->msg_tab) ; ++i) {
289 mailmessage * msg; 289 mailmessage * msg;
290 msg = (mailmessage*)carray_get(l->msg_tab, i); 290 msg = (mailmessage*)carray_get(l->msg_tab, i);
291 j = msg->msg_index; 291 j = msg->msg_index;
292 r = mailsession_remove_message(m_storage->sto_session,j); 292 r = mailsession_remove_message(m_storage->sto_session,j);
293 if (r != MAIL_NO_ERROR) { 293 if (r != MAIL_NO_ERROR) {
294 Global::statusMessage(i18n("Error deleting mail %1").arg(i+1)); 294 Global::statusMessage(i18n("Error deleting mail %1").arg(i+1));
295 res = 0; 295 res = 0;
296 break; 296 break;
297 } 297 }
298 } 298 }
299 if (l) mailmessage_list_free(l); 299 if (l) mailmessage_list_free(l);
300 return res; 300 return res;
301} 301}
302 302
303int MHwrapper::deleteMbox(const FolderP&tfolder) 303int MHwrapper::deleteMbox(const FolderP&tfolder)
304{ 304{
305 init_storage(); 305 init_storage();
306 if (!m_storage) { 306 if (!m_storage) {
307 return 0; 307 return 0;
308 } 308 }
309 if (!tfolder) return 0; 309 if (!tfolder) return 0;
310 if (tfolder->getName()=="/" || tfolder->getName().isEmpty()) return 0; 310 if (tfolder->getName()=="/" || tfolder->getName().isEmpty()) return 0;
311 311
312 int r = mailsession_delete_folder(m_storage->sto_session,(char*)tfolder->getName().latin1()); 312 int r = mailsession_delete_folder(m_storage->sto_session,(char*)tfolder->getName().latin1());
313 313
314 if (r != MAIL_NO_ERROR) { 314 if (r != MAIL_NO_ERROR) {
315 qDebug("error deleting mail box "); 315 qDebug("error deleting mail box ");
316 return 0; 316 return 0;
317 } 317 }
318 QString delDir = locateLocal( "apps", "kopiemail")+ "localmail";
319 qDebug("*****************\ndel %s %s ", delDir.latin1(),tfolder->getName().latin1() );
320#if 0
318 QString cmd = "rm -rf "+tfolder->getName(); 321 QString cmd = "rm -rf "+tfolder->getName();
319 QStringList command; 322 QStringList command;
320 command << "/bin/sh"; 323 command << "/bin/sh";
321 command << "-c"; 324 command << "-c";
322 command << cmd.latin1(); 325 command << cmd.latin1();
323 OProcess *process = new OProcess(); 326 OProcess *process = new OProcess();
324 327
328 /*
325 connect(process, SIGNAL(processExited(Opie::Core::OProcess*)), 329 connect(process, SIGNAL(processExited(Opie::Core::OProcess*)),
326 this, SLOT( processEnded(Opie::Core::OProcess*))); 330 this, SLOT( processEnded(Opie::Core::OProcess*)));
327 connect(process, SIGNAL( receivedStderr(Opie::Core::OProcess*,char*,int)), 331 connect(process, SIGNAL( receivedStderr(Opie::Core::OProcess*,char*,int)),
328 this, SLOT( oprocessStderr(Opie::Core::OProcess*,char*,int))); 332 this, SLOT( oprocessStderr(Opie::Core::OProcess*,char*,int)));
329 333 */
330 *process << command; 334 *process << command;
331 removeMboxfailed = false; 335 removeMboxfailed = false;
332 if(!process->start(OProcess::Block, OProcess::All) ) { 336 if(!process->start(OProcess::Block, OProcess::All) ) {
333 qDebug("could not start process "); 337 qDebug("could not start process ");
334 return 0; 338 return 0;
335 } 339 }
340#endif
336 qDebug("mail box deleted "); 341 qDebug("mail box deleted ");
337 return 1; 342 return 1;
338} 343}
339 344
340void MHwrapper::processEnded(OProcess *p)
341{
342 if (p) delete p;
343}
344
345void MHwrapper::oprocessStderr(OProcess*, char *buffer, int )
346{
347 QString lineStr = buffer;
348 QMessageBox::warning( 0, i18n("Error"), lineStr ,i18n("Ok") );
349 removeMboxfailed = true;
350}
351 345
352void MHwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) 346void MHwrapper::statusFolder(folderStat&target_stat,const QString & mailbox)
353{ 347{
354 init_storage(); 348 init_storage();
355 if (!m_storage) { 349 if (!m_storage) {
356 return; 350 return;
357 } 351 }
358 target_stat.message_count = 0; 352 target_stat.message_count = 0;
359 target_stat.message_unseen = 0; 353 target_stat.message_unseen = 0;
360 target_stat.message_recent = 0; 354 target_stat.message_recent = 0;
361 QString f = buildPath(mailbox); 355 QString f = buildPath(mailbox);
362 int r = mailsession_status_folder(m_storage->sto_session,(char*)f.latin1(),&target_stat.message_count, 356 int r = mailsession_status_folder(m_storage->sto_session,(char*)f.latin1(),&target_stat.message_count,
363 &target_stat.message_recent,&target_stat.message_unseen); 357 &target_stat.message_recent,&target_stat.message_unseen);
364 if (r != MAIL_NO_ERROR) { 358 if (r != MAIL_NO_ERROR) {
365 Global::statusMessage(i18n("Error retrieving status")); 359 Global::statusMessage(i18n("Error retrieving status"));
366 } 360 }
367} 361}
368 362
369MAILLIB::ATYPE MHwrapper::getType()const 363MAILLIB::ATYPE MHwrapper::getType()const
370{ 364{
371 return MAILLIB::A_MH; 365 return MAILLIB::A_MH;
372} 366}
373 367
374const QString&MHwrapper::getName()const 368const QString&MHwrapper::getName()const
375{ 369{
376 return MHName; 370 return MHName;
377} 371}
378void MHwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) 372void MHwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
379{ 373{
380 init_storage(); 374 init_storage();
381 if (!m_storage) { 375 if (!m_storage) {
382 return; 376 return;
383 } 377 }
384 if (targetWrapper != this) { 378 if (targetWrapper != this) {
385 qDebug("Using generic "); 379 qDebug("Using generic ");
386 Genericwrapper::mvcpMail(mail,targetFolder,targetWrapper,moveit); 380 Genericwrapper::mvcpMail(mail,targetFolder,targetWrapper,moveit);
387 return; 381 return;
388 } 382 }
389 qDebug("Using internal routines for move/copy "); 383 qDebug("Using internal routines for move/copy ");
390 QString tf = buildPath(targetFolder); 384 QString tf = buildPath(targetFolder);
391 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1()); 385 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1());
392 if (r != MAIL_NO_ERROR) { 386 if (r != MAIL_NO_ERROR) {
393 qDebug("Error selecting source mailbox "); 387 qDebug("Error selecting source mailbox ");
394 return; 388 return;
395 } 389 }
396 if (moveit) { 390 if (moveit) {
397 r = mailsession_move_message(m_storage->sto_session,mail->getNumber(),(char*)tf.latin1()); 391 r = mailsession_move_message(m_storage->sto_session,mail->getNumber(),(char*)tf.latin1());
398 } else { 392 } else {
399 r = mailsession_copy_message(m_storage->sto_session,mail->getNumber(),(char*)tf.latin1()); 393 r = mailsession_copy_message(m_storage->sto_session,mail->getNumber(),(char*)tf.latin1());
400 } 394 }
401 if (r != MAIL_NO_ERROR) { 395 if (r != MAIL_NO_ERROR) {
402 qDebug("Error copy/moving mail internal "); 396 qDebug("Error copy/moving mail internal ");
403 } 397 }
404} 398}
405 399
406void MHwrapper::mvcpAllMails(const FolderP&fromFolder, 400void MHwrapper::mvcpAllMails(const FolderP&fromFolder,
407 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) 401 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
408{ 402{
409 init_storage(); 403 init_storage();
410 if (!m_storage) { 404 if (!m_storage) {
411 return; 405 return;
412 } 406 }
413 if (targetWrapper != this) { 407 if (targetWrapper != this) {
414 qDebug("Using generic "); 408 qDebug("Using generic ");
415 Genericwrapper::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit); 409 Genericwrapper::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit);
416 return; 410 return;
417 } 411 }
418 if (!fromFolder) return; 412 if (!fromFolder) return;
419 int r = mailsession_select_folder(m_storage->sto_session,(char*)fromFolder->getName().latin1()); 413 int r = mailsession_select_folder(m_storage->sto_session,(char*)fromFolder->getName().latin1());
420 if (r!=MAIL_NO_ERROR) { 414 if (r!=MAIL_NO_ERROR) {
421 qDebug("error selecting source folder! "); 415 qDebug("error selecting source folder! ");
422 return; 416 return;
423 } 417 }
424 QString tf = buildPath(targetFolder); 418 QString tf = buildPath(targetFolder);
425 mailmessage_list*l=0; 419 mailmessage_list*l=0;
426 r = mailsession_get_messages_list(m_storage->sto_session,&l); 420 r = mailsession_get_messages_list(m_storage->sto_session,&l);
427 if (r != MAIL_NO_ERROR) { 421 if (r != MAIL_NO_ERROR) {
428 qDebug("Error message list "); 422 qDebug("Error message list ");
429 } 423 }
430 unsigned j = 0; 424 unsigned j = 0;
431 for(unsigned int i = 0 ; l!= 0 && i < carray_count(l->msg_tab) ; ++i) { 425 for(unsigned int i = 0 ; l!= 0 && i < carray_count(l->msg_tab) ; ++i) {
432 mailmessage * msg; 426 mailmessage * msg;
433 msg = (mailmessage*)carray_get(l->msg_tab, i); 427 msg = (mailmessage*)carray_get(l->msg_tab, i);
434 j = msg->msg_index; 428 j = msg->msg_index;
435 if (moveit) { 429 if (moveit) {
436 r = mailsession_move_message(m_storage->sto_session,j,(char*)tf.latin1()); 430 r = mailsession_move_message(m_storage->sto_session,j,(char*)tf.latin1());
437 } else { 431 } else {
438 r = mailsession_copy_message(m_storage->sto_session,j,(char*)tf.latin1()); 432 r = mailsession_copy_message(m_storage->sto_session,j,(char*)tf.latin1());
439 } 433 }
440 if (r != MAIL_NO_ERROR) { 434 if (r != MAIL_NO_ERROR) {
441 qDebug("Error copy/moving mail interna "); 435 qDebug("Error copy/moving mail interna ");
442 436
443 break; 437 break;
444 } 438 }
445 } 439 }
446 if (l) mailmessage_list_free(l); 440 if (l) mailmessage_list_free(l);
447} 441}
diff --git a/kmicromail/libmailwrapper/mhwrapper.h b/kmicromail/libmailwrapper/mhwrapper.h
index d1b7d1f..87f8ca1 100644
--- a/kmicromail/libmailwrapper/mhwrapper.h
+++ b/kmicromail/libmailwrapper/mhwrapper.h
@@ -1,62 +1,58 @@
1// CHANGED 2004-09-31 Lutz Rogowski 1// CHANGED 2004-09-31 Lutz Rogowski
2#ifndef __MH_WRAPPER_H 2#ifndef __MH_WRAPPER_H
3#define __MH_WRAPPER_H 3#define __MH_WRAPPER_H
4 4
5#include "maildefines.h" 5#include "maildefines.h"
6 6
7#include "genericwrapper.h" 7#include "genericwrapper.h"
8#include <qstring.h> 8#include <qstring.h>
9 9
10class encodedString; 10class encodedString;
11struct mailmbox_folder; 11struct mailmbox_folder;
12namespace Opie {namespace Core {class OProcess;}}
13
14class MHwrapper : public Genericwrapper 12class MHwrapper : public Genericwrapper
15{ 13{
16 Q_OBJECT 14 Q_OBJECT
17public: 15public:
18 MHwrapper(const QString & dir,const QString&name); 16 MHwrapper(const QString & dir,const QString&name);
19 virtual ~MHwrapper(); 17 virtual ~MHwrapper();
20 18
21 virtual void listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb = 0 ); 19 virtual void listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb = 0 );
22 virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders(); 20 virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders();
23 virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); 21 virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX");
24 22
25 virtual void deleteMail(const RecMailP&mail); 23 virtual void deleteMail(const RecMailP&mail);
26 virtual void answeredMail(const RecMailP&mail); 24 virtual void answeredMail(const RecMailP&mail);
27 virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); 25 virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit);
28 virtual void mvcpAllMails(const Opie::Core::OSmartPointer<Folder>&fromFolder, 26 virtual void mvcpAllMails(const Opie::Core::OSmartPointer<Folder>&fromFolder,
29 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); 27 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit);
30 28
31 virtual int createMbox(const QString&folder,const Opie::Core::OSmartPointer<Folder>&f=0, 29 virtual int createMbox(const QString&folder,const Opie::Core::OSmartPointer<Folder>&f=0,
32 const QString&d="",bool s=false); 30 const QString&d="",bool s=false);
33 virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&); 31 virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&);
34 32
35 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);
36 34
37 virtual RecBodyP fetchBody( const RecMailP &mail ); 35 virtual RecBodyP fetchBody( const RecMailP &mail );
38 static void mbox_progress( size_t current, size_t maximum ); 36 static void mbox_progress( size_t current, size_t maximum );
39 37
40 virtual encodedString* fetchRawBody(const RecMailP&mail); 38 virtual encodedString* fetchRawBody(const RecMailP&mail);
41 virtual void deleteMails(const QString & FolderName,const QValueList<Opie::Core::OSmartPointer<RecMail> > &target); 39 virtual void deleteMails(const QString & FolderName,const QValueList<Opie::Core::OSmartPointer<RecMail> > &target);
42 virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&); 40 virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&);
43 virtual MAILLIB::ATYPE getType()const; 41 virtual MAILLIB::ATYPE getType()const;
44 virtual const QString&getName()const; 42 virtual const QString&getName()const;
45 virtual Account* getAccount() { return 0; }; 43 virtual Account* getAccount() { return 0; };
46 44
47public slots: 45public slots:
48 /* for deleting maildirs we are using a system call */ 46
49 virtual void oprocessStderr(Opie::Core::OProcess*, char *buffer, int );
50 virtual void processEnded(Opie::Core::OProcess *);
51protected: 47protected:
52 QString buildPath(const QString&p); 48 QString buildPath(const QString&p);
53 QString MHPath; 49 QString MHPath;
54 QString MHName; 50 QString MHName;
55 51
56 void init_storage(); 52 void init_storage();
57 void clean_storage(); 53 void clean_storage();
58 54
59 bool removeMboxfailed; 55 bool removeMboxfailed;
60}; 56};
61 57
62#endif 58#endif
diff --git a/kmicromail/libmailwrapper/settings.h b/kmicromail/libmailwrapper/settings.h
index 61051dd..79567ef 100644
--- a/kmicromail/libmailwrapper/settings.h
+++ b/kmicromail/libmailwrapper/settings.h
@@ -1,180 +1,181 @@
1#ifndef SETTINGS_H 1#ifndef SETTINGS_H
2#define SETTINGS_H 2#define SETTINGS_H
3 3
4#include "maildefines.h" 4#include "maildefines.h"
5 5
6/* OPIE */ 6/* OPIE */
7 7
8/* QT */ 8/* QT */
9#include <qobject.h> 9#include <qobject.h>
10#include <qlist.h> 10#include <qlist.h>
11#include <qstringlist.h>
11#include <qdatetime.h> 12#include <qdatetime.h>
12 13
13class Account 14class Account
14{ 15{
15 16
16public: 17public:
17 Account(); 18 Account();
18 virtual ~Account() {} 19 virtual ~Account() {}
19 20
20 void remove(); 21 void remove();
21 void setAccountName( QString name ) { accountName = name; } 22 void setAccountName( QString name ) { accountName = name; }
22 const QString&getAccountName()const{ return accountName; } 23 const QString&getAccountName()const{ return accountName; }
23 MAILLIB::ATYPE getType()const{ return type; } 24 MAILLIB::ATYPE getType()const{ return type; }
24 25
25 void setServer(const QString&str){ server = str; } 26 void setServer(const QString&str){ server = str; }
26 const QString&getServer()const{ return server; } 27 const QString&getServer()const{ return server; }
27 28
28 void setLocalFolder( QString name ) { localFolder = name; } 29 void setLocalFolder( QString name ) { localFolder = name; }
29 const QString& getLocalFolder()const{ return localFolder; } 30 const QString& getLocalFolder()const{ return localFolder; }
30 31
31 void setPort(const QString&str) { port = str; } 32 void setPort(const QString&str) { port = str; }
32 const QString&getPort()const{ return port; } 33 const QString&getPort()const{ return port; }
33 34
34 void setUser(const QString&str){ user = str; } 35 void setUser(const QString&str){ user = str; }
35 const QString&getUser()const{ return user; } 36 const QString&getUser()const{ return user; }
36 37
37 void setPassword(const QString&str) { password = str; } 38 void setPassword(const QString&str) { password = str; }
38 const QString&getPassword()const { return password; } 39 const QString&getPassword()const { return password; }
39 40
40 void setPasswordList(const QStringList &str); 41 void setPasswordList(const QStringList &str);
41 QStringList getPasswordList(); 42 QStringList getPasswordList();
42 43
43 void setSSL( bool b ) { ssl = b; } 44 void setSSL( bool b ) { ssl = b; }
44 bool getSSL() { return ssl; } 45 bool getSSL() { return ssl; }
45 46
46 void setConnectionType( int x ) { connectionType = x; } 47 void setConnectionType( int x ) { connectionType = x; }
47 int ConnectionType() { return connectionType; } 48 int ConnectionType() { return connectionType; }
48 49
49 void setMaxMailSize( int x ) { maxMailSize = x; } 50 void setMaxMailSize( int x ) { maxMailSize = x; }
50 int getMaxMailSize() { return maxMailSize; } 51 int getMaxMailSize() { return maxMailSize; }
51 52
52 void setOffline(bool b) {offline = b;} 53 void setOffline(bool b) {offline = b;}
53 bool getOffline()const{return offline;} 54 bool getOffline()const{return offline;}
54 55
55 bool getLeaveOnServer(){ return leaveOnServer;} 56 bool getLeaveOnServer(){ return leaveOnServer;}
56 void setLeaveOnServer(bool b){ leaveOnServer = b;} 57 void setLeaveOnServer(bool b){ leaveOnServer = b;}
57 58
58 virtual QString getFileName() { return accountName; } 59 virtual QString getFileName() { return accountName; }
59 virtual void read() { ; } 60 virtual void read() { ; }
60 virtual void save() { ; } 61 virtual void save() { ; }
61 62
62protected: 63protected:
63 QString accountName, server, port, user, password; 64 QString accountName, server, port, user, password;
64 bool ssl; 65 bool ssl;
65 int connectionType; 66 int connectionType;
66 bool offline; 67 bool offline;
67 MAILLIB::ATYPE type; 68 MAILLIB::ATYPE type;
68 QString localFolder; 69 QString localFolder;
69 int maxMailSize; 70 int maxMailSize;
70 QDateTime lastFetch; 71 QDateTime lastFetch;
71 bool leaveOnServer; 72 bool leaveOnServer;
72}; 73};
73 74
74class IMAPaccount : public Account 75class IMAPaccount : public Account
75{ 76{
76 77
77public: 78public:
78 IMAPaccount(); 79 IMAPaccount();
79 IMAPaccount( QString filename ); 80 IMAPaccount( QString filename );
80 81
81 static QString getUniqueFileName(); 82 static QString getUniqueFileName();
82 83
83 virtual void read(); 84 virtual void read();
84 virtual void save(); 85 virtual void save();
85 virtual QString getFileName(); 86 virtual QString getFileName();
86 87
87 void setPrefix(const QString&str) {prefix=str;} 88 void setPrefix(const QString&str) {prefix=str;}
88 const QString&getPrefix()const{return prefix;} 89 const QString&getPrefix()const{return prefix;}
89 90
90private: 91private:
91 QString file,prefix; 92 QString file,prefix;
92 93
93}; 94};
94 95
95class POP3account : public Account 96class POP3account : public Account
96{ 97{
97 98
98public: 99public:
99 POP3account(); 100 POP3account();
100 POP3account( QString filename ); 101 POP3account( QString filename );
101 102
102 static QString getUniqueFileName(); 103 static QString getUniqueFileName();
103 104
104 virtual void read(); 105 virtual void read();
105 virtual void save(); 106 virtual void save();
106 virtual QString getFileName(); 107 virtual QString getFileName();
107 108
108private: 109private:
109 QString file; 110 QString file;
110 111
111}; 112};
112 113
113class SMTPaccount : public Account 114class SMTPaccount : public Account
114{ 115{
115 116
116public: 117public:
117 SMTPaccount(); 118 SMTPaccount();
118 SMTPaccount( QString filename ); 119 SMTPaccount( QString filename );
119 120
120 static QString getUniqueFileName(); 121 static QString getUniqueFileName();
121 122
122 virtual void read(); 123 virtual void read();
123 virtual void save(); 124 virtual void save();
124 virtual QString getFileName(); 125 virtual QString getFileName();
125 126
126 void setLogin( bool b ) { login = b; } 127 void setLogin( bool b ) { login = b; }
127 bool getLogin() { return login; } 128 bool getLogin() { return login; }
128 129
129private: 130private:
130 QString file, name, mail, org, cc, bcc, reply, signature; 131 QString file, name, mail, org, cc, bcc, reply, signature;
131 bool useCC, useBCC, useReply, login; 132 bool useCC, useBCC, useReply, login;
132 133
133}; 134};
134 135
135class NNTPaccount : public Account 136class NNTPaccount : public Account
136{ 137{
137 138
138public: 139public:
139 NNTPaccount(); 140 NNTPaccount();
140 NNTPaccount( QString filename ); 141 NNTPaccount( QString filename );
141 142
142 static QString getUniqueFileName(); 143 static QString getUniqueFileName();
143 144
144 virtual void read(); 145 virtual void read();
145 virtual void save(); 146 virtual void save();
146 virtual QString getFileName(); 147 virtual QString getFileName();
147 148
148 void setLogin( bool b ) { login = b; } 149 void setLogin( bool b ) { login = b; }
149 bool getLogin() { return login; } 150 bool getLogin() { return login; }
150 151
151 void setGroups( QStringList list ) { subscribedGroups = list; } 152 void setGroups( QStringList list ) { subscribedGroups = list; }
152 QStringList getGroups() { return subscribedGroups; } 153 QStringList getGroups() { return subscribedGroups; }
153 154
154private: 155private:
155 QString file; 156 QString file;
156 bool login; 157 bool login;
157 QStringList subscribedGroups; 158 QStringList subscribedGroups;
158 159
159}; 160};
160 161
161class Settings : public QObject 162class Settings : public QObject
162{ 163{
163 Q_OBJECT 164 Q_OBJECT
164 165
165public: 166public:
166 Settings(); 167 Settings();
167 QList<Account> getAccounts(); 168 QList<Account> getAccounts();
168 void addAccount(Account *account); 169 void addAccount(Account *account);
169 void delAccount(Account *account); 170 void delAccount(Account *account);
170 void saveAccounts(); 171 void saveAccounts();
171 void readAccounts(); 172 void readAccounts();
172 static void checkDirectory(); 173 static void checkDirectory();
173 174
174private: 175private:
175 void updateAccounts(); 176 void updateAccounts();
176 QList<Account> accounts; 177 QList<Account> accounts;
177 178
178}; 179};
179 180
180#endif 181#endif
diff --git a/kmicromail/libmailwrapper/smtpwrapper.cpp b/kmicromail/libmailwrapper/smtpwrapper.cpp
index dee1477..eb07ef1 100644
--- a/kmicromail/libmailwrapper/smtpwrapper.cpp
+++ b/kmicromail/libmailwrapper/smtpwrapper.cpp
@@ -1,461 +1,466 @@
1#include "smtpwrapper.h" 1#include "smtpwrapper.h"
2#include "mailwrapper.h" 2#include "mailwrapper.h"
3#include "abstractmail.h" 3#include "abstractmail.h"
4#include "logindialog.h" 4#include "logindialog.h"
5#include "mailtypes.h" 5#include "mailtypes.h"
6#include "sendmailprogress.h" 6#include "sendmailprogress.h"
7 7
8//#include <opie2/odebug.h> 8//#include <opie2/odebug.h>
9//#include <qt.h> 9//#include <qt.h>
10#include <qapplication.h> 10#include <qapplication.h>
11#include <qmessagebox.h> 11#include <qmessagebox.h>
12#include <stdlib.h> 12#include <stdlib.h>
13#include <qpe/config.h> 13#ifndef DESKTOP_VERSION
14//#include <qpe/config.h>
14#include <qpe/qcopenvelope_qws.h> 15#include <qpe/qcopenvelope_qws.h>
15 16#endif
16#include <libetpan/libetpan.h> 17#include <libetpan/libetpan.h>
17#include <klocale.h> 18#include <klocale.h>
19#include <kglobal.h>
20#include <kconfig.h>
18 21
19 22
20using namespace Opie::Core; 23using namespace Opie::Core;
21progressMailSend*SMTPwrapper::sendProgress = 0; 24progressMailSend*SMTPwrapper::sendProgress = 0;
22 25
23SMTPwrapper::SMTPwrapper(SMTPaccount * aSmtp ) 26SMTPwrapper::SMTPwrapper(SMTPaccount * aSmtp )
24 : Generatemail() 27 : Generatemail()
25{ 28{
26 m_SmtpAccount = aSmtp; 29 m_SmtpAccount = aSmtp;
27 Config cfg( "mail" ); 30 KConfig cfg( locateLocal("config", "kopiemail" ) );
28 cfg.setGroup( "Status" ); 31 cfg.setGroup( "Status" );
29 m_queuedMail = cfg.readNumEntry( "outgoing", 0 ); 32 m_queuedMail = cfg.readNumEntry( "outgoing", 0 );
30 emit queuedMails( m_queuedMail ); 33 emit queuedMails( m_queuedMail );
31 connect( this, SIGNAL( queuedMails(int) ), this, SLOT( emitQCop(int) ) ); 34 connect( this, SIGNAL( queuedMails(int) ), this, SLOT( emitQCop(int) ) );
32 m_smtp = 0; 35 m_smtp = 0;
33} 36}
34 37
35SMTPwrapper::~SMTPwrapper() 38SMTPwrapper::~SMTPwrapper()
36{ 39{
37 disc_server(); 40 disc_server();
38} 41}
39 42
40void SMTPwrapper::emitQCop( int queued ) { 43void SMTPwrapper::emitQCop( int queued ) {
44#ifndef DESKTOP_VERSION
41 QCopEnvelope env( "QPE/Pim", "outgoingMails(int)" ); 45 QCopEnvelope env( "QPE/Pim", "outgoingMails(int)" );
42 env << queued; 46 env << queued;
47#endif
43} 48}
44 49
45QString SMTPwrapper::mailsmtpError( int errnum ) { 50QString SMTPwrapper::mailsmtpError( int errnum ) {
46 switch ( errnum ) { 51 switch ( errnum ) {
47 case MAILSMTP_NO_ERROR: 52 case MAILSMTP_NO_ERROR:
48 return i18n( "No error" ); 53 return i18n( "No error" );
49 case MAILSMTP_ERROR_UNEXPECTED_CODE: 54 case MAILSMTP_ERROR_UNEXPECTED_CODE:
50 return i18n( "Unexpected error code" ); 55 return i18n( "Unexpected error code" );
51 case MAILSMTP_ERROR_SERVICE_NOT_AVAILABLE: 56 case MAILSMTP_ERROR_SERVICE_NOT_AVAILABLE:
52 return i18n( "Service not available" ); 57 return i18n( "Service not available" );
53 case MAILSMTP_ERROR_STREAM: 58 case MAILSMTP_ERROR_STREAM:
54 return i18n( "Stream error" ); 59 return i18n( "Stream error" );
55 case MAILSMTP_ERROR_HOSTNAME: 60 case MAILSMTP_ERROR_HOSTNAME:
56 return i18n( "gethostname() failed" ); 61 return i18n( "gethostname() failed" );
57 case MAILSMTP_ERROR_NOT_IMPLEMENTED: 62 case MAILSMTP_ERROR_NOT_IMPLEMENTED:
58 return i18n( "Not implemented" ); 63 return i18n( "Not implemented" );
59 case MAILSMTP_ERROR_ACTION_NOT_TAKEN: 64 case MAILSMTP_ERROR_ACTION_NOT_TAKEN:
60 return i18n( "Error, action not taken" ); 65 return i18n( "Error, action not taken" );
61 case MAILSMTP_ERROR_EXCEED_STORAGE_ALLOCATION: 66 case MAILSMTP_ERROR_EXCEED_STORAGE_ALLOCATION:
62 return i18n( "Data exceeds storage allocation" ); 67 return i18n( "Data exceeds storage allocation" );
63 case MAILSMTP_ERROR_IN_PROCESSING: 68 case MAILSMTP_ERROR_IN_PROCESSING:
64 return i18n( "Error in processing" ); 69 return i18n( "Error in processing" );
65 case MAILSMTP_ERROR_STARTTLS_NOT_SUPPORTED: 70 case MAILSMTP_ERROR_STARTTLS_NOT_SUPPORTED:
66 return i18n( "Starttls not supported" ); 71 return i18n( "Starttls not supported" );
67 // case MAILSMTP_ERROR_INSUFFISANT_SYSTEM_STORAGE: 72 // case MAILSMTP_ERROR_INSUFFISANT_SYSTEM_STORAGE:
68 // return i18n( "Insufficient system storage" ); 73 // return i18n( "Insufficient system storage" );
69 case MAILSMTP_ERROR_MAILBOX_UNAVAILABLE: 74 case MAILSMTP_ERROR_MAILBOX_UNAVAILABLE:
70 return i18n( "Mailbox unavailable" ); 75 return i18n( "Mailbox unavailable" );
71 case MAILSMTP_ERROR_MAILBOX_NAME_NOT_ALLOWED: 76 case MAILSMTP_ERROR_MAILBOX_NAME_NOT_ALLOWED:
72 return i18n( "Mailbox name not allowed" ); 77 return i18n( "Mailbox name not allowed" );
73 case MAILSMTP_ERROR_BAD_SEQUENCE_OF_COMMAND: 78 case MAILSMTP_ERROR_BAD_SEQUENCE_OF_COMMAND:
74 return i18n( "Bad command sequence" ); 79 return i18n( "Bad command sequence" );
75 case MAILSMTP_ERROR_USER_NOT_LOCAL: 80 case MAILSMTP_ERROR_USER_NOT_LOCAL:
76 return i18n( "User not local" ); 81 return i18n( "User not local" );
77 case MAILSMTP_ERROR_TRANSACTION_FAILED: 82 case MAILSMTP_ERROR_TRANSACTION_FAILED:
78 return i18n( "Transaction failed" ); 83 return i18n( "Transaction failed" );
79 case MAILSMTP_ERROR_MEMORY: 84 case MAILSMTP_ERROR_MEMORY:
80 return i18n( "Memory error" ); 85 return i18n( "Memory error" );
81 case MAILSMTP_ERROR_CONNECTION_REFUSED: 86 case MAILSMTP_ERROR_CONNECTION_REFUSED:
82 return i18n( "Connection refused" ); 87 return i18n( "Connection refused" );
83 default: 88 default:
84 return i18n( "Unknown error code" ); 89 return i18n( "Unknown error code" );
85 } 90 }
86} 91}
87 92
88 93
89void SMTPwrapper::progress( size_t current, size_t maximum ) { 94void SMTPwrapper::progress( size_t current, size_t maximum ) {
90 if (SMTPwrapper::sendProgress) { 95 if (SMTPwrapper::sendProgress) {
91 SMTPwrapper::sendProgress->setSingleMail(current, maximum ); 96 SMTPwrapper::sendProgress->setSingleMail(current, maximum );
92 qApp->processEvents(); 97 qApp->processEvents();
93 } 98 }
94} 99}
95 100
96void SMTPwrapper::storeMail(const char*mail, size_t length, const QString&box) { 101void SMTPwrapper::storeMail(const char*mail, size_t length, const QString&box) {
97 if (!mail) 102 if (!mail)
98 return; 103 return;
99 QString localfolders = AbstractMail::defaultLocalfolder(); 104 QString localfolders = AbstractMail::defaultLocalfolder();
100 AbstractMail*wrap = AbstractMail::getWrapper(localfolders); 105 AbstractMail*wrap = AbstractMail::getWrapper(localfolders);
101 wrap->createMbox(box); 106 wrap->createMbox(box);
102 wrap->storeMessage(mail,length,box); 107 wrap->storeMessage(mail,length,box);
103 delete wrap; 108 delete wrap;
104} 109}
105 110
106bool SMTPwrapper::smtpSend( mailmime *mail,bool later) { 111bool SMTPwrapper::smtpSend( mailmime *mail,bool later) {
107 clist *rcpts = 0; 112 clist *rcpts = 0;
108 char *from, *data; 113 char *from, *data;
109 size_t size; 114 size_t size;
110 115
111 from = data = 0; 116 from = data = 0;
112 117
113 mailmessage * msg = 0; 118 mailmessage * msg = 0;
114 msg = mime_message_init(mail); 119 msg = mime_message_init(mail);
115 mime_message_set_tmpdir(msg,getenv( "HOME" )); 120 mime_message_set_tmpdir(msg,getenv( "HOME" ));
116 int r = mailmessage_fetch(msg,&data,&size); 121 int r = mailmessage_fetch(msg,&data,&size);
117 mime_message_detach_mime(msg); 122 mime_message_detach_mime(msg);
118 mailmessage_free(msg); 123 mailmessage_free(msg);
119 if (r != MAIL_NO_ERROR || !data) { 124 if (r != MAIL_NO_ERROR || !data) {
120 if (data) 125 if (data)
121 free(data); 126 free(data);
122 qDebug("Error fetching mime... "); 127 qDebug("Error fetching mime... ");
123 return false; 128 return false;
124 } 129 }
125 msg = 0; 130 msg = 0;
126 if (later) { 131 if (later) {
127 storeMail(data,size,"Outgoing"); 132 storeMail(data,size,"Outgoing");
128 if (data) 133 if (data)
129 free( data ); 134 free( data );
130 Config cfg( "mail" ); 135 KConfig cfg( locateLocal("config", "kopiemail" ) );
131 cfg.setGroup( "Status" ); 136 cfg.setGroup( "Status" );
132 cfg.writeEntry( "outgoing", ++m_queuedMail ); 137 cfg.writeEntry( "outgoing", ++m_queuedMail );
133 emit queuedMails( m_queuedMail ); 138 emit queuedMails( m_queuedMail );
134 return true; 139 return true;
135 } 140 }
136 from = getFrom( mail ); 141 from = getFrom( mail );
137 rcpts = createRcptList( mail->mm_data.mm_message.mm_fields ); 142 rcpts = createRcptList( mail->mm_data.mm_message.mm_fields );
138 bool result = smtpSend(from,rcpts,data,size); 143 bool result = smtpSend(from,rcpts,data,size);
139 if (data) { 144 if (data) {
140 free(data); 145 free(data);
141 } 146 }
142 if (from) { 147 if (from) {
143 free(from); 148 free(from);
144 } 149 }
145 if (rcpts) 150 if (rcpts)
146 smtp_address_list_free( rcpts ); 151 smtp_address_list_free( rcpts );
147 return result; 152 return result;
148} 153}
149 154
150void SMTPwrapper::storeFailedMail(const char*data,unsigned int size, const char*failuremessage) 155void SMTPwrapper::storeFailedMail(const char*data,unsigned int size, const char*failuremessage)
151{ 156{
152 if (data) { 157 if (data) {
153 storeMail(data,size,"Sendfailed"); 158 storeMail(data,size,"Sendfailed");
154 } 159 }
155 if (failuremessage) { 160 if (failuremessage) {
156 QMessageBox::critical(0,i18n("Error sending mail"), 161 QMessageBox::critical(0,i18n("Error sending mail"),
157 i18n("<center>%1</center>").arg(failuremessage)); 162 i18n("<center>%1</center>").arg(failuremessage));
158 } 163 }
159} 164}
160 165
161int SMTPwrapper::start_smtp_tls() 166int SMTPwrapper::start_smtp_tls()
162{ 167{
163 if (!m_smtp) { 168 if (!m_smtp) {
164 return MAILSMTP_ERROR_IN_PROCESSING; 169 return MAILSMTP_ERROR_IN_PROCESSING;
165 } 170 }
166 int err = mailesmtp_starttls(m_smtp); 171 int err = mailesmtp_starttls(m_smtp);
167 if (err != MAILSMTP_NO_ERROR) return err; 172 if (err != MAILSMTP_NO_ERROR) return err;
168 mailstream_low * low; 173 mailstream_low * low;
169 mailstream_low * new_low; 174 mailstream_low * new_low;
170 low = mailstream_get_low(m_smtp->stream); 175 low = mailstream_get_low(m_smtp->stream);
171 if (!low) { 176 if (!low) {
172 return MAILSMTP_ERROR_IN_PROCESSING; 177 return MAILSMTP_ERROR_IN_PROCESSING;
173 } 178 }
174 int fd = mailstream_low_get_fd(low); 179 int fd = mailstream_low_get_fd(low);
175 if (fd > -1 && (new_low = mailstream_low_ssl_open(fd))!=0) { 180 if (fd > -1 && (new_low = mailstream_low_ssl_open(fd))!=0) {
176 mailstream_low_free(low); 181 mailstream_low_free(low);
177 mailstream_set_low(m_smtp->stream, new_low); 182 mailstream_set_low(m_smtp->stream, new_low);
178 } else { 183 } else {
179 return MAILSMTP_ERROR_IN_PROCESSING; 184 return MAILSMTP_ERROR_IN_PROCESSING;
180 } 185 }
181 return err; 186 return err;
182} 187}
183 188
184void SMTPwrapper::connect_server() 189void SMTPwrapper::connect_server()
185{ 190{
186 QString server, user, pass; 191 QString server, user, pass;
187 bool ssl; 192 bool ssl;
188 uint16_t port; 193 uint16_t port;
189 ssl = false; 194 ssl = false;
190 bool try_tls = true; 195 bool try_tls = true;
191 bool force_tls=false; 196 bool force_tls=false;
192 QString failuretext = ""; 197 QString failuretext = "";
193 198
194 if (m_smtp || !m_SmtpAccount) { 199 if (m_smtp || !m_SmtpAccount) {
195 return; 200 return;
196 } 201 }
197 server = m_SmtpAccount->getServer(); 202 server = m_SmtpAccount->getServer();
198 if ( m_SmtpAccount->ConnectionType() == 2 ) { 203 if ( m_SmtpAccount->ConnectionType() == 2 ) {
199 ssl = true; 204 ssl = true;
200 try_tls = false; 205 try_tls = false;
201 } else if (m_SmtpAccount->ConnectionType() == 1) { 206 } else if (m_SmtpAccount->ConnectionType() == 1) {
202 force_tls = true; 207 force_tls = true;
203 } 208 }
204 int result = 1; 209 int result = 1;
205 port = m_SmtpAccount->getPort().toUInt(); 210 port = m_SmtpAccount->getPort().toUInt();
206 211
207 m_smtp = mailsmtp_new( 20, &progress ); 212 m_smtp = mailsmtp_new( 20, &progress );
208 if ( m_smtp == NULL ) { 213 if ( m_smtp == NULL ) {
209 /* no failure message cause this happens when problems with memory - than we 214 /* no failure message cause this happens when problems with memory - than we
210 we can not display any messagebox */ 215 we can not display any messagebox */
211 return; 216 return;
212 } 217 }
213 218
214 int err = MAILSMTP_NO_ERROR; 219 int err = MAILSMTP_NO_ERROR;
215 ; // odebug << "Servername " << server << " at port " << port << "" << oendl; 220 ; // odebug << "Servername " << server << " at port " << port << "" << oendl;
216 if ( ssl ) { 221 if ( ssl ) {
217 ; // odebug << "SSL session" << oendl; 222 ; // odebug << "SSL session" << oendl;
218 err = mailsmtp_ssl_connect( m_smtp, server.latin1(), port ); 223 err = mailsmtp_ssl_connect( m_smtp, server.latin1(), port );
219 } else { 224 } else {
220 ; // odebug << "No SSL session" << oendl; 225 ; // odebug << "No SSL session" << oendl;
221 err = mailsmtp_socket_connect( m_smtp, server.latin1(), port ); 226 err = mailsmtp_socket_connect( m_smtp, server.latin1(), port );
222 } 227 }
223 if ( err != MAILSMTP_NO_ERROR ) { 228 if ( err != MAILSMTP_NO_ERROR ) {
224 ; // odebug << "Error init connection" << oendl; 229 ; // odebug << "Error init connection" << oendl;
225 failuretext = i18n("Error init SMTP connection: %1").arg(mailsmtpError(err)); 230 failuretext = i18n("Error init SMTP connection: %1").arg(mailsmtpError(err));
226 result = 0; 231 result = 0;
227 } 232 }
228 233
229 /* switch to tls after init 'cause there it will send the ehlo */ 234 /* switch to tls after init 'cause there it will send the ehlo */
230 if (result) { 235 if (result) {
231 err = mailsmtp_init( m_smtp ); 236 err = mailsmtp_init( m_smtp );
232 if (err != MAILSMTP_NO_ERROR) { 237 if (err != MAILSMTP_NO_ERROR) {
233 result = 0; 238 result = 0;
234 failuretext = i18n("Error init SMTP connection: %1").arg(mailsmtpError(err)); 239 failuretext = i18n("Error init SMTP connection: %1").arg(mailsmtpError(err));
235 } 240 }
236 } 241 }
237 242
238 if (try_tls) { 243 if (try_tls) {
239 err = start_smtp_tls(); 244 err = start_smtp_tls();
240 if (err != MAILSMTP_NO_ERROR) { 245 if (err != MAILSMTP_NO_ERROR) {
241 try_tls = false; 246 try_tls = false;
242 } else { 247 } else {
243 err = mailesmtp_ehlo(m_smtp); 248 err = mailesmtp_ehlo(m_smtp);
244 } 249 }
245 } 250 }
246 251
247 if (!try_tls && force_tls) { 252 if (!try_tls && force_tls) {
248 result = 0; 253 result = 0;
249 failuretext = i18n("Error init SMTP tls: %1").arg(mailsmtpError(err)); 254 failuretext = i18n("Error init SMTP tls: %1").arg(mailsmtpError(err));
250 } 255 }
251 256
252 if (result==1 && m_SmtpAccount->getLogin() ) { 257 if (result==1 && m_SmtpAccount->getLogin() ) {
253 ; // odebug << "smtp with auth" << oendl; 258 ; // odebug << "smtp with auth" << oendl;
254 if ( m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty() ) { 259 if ( m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty() ) {
255 // get'em 260 // get'em
256 LoginDialog login( m_SmtpAccount->getUser(), 261 LoginDialog login( m_SmtpAccount->getUser(),
257 m_SmtpAccount->getPassword(), NULL, 0, true ); 262 m_SmtpAccount->getPassword(), NULL, 0, true );
258 login.show(); 263 login.show();
259 if ( QDialog::Accepted == login.exec() ) { 264 if ( QDialog::Accepted == login.exec() ) {
260 // ok 265 // ok
261 user = login.getUser(); 266 user = login.getUser();
262 pass = login.getPassword(); 267 pass = login.getPassword();
263 } else { 268 } else {
264 result = 0; 269 result = 0;
265 failuretext=i18n("Login aborted - storing mail to localfolder"); 270 failuretext=i18n("Login aborted - storing mail to localfolder");
266 } 271 }
267 } else { 272 } else {
268 user = m_SmtpAccount->getUser(); 273 user = m_SmtpAccount->getUser();
269 pass = m_SmtpAccount->getPassword(); 274 pass = m_SmtpAccount->getPassword();
270 } 275 }
271 ; // odebug << "session->auth: " << m_smtp->auth << "" << oendl; 276 ; // odebug << "session->auth: " << m_smtp->auth << "" << oendl;
272 if (result) { 277 if (result) {
273 err = mailsmtp_auth( m_smtp, (char*)user.latin1(), (char*)pass.latin1() ); 278 err = mailsmtp_auth( m_smtp, (char*)user.latin1(), (char*)pass.latin1() );
274 if ( err == MAILSMTP_NO_ERROR ) { 279 if ( err == MAILSMTP_NO_ERROR ) {
275 ; // odebug << "auth ok" << oendl; 280 ; // odebug << "auth ok" << oendl;
276 } else { 281 } else {
277 failuretext = i18n("Authentification failed"); 282 failuretext = i18n("Authentification failed");
278 result = 0; 283 result = 0;
279 } 284 }
280 } 285 }
281 } 286 }
282} 287}
283 288
284void SMTPwrapper::disc_server() 289void SMTPwrapper::disc_server()
285{ 290{
286 if (m_smtp) { 291 if (m_smtp) {
287 mailsmtp_quit( m_smtp ); 292 mailsmtp_quit( m_smtp );
288 mailsmtp_free( m_smtp ); 293 mailsmtp_free( m_smtp );
289 m_smtp = 0; 294 m_smtp = 0;
290 } 295 }
291} 296}
292 297
293int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size ) 298int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size )
294{ 299{
295 int err,result; 300 int err,result;
296 QString failuretext = ""; 301 QString failuretext = "";
297 302
298 connect_server(); 303 connect_server();
299 304
300 result = 1; 305 result = 1;
301 if (m_smtp) { 306 if (m_smtp) {
302 err = mailsmtp_send( m_smtp, from, rcpts, data, size ); 307 err = mailsmtp_send( m_smtp, from, rcpts, data, size );
303 if ( err != MAILSMTP_NO_ERROR ) { 308 if ( err != MAILSMTP_NO_ERROR ) {
304 failuretext=i18n("Error sending mail: %1").arg(mailsmtpError(err)); 309 failuretext=i18n("Error sending mail: %1").arg(mailsmtpError(err));
305 result = 0; 310 result = 0;
306 } 311 }
307 } else { 312 } else {
308 result = 0; 313 result = 0;
309 } 314 }
310 315
311 if (!result) { 316 if (!result) {
312 storeFailedMail(data,size,failuretext); 317 storeFailedMail(data,size,failuretext);
313 } else { 318 } else {
314 ; // odebug << "Mail sent." << oendl; 319 ; // odebug << "Mail sent." << oendl;
315 storeMail(data,size,"Sent"); 320 storeMail(data,size,"Sent");
316 } 321 }
317 return result; 322 return result;
318} 323}
319 324
320bool SMTPwrapper::sendMail(const Opie::Core::OSmartPointer<Mail>&mail,bool later ) 325bool SMTPwrapper::sendMail(const Opie::Core::OSmartPointer<Mail>&mail,bool later )
321{ 326{
322 mailmime * mimeMail; 327 mailmime * mimeMail;
323 bool result = true; 328 bool result = true;
324 mimeMail = createMimeMail(mail ); 329 mimeMail = createMimeMail(mail );
325 if ( mimeMail == 0 ) { 330 if ( mimeMail == 0 ) {
326 qDebug("SMTP wrapper:Error creating mail! "); 331 qDebug("SMTP wrapper:Error creating mail! ");
327 return false; 332 return false;
328 } else { 333 } else {
329 sendProgress = new progressMailSend(); 334 sendProgress = new progressMailSend();
330 sendProgress->show(); 335 sendProgress->show();
331 sendProgress->setMaxMails(1); 336 sendProgress->setMaxMails(1);
332 result = smtpSend( mimeMail,later); 337 result = smtpSend( mimeMail,later);
333 ; // odebug << "Clean up done" << oendl; 338 ; // odebug << "Clean up done" << oendl;
334 sendProgress->hide(); 339 sendProgress->hide();
335 delete sendProgress; 340 delete sendProgress;
336 sendProgress = 0; 341 sendProgress = 0;
337 mailmime_free( mimeMail ); 342 mailmime_free( mimeMail );
338 } 343 }
339 return result; 344 return result;
340} 345}
341 346
342int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,const RecMailP&which) { 347int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,const RecMailP&which) {
343 size_t curTok = 0; 348 size_t curTok = 0;
344 mailimf_fields *fields = 0; 349 mailimf_fields *fields = 0;
345 mailimf_field*ffrom = 0; 350 mailimf_field*ffrom = 0;
346 clist *rcpts = 0; 351 clist *rcpts = 0;
347 char*from = 0; 352 char*from = 0;
348 int res = 0; 353 int res = 0;
349 354
350 encodedString * data = wrap->fetchRawBody(which); 355 encodedString * data = wrap->fetchRawBody(which);
351 if (!data) 356 if (!data)
352 return 0; 357 return 0;
353 int err = mailimf_fields_parse( data->Content(), data->Length(), &curTok, &fields ); 358 int err = mailimf_fields_parse( data->Content(), data->Length(), &curTok, &fields );
354 if (err != MAILIMF_NO_ERROR) { 359 if (err != MAILIMF_NO_ERROR) {
355 delete data; 360 delete data;
356 delete wrap; 361 delete wrap;
357 return 0; 362 return 0;
358 } 363 }
359 364
360 rcpts = createRcptList( fields ); 365 rcpts = createRcptList( fields );
361 ffrom = getField(fields, MAILIMF_FIELD_FROM ); 366 ffrom = getField(fields, MAILIMF_FIELD_FROM );
362 from = getFrom(ffrom); 367 from = getFrom(ffrom);
363 368
364 if (rcpts && from) { 369 if (rcpts && from) {
365 res = smtpSend(from,rcpts,data->Content(),data->Length()); 370 res = smtpSend(from,rcpts,data->Content(),data->Length());
366 } 371 }
367 if (fields) { 372 if (fields) {
368 mailimf_fields_free(fields); 373 mailimf_fields_free(fields);
369 fields = 0; 374 fields = 0;
370 } 375 }
371 if (data) { 376 if (data) {
372 delete data; 377 delete data;
373 } 378 }
374 if (from) { 379 if (from) {
375 free(from); 380 free(from);
376 } 381 }
377 if (rcpts) { 382 if (rcpts) {
378 smtp_address_list_free( rcpts ); 383 smtp_address_list_free( rcpts );
379 } 384 }
380 return res; 385 return res;
381} 386}
382 387
383/* this is a special fun */ 388/* this is a special fun */
384bool SMTPwrapper::flushOutbox() { 389bool SMTPwrapper::flushOutbox() {
385 bool returnValue = true; 390 bool returnValue = true;
386 391
387 ; // odebug << "Sending the queue" << oendl; 392 ; // odebug << "Sending the queue" << oendl;
388 if (!m_SmtpAccount) { 393 if (!m_SmtpAccount) {
389 ; // odebug << "No smtp account given" << oendl; 394 ; // odebug << "No smtp account given" << oendl;
390 return false; 395 return false;
391 } 396 }
392 397
393 bool reset_user_value = false; 398 bool reset_user_value = false;
394 QString localfolders = AbstractMail::defaultLocalfolder(); 399 QString localfolders = AbstractMail::defaultLocalfolder();
395 AbstractMail*wrap = AbstractMail::getWrapper(localfolders); 400 AbstractMail*wrap = AbstractMail::getWrapper(localfolders);
396 if (!wrap) { 401 if (!wrap) {
397 ; // odebug << "memory error" << oendl; 402 ; // odebug << "memory error" << oendl;
398 return false; 403 return false;
399 } 404 }
400 QString oldPw, oldUser; 405 QString oldPw, oldUser;
401 QValueList<RecMailP> mailsToSend; 406 QValueList<RecMailP> mailsToSend;
402 QValueList<RecMailP> mailsToRemove; 407 QValueList<RecMailP> mailsToRemove;
403 QString mbox("Outgoing"); 408 QString mbox("Outgoing");
404 wrap->listMessages(mbox,mailsToSend); 409 wrap->listMessages(mbox,mailsToSend);
405 if (mailsToSend.count()==0) { 410 if (mailsToSend.count()==0) {
406 delete wrap; 411 delete wrap;
407 ; // odebug << "No mails to send" << oendl; 412 ; // odebug << "No mails to send" << oendl;
408 return false; 413 return false;
409 } 414 }
410 415
411 oldPw = m_SmtpAccount->getPassword(); 416 oldPw = m_SmtpAccount->getPassword();
412 oldUser = m_SmtpAccount->getUser(); 417 oldUser = m_SmtpAccount->getUser();
413 if (m_SmtpAccount->getLogin() && (m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty()) ) { 418 if (m_SmtpAccount->getLogin() && (m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty()) ) {
414 // get'em 419 // get'em
415 QString user,pass; 420 QString user,pass;
416 LoginDialog login( m_SmtpAccount->getUser(), m_SmtpAccount->getPassword(), NULL, 0, true ); 421 LoginDialog login( m_SmtpAccount->getUser(), m_SmtpAccount->getPassword(), NULL, 0, true );
417 login.show(); 422 login.show();
418 if ( QDialog::Accepted == login.exec() ) { 423 if ( QDialog::Accepted == login.exec() ) {
419 // ok 424 // ok
420 user = login.getUser().latin1(); 425 user = login.getUser().latin1();
421 pass = login.getPassword().latin1(); 426 pass = login.getPassword().latin1();
422 reset_user_value = true; 427 reset_user_value = true;
423 m_SmtpAccount->setUser(user); 428 m_SmtpAccount->setUser(user);
424 m_SmtpAccount->setPassword(pass); 429 m_SmtpAccount->setPassword(pass);
425 } else { 430 } else {
426 return true; 431 return true;
427 } 432 }
428 } 433 }
429 434
430 435
431 sendProgress = new progressMailSend(); 436 sendProgress = new progressMailSend();
432 sendProgress->show(); 437 sendProgress->show();
433 sendProgress->setMaxMails(mailsToSend.count()); 438 sendProgress->setMaxMails(mailsToSend.count());
434 439
435 while (mailsToSend.count()>0) { 440 while (mailsToSend.count()>0) {
436 if (sendQueuedMail(wrap, (*mailsToSend.begin()))==0) { 441 if (sendQueuedMail(wrap, (*mailsToSend.begin()))==0) {
437 QMessageBox::critical(0,i18n("Error sending mail"), 442 QMessageBox::critical(0,i18n("Error sending mail"),
438 i18n("Error sending queued mail - breaking")); 443 i18n("Error sending queued mail - breaking"));
439 returnValue = false; 444 returnValue = false;
440 break; 445 break;
441 } 446 }
442 mailsToRemove.append((*mailsToSend.begin())); 447 mailsToRemove.append((*mailsToSend.begin()));
443 mailsToSend.remove(mailsToSend.begin()); 448 mailsToSend.remove(mailsToSend.begin());
444 sendProgress->setCurrentMails(mailsToRemove.count()); 449 sendProgress->setCurrentMails(mailsToRemove.count());
445 } 450 }
446 if (reset_user_value) { 451 if (reset_user_value) {
447 m_SmtpAccount->setUser(oldUser); 452 m_SmtpAccount->setUser(oldUser);
448 m_SmtpAccount->setPassword(oldPw); 453 m_SmtpAccount->setPassword(oldPw);
449 } 454 }
450 Config cfg( "mail" ); 455 KConfig cfg( locateLocal("config", "kopiemail" ) );
451 cfg.setGroup( "Status" ); 456 cfg.setGroup( "Status" );
452 m_queuedMail = 0; 457 m_queuedMail = 0;
453 cfg.writeEntry( "outgoing", m_queuedMail ); 458 cfg.writeEntry( "outgoing", m_queuedMail );
454 emit queuedMails( m_queuedMail ); 459 emit queuedMails( m_queuedMail );
455 sendProgress->hide(); 460 sendProgress->hide();
456 delete sendProgress; 461 delete sendProgress;
457 sendProgress = 0; 462 sendProgress = 0;
458 wrap->deleteMails(mbox,mailsToRemove); 463 wrap->deleteMails(mbox,mailsToRemove);
459 delete wrap; 464 delete wrap;
460 return returnValue; 465 return returnValue;
461} 466}
diff --git a/kmicromail/libmailwrapper/smtpwrapper.h b/kmicromail/libmailwrapper/smtpwrapper.h
index ec42b56..bdca000 100644
--- a/kmicromail/libmailwrapper/smtpwrapper.h
+++ b/kmicromail/libmailwrapper/smtpwrapper.h
@@ -1,64 +1,64 @@
1// -*- Mode: C++; -*- 1// -*- Mode: C++; -*-
2#ifndef SMTPwrapper_H 2#ifndef SMTPwrapper_H
3#define SMTPwrapper_H 3#define SMTPwrapper_H
4 4
5#include <qpe/applnk.h> 5//#include <qpe/applnk.h>
6 6
7#include <qbitarray.h> 7#include <qbitarray.h>
8#include <qdatetime.h> 8#include <qdatetime.h>
9#include <libetpan/clist.h> 9#include <libetpan/clist.h>
10 10
11#include "settings.h" 11#include "settings.h"
12#include "generatemail.h" 12#include "generatemail.h"
13 13
14#include <opie2/osmartpointer.h> 14#include <opie2/osmartpointer.h>
15 15
16class SMTPaccount; 16class SMTPaccount;
17class AbstractMail; 17class AbstractMail;
18 18
19class SMTPwrapper : public Generatemail 19class SMTPwrapper : public Generatemail
20{ 20{
21 Q_OBJECT 21 Q_OBJECT
22 22
23public: 23public:
24 SMTPwrapper(SMTPaccount * aSmtp); 24 SMTPwrapper(SMTPaccount * aSmtp);
25 virtual ~SMTPwrapper(); 25 virtual ~SMTPwrapper();
26 bool sendMail(const Opie::Core::OSmartPointer<Mail>& mail,bool later=false ); 26 bool sendMail(const Opie::Core::OSmartPointer<Mail>& mail,bool later=false );
27 bool flushOutbox(); 27 bool flushOutbox();
28 28
29 static progressMailSend*sendProgress; 29 static progressMailSend*sendProgress;
30 virtual Account* getAccount() { return m_SmtpAccount; }; 30 virtual Account* getAccount() { return m_SmtpAccount; };
31 31
32signals: 32signals:
33 void queuedMails( int ); 33 void queuedMails( int );
34 34
35protected: 35protected:
36 mailsmtp *m_smtp; 36 mailsmtp *m_smtp;
37 SMTPaccount * m_SmtpAccount; 37 SMTPaccount * m_SmtpAccount;
38 38
39 void connect_server(); 39 void connect_server();
40 void disc_server(); 40 void disc_server();
41 int start_smtp_tls(); 41 int start_smtp_tls();
42 42
43 43
44 bool smtpSend( mailmime *mail,bool later); 44 bool smtpSend( mailmime *mail,bool later);
45 45
46 static void storeMail(const char*mail, size_t length, const QString&box); 46 static void storeMail(const char*mail, size_t length, const QString&box);
47 static QString mailsmtpError( int err ); 47 static QString mailsmtpError( int err );
48 static void progress( size_t current, size_t maximum ); 48 static void progress( size_t current, size_t maximum );
49 49
50 int smtpSend(char*from,clist*rcpts,const char*data,size_t size); 50 int smtpSend(char*from,clist*rcpts,const char*data,size_t size);
51 51
52 void storeMail(mailmime*mail, const QString&box); 52 void storeMail(mailmime*mail, const QString&box);
53 53
54 int sendQueuedMail(AbstractMail*wrap,const Opie::Core::OSmartPointer<RecMail>&which); 54 int sendQueuedMail(AbstractMail*wrap,const Opie::Core::OSmartPointer<RecMail>&which);
55 void storeFailedMail(const char*data,unsigned int size, const char*failuremessage); 55 void storeFailedMail(const char*data,unsigned int size, const char*failuremessage);
56 56
57 int m_queuedMail; 57 int m_queuedMail;
58 58
59protected slots: 59protected slots:
60 void emitQCop( int queued ); 60 void emitQCop( int queued );
61 61
62}; 62};
63 63
64#endif 64#endif
diff --git a/kmicromail/libmailwrapper/storemail.h b/kmicromail/libmailwrapper/storemail.h
index 4433de0..e449f57 100644
--- a/kmicromail/libmailwrapper/storemail.h
+++ b/kmicromail/libmailwrapper/storemail.h
@@ -1,29 +1,29 @@
1#ifndef __STORE_MAIL_H 1#ifndef __STORE_MAIL_H
2#define __STORE_MAIL_H 2#define __STORE_MAIL_H
3 3
4#include <qpe/applnk.h> 4//#include <qpe/applnk.h>
5 5
6#include "generatemail.h" 6#include "generatemail.h"
7 7
8class Account; 8class Account;
9class Mail; 9class Mail;
10class AbstractMail; 10class AbstractMail;
11 11
12class Storemail : public Generatemail 12class Storemail : public Generatemail
13{ 13{
14 Q_OBJECT 14 Q_OBJECT
15public: 15public:
16 Storemail(Account*aAccount,const QString&aFolder); 16 Storemail(Account*aAccount,const QString&aFolder);
17 Storemail(const QString&dir,const QString&aFolder); 17 Storemail(const QString&dir,const QString&aFolder);
18 Storemail(const QString&aFolder); 18 Storemail(const QString&aFolder);
19 virtual ~Storemail(); 19 virtual ~Storemail();
20 20
21 int storeMail(const Opie::Core::OSmartPointer<Mail>&mail); 21 int storeMail(const Opie::Core::OSmartPointer<Mail>&mail);
22 22
23protected: 23protected:
24 Account* m_Account; 24 Account* m_Account;
25 QString m_tfolder; 25 QString m_tfolder;
26 AbstractMail*wrapper; 26 AbstractMail*wrapper;
27}; 27};
28 28
29#endif 29#endif