summaryrefslogtreecommitdiffabout
path: root/kmicromail/libmailwrapper
authorzautrix <zautrix>2004-11-01 14:15:56 (UTC)
committer zautrix <zautrix>2004-11-01 14:15:56 (UTC)
commit3320af5e47cdb4b54c4185c91d0332c013d90818 (patch) (side-by-side diff)
tree9d7db42d4350616d315c5f95e1ac0aed00ed1314 /kmicromail/libmailwrapper
parent56845a3ee7013af8a2db26a89aa151ee482ef0ed (diff)
downloadkdepimpi-3320af5e47cdb4b54c4185c91d0332c013d90818.zip
kdepimpi-3320af5e47cdb4b54c4185c91d0332c013d90818.tar.gz
kdepimpi-3320af5e47cdb4b54c4185c91d0332c013d90818.tar.bz2
ompi fixes
Diffstat (limited to 'kmicromail/libmailwrapper') (more/less context) (show whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/generatemail.cpp13
-rw-r--r--kmicromail/libmailwrapper/imapwrapper.cpp7
-rw-r--r--kmicromail/libmailwrapper/settings.cpp1
3 files changed, 12 insertions, 9 deletions
diff --git a/kmicromail/libmailwrapper/generatemail.cpp b/kmicromail/libmailwrapper/generatemail.cpp
index 49315ba..32311d7 100644
--- a/kmicromail/libmailwrapper/generatemail.cpp
+++ b/kmicromail/libmailwrapper/generatemail.cpp
@@ -1,24 +1,24 @@
#include "generatemail.h"
#include "mailwrapper.h"
#include <libetpan/libetpan.h>
//#include <qt.h>
#include <stdlib.h>
#include <qfileinfo.h>
using namespace Opie::Core;
-const char* Generatemail::USER_AGENT="OpieMail v0.6";
+const char* Generatemail::USER_AGENT="KOpieMail 33 1/3";
Generatemail::Generatemail()
{
}
Generatemail::~Generatemail()
{
}
void Generatemail::addRcpts( clist *list, mailimf_address_list *addr_list ) {
clistiter *it, *it2;
@@ -123,25 +123,24 @@ mailimf_address_list *Generatemail::parseAddresses(const QString&addr ) {
}
return addresses;
}
mailmime *Generatemail::buildFilePart(const QString&filename,const QString&mimetype,const QString&TextContent ) {
mailmime * filePart = 0;
mailmime_fields * fields = 0;
mailmime_content * content = 0;
mailmime_parameter * param = 0;
char*name = 0;
char*file = 0;
int err;
-
int pos = filename.findRev( '/' );
if (filename.length()>0) {
QString tmp = filename.right( filename.length() - ( pos + 1 ) );
name = strdup( tmp.latin1() ); // just filename
file = strdup( filename.latin1() ); // full name with path
}
int disptype = MAILMIME_DISPOSITION_TYPE_ATTACHMENT;
int mechanism = MAILMIME_MECHANISM_BASE64;
if ( mimetype.startsWith( "text/" ) ) {
@@ -162,25 +161,25 @@ mailmime *Generatemail::buildFilePart(const QString&filename,const QString&mimet
if (filename.length()>0) {
QFileInfo f(filename);
param = mailmime_parameter_new(strdup("name"),strdup(f.fileName().latin1()));
clist_append(content->ct_parameters,param);
param = 0;
}
filePart = mailmime_new_empty( content, fields );
}
if (filePart) {
if (filename.length()>0) {
err = mailmime_set_body_file( filePart, file );
} else {
- err = mailmime_set_body_text(filePart,strdup(TextContent.data()),TextContent.length());
+ err = mailmime_set_body_text(filePart,strdup( TextContent.utf8()),TextContent.utf8().length());
}
if (err != MAILIMF_NO_ERROR) {
qDebug("Error setting body with file ");
mailmime_free( filePart );
filePart = 0;
}
}
if (!filePart) {
if ( param != NULL ) {
mailmime_parameter_free( param );
}
@@ -218,47 +217,49 @@ void Generatemail::addFileParts( mailmime *message,const QList<Attachment>&files
if ( err != MAILIMF_NO_ERROR ) {
mailmime_free( filePart );
}
}
}
mailmime *Generatemail::buildTxtPart(const QString&str ) {
mailmime *txtPart;
mailmime_fields *fields;
mailmime_content *content;
mailmime_parameter *param;
int err;
-
+ QCString __str;
param = mailmime_parameter_new( strdup( "charset" ),
strdup( "iso-8859-1" ) );
if ( param == NULL )
goto err_free;
content = mailmime_content_new_with_str( "text/plain" );
if ( content == NULL )
goto err_free_param;
err = clist_append( content->ct_parameters, param );
if ( err != MAILIMF_NO_ERROR )
goto err_free_content;
fields = mailmime_fields_new_encoding(MAILMIME_MECHANISM_8BIT);
if ( fields == NULL )
goto err_free_content;
txtPart = mailmime_new_empty( content, fields );
if ( txtPart == NULL )
goto err_free_fields;
-
- err = mailmime_set_body_text( txtPart, (char*)str.data(), str.length() );
+ {
+ __str = str.utf8();
+ err = mailmime_set_body_text( txtPart, __str.data(), __str.length() );
+ }
if ( err != MAILIMF_NO_ERROR )
goto err_free_txtPart;
return txtPart; // Success :)
err_free_txtPart:
mailmime_free( txtPart );
err_free_fields:
mailmime_fields_free( fields );
err_free_content:
mailmime_content_free( content );
err_free_param:
diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp
index ae667ec..d90a8d2 100644
--- a/kmicromail/libmailwrapper/imapwrapper.cpp
+++ b/kmicromail/libmailwrapper/imapwrapper.cpp
@@ -66,25 +66,25 @@ void IMAPwrapper::progress( QString m )
}
QString mess;
//qDebug("progress ");
if ( mMax ) mess = mProgrMess +i18n(" message %1 of %2").arg( mCurrent++).arg(mMax);
else mess = mProgrMess +i18n(" message %1").arg( mCurrent++);
Global::statusMessage(mess);
//qDebug("Progress %s %s", mess.latin1(), m.latin1());
qApp->processEvents();
}
bool IMAPwrapper::start_tls(bool force_tls)
{
int err;
- bool try_tls;
+ bool try_tls = force_tls;
mailimap_capability_data * cap_data = 0;
err = mailimap_capability(m_imap,&cap_data);
if (err != MAILIMAP_NO_ERROR) {
Global::statusMessage("error getting capabilities!");
return false;
}
clistiter * cur;
for(cur = clist_begin(cap_data->cap_list) ; cur != NULL;cur = clist_next(cur)) {
struct mailimap_capability * cap;
cap = (struct mailimap_capability *)clist_content(cur);
if (cap->cap_type == MAILIMAP_CAPABILITY_NAME) {
@@ -469,43 +469,44 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
}
}
continue;
}
if ( item->att_data.att_static == NULL )
continue;
if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) {
mailimap_envelope * head = item->att_data.att_static->att_data.att_env;
if ( head == NULL )
continue;
if ( head->env_date != NULL ) {
m->setDate(head->env_date);
- struct mailimf_date_time result;
- struct mailimf_date_time* date = &result;
+ //struct mailimf_date_time result;
+ struct mailimf_date_time* date;// = &result;
struct mailimf_date_time **re = &date;
size_t length = m->getDate().length();
size_t index = 0;
if ( mailimf_date_time_parse(head->env_date, length,&index, re ) == MAILIMF_NO_ERROR ) {
QDateTime dt = Genericwrapper::parseDateTime( date );
QString ret;
if ( dt.date() == QDate::currentDate () )
ret = KGlobal::locale()->formatTime( dt.time(),true);
else {
ret = KGlobal::locale()->formatDateTime( dt,true,true);
}
m->setDate( ret );
char tmp[20];
snprintf( tmp, 20, "%04i-%02i-%02i %02i:%02i:%02i",
dt.date().year(),dt.date().month(), dt.date().day(), dt.time().hour(), dt.time().minute(), dt.time().second() );
//qDebug("%d iso %s %s ", date->dt_zone, tmp, head->env_date);
m->setIsoDate( QString( tmp ) );
+ mailimf_date_time_free ( date );
} else {
m->setIsoDate(head->env_date);
}
}
if ( head->env_subject != NULL )
m->setSubject(convert_String((const char*)head->env_subject));
//m->setSubject(head->env_subject);
if (head->env_from!=NULL) {
addresslist = address_list_to_stringlist(head->env_from->frm_list);
if (addresslist.count()) {
m->setFrom(addresslist.first());
}
diff --git a/kmicromail/libmailwrapper/settings.cpp b/kmicromail/libmailwrapper/settings.cpp
index 5d2c0ad..04afe7c 100644
--- a/kmicromail/libmailwrapper/settings.cpp
+++ b/kmicromail/libmailwrapper/settings.cpp
@@ -12,24 +12,25 @@
#define IMAP_SSL_PORT "993"
#define SMTP_PORT "25"
#define SMTP_SSL_PORT "465"
#define POP3_PORT "110"
#define POP3_SSL_PORT "995"
#define NNTP_PORT "119"
#define NNTP_SSL_PORT "563"
Settings::Settings()
: QObject()
{
+ accounts.setAutoDelete( true ); ;
updateAccounts();
//qDebug("++++++++++++++++++new settings ");
}
void Settings::checkDirectory()
{
return;
locateLocal("data", "kopiemail" );
/*
if ( !QDir( (QString) getenv( "HOME" ) + "/Applications/opiemail/" ).exists() ) {
system( "mkdir -p $HOME/Applications/opiemail" );
qDebug("$HOME/Applications/opiemail created ");