summaryrefslogtreecommitdiff
path: root/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
authoralwin <alwin>2004-01-05 22:21:41 (UTC)
committer alwin <alwin>2004-01-05 22:21:41 (UTC)
commitc8d0dd53a75b7142a5ce924e4afbea77b86e56b0 (patch) (side-by-side diff)
tree2845e68c4a3ee0daa7f732a29fefd81d47c90f9d /noncore/net/mail/libmailwrapper/smtpwrapper.cpp
parent07278dd6ba68e3ff55d22acc76a28956b06d5d9c (diff)
downloadopie-c8d0dd53a75b7142a5ce924e4afbea77b86e56b0.zip
opie-c8d0dd53a75b7142a5ce924e4afbea77b86e56b0.tar.gz
opie-c8d0dd53a75b7142a5ce924e4afbea77b86e56b0.tar.bz2
bugfix in imapwrapper
storemail for all possible mail-accounts raw body fetch in all wrappers unified public interface dialog for selecting a target mailbox started
Diffstat (limited to 'noncore/net/mail/libmailwrapper/smtpwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/libmailwrapper/smtpwrapper.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
index e054365..00181ff 100644
--- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
@@ -476,25 +476,25 @@ char *SMTPwrapper::getFrom( mailmime *mail )
ffrom = getField( mail->mm_data.mm_message.mm_fields, MAILIMF_FIELD_FROM );
return getFrom(ffrom);
}
void SMTPwrapper::progress( size_t current, size_t maximum )
{
if (SMTPwrapper::sendProgress) {
SMTPwrapper::sendProgress->setSingleMail(current, maximum );
qApp->processEvents();
}
}
-void SMTPwrapper::storeMail(char*mail, size_t length, const QString&box)
+void SMTPwrapper::storeMail(const char*mail, size_t length, const QString&box)
{
if (!mail) return;
QString localfolders = AbstractMail::defaultLocalfolder();
MBOXwrapper*wrap = new MBOXwrapper(localfolders);
wrap->storeMessage(mail,length,box);
delete wrap;
}
void SMTPwrapper::smtpSend( mailmime *mail,bool later, SMTPaccount *smtp )
{
clist *rcpts = 0;
char *from, *data;
@@ -527,25 +527,25 @@ void SMTPwrapper::smtpSend( mailmime *mail,bool later, SMTPaccount *smtp )
cfg.writeEntry( "outgoing", ++m_queuedMail );
emit queuedMails( m_queuedMail );
return;
}
from = getFrom( mail );
rcpts = createRcptList( mail->mm_data.mm_message.mm_fields );
smtpSend(from,rcpts,data,size,smtp);
if (data) {free(data);}
if (from) {free(from);}
if (rcpts) smtp_address_list_free( rcpts );
}
-int SMTPwrapper::smtpSend(char*from,clist*rcpts,char*data,size_t size, SMTPaccount *smtp )
+int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size, SMTPaccount *smtp )
{
char *server, *user, *pass;
bool ssl;
uint16_t port;
mailsmtp *session;
int err,result;
result = 1;
server = user = pass = 0;
server = strdup( smtp->getServer().latin1() );
ssl = smtp->getSSL();
port = smtp->getPort().toUInt();
@@ -631,56 +631,53 @@ void SMTPwrapper::sendMail(const Mail&mail,SMTPaccount*aSmtp,bool later )
sendProgress->setMaxMails(1);
smtpSend( mimeMail,later,smtp);
qDebug("Clean up done");
sendProgress->hide();
delete sendProgress;
sendProgress = 0;
mailmime_free( mimeMail );
}
}
int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which)
{
- char*data = 0;
- size_t length = 0;
size_t curTok = 0;
mailimf_fields *fields = 0;
mailimf_field*ffrom = 0;
clist *rcpts = 0;
char*from = 0;
int res = 0;
- wrap->fetchRawBody(*which,&data,&length);
+ encodedString * data = wrap->fetchRawBody(*which);
if (!data) return 0;
- int err = mailimf_fields_parse( data, length, &curTok, &fields );
+ int err = mailimf_fields_parse( data->Content(), data->Length(), &curTok, &fields );
if (err != MAILIMF_NO_ERROR) {
- free(data);
+ delete data;
delete wrap;
return 0;
}
rcpts = createRcptList( fields );
ffrom = getField(fields, MAILIMF_FIELD_FROM );
from = getFrom(ffrom);
- qDebug("Size: %i vs. %i",length,strlen(data));
if (rcpts && from) {
- res = smtpSend(from,rcpts,data,length,smtp );
+ res = smtpSend(from,rcpts,data->Content(),data->Length(),smtp );
}
if (fields) {
mailimf_fields_free(fields);
fields = 0;
}
if (data) {
- free(data);
+ delete data;
}
if (from) {
free(from);
}
if (rcpts) {
smtp_address_list_free( rcpts );
}
return res;
}
/* this is a special fun */
bool SMTPwrapper::flushOutbox(SMTPaccount*smtp)