-rw-r--r-- | noncore/net/mail/genericwrapper.cpp | 6 | ||||
-rw-r--r-- | noncore/net/mail/imapwrapper.cpp | 12 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/genericwrapper.cpp | 6 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.cpp | 12 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mailwrapper.cpp | 2 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mboxwrapper.cpp | 12 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/smtpwrapper.cpp | 33 | ||||
-rw-r--r-- | noncore/net/mail/mailwrapper.cpp | 2 | ||||
-rw-r--r-- | noncore/net/mail/mboxwrapper.cpp | 12 | ||||
-rw-r--r-- | noncore/net/mail/smtpwrapper.cpp | 33 |
10 files changed, 84 insertions, 46 deletions
diff --git a/noncore/net/mail/genericwrapper.cpp b/noncore/net/mail/genericwrapper.cpp index 447cad0..c1b6e48 100644 --- a/noncore/net/mail/genericwrapper.cpp +++ b/noncore/net/mail/genericwrapper.cpp | |||
@@ -191,9 +191,9 @@ RecMail *Genericwrapper::parseHeader( const char *header ) | |||
191 | int err = MAILIMF_NO_ERROR; | 191 | int err = MAILIMF_NO_ERROR; |
192 | size_t curTok = 0; | 192 | size_t curTok = 0; |
193 | RecMail *mail = new RecMail(); | 193 | RecMail *mail = new RecMail(); |
194 | mailimf_fields *fields; | 194 | mailimf_fields *fields = 0; |
195 | mailimf_references * refs; | 195 | mailimf_references * refs = 0; |
196 | mailimf_keywords*keys; | 196 | mailimf_keywords*keys = 0; |
197 | QString status; | 197 | QString status; |
198 | QString value; | 198 | QString value; |
199 | QBitArray mFlags(7); | 199 | QBitArray mFlags(7); |
diff --git a/noncore/net/mail/imapwrapper.cpp b/noncore/net/mail/imapwrapper.cpp index 853e4a2..0178e33 100644 --- a/noncore/net/mail/imapwrapper.cpp +++ b/noncore/net/mail/imapwrapper.cpp | |||
@@ -94,13 +94,13 @@ void IMAPwrapper::logout() | |||
94 | 94 | ||
95 | void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) | 95 | void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) |
96 | { | 96 | { |
97 | const char *mb; | 97 | const char *mb = 0; |
98 | int err = MAILIMAP_NO_ERROR; | 98 | int err = MAILIMAP_NO_ERROR; |
99 | clist *result; | 99 | clist *result = 0; |
100 | clistcell *current; | 100 | clistcell *current; |
101 | // mailimap_fetch_att *fetchAtt,*fetchAttFlags,*fetchAttDate,*fetchAttSize; | 101 | // mailimap_fetch_att *fetchAtt,*fetchAttFlags,*fetchAttDate,*fetchAttSize; |
102 | mailimap_fetch_type *fetchType; | 102 | mailimap_fetch_type *fetchType = 0; |
103 | mailimap_set *set; | 103 | mailimap_set *set = 0; |
104 | 104 | ||
105 | mb = mailbox.latin1(); | 105 | mb = mailbox.latin1(); |
106 | login(); | 106 | login(); |
@@ -121,7 +121,6 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) | |||
121 | return; | 121 | return; |
122 | } | 122 | } |
123 | 123 | ||
124 | result = clist_new(); | ||
125 | /* the range has to start at 1!!! not with 0!!!! */ | 124 | /* the range has to start at 1!!! not with 0!!!! */ |
126 | set = mailimap_set_new_interval( 1, last ); | 125 | set = mailimap_set_new_interval( 1, last ); |
127 | fetchType = mailimap_fetch_type_new_fetch_att_list_empty(); | 126 | fetchType = mailimap_fetch_type_new_fetch_att_list_empty(); |
@@ -137,7 +136,6 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) | |||
137 | QString date,subject,from; | 136 | QString date,subject,from; |
138 | 137 | ||
139 | if ( err == MAILIMAP_NO_ERROR ) { | 138 | if ( err == MAILIMAP_NO_ERROR ) { |
140 | |||
141 | mailimap_msg_att * msg_att; | 139 | mailimap_msg_att * msg_att; |
142 | int i = 0; | 140 | int i = 0; |
143 | for (current = clist_begin(result); current != 0; current=clist_next(current)) { | 141 | for (current = clist_begin(result); current != 0; current=clist_next(current)) { |
@@ -154,7 +152,7 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) | |||
154 | } else { | 152 | } else { |
155 | qDebug("Error fetching headers: %s",m_imap->imap_response); | 153 | qDebug("Error fetching headers: %s",m_imap->imap_response); |
156 | } | 154 | } |
157 | mailimap_fetch_list_free(result); | 155 | if (result) mailimap_fetch_list_free(result); |
158 | } | 156 | } |
159 | 157 | ||
160 | QList<Folder>* IMAPwrapper::listFolders() | 158 | QList<Folder>* IMAPwrapper::listFolders() |
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.cpp b/noncore/net/mail/libmailwrapper/genericwrapper.cpp index 447cad0..c1b6e48 100644 --- a/noncore/net/mail/libmailwrapper/genericwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/genericwrapper.cpp | |||
@@ -191,9 +191,9 @@ RecMail *Genericwrapper::parseHeader( const char *header ) | |||
191 | int err = MAILIMF_NO_ERROR; | 191 | int err = MAILIMF_NO_ERROR; |
192 | size_t curTok = 0; | 192 | size_t curTok = 0; |
193 | RecMail *mail = new RecMail(); | 193 | RecMail *mail = new RecMail(); |
194 | mailimf_fields *fields; | 194 | mailimf_fields *fields = 0; |
195 | mailimf_references * refs; | 195 | mailimf_references * refs = 0; |
196 | mailimf_keywords*keys; | 196 | mailimf_keywords*keys = 0; |
197 | QString status; | 197 | QString status; |
198 | QString value; | 198 | QString value; |
199 | QBitArray mFlags(7); | 199 | QBitArray mFlags(7); |
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp index 853e4a2..0178e33 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp | |||
@@ -94,13 +94,13 @@ void IMAPwrapper::logout() | |||
94 | 94 | ||
95 | void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) | 95 | void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) |
96 | { | 96 | { |
97 | const char *mb; | 97 | const char *mb = 0; |
98 | int err = MAILIMAP_NO_ERROR; | 98 | int err = MAILIMAP_NO_ERROR; |
99 | clist *result; | 99 | clist *result = 0; |
100 | clistcell *current; | 100 | clistcell *current; |
101 | // mailimap_fetch_att *fetchAtt,*fetchAttFlags,*fetchAttDate,*fetchAttSize; | 101 | // mailimap_fetch_att *fetchAtt,*fetchAttFlags,*fetchAttDate,*fetchAttSize; |
102 | mailimap_fetch_type *fetchType; | 102 | mailimap_fetch_type *fetchType = 0; |
103 | mailimap_set *set; | 103 | mailimap_set *set = 0; |
104 | 104 | ||
105 | mb = mailbox.latin1(); | 105 | mb = mailbox.latin1(); |
106 | login(); | 106 | login(); |
@@ -121,7 +121,6 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) | |||
121 | return; | 121 | return; |
122 | } | 122 | } |
123 | 123 | ||
124 | result = clist_new(); | ||
125 | /* the range has to start at 1!!! not with 0!!!! */ | 124 | /* the range has to start at 1!!! not with 0!!!! */ |
126 | set = mailimap_set_new_interval( 1, last ); | 125 | set = mailimap_set_new_interval( 1, last ); |
127 | fetchType = mailimap_fetch_type_new_fetch_att_list_empty(); | 126 | fetchType = mailimap_fetch_type_new_fetch_att_list_empty(); |
@@ -137,7 +136,6 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) | |||
137 | QString date,subject,from; | 136 | QString date,subject,from; |
138 | 137 | ||
139 | if ( err == MAILIMAP_NO_ERROR ) { | 138 | if ( err == MAILIMAP_NO_ERROR ) { |
140 | |||
141 | mailimap_msg_att * msg_att; | 139 | mailimap_msg_att * msg_att; |
142 | int i = 0; | 140 | int i = 0; |
143 | for (current = clist_begin(result); current != 0; current=clist_next(current)) { | 141 | for (current = clist_begin(result); current != 0; current=clist_next(current)) { |
@@ -154,7 +152,7 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) | |||
154 | } else { | 152 | } else { |
155 | qDebug("Error fetching headers: %s",m_imap->imap_response); | 153 | qDebug("Error fetching headers: %s",m_imap->imap_response); |
156 | } | 154 | } |
157 | mailimap_fetch_list_free(result); | 155 | if (result) mailimap_fetch_list_free(result); |
158 | } | 156 | } |
159 | 157 | ||
160 | QList<Folder>* IMAPwrapper::listFolders() | 158 | QList<Folder>* IMAPwrapper::listFolders() |
diff --git a/noncore/net/mail/libmailwrapper/mailwrapper.cpp b/noncore/net/mail/libmailwrapper/mailwrapper.cpp index f8efd09..6479783 100644 --- a/noncore/net/mail/libmailwrapper/mailwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mailwrapper.cpp | |||
@@ -55,7 +55,7 @@ QString IMAPFolder::decodeFolderName( const QString &name ) | |||
55 | unsigned long ucs4, utf16, bitbuf; | 55 | unsigned long ucs4, utf16, bitbuf; |
56 | unsigned char base64[256], utf8[6]; | 56 | unsigned char base64[256], utf8[6]; |
57 | unsigned long srcPtr = 0; | 57 | unsigned long srcPtr = 0; |
58 | QCString dst; | 58 | QCString dst = ""; |
59 | QCString src = name.ascii(); | 59 | QCString src = name.ascii(); |
60 | 60 | ||
61 | /* initialize modified base64 decoding table */ | 61 | /* initialize modified base64 decoding table */ |
diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp index 293ae1b..6d69263 100644 --- a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <libetpan/libetpan.h> | 4 | #include <libetpan/libetpan.h> |
5 | #include <libetpan/mailstorage.h> | 5 | #include <libetpan/mailstorage.h> |
6 | #include <qdir.h> | 6 | #include <qdir.h> |
7 | #include <stdlib.h> | ||
7 | 8 | ||
8 | MBOXwrapper::MBOXwrapper(const QString & mbox_dir) | 9 | MBOXwrapper::MBOXwrapper(const QString & mbox_dir) |
9 | : Genericwrapper(),MBOXPath(mbox_dir) | 10 | : Genericwrapper(),MBOXPath(mbox_dir) |
@@ -23,15 +24,19 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) | |||
23 | mailstorage*storage = mailstorage_new(NULL); | 24 | mailstorage*storage = mailstorage_new(NULL); |
24 | QString p = MBOXPath+"/"; | 25 | QString p = MBOXPath+"/"; |
25 | p+=mailbox; | 26 | p+=mailbox; |
27 | char*fname = 0; | ||
26 | 28 | ||
27 | int r = mbox_mailstorage_init(storage,strdup(p.latin1()),0,0,0); | 29 | fname = strdup(p.latin1()); |
30 | |||
31 | int r = mbox_mailstorage_init(storage,fname,0,0,0); | ||
28 | mailfolder*folder; | 32 | mailfolder*folder; |
29 | folder = mailfolder_new( storage,strdup(p.latin1()),NULL); | 33 | folder = mailfolder_new( storage,fname,NULL); |
30 | r = mailfolder_connect(folder); | 34 | r = mailfolder_connect(folder); |
31 | if (r != MAIL_NO_ERROR) { | 35 | if (r != MAIL_NO_ERROR) { |
32 | qDebug("Error initializing mbox"); | 36 | qDebug("Error initializing mbox"); |
33 | mailfolder_free(folder); | 37 | mailfolder_free(folder); |
34 | mailstorage_free(storage); | 38 | mailstorage_free(storage); |
39 | free(fname); | ||
35 | return; | 40 | return; |
36 | } | 41 | } |
37 | mailmessage_list * env_list = 0; | 42 | mailmessage_list * env_list = 0; |
@@ -40,6 +45,7 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) | |||
40 | qDebug("Error message list"); | 45 | qDebug("Error message list"); |
41 | mailfolder_free(folder); | 46 | mailfolder_free(folder); |
42 | mailstorage_free(storage); | 47 | mailstorage_free(storage); |
48 | free(fname); | ||
43 | return; | 49 | return; |
44 | } | 50 | } |
45 | r = mailsession_get_envelopes_list(folder->fld_session, env_list); | 51 | r = mailsession_get_envelopes_list(folder->fld_session, env_list); |
@@ -50,6 +56,7 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) | |||
50 | } | 56 | } |
51 | mailfolder_free(folder); | 57 | mailfolder_free(folder); |
52 | mailstorage_free(storage); | 58 | mailstorage_free(storage); |
59 | free(fname); | ||
53 | return; | 60 | return; |
54 | } | 61 | } |
55 | mailimf_references * refs; | 62 | mailimf_references * refs; |
@@ -103,6 +110,7 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) | |||
103 | mailfolder_disconnect(folder); | 110 | mailfolder_disconnect(folder); |
104 | mailfolder_free(folder); | 111 | mailfolder_free(folder); |
105 | mailstorage_free(storage); | 112 | mailstorage_free(storage); |
113 | free(fname); | ||
106 | } | 114 | } |
107 | 115 | ||
108 | QList<Folder>* MBOXwrapper::listFolders() | 116 | QList<Folder>* MBOXwrapper::listFolders() |
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp index a7e4837..21992b4 100644 --- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp | |||
@@ -441,7 +441,9 @@ char *SMTPwrapper::getFrom( mailimf_field *ffrom) | |||
441 | 441 | ||
442 | char *SMTPwrapper::getFrom( mailmime *mail ) | 442 | char *SMTPwrapper::getFrom( mailmime *mail ) |
443 | { | 443 | { |
444 | /* no need to delete - its just a pointer to structure content */ | ||
444 | mailimf_field *ffrom = 0; | 445 | mailimf_field *ffrom = 0; |
446 | char*f = 0; | ||
445 | ffrom = getField( mail->mm_data.mm_message.mm_fields, MAILIMF_FIELD_FROM ); | 447 | ffrom = getField( mail->mm_data.mm_message.mm_fields, MAILIMF_FIELD_FROM ); |
446 | return getFrom(ffrom); | 448 | return getFrom(ffrom); |
447 | } | 449 | } |
@@ -563,6 +565,9 @@ void SMTPwrapper::smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ) | |||
563 | from = getFrom( mail ); | 565 | from = getFrom( mail ); |
564 | rcpts = createRcptList( mail->mm_data.mm_message.mm_fields ); | 566 | rcpts = createRcptList( mail->mm_data.mm_message.mm_fields ); |
565 | smtpSend(from,rcpts,data,size,smtp); | 567 | smtpSend(from,rcpts,data,size,smtp); |
568 | if (data) {free(data);} | ||
569 | if (from) {free(from);} | ||
570 | if (rcpts) smtp_address_list_free( rcpts ); | ||
566 | } | 571 | } |
567 | 572 | ||
568 | int SMTPwrapper::smtpSend(char*from,clist*rcpts,char*data,size_t size, SMTPaccount *smtp ) | 573 | int SMTPwrapper::smtpSend(char*from,clist*rcpts,char*data,size_t size, SMTPaccount *smtp ) |
@@ -630,10 +635,7 @@ free_con_session: | |||
630 | free_mem_session: | 635 | free_mem_session: |
631 | mailsmtp_free( session ); | 636 | mailsmtp_free( session ); |
632 | free_mem: | 637 | free_mem: |
633 | if (rcpts) smtp_address_list_free( rcpts ); | ||
634 | if (data) free( data ); | ||
635 | if (server) free( server ); | 638 | if (server) free( server ); |
636 | if (from) free( from ); | ||
637 | if ( smtp->getLogin() ) { | 639 | if ( smtp->getLogin() ) { |
638 | free( user ); | 640 | free( user ); |
639 | free( pass ); | 641 | free( pass ); |
@@ -652,7 +654,6 @@ void SMTPwrapper::sendMail(const Mail&mail,bool later ) | |||
652 | qDebug( "sendMail: error creating mime mail" ); | 654 | qDebug( "sendMail: error creating mime mail" ); |
653 | } else { | 655 | } else { |
654 | sendProgress = new progressMailSend(); | 656 | sendProgress = new progressMailSend(); |
655 | // sendProgress->showMaximized(); | ||
656 | sendProgress->show(); | 657 | sendProgress->show(); |
657 | sendProgress->setMaxMails(1); | 658 | sendProgress->setMaxMails(1); |
658 | smtpSend( mimeMail,later,smtp); | 659 | smtpSend( mimeMail,later,smtp); |
@@ -673,6 +674,7 @@ int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which) | |||
673 | mailimf_field*ffrom = 0; | 674 | mailimf_field*ffrom = 0; |
674 | clist *rcpts = 0; | 675 | clist *rcpts = 0; |
675 | char*from = 0; | 676 | char*from = 0; |
677 | int res = 0; | ||
676 | 678 | ||
677 | wrap->fetchRawBody(*which,&data,&length); | 679 | wrap->fetchRawBody(*which,&data,&length); |
678 | if (!data) return 0; | 680 | if (!data) return 0; |
@@ -689,9 +691,22 @@ int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which) | |||
689 | 691 | ||
690 | qDebug("Size: %i vs. %i",length,strlen(data)); | 692 | qDebug("Size: %i vs. %i",length,strlen(data)); |
691 | if (rcpts && from) { | 693 | if (rcpts && from) { |
692 | return smtpSend(from,rcpts,data,strlen(data),smtp ); | 694 | res = smtpSend(from,rcpts,data,length,smtp ); |
693 | } | 695 | } |
694 | return 0; | 696 | if (fields) { |
697 | mailimf_fields_free(fields); | ||
698 | fields = 0; | ||
699 | } | ||
700 | if (data) { | ||
701 | free(data); | ||
702 | } | ||
703 | if (from) { | ||
704 | free(from); | ||
705 | } | ||
706 | if (rcpts) { | ||
707 | smtp_address_list_free( rcpts ); | ||
708 | } | ||
709 | return res; | ||
695 | } | 710 | } |
696 | 711 | ||
697 | /* this is a special fun */ | 712 | /* this is a special fun */ |
@@ -717,9 +732,8 @@ bool SMTPwrapper::flushOutbox(SMTPaccount*smtp) | |||
717 | } | 732 | } |
718 | mailsToSend.setAutoDelete(false); | 733 | mailsToSend.setAutoDelete(false); |
719 | sendProgress = new progressMailSend(); | 734 | sendProgress = new progressMailSend(); |
720 | // sendProgress->showMaximized(); | 735 | sendProgress->show(); |
721 | sendProgress->show(); | 736 | sendProgress->setMaxMails(mailsToSend.count()); |
722 | sendProgress->setMaxMails(mailsToSend.count()); | ||
723 | 737 | ||
724 | while (mailsToSend.count()>0) { | 738 | while (mailsToSend.count()>0) { |
725 | if (sendQueuedMail(wrap,smtp,mailsToSend.at(0))==0) { | 739 | if (sendQueuedMail(wrap,smtp,mailsToSend.at(0))==0) { |
@@ -740,5 +754,4 @@ bool SMTPwrapper::flushOutbox(SMTPaccount*smtp) | |||
740 | mailsToSend.setAutoDelete(true); | 754 | mailsToSend.setAutoDelete(true); |
741 | delete wrap; | 755 | delete wrap; |
742 | return returnValue; | 756 | return returnValue; |
743 | |||
744 | } | 757 | } |
diff --git a/noncore/net/mail/mailwrapper.cpp b/noncore/net/mail/mailwrapper.cpp index f8efd09..6479783 100644 --- a/noncore/net/mail/mailwrapper.cpp +++ b/noncore/net/mail/mailwrapper.cpp | |||
@@ -55,7 +55,7 @@ QString IMAPFolder::decodeFolderName( const QString &name ) | |||
55 | unsigned long ucs4, utf16, bitbuf; | 55 | unsigned long ucs4, utf16, bitbuf; |
56 | unsigned char base64[256], utf8[6]; | 56 | unsigned char base64[256], utf8[6]; |
57 | unsigned long srcPtr = 0; | 57 | unsigned long srcPtr = 0; |
58 | QCString dst; | 58 | QCString dst = ""; |
59 | QCString src = name.ascii(); | 59 | QCString src = name.ascii(); |
60 | 60 | ||
61 | /* initialize modified base64 decoding table */ | 61 | /* initialize modified base64 decoding table */ |
diff --git a/noncore/net/mail/mboxwrapper.cpp b/noncore/net/mail/mboxwrapper.cpp index 293ae1b..6d69263 100644 --- a/noncore/net/mail/mboxwrapper.cpp +++ b/noncore/net/mail/mboxwrapper.cpp | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <libetpan/libetpan.h> | 4 | #include <libetpan/libetpan.h> |
5 | #include <libetpan/mailstorage.h> | 5 | #include <libetpan/mailstorage.h> |
6 | #include <qdir.h> | 6 | #include <qdir.h> |
7 | #include <stdlib.h> | ||
7 | 8 | ||
8 | MBOXwrapper::MBOXwrapper(const QString & mbox_dir) | 9 | MBOXwrapper::MBOXwrapper(const QString & mbox_dir) |
9 | : Genericwrapper(),MBOXPath(mbox_dir) | 10 | : Genericwrapper(),MBOXPath(mbox_dir) |
@@ -23,15 +24,19 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) | |||
23 | mailstorage*storage = mailstorage_new(NULL); | 24 | mailstorage*storage = mailstorage_new(NULL); |
24 | QString p = MBOXPath+"/"; | 25 | QString p = MBOXPath+"/"; |
25 | p+=mailbox; | 26 | p+=mailbox; |
27 | char*fname = 0; | ||
26 | 28 | ||
27 | int r = mbox_mailstorage_init(storage,strdup(p.latin1()),0,0,0); | 29 | fname = strdup(p.latin1()); |
30 | |||
31 | int r = mbox_mailstorage_init(storage,fname,0,0,0); | ||
28 | mailfolder*folder; | 32 | mailfolder*folder; |
29 | folder = mailfolder_new( storage,strdup(p.latin1()),NULL); | 33 | folder = mailfolder_new( storage,fname,NULL); |
30 | r = mailfolder_connect(folder); | 34 | r = mailfolder_connect(folder); |
31 | if (r != MAIL_NO_ERROR) { | 35 | if (r != MAIL_NO_ERROR) { |
32 | qDebug("Error initializing mbox"); | 36 | qDebug("Error initializing mbox"); |
33 | mailfolder_free(folder); | 37 | mailfolder_free(folder); |
34 | mailstorage_free(storage); | 38 | mailstorage_free(storage); |
39 | free(fname); | ||
35 | return; | 40 | return; |
36 | } | 41 | } |
37 | mailmessage_list * env_list = 0; | 42 | mailmessage_list * env_list = 0; |
@@ -40,6 +45,7 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) | |||
40 | qDebug("Error message list"); | 45 | qDebug("Error message list"); |
41 | mailfolder_free(folder); | 46 | mailfolder_free(folder); |
42 | mailstorage_free(storage); | 47 | mailstorage_free(storage); |
48 | free(fname); | ||
43 | return; | 49 | return; |
44 | } | 50 | } |
45 | r = mailsession_get_envelopes_list(folder->fld_session, env_list); | 51 | r = mailsession_get_envelopes_list(folder->fld_session, env_list); |
@@ -50,6 +56,7 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) | |||
50 | } | 56 | } |
51 | mailfolder_free(folder); | 57 | mailfolder_free(folder); |
52 | mailstorage_free(storage); | 58 | mailstorage_free(storage); |
59 | free(fname); | ||
53 | return; | 60 | return; |
54 | } | 61 | } |
55 | mailimf_references * refs; | 62 | mailimf_references * refs; |
@@ -103,6 +110,7 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) | |||
103 | mailfolder_disconnect(folder); | 110 | mailfolder_disconnect(folder); |
104 | mailfolder_free(folder); | 111 | mailfolder_free(folder); |
105 | mailstorage_free(storage); | 112 | mailstorage_free(storage); |
113 | free(fname); | ||
106 | } | 114 | } |
107 | 115 | ||
108 | QList<Folder>* MBOXwrapper::listFolders() | 116 | QList<Folder>* MBOXwrapper::listFolders() |
diff --git a/noncore/net/mail/smtpwrapper.cpp b/noncore/net/mail/smtpwrapper.cpp index a7e4837..21992b4 100644 --- a/noncore/net/mail/smtpwrapper.cpp +++ b/noncore/net/mail/smtpwrapper.cpp | |||
@@ -441,7 +441,9 @@ char *SMTPwrapper::getFrom( mailimf_field *ffrom) | |||
441 | 441 | ||
442 | char *SMTPwrapper::getFrom( mailmime *mail ) | 442 | char *SMTPwrapper::getFrom( mailmime *mail ) |
443 | { | 443 | { |
444 | /* no need to delete - its just a pointer to structure content */ | ||
444 | mailimf_field *ffrom = 0; | 445 | mailimf_field *ffrom = 0; |
446 | char*f = 0; | ||
445 | ffrom = getField( mail->mm_data.mm_message.mm_fields, MAILIMF_FIELD_FROM ); | 447 | ffrom = getField( mail->mm_data.mm_message.mm_fields, MAILIMF_FIELD_FROM ); |
446 | return getFrom(ffrom); | 448 | return getFrom(ffrom); |
447 | } | 449 | } |
@@ -563,6 +565,9 @@ void SMTPwrapper::smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ) | |||
563 | from = getFrom( mail ); | 565 | from = getFrom( mail ); |
564 | rcpts = createRcptList( mail->mm_data.mm_message.mm_fields ); | 566 | rcpts = createRcptList( mail->mm_data.mm_message.mm_fields ); |
565 | smtpSend(from,rcpts,data,size,smtp); | 567 | smtpSend(from,rcpts,data,size,smtp); |
568 | if (data) {free(data);} | ||
569 | if (from) {free(from);} | ||
570 | if (rcpts) smtp_address_list_free( rcpts ); | ||
566 | } | 571 | } |
567 | 572 | ||
568 | int SMTPwrapper::smtpSend(char*from,clist*rcpts,char*data,size_t size, SMTPaccount *smtp ) | 573 | int SMTPwrapper::smtpSend(char*from,clist*rcpts,char*data,size_t size, SMTPaccount *smtp ) |
@@ -630,10 +635,7 @@ free_con_session: | |||
630 | free_mem_session: | 635 | free_mem_session: |
631 | mailsmtp_free( session ); | 636 | mailsmtp_free( session ); |
632 | free_mem: | 637 | free_mem: |
633 | if (rcpts) smtp_address_list_free( rcpts ); | ||
634 | if (data) free( data ); | ||
635 | if (server) free( server ); | 638 | if (server) free( server ); |
636 | if (from) free( from ); | ||
637 | if ( smtp->getLogin() ) { | 639 | if ( smtp->getLogin() ) { |
638 | free( user ); | 640 | free( user ); |
639 | free( pass ); | 641 | free( pass ); |
@@ -652,7 +654,6 @@ void SMTPwrapper::sendMail(const Mail&mail,bool later ) | |||
652 | qDebug( "sendMail: error creating mime mail" ); | 654 | qDebug( "sendMail: error creating mime mail" ); |
653 | } else { | 655 | } else { |
654 | sendProgress = new progressMailSend(); | 656 | sendProgress = new progressMailSend(); |
655 | // sendProgress->showMaximized(); | ||
656 | sendProgress->show(); | 657 | sendProgress->show(); |
657 | sendProgress->setMaxMails(1); | 658 | sendProgress->setMaxMails(1); |
658 | smtpSend( mimeMail,later,smtp); | 659 | smtpSend( mimeMail,later,smtp); |
@@ -673,6 +674,7 @@ int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which) | |||
673 | mailimf_field*ffrom = 0; | 674 | mailimf_field*ffrom = 0; |
674 | clist *rcpts = 0; | 675 | clist *rcpts = 0; |
675 | char*from = 0; | 676 | char*from = 0; |
677 | int res = 0; | ||
676 | 678 | ||
677 | wrap->fetchRawBody(*which,&data,&length); | 679 | wrap->fetchRawBody(*which,&data,&length); |
678 | if (!data) return 0; | 680 | if (!data) return 0; |
@@ -689,9 +691,22 @@ int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which) | |||
689 | 691 | ||
690 | qDebug("Size: %i vs. %i",length,strlen(data)); | 692 | qDebug("Size: %i vs. %i",length,strlen(data)); |
691 | if (rcpts && from) { | 693 | if (rcpts && from) { |
692 | return smtpSend(from,rcpts,data,strlen(data),smtp ); | 694 | res = smtpSend(from,rcpts,data,length,smtp ); |
693 | } | 695 | } |
694 | return 0; | 696 | if (fields) { |
697 | mailimf_fields_free(fields); | ||
698 | fields = 0; | ||
699 | } | ||
700 | if (data) { | ||
701 | free(data); | ||
702 | } | ||
703 | if (from) { | ||
704 | free(from); | ||
705 | } | ||
706 | if (rcpts) { | ||
707 | smtp_address_list_free( rcpts ); | ||
708 | } | ||
709 | return res; | ||
695 | } | 710 | } |
696 | 711 | ||
697 | /* this is a special fun */ | 712 | /* this is a special fun */ |
@@ -717,9 +732,8 @@ bool SMTPwrapper::flushOutbox(SMTPaccount*smtp) | |||
717 | } | 732 | } |
718 | mailsToSend.setAutoDelete(false); | 733 | mailsToSend.setAutoDelete(false); |
719 | sendProgress = new progressMailSend(); | 734 | sendProgress = new progressMailSend(); |
720 | // sendProgress->showMaximized(); | 735 | sendProgress->show(); |
721 | sendProgress->show(); | 736 | sendProgress->setMaxMails(mailsToSend.count()); |
722 | sendProgress->setMaxMails(mailsToSend.count()); | ||
723 | 737 | ||
724 | while (mailsToSend.count()>0) { | 738 | while (mailsToSend.count()>0) { |
725 | if (sendQueuedMail(wrap,smtp,mailsToSend.at(0))==0) { | 739 | if (sendQueuedMail(wrap,smtp,mailsToSend.at(0))==0) { |
@@ -740,5 +754,4 @@ bool SMTPwrapper::flushOutbox(SMTPaccount*smtp) | |||
740 | mailsToSend.setAutoDelete(true); | 754 | mailsToSend.setAutoDelete(true); |
741 | delete wrap; | 755 | delete wrap; |
742 | return returnValue; | 756 | return returnValue; |
743 | |||
744 | } | 757 | } |