summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/abstractmail.cpp17
-rw-r--r--noncore/net/mail/imapwrapper.cpp6
-rw-r--r--noncore/net/mail/libmailwrapper/abstractmail.cpp17
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.cpp6
4 files changed, 22 insertions, 24 deletions
diff --git a/noncore/net/mail/abstractmail.cpp b/noncore/net/mail/abstractmail.cpp
index b7e5eaa..3d76c96 100644
--- a/noncore/net/mail/abstractmail.cpp
+++ b/noncore/net/mail/abstractmail.cpp
@@ -28,44 +28,41 @@ encodedString* AbstractMail::decode_String(const encodedString*text,const QStrin
28 int mimetype = MAILMIME_MECHANISM_7BIT; 28 int mimetype = MAILMIME_MECHANISM_7BIT;
29 if (enc.lower()=="quoted-printable") { 29 if (enc.lower()=="quoted-printable") {
30 mimetype = MAILMIME_MECHANISM_QUOTED_PRINTABLE; 30 mimetype = MAILMIME_MECHANISM_QUOTED_PRINTABLE;
31 } else if (enc.lower()=="base64") { 31 } else if (enc.lower()=="base64") {
32 mimetype = MAILMIME_MECHANISM_BASE64; 32 mimetype = MAILMIME_MECHANISM_BASE64;
33 } else if (enc.lower()=="8bit") { 33 } else if (enc.lower()=="8bit") {
34 mimetype = MAILMIME_MECHANISM_8BIT; 34 mimetype = MAILMIME_MECHANISM_8BIT;
35 } else if (enc.lower()=="binary") { 35 } else if (enc.lower()=="binary") {
36 mimetype = MAILMIME_MECHANISM_BINARY; 36 mimetype = MAILMIME_MECHANISM_BINARY;
37 } 37 }
38 38
39 int err = mailmime_part_parse(text->Content(),text->Length(),&index,mimetype, 39 int err = mailmime_part_parse(text->Content(),text->Length(),&index,mimetype,
40 &result_text,&target_length); 40 &result_text,&target_length);
41 41
42 encodedString* result = new encodedString(); 42 encodedString* result = new encodedString();
43 if (err == MAILIMF_NO_ERROR) { 43 if (err == MAILIMF_NO_ERROR) {
44 result->setContent(result_text,target_length); 44 result->setContent(result_text,target_length);
45 } 45 }
46 qDebug("Decode string finished"); 46 qDebug("Decode string finished");
47 return result; 47 return result;
48} 48}
49 49
50QString AbstractMail::convert_String(const char*text) 50QString AbstractMail::convert_String(const char*text)
51{ 51{
52#if 0
53 size_t index = 0; 52 size_t index = 0;
54 char*res = 0; 53 char*res = 0;
55 54
56 qDebug("encode start %s",text); 55 /* attention - doesn't work with arm systems! */
57 /* attention - doesn't work with arm systems! */
58 int err = mailmime_encoded_phrase_parse("iso-8859-1", 56 int err = mailmime_encoded_phrase_parse("iso-8859-1",
59 text, strlen(text),&index, "iso-8859-1",&res); 57 text, strlen(text),&index, "iso-8859-1",&res);
60 qDebug("encode end");
61 if (err != MAILIMF_NO_ERROR) { 58 if (err != MAILIMF_NO_ERROR) {
62 if (res) free(res); 59 if (res) free(res);
63 return QString(text); 60 return QString(text);
64 } 61 }
65 QString result(res); 62 if (res) {
66 free(res); 63 QString result(res);
67 return result; 64 free(res);
68#else 65 return result;
69 return QString(text); 66 }
70#endif 67 return QString(text);
71} 68}
diff --git a/noncore/net/mail/imapwrapper.cpp b/noncore/net/mail/imapwrapper.cpp
index 8a86c95..838300a 100644
--- a/noncore/net/mail/imapwrapper.cpp
+++ b/noncore/net/mail/imapwrapper.cpp
@@ -257,49 +257,50 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
257 mFlags.setBit(FLAG_DELETED); 257 mFlags.setBit(FLAG_DELETED);
258 break; 258 break;
259 case MAILIMAP_FLAG_SEEN: /* \Seen flag */ 259 case MAILIMAP_FLAG_SEEN: /* \Seen flag */
260 mFlags.setBit(FLAG_SEEN); 260 mFlags.setBit(FLAG_SEEN);
261 break; 261 break;
262 case MAILIMAP_FLAG_DRAFT: /* \Draft flag */ 262 case MAILIMAP_FLAG_DRAFT: /* \Draft flag */
263 mFlags.setBit(FLAG_DRAFT); 263 mFlags.setBit(FLAG_DRAFT);
264 break; 264 break;
265 case MAILIMAP_FLAG_KEYWORD: /* keyword flag */ 265 case MAILIMAP_FLAG_KEYWORD: /* keyword flag */
266 break; 266 break;
267 case MAILIMAP_FLAG_EXTENSION: /* \extension flag */ 267 case MAILIMAP_FLAG_EXTENSION: /* \extension flag */
268 break; 268 break;
269 default: 269 default:
270 break; 270 break;
271 } 271 }
272 } else if (cflag->fl_type==MAILIMAP_FLAG_FETCH_RECENT) { 272 } else if (cflag->fl_type==MAILIMAP_FLAG_FETCH_RECENT) {
273 mFlags.setBit(FLAG_RECENT); 273 mFlags.setBit(FLAG_RECENT);
274 } 274 }
275 } 275 }
276 continue; 276 continue;
277 } 277 }
278 if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) { 278 if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) {
279 mailimap_envelope * head = item->att_data.att_static->att_data.att_env; 279 mailimap_envelope * head = item->att_data.att_static->att_data.att_env;
280 m->setDate(head->env_date); 280 m->setDate(head->env_date);
281 m->setSubject(head->env_subject); 281 m->setSubject(convert_String((const char*)head->env_subject));
282 //m->setSubject(head->env_subject);
282 if (head->env_from!=NULL) { 283 if (head->env_from!=NULL) {
283 addresslist = address_list_to_stringlist(head->env_from->frm_list); 284 addresslist = address_list_to_stringlist(head->env_from->frm_list);
284 if (addresslist.count()) { 285 if (addresslist.count()) {
285 m->setFrom(addresslist.first()); 286 m->setFrom(addresslist.first());
286 } 287 }
287 } 288 }
288 if (head->env_to!=NULL) { 289 if (head->env_to!=NULL) {
289 addresslist = address_list_to_stringlist(head->env_to->to_list); 290 addresslist = address_list_to_stringlist(head->env_to->to_list);
290 m->setTo(addresslist); 291 m->setTo(addresslist);
291 } 292 }
292 if (head->env_cc!=NULL) { 293 if (head->env_cc!=NULL) {
293 addresslist = address_list_to_stringlist(head->env_cc->cc_list); 294 addresslist = address_list_to_stringlist(head->env_cc->cc_list);
294 m->setCC(addresslist); 295 m->setCC(addresslist);
295 } 296 }
296 if (head->env_bcc!=NULL) { 297 if (head->env_bcc!=NULL) {
297 addresslist = address_list_to_stringlist(head->env_bcc->bcc_list); 298 addresslist = address_list_to_stringlist(head->env_bcc->bcc_list);
298 m->setBcc(addresslist); 299 m->setBcc(addresslist);
299 } 300 }
300 if (head->env_reply_to!=NULL) { 301 if (head->env_reply_to!=NULL) {
301 addresslist = address_list_to_stringlist(head->env_reply_to->rt_list); 302 addresslist = address_list_to_stringlist(head->env_reply_to->rt_list);
302 if (addresslist.count()) { 303 if (addresslist.count()) {
303 m->setReplyto(addresslist.first()); 304 m->setReplyto(addresslist.first());
304 } 305 }
305 } 306 }
@@ -413,49 +414,50 @@ void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_1part*mai
413 break; 414 break;
414 default: 415 default:
415 break; 416 break;
416 } 417 }
417 418
418 return; 419 return;
419} 420}
420 421
421QStringList IMAPwrapper::address_list_to_stringlist(clist*list) 422QStringList IMAPwrapper::address_list_to_stringlist(clist*list)
422{ 423{
423 QStringList l; 424 QStringList l;
424 QString from; 425 QString from;
425 bool named_from; 426 bool named_from;
426 clistcell *current = NULL; 427 clistcell *current = NULL;
427 mailimap_address * current_address=NULL; 428 mailimap_address * current_address=NULL;
428 if (!list) { 429 if (!list) {
429 return l; 430 return l;
430 } 431 }
431 unsigned int count = 0; 432 unsigned int count = 0;
432 for (current=clist_begin(list);current!= NULL;current=clist_next(current)) { 433 for (current=clist_begin(list);current!= NULL;current=clist_next(current)) {
433 from = ""; 434 from = "";
434 named_from = false; 435 named_from = false;
435 current_address=(mailimap_address*)current->data; 436 current_address=(mailimap_address*)current->data;
436 if (current_address->ad_personal_name){ 437 if (current_address->ad_personal_name){
437 from+=QString(current_address->ad_personal_name); 438 from+=convert_String((const char*)current_address->ad_personal_name);
439 //from+=QString(current_address->ad_personal_name);
438 from+=" "; 440 from+=" ";
439 named_from = true; 441 named_from = true;
440 } 442 }
441 if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) { 443 if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) {
442 from+="<"; 444 from+="<";
443 } 445 }
444 if (current_address->ad_mailbox_name) { 446 if (current_address->ad_mailbox_name) {
445 from+=QString(current_address->ad_mailbox_name); 447 from+=QString(current_address->ad_mailbox_name);
446 from+="@"; 448 from+="@";
447 } 449 }
448 if (current_address->ad_host_name) { 450 if (current_address->ad_host_name) {
449 from+=QString(current_address->ad_host_name); 451 from+=QString(current_address->ad_host_name);
450 } 452 }
451 if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) { 453 if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) {
452 from+=">"; 454 from+=">";
453 } 455 }
454 l.append(QString(from)); 456 l.append(QString(from));
455 if (++count > 99) { 457 if (++count > 99) {
456 break; 458 break;
457 } 459 }
458 } 460 }
459 return l; 461 return l;
460} 462}
461 463
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.cpp b/noncore/net/mail/libmailwrapper/abstractmail.cpp
index b7e5eaa..3d76c96 100644
--- a/noncore/net/mail/libmailwrapper/abstractmail.cpp
+++ b/noncore/net/mail/libmailwrapper/abstractmail.cpp
@@ -28,44 +28,41 @@ encodedString* AbstractMail::decode_String(const encodedString*text,const QStrin
28 int mimetype = MAILMIME_MECHANISM_7BIT; 28 int mimetype = MAILMIME_MECHANISM_7BIT;
29 if (enc.lower()=="quoted-printable") { 29 if (enc.lower()=="quoted-printable") {
30 mimetype = MAILMIME_MECHANISM_QUOTED_PRINTABLE; 30 mimetype = MAILMIME_MECHANISM_QUOTED_PRINTABLE;
31 } else if (enc.lower()=="base64") { 31 } else if (enc.lower()=="base64") {
32 mimetype = MAILMIME_MECHANISM_BASE64; 32 mimetype = MAILMIME_MECHANISM_BASE64;
33 } else if (enc.lower()=="8bit") { 33 } else if (enc.lower()=="8bit") {
34 mimetype = MAILMIME_MECHANISM_8BIT; 34 mimetype = MAILMIME_MECHANISM_8BIT;
35 } else if (enc.lower()=="binary") { 35 } else if (enc.lower()=="binary") {
36 mimetype = MAILMIME_MECHANISM_BINARY; 36 mimetype = MAILMIME_MECHANISM_BINARY;
37 } 37 }
38 38
39 int err = mailmime_part_parse(text->Content(),text->Length(),&index,mimetype, 39 int err = mailmime_part_parse(text->Content(),text->Length(),&index,mimetype,
40 &result_text,&target_length); 40 &result_text,&target_length);
41 41
42 encodedString* result = new encodedString(); 42 encodedString* result = new encodedString();
43 if (err == MAILIMF_NO_ERROR) { 43 if (err == MAILIMF_NO_ERROR) {
44 result->setContent(result_text,target_length); 44 result->setContent(result_text,target_length);
45 } 45 }
46 qDebug("Decode string finished"); 46 qDebug("Decode string finished");
47 return result; 47 return result;
48} 48}
49 49
50QString AbstractMail::convert_String(const char*text) 50QString AbstractMail::convert_String(const char*text)
51{ 51{
52#if 0
53 size_t index = 0; 52 size_t index = 0;
54 char*res = 0; 53 char*res = 0;
55 54
56 qDebug("encode start %s",text); 55 /* attention - doesn't work with arm systems! */
57 /* attention - doesn't work with arm systems! */
58 int err = mailmime_encoded_phrase_parse("iso-8859-1", 56 int err = mailmime_encoded_phrase_parse("iso-8859-1",
59 text, strlen(text),&index, "iso-8859-1",&res); 57 text, strlen(text),&index, "iso-8859-1",&res);
60 qDebug("encode end");
61 if (err != MAILIMF_NO_ERROR) { 58 if (err != MAILIMF_NO_ERROR) {
62 if (res) free(res); 59 if (res) free(res);
63 return QString(text); 60 return QString(text);
64 } 61 }
65 QString result(res); 62 if (res) {
66 free(res); 63 QString result(res);
67 return result; 64 free(res);
68#else 65 return result;
69 return QString(text); 66 }
70#endif 67 return QString(text);
71} 68}
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
index 8a86c95..838300a 100644
--- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
@@ -257,49 +257,50 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
257 mFlags.setBit(FLAG_DELETED); 257 mFlags.setBit(FLAG_DELETED);
258 break; 258 break;
259 case MAILIMAP_FLAG_SEEN: /* \Seen flag */ 259 case MAILIMAP_FLAG_SEEN: /* \Seen flag */
260 mFlags.setBit(FLAG_SEEN); 260 mFlags.setBit(FLAG_SEEN);
261 break; 261 break;
262 case MAILIMAP_FLAG_DRAFT: /* \Draft flag */ 262 case MAILIMAP_FLAG_DRAFT: /* \Draft flag */
263 mFlags.setBit(FLAG_DRAFT); 263 mFlags.setBit(FLAG_DRAFT);
264 break; 264 break;
265 case MAILIMAP_FLAG_KEYWORD: /* keyword flag */ 265 case MAILIMAP_FLAG_KEYWORD: /* keyword flag */
266 break; 266 break;
267 case MAILIMAP_FLAG_EXTENSION: /* \extension flag */ 267 case MAILIMAP_FLAG_EXTENSION: /* \extension flag */
268 break; 268 break;
269 default: 269 default:
270 break; 270 break;
271 } 271 }
272 } else if (cflag->fl_type==MAILIMAP_FLAG_FETCH_RECENT) { 272 } else if (cflag->fl_type==MAILIMAP_FLAG_FETCH_RECENT) {
273 mFlags.setBit(FLAG_RECENT); 273 mFlags.setBit(FLAG_RECENT);
274 } 274 }
275 } 275 }
276 continue; 276 continue;
277 } 277 }
278 if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) { 278 if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) {
279 mailimap_envelope * head = item->att_data.att_static->att_data.att_env; 279 mailimap_envelope * head = item->att_data.att_static->att_data.att_env;
280 m->setDate(head->env_date); 280 m->setDate(head->env_date);
281 m->setSubject(head->env_subject); 281 m->setSubject(convert_String((const char*)head->env_subject));
282 //m->setSubject(head->env_subject);
282 if (head->env_from!=NULL) { 283 if (head->env_from!=NULL) {
283 addresslist = address_list_to_stringlist(head->env_from->frm_list); 284 addresslist = address_list_to_stringlist(head->env_from->frm_list);
284 if (addresslist.count()) { 285 if (addresslist.count()) {
285 m->setFrom(addresslist.first()); 286 m->setFrom(addresslist.first());
286 } 287 }
287 } 288 }
288 if (head->env_to!=NULL) { 289 if (head->env_to!=NULL) {
289 addresslist = address_list_to_stringlist(head->env_to->to_list); 290 addresslist = address_list_to_stringlist(head->env_to->to_list);
290 m->setTo(addresslist); 291 m->setTo(addresslist);
291 } 292 }
292 if (head->env_cc!=NULL) { 293 if (head->env_cc!=NULL) {
293 addresslist = address_list_to_stringlist(head->env_cc->cc_list); 294 addresslist = address_list_to_stringlist(head->env_cc->cc_list);
294 m->setCC(addresslist); 295 m->setCC(addresslist);
295 } 296 }
296 if (head->env_bcc!=NULL) { 297 if (head->env_bcc!=NULL) {
297 addresslist = address_list_to_stringlist(head->env_bcc->bcc_list); 298 addresslist = address_list_to_stringlist(head->env_bcc->bcc_list);
298 m->setBcc(addresslist); 299 m->setBcc(addresslist);
299 } 300 }
300 if (head->env_reply_to!=NULL) { 301 if (head->env_reply_to!=NULL) {
301 addresslist = address_list_to_stringlist(head->env_reply_to->rt_list); 302 addresslist = address_list_to_stringlist(head->env_reply_to->rt_list);
302 if (addresslist.count()) { 303 if (addresslist.count()) {
303 m->setReplyto(addresslist.first()); 304 m->setReplyto(addresslist.first());
304 } 305 }
305 } 306 }
@@ -413,49 +414,50 @@ void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_1part*mai
413 break; 414 break;
414 default: 415 default:
415 break; 416 break;
416 } 417 }
417 418
418 return; 419 return;
419} 420}
420 421
421QStringList IMAPwrapper::address_list_to_stringlist(clist*list) 422QStringList IMAPwrapper::address_list_to_stringlist(clist*list)
422{ 423{
423 QStringList l; 424 QStringList l;
424 QString from; 425 QString from;
425 bool named_from; 426 bool named_from;
426 clistcell *current = NULL; 427 clistcell *current = NULL;
427 mailimap_address * current_address=NULL; 428 mailimap_address * current_address=NULL;
428 if (!list) { 429 if (!list) {
429 return l; 430 return l;
430 } 431 }
431 unsigned int count = 0; 432 unsigned int count = 0;
432 for (current=clist_begin(list);current!= NULL;current=clist_next(current)) { 433 for (current=clist_begin(list);current!= NULL;current=clist_next(current)) {
433 from = ""; 434 from = "";
434 named_from = false; 435 named_from = false;
435 current_address=(mailimap_address*)current->data; 436 current_address=(mailimap_address*)current->data;
436 if (current_address->ad_personal_name){ 437 if (current_address->ad_personal_name){
437 from+=QString(current_address->ad_personal_name); 438 from+=convert_String((const char*)current_address->ad_personal_name);
439 //from+=QString(current_address->ad_personal_name);
438 from+=" "; 440 from+=" ";
439 named_from = true; 441 named_from = true;
440 } 442 }
441 if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) { 443 if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) {
442 from+="<"; 444 from+="<";
443 } 445 }
444 if (current_address->ad_mailbox_name) { 446 if (current_address->ad_mailbox_name) {
445 from+=QString(current_address->ad_mailbox_name); 447 from+=QString(current_address->ad_mailbox_name);
446 from+="@"; 448 from+="@";
447 } 449 }
448 if (current_address->ad_host_name) { 450 if (current_address->ad_host_name) {
449 from+=QString(current_address->ad_host_name); 451 from+=QString(current_address->ad_host_name);
450 } 452 }
451 if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) { 453 if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) {
452 from+=">"; 454 from+=">";
453 } 455 }
454 l.append(QString(from)); 456 l.append(QString(from));
455 if (++count > 99) { 457 if (++count > 99) {
456 break; 458 break;
457 } 459 }
458 } 460 }
459 return l; 461 return l;
460} 462}
461 463