summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/libmailwrapper/generatemail.cpp30
-rw-r--r--noncore/net/mail/libmailwrapper/generatemail.h6
-rw-r--r--noncore/net/mail/libmailwrapper/mailwrapper.cpp4
-rw-r--r--noncore/net/mail/libmailwrapper/mailwrapper.h4
-rw-r--r--noncore/net/mail/libmailwrapper/smtpwrapper.cpp2
-rw-r--r--noncore/net/mail/libmailwrapper/smtpwrapper.h4
-rw-r--r--noncore/net/mail/libmailwrapper/storemail.cpp2
-rw-r--r--noncore/net/mail/libmailwrapper/storemail.h2
8 files changed, 31 insertions, 23 deletions
diff --git a/noncore/net/mail/libmailwrapper/generatemail.cpp b/noncore/net/mail/libmailwrapper/generatemail.cpp
index 48fa02e..4f7ec0c 100644
--- a/noncore/net/mail/libmailwrapper/generatemail.cpp
+++ b/noncore/net/mail/libmailwrapper/generatemail.cpp
@@ -4,9 +4,9 @@
4#include <libetpan/libetpan.h> 4#include <libetpan/libetpan.h>
5 5
6#include <qt.h> 6#include <qt.h>
7 7
8const char* Generatemail::USER_AGENT="OpieMail v0.5"; 8const char* Generatemail::USER_AGENT="OpieMail v0.6";
9 9
10Generatemail::Generatemail() 10Generatemail::Generatemail()
11{ 11{
12} 12}
@@ -278,27 +278,27 @@ mailimf_mailbox *Generatemail::newMailbox(const QString&name, const QString&mail
278 return mailimf_mailbox_new( strdup( name.latin1() ), 278 return mailimf_mailbox_new( strdup( name.latin1() ),
279 strdup( mail.latin1() ) ); 279 strdup( mail.latin1() ) );
280} 280}
281 281
282mailimf_fields *Generatemail::createImfFields(const Mail&mail ) 282mailimf_fields *Generatemail::createImfFields(const Opie::osmart_pointer<Mail>&mail )
283{ 283{
284 mailimf_fields *fields = NULL; 284 mailimf_fields *fields = NULL;
285 mailimf_field *xmailer = NULL; 285 mailimf_field *xmailer = NULL;
286 mailimf_mailbox *sender=0,*fromBox=0; 286 mailimf_mailbox *sender=0,*fromBox=0;
287 mailimf_mailbox_list *from=0; 287 mailimf_mailbox_list *from=0;
288 mailimf_address_list *to=0, *cc=0, *bcc=0, *reply=0; 288 mailimf_address_list *to=0, *cc=0, *bcc=0, *reply=0;
289 clist*in_reply_to = 0; 289 clist*in_reply_to = 0;
290 char *subject = strdup( mail.getSubject().latin1() ); 290 char *subject = strdup( mail->getSubject().latin1() );
291 int err; 291 int err;
292 int res = 1; 292 int res = 1;
293 293
294 sender = newMailbox( mail.getName(), mail.getMail() ); 294 sender = newMailbox( mail->getName(), mail->getMail() );
295 if ( sender == NULL ) { 295 if ( sender == NULL ) {
296 res = 0; 296 res = 0;
297 } 297 }
298 298
299 if (res) { 299 if (res) {
300 fromBox = newMailbox( mail.getName(), mail.getMail() ); 300 fromBox = newMailbox( mail->getName(), mail->getMail() );
301 } 301 }
302 if ( fromBox == NULL ) { 302 if ( fromBox == NULL ) {
303 res = 0; 303 res = 0;
304 } 304 }
@@ -316,19 +316,19 @@ mailimf_fields *Generatemail::createImfFields(const Mail&mail )
316 res = 0; 316 res = 0;
317 } 317 }
318 } 318 }
319 319
320 if (res) to = parseAddresses( mail.getTo() ); 320 if (res) to = parseAddresses( mail->getTo() );
321 if (res) cc = parseAddresses( mail.getCC() ); 321 if (res) cc = parseAddresses( mail->getCC() );
322 if (res) bcc = parseAddresses( mail.getBCC() ); 322 if (res) bcc = parseAddresses( mail->getBCC() );
323 if (res) reply = parseAddresses( mail.getReply() ); 323 if (res) reply = parseAddresses( mail->getReply() );
324 324
325 if (res && mail.Inreply().count()>0) { 325 if (res && mail->Inreply().count()>0) {
326 in_reply_to = clist_new(); 326 in_reply_to = clist_new();
327 char*c_reply; 327 char*c_reply;
328 unsigned int nsize = 0; 328 unsigned int nsize = 0;
329 for (QStringList::ConstIterator it=mail.Inreply().begin(); 329 for (QStringList::ConstIterator it=mail->Inreply().begin();
330 it != mail.Inreply().end();++it) { 330 it != mail->Inreply().end();++it) {
331 if ((*it).isEmpty()) 331 if ((*it).isEmpty())
332 continue; 332 continue;
333 QString h((*it)); 333 QString h((*it));
334 while (h.length()>0 && h[0]=='<') { 334 while (h.length()>0 && h[0]=='<') {
@@ -398,9 +398,9 @@ mailimf_fields *Generatemail::createImfFields(const Mail&mail )
398 } 398 }
399 return fields; 399 return fields;
400} 400}
401 401
402mailmime *Generatemail::createMimeMail(const Mail &mail ) { 402mailmime *Generatemail::createMimeMail(const Opie::osmart_pointer<Mail> &mail ) {
403 mailmime *message, *txtPart; 403 mailmime *message, *txtPart;
404 mailimf_fields *fields; 404 mailimf_fields *fields;
405 int err; 405 int err;
406 406
@@ -413,18 +413,18 @@ mailmime *Generatemail::createMimeMail(const Mail &mail ) {
413 goto err_free_fields; 413 goto err_free_fields;
414 414
415 mailmime_set_imf_fields( message, fields ); 415 mailmime_set_imf_fields( message, fields );
416 416
417 txtPart = buildTxtPart( mail.getMessage() ); 417 txtPart = buildTxtPart( mail->getMessage() );
418 418
419 if ( txtPart == NULL ) 419 if ( txtPart == NULL )
420 goto err_free_message; 420 goto err_free_message;
421 421
422 err = mailmime_smart_add_part( message, txtPart ); 422 err = mailmime_smart_add_part( message, txtPart );
423 if ( err != MAILIMF_NO_ERROR ) 423 if ( err != MAILIMF_NO_ERROR )
424 goto err_free_txtPart; 424 goto err_free_txtPart;
425 425
426 addFileParts( message, mail.getAttachments() ); 426 addFileParts( message, mail->getAttachments() );
427 427
428 return message; // Success :) 428 return message; // Success :)
429 429
430err_free_txtPart: 430err_free_txtPart:
diff --git a/noncore/net/mail/libmailwrapper/generatemail.h b/noncore/net/mail/libmailwrapper/generatemail.h
index 8be5a2b..409a55e 100644
--- a/noncore/net/mail/libmailwrapper/generatemail.h
+++ b/noncore/net/mail/libmailwrapper/generatemail.h
@@ -5,8 +5,10 @@
5 5
6#include <qobject.h> 6#include <qobject.h>
7#include <libetpan/clist.h> 7#include <libetpan/clist.h>
8 8
9#include <opie2/osmart_pointer.h>
10
9class Mail; 11class Mail;
10class RecMail; 12class RecMail;
11class Attachment; 13class Attachment;
12struct mailimf_fields; 14struct mailimf_fields;
@@ -33,10 +35,10 @@ protected:
33 void addFileParts( mailmime *message,const QList<Attachment>&files ); 35 void addFileParts( mailmime *message,const QList<Attachment>&files );
34 mailmime *buildFilePart(const QString&filename,const QString&mimetype,const QString&content); 36 mailmime *buildFilePart(const QString&filename,const QString&mimetype,const QString&content);
35 mailmime *buildTxtPart(const QString&str ); 37 mailmime *buildTxtPart(const QString&str );
36 mailimf_mailbox *newMailbox(const QString&name,const QString&mail ); 38 mailimf_mailbox *newMailbox(const QString&name,const QString&mail );
37 mailimf_fields *createImfFields(const Mail &mail ); 39 mailimf_fields *createImfFields(const Opie::osmart_pointer<Mail> &mail );
38 mailmime *createMimeMail(const Mail&mail ); 40 mailmime *createMimeMail(const Opie::osmart_pointer<Mail>&mail );
39 clist *createRcptList( mailimf_fields *fields ); 41 clist *createRcptList( mailimf_fields *fields );
40 42
41 static const char* USER_AGENT; 43 static const char* USER_AGENT;
42}; 44};
diff --git a/noncore/net/mail/libmailwrapper/mailwrapper.cpp b/noncore/net/mail/libmailwrapper/mailwrapper.cpp
index ebdbf4b..6bd98f6 100644
--- a/noncore/net/mail/libmailwrapper/mailwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/mailwrapper.cpp
@@ -44,9 +44,11 @@ IMAPFolder::IMAPFolder(const QString&name,const QString&sep, bool select,bool no
44 : Folder( name,sep ),m_MaySelect(select),m_NoInferior(no_inf) 44 : Folder( name,sep ),m_MaySelect(select),m_NoInferior(no_inf)
45{ 45{
46 // Decode IMAP foldername 46 // Decode IMAP foldername
47 nameDisplay = IMAPFolder::decodeFolderName( name ); 47 nameDisplay = IMAPFolder::decodeFolderName( name );
48 /*
48 qDebug( "folder " + name + " - displayed as " + nameDisplay ); 49 qDebug( "folder " + name + " - displayed as " + nameDisplay );
50 */
49 prefix = aprefix; 51 prefix = aprefix;
50 52
51 if (prefix.length()>0) { 53 if (prefix.length()>0) {
52 if (nameDisplay.startsWith(prefix) && nameDisplay.length()>prefix.length()) { 54 if (nameDisplay.startsWith(prefix) && nameDisplay.length()>prefix.length()) {
@@ -144,9 +146,9 @@ QString IMAPFolder::decodeFolderName( const QString &name )
144 return QString::fromUtf8( dst.data() ); 146 return QString::fromUtf8( dst.data() );
145} 147}
146 148
147Mail::Mail() 149Mail::Mail()
148 :name(""), mail(""), to(""), cc(""), bcc(""), reply(""), subject(""), message("") 150 :Opie::oref_count(),name(""), mail(""), to(""), cc(""), bcc(""), reply(""), subject(""), message("")
149{ 151{
150} 152}
151 153
152MHFolder::MHFolder(const QString&disp_name,const QString&mbox) 154MHFolder::MHFolder(const QString&disp_name,const QString&mbox)
diff --git a/noncore/net/mail/libmailwrapper/mailwrapper.h b/noncore/net/mail/libmailwrapper/mailwrapper.h
index 3a9f97b..c66572c 100644
--- a/noncore/net/mail/libmailwrapper/mailwrapper.h
+++ b/noncore/net/mail/libmailwrapper/mailwrapper.h
@@ -7,8 +7,10 @@
7#include <qdatetime.h> 7#include <qdatetime.h>
8 8
9#include "settings.h" 9#include "settings.h"
10 10
11#include <opie2/osmart_pointer.h>
12
11class Attachment 13class Attachment
12{ 14{
13public: 15public:
14 Attachment( DocLnk lnk ); 16 Attachment( DocLnk lnk );
@@ -25,9 +27,9 @@ protected:
25 int size; 27 int size;
26 28
27}; 29};
28 30
29class Mail 31class Mail:public Opie::oref_count
30{ 32{
31public: 33public:
32 Mail(); 34 Mail();
33 /* Possible that this destructor must not be declared virtual 35 /* Possible that this destructor must not be declared virtual
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
index a4e0beb..afc5618 100644
--- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
@@ -311,9 +311,9 @@ int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size )
311 } 311 }
312 return result; 312 return result;
313} 313}
314 314
315void SMTPwrapper::sendMail(const Mail&mail,bool later ) 315void SMTPwrapper::sendMail(const Opie::osmart_pointer<Mail>&mail,bool later )
316{ 316{
317 mailmime * mimeMail; 317 mailmime * mimeMail;
318 318
319 mimeMail = createMimeMail(mail ); 319 mimeMail = createMimeMail(mail );
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.h b/noncore/net/mail/libmailwrapper/smtpwrapper.h
index 1796df7..08bde74 100644
--- a/noncore/net/mail/libmailwrapper/smtpwrapper.h
+++ b/noncore/net/mail/libmailwrapper/smtpwrapper.h
@@ -10,8 +10,10 @@
10 10
11#include "settings.h" 11#include "settings.h"
12#include "generatemail.h" 12#include "generatemail.h"
13 13
14#include <opie2/osmart_pointer.h>
15
14class SMTPaccount; 16class SMTPaccount;
15class AbstractMail; 17class AbstractMail;
16 18
17class SMTPwrapper : public Generatemail 19class SMTPwrapper : public Generatemail
@@ -20,9 +22,9 @@ class SMTPwrapper : public Generatemail
20 22
21public: 23public:
22 SMTPwrapper(SMTPaccount * aSmtp); 24 SMTPwrapper(SMTPaccount * aSmtp);
23 virtual ~SMTPwrapper(); 25 virtual ~SMTPwrapper();
24 void sendMail(const Mail& mail,bool later=false ); 26 void sendMail(const Opie::osmart_pointer<Mail>& mail,bool later=false );
25 bool flushOutbox(); 27 bool flushOutbox();
26 28
27 static progressMailSend*sendProgress; 29 static progressMailSend*sendProgress;
28 30
diff --git a/noncore/net/mail/libmailwrapper/storemail.cpp b/noncore/net/mail/libmailwrapper/storemail.cpp
index 53101f8..052e0f1 100644
--- a/noncore/net/mail/libmailwrapper/storemail.cpp
+++ b/noncore/net/mail/libmailwrapper/storemail.cpp
@@ -48,9 +48,9 @@ Storemail::Storemail(const QString&aFolder)
48Storemail::~Storemail() 48Storemail::~Storemail()
49{ 49{
50} 50}
51 51
52int Storemail::storeMail(const Mail&mail) 52int Storemail::storeMail(const Opie::osmart_pointer<Mail>&mail)
53{ 53{
54 if (!wrapper) return 0; 54 if (!wrapper) return 0;
55 int ret = 1; 55 int ret = 1;
56 56
diff --git a/noncore/net/mail/libmailwrapper/storemail.h b/noncore/net/mail/libmailwrapper/storemail.h
index 872c981..7d8ea3d 100644
--- a/noncore/net/mail/libmailwrapper/storemail.h
+++ b/noncore/net/mail/libmailwrapper/storemail.h
@@ -17,9 +17,9 @@ public:
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 Mail&mail); 21 int storeMail(const Opie::osmart_pointer<Mail>&mail);
22 22
23protected: 23protected:
24 Account* m_Account; 24 Account* m_Account;
25 QString m_tfolder; 25 QString m_tfolder;