-rw-r--r-- | noncore/net/mail/ProgrammersDoc/ReceivingMails.dia | bin | 3086 -> 3158 bytes | |||
-rw-r--r-- | noncore/net/mail/imapwrapper.cpp | 29 | ||||
-rw-r--r-- | noncore/net/mail/imapwrapper.h | 2 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.cpp | 29 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.h | 2 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mailtypes.h | 5 | ||||
-rw-r--r-- | noncore/net/mail/mailtypes.h | 5 |
7 files changed, 42 insertions, 30 deletions
diff --git a/noncore/net/mail/ProgrammersDoc/ReceivingMails.dia b/noncore/net/mail/ProgrammersDoc/ReceivingMails.dia index 08c6434..2e3033e 100644 --- a/noncore/net/mail/ProgrammersDoc/ReceivingMails.dia +++ b/noncore/net/mail/ProgrammersDoc/ReceivingMails.dia | |||
Binary files differ | |||
diff --git a/noncore/net/mail/imapwrapper.cpp b/noncore/net/mail/imapwrapper.cpp index 5ce140e..eae85a7 100644 --- a/noncore/net/mail/imapwrapper.cpp +++ b/noncore/net/mail/imapwrapper.cpp | |||
@@ -196,37 +196,33 @@ QList<IMAPFolder>* IMAPwrapper::listFolders() | |||
196 | if (temp.lower()=="inbox") | 196 | if (temp.lower()=="inbox") |
197 | continue; | 197 | continue; |
198 | folders->append(new IMAPFolder(temp)); | 198 | folders->append(new IMAPFolder(temp)); |
199 | 199 | ||
200 | } | 200 | } |
201 | } else { | 201 | } else { |
202 | qDebug("error fetching folders %s",m_imap->response); | 202 | qDebug("error fetching folders %s",m_imap->response); |
203 | } | 203 | } |
204 | mailimap_list_result_free( result ); | 204 | mailimap_list_result_free( result ); |
205 | return folders; | 205 | return folders; |
206 | } | 206 | } |
207 | 207 | ||
208 | RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | 208 | RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) |
209 | { | 209 | { |
210 | RecMail * m = 0; | 210 | RecMail * m = 0; |
211 | mailimap_msg_att_item *item=0; | 211 | mailimap_msg_att_item *item=0; |
212 | bool named_from = false; | 212 | clistcell *current,*c,*cf; |
213 | QString from,date,subject; | ||
214 | date = from = subject = ""; | ||
215 | clistcell *current,*c,*cf, *current_from = NULL; | ||
216 | mailimap_address * current_address = NULL; | ||
217 | mailimap_msg_att_dynamic*flist; | 213 | mailimap_msg_att_dynamic*flist; |
218 | mailimap_flag_fetch*cflag; | 214 | mailimap_flag_fetch*cflag; |
219 | QBitArray mFlags(7); | 215 | QBitArray mFlags(7); |
220 | QStringList addresslist; | 216 | QStringList addresslist; |
221 | 217 | ||
222 | if (!m_att) { | 218 | if (!m_att) { |
223 | return m; | 219 | return m; |
224 | } | 220 | } |
225 | 221 | ||
226 | c = clist_begin(m_att->list); | 222 | c = clist_begin(m_att->list); |
227 | while ( c ) { | 223 | while ( c ) { |
228 | current = c; | 224 | current = c; |
229 | c = c->next; | 225 | c = c->next; |
230 | item = (mailimap_msg_att_item*)current->data; | 226 | item = (mailimap_msg_att_item*)current->data; |
231 | if (item->type!=MAILIMAP_MSG_ATT_ITEM_STATIC) { | 227 | if (item->type!=MAILIMAP_MSG_ATT_ITEM_STATIC) { |
232 | flist = (mailimap_msg_att_dynamic*)item->msg_att_dyn; | 228 | flist = (mailimap_msg_att_dynamic*)item->msg_att_dyn; |
@@ -258,60 +254,63 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | |||
258 | case MAILIMAP_FLAG_EXTENSION: /* \extension flag */ | 254 | case MAILIMAP_FLAG_EXTENSION: /* \extension flag */ |
259 | break; | 255 | break; |
260 | default: | 256 | default: |
261 | break; | 257 | break; |
262 | } | 258 | } |
263 | } else if (cflag->type==MAILIMAP_FLAG_FETCH_RECENT) { | 259 | } else if (cflag->type==MAILIMAP_FLAG_FETCH_RECENT) { |
264 | mFlags.setBit(FLAG_RECENT); | 260 | mFlags.setBit(FLAG_RECENT); |
265 | } | 261 | } |
266 | cf = cf->next; | 262 | cf = cf->next; |
267 | } | 263 | } |
268 | continue; | 264 | continue; |
269 | } | 265 | } |
270 | if ( item->msg_att_static->type == MAILIMAP_MSG_ATT_RFC822_HEADER ) { | 266 | if ( item->msg_att_static->type == MAILIMAP_MSG_ATT_RFC822_HEADER ) { |
271 | qDebug( "header: \n%s", item->msg_att_static->rfc822_header ); | 267 | qDebug( "header: \n%s", item->msg_att_static->rfc822_header ); |
272 | } else if (item->msg_att_static->type==MAILIMAP_MSG_ATT_ENVELOPE) { | 268 | } else if (item->msg_att_static->type==MAILIMAP_MSG_ATT_ENVELOPE) { |
273 | mailimap_envelope * head = item->msg_att_static->env; | 269 | mailimap_envelope * head = item->msg_att_static->env; |
274 | date = head->date; | ||
275 | subject = head->subject; | ||
276 | m = new RecMail(); | 270 | m = new RecMail(); |
271 | m->setDate(head->date); | ||
272 | m->setSubject(head->subject); | ||
277 | if (head->from!=NULL) { | 273 | if (head->from!=NULL) { |
278 | addresslist = address_list_to_stringlist(head->from->list); | 274 | addresslist = address_list_to_stringlist(head->from->list); |
279 | if (addresslist.count()) { | 275 | if (addresslist.count()) { |
280 | from = addresslist.first(); | 276 | m->setFrom(addresslist.first()); |
281 | } | 277 | } |
282 | } | 278 | } |
283 | if (head->to!=NULL) { | 279 | if (head->to!=NULL) { |
284 | addresslist = address_list_to_stringlist(head->to->list); | 280 | addresslist = address_list_to_stringlist(head->to->list); |
285 | m->setTo(addresslist); | 281 | m->setTo(addresslist); |
286 | } | 282 | } |
287 | if (head->cc!=NULL) { | 283 | if (head->cc!=NULL) { |
288 | addresslist = address_list_to_stringlist(head->cc->list); | 284 | addresslist = address_list_to_stringlist(head->cc->list); |
289 | m->setCC(addresslist); | 285 | m->setCC(addresslist); |
290 | } | 286 | } |
291 | if (head->bcc!=NULL) { | 287 | if (head->bcc!=NULL) { |
292 | addresslist = address_list_to_stringlist(head->bcc->list); | 288 | addresslist = address_list_to_stringlist(head->bcc->list); |
293 | m->setBcc(addresslist); | 289 | m->setBcc(addresslist); |
294 | } | 290 | } |
295 | m->setSubject(subject); | 291 | if (head->reply_to!=NULL) { |
296 | m->setFrom(from); | 292 | addresslist = address_list_to_stringlist(head->bcc->list); |
297 | m->setDate(date); | 293 | if (addresslist.count()) { |
294 | m->setReplyto(addresslist.first()); | ||
295 | } | ||
296 | } | ||
298 | m->setMsgid(QString(head->message_id)); | 297 | m->setMsgid(QString(head->message_id)); |
299 | qDebug("header: \nFrom: %s\nSubject: %s\nDate: %s\nMsgid: %s", | 298 | qDebug("header: \nFrom: %s\nSubject: %s\nDate: %s\nMsgid: %s", |
300 | from.latin1(), | 299 | m->getFrom().latin1(), |
301 | subject.latin1(),date.latin1(),m->Msgid().latin1()); | 300 | m->getSubject().latin1(),m->getDate().latin1(),m->Msgid().latin1()); |
302 | } else if (item->msg_att_static->type==MAILIMAP_MSG_ATT_INTERNALDATE) { | 301 | } else if (item->msg_att_static->type==MAILIMAP_MSG_ATT_INTERNALDATE) { |
303 | mailimap_date_time*d = item->msg_att_static->internal_date; | 302 | mailimap_date_time*d = item->msg_att_static->internal_date; |
304 | QDateTime da(QDate(d->year,d->month,d->day),QTime(d->hour,d->min,d->sec)); | 303 | QDateTime da(QDate(d->year,d->month,d->day),QTime(d->hour,d->min,d->sec)); |
305 | qDebug("%i %i %i - %i %i %i",d->year,d->month,d->day,d->hour,d->min,d->sec); | 304 | qDebug("%i %i %i - %i %i %i",d->year,d->month,d->day,d->hour,d->min,d->sec); |
306 | qDebug(da.toString()); | 305 | qDebug(da.toString()); |
307 | } else { | 306 | } else { |
308 | qDebug("Another type"); | 307 | qDebug("Another type"); |
309 | } | 308 | } |
310 | } | 309 | } |
311 | /* msg is already deleted */ | 310 | /* msg is already deleted */ |
312 | if (mFlags.testBit(FLAG_DELETED) && m) { | 311 | if (mFlags.testBit(FLAG_DELETED) && m) { |
313 | delete m; | 312 | delete m; |
314 | m = 0; | 313 | m = 0; |
315 | } | 314 | } |
316 | if (m) { | 315 | if (m) { |
317 | m->setFlags(mFlags); | 316 | m->setFlags(mFlags); |
@@ -426,43 +425,47 @@ void IMAPwrapper::fillPlainBody(const RecMail&mail,RecBody&target_body, mailimap | |||
426 | clist_free(result); | 425 | clist_free(result); |
427 | target_body.setBodytext(body); | 426 | target_body.setBodytext(body); |
428 | return; | 427 | return; |
429 | } | 428 | } |
430 | 429 | ||
431 | QStringList IMAPwrapper::address_list_to_stringlist(clist*list) | 430 | QStringList IMAPwrapper::address_list_to_stringlist(clist*list) |
432 | { | 431 | { |
433 | QStringList l; | 432 | QStringList l; |
434 | QString from; | 433 | QString from; |
435 | bool named_from; | 434 | bool named_from; |
436 | clistcell *current = NULL; | 435 | clistcell *current = NULL; |
437 | mailimap_address * current_address=NULL; | 436 | mailimap_address * current_address=NULL; |
438 | if (!list) { | 437 | if (!list) { |
439 | return l; | 438 | return l; |
440 | } | 439 | } |
441 | current = clist_begin(list); | 440 | current = clist_begin(list); |
441 | unsigned int count = 0; | ||
442 | while (current!= NULL) { | 442 | while (current!= NULL) { |
443 | from = ""; | 443 | from = ""; |
444 | named_from = false; | 444 | named_from = false; |
445 | current_address=(mailimap_address*)current->data; | 445 | current_address=(mailimap_address*)current->data; |
446 | current = current->next; | 446 | current = current->next; |
447 | if (current_address->personal_name){ | 447 | if (current_address->personal_name){ |
448 | from+=QString(current_address->personal_name); | 448 | from+=QString(current_address->personal_name); |
449 | from+=" "; | 449 | from+=" "; |
450 | named_from = true; | 450 | named_from = true; |
451 | } | 451 | } |
452 | if (named_from && (current_address->mailbox_name || current_address->host_name)) { | 452 | if (named_from && (current_address->mailbox_name || current_address->host_name)) { |
453 | from+="<"; | 453 | from+="<"; |
454 | } | 454 | } |
455 | if (current_address->mailbox_name) { | 455 | if (current_address->mailbox_name) { |
456 | from+=QString(current_address->mailbox_name); | 456 | from+=QString(current_address->mailbox_name); |
457 | from+="@"; | 457 | from+="@"; |
458 | } | 458 | } |
459 | if (current_address->host_name) { | 459 | if (current_address->host_name) { |
460 | from+=QString(current_address->host_name); | 460 | from+=QString(current_address->host_name); |
461 | } | 461 | } |
462 | if (named_from && (current_address->mailbox_name || current_address->host_name)) { | 462 | if (named_from && (current_address->mailbox_name || current_address->host_name)) { |
463 | from+=">"; | 463 | from+=">"; |
464 | } | 464 | } |
465 | l.append(QString(from)); | 465 | l.append(QString(from)); |
466 | if (++count > 99) { | ||
467 | break; | ||
468 | } | ||
466 | } | 469 | } |
467 | return l; | 470 | return l; |
468 | } | 471 | } |
diff --git a/noncore/net/mail/imapwrapper.h b/noncore/net/mail/imapwrapper.h index 6565896..faab43c 100644 --- a/noncore/net/mail/imapwrapper.h +++ b/noncore/net/mail/imapwrapper.h | |||
@@ -15,24 +15,24 @@ class IMAPwrapper : public QObject | |||
15 | Q_OBJECT | 15 | Q_OBJECT |
16 | 16 | ||
17 | public: | 17 | public: |
18 | IMAPwrapper( IMAPaccount *a ); | 18 | IMAPwrapper( IMAPaccount *a ); |
19 | virtual ~IMAPwrapper(); | 19 | virtual ~IMAPwrapper(); |
20 | QList<IMAPFolder>* listFolders(); | 20 | QList<IMAPFolder>* listFolders(); |
21 | void listMessages(const QString & mailbox,QList<RecMail>&target ); | 21 | void listMessages(const QString & mailbox,QList<RecMail>&target ); |
22 | RecBody fetchBody(const RecMail&mail); | 22 | RecBody fetchBody(const RecMail&mail); |
23 | static void imap_progress( size_t current, size_t maximum ); | 23 | static void imap_progress( size_t current, size_t maximum ); |
24 | 24 | ||
25 | protected: | 25 | protected: |
26 | RecMail*parse_list_result(mailimap_msg_att*); | 26 | RecMail*parse_list_result(mailimap_msg_att*); |
27 | void login(); | 27 | void login(); |
28 | void logout(); | 28 | void logout(); |
29 | void searchBodyText(const RecMail&mail,mailimap_body_type_1part*mailDescription,RecBody&target_body); | 29 | void searchBodyText(const RecMail&mail,mailimap_body_type_1part*mailDescription,RecBody&target_body); |
30 | void fillPlainBody(const RecMail&mail,RecBody&target_body, mailimap_body_type_text * text_body); | 30 | void fillPlainBody(const RecMail&mail,RecBody&target_body, mailimap_body_type_text * text_body); |
31 | QStringList address_list_to_stringlist(clist*list); | 31 | static QStringList address_list_to_stringlist(clist*list); |
32 | 32 | ||
33 | private: | 33 | private: |
34 | IMAPaccount *account; | 34 | IMAPaccount *account; |
35 | mailimap *m_imap; | 35 | mailimap *m_imap; |
36 | }; | 36 | }; |
37 | 37 | ||
38 | #endif | 38 | #endif |
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp index 5ce140e..eae85a7 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp | |||
@@ -196,37 +196,33 @@ QList<IMAPFolder>* IMAPwrapper::listFolders() | |||
196 | if (temp.lower()=="inbox") | 196 | if (temp.lower()=="inbox") |
197 | continue; | 197 | continue; |
198 | folders->append(new IMAPFolder(temp)); | 198 | folders->append(new IMAPFolder(temp)); |
199 | 199 | ||
200 | } | 200 | } |
201 | } else { | 201 | } else { |
202 | qDebug("error fetching folders %s",m_imap->response); | 202 | qDebug("error fetching folders %s",m_imap->response); |
203 | } | 203 | } |
204 | mailimap_list_result_free( result ); | 204 | mailimap_list_result_free( result ); |
205 | return folders; | 205 | return folders; |
206 | } | 206 | } |
207 | 207 | ||
208 | RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | 208 | RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) |
209 | { | 209 | { |
210 | RecMail * m = 0; | 210 | RecMail * m = 0; |
211 | mailimap_msg_att_item *item=0; | 211 | mailimap_msg_att_item *item=0; |
212 | bool named_from = false; | 212 | clistcell *current,*c,*cf; |
213 | QString from,date,subject; | ||
214 | date = from = subject = ""; | ||
215 | clistcell *current,*c,*cf, *current_from = NULL; | ||
216 | mailimap_address * current_address = NULL; | ||
217 | mailimap_msg_att_dynamic*flist; | 213 | mailimap_msg_att_dynamic*flist; |
218 | mailimap_flag_fetch*cflag; | 214 | mailimap_flag_fetch*cflag; |
219 | QBitArray mFlags(7); | 215 | QBitArray mFlags(7); |
220 | QStringList addresslist; | 216 | QStringList addresslist; |
221 | 217 | ||
222 | if (!m_att) { | 218 | if (!m_att) { |
223 | return m; | 219 | return m; |
224 | } | 220 | } |
225 | 221 | ||
226 | c = clist_begin(m_att->list); | 222 | c = clist_begin(m_att->list); |
227 | while ( c ) { | 223 | while ( c ) { |
228 | current = c; | 224 | current = c; |
229 | c = c->next; | 225 | c = c->next; |
230 | item = (mailimap_msg_att_item*)current->data; | 226 | item = (mailimap_msg_att_item*)current->data; |
231 | if (item->type!=MAILIMAP_MSG_ATT_ITEM_STATIC) { | 227 | if (item->type!=MAILIMAP_MSG_ATT_ITEM_STATIC) { |
232 | flist = (mailimap_msg_att_dynamic*)item->msg_att_dyn; | 228 | flist = (mailimap_msg_att_dynamic*)item->msg_att_dyn; |
@@ -258,60 +254,63 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | |||
258 | case MAILIMAP_FLAG_EXTENSION: /* \extension flag */ | 254 | case MAILIMAP_FLAG_EXTENSION: /* \extension flag */ |
259 | break; | 255 | break; |
260 | default: | 256 | default: |
261 | break; | 257 | break; |
262 | } | 258 | } |
263 | } else if (cflag->type==MAILIMAP_FLAG_FETCH_RECENT) { | 259 | } else if (cflag->type==MAILIMAP_FLAG_FETCH_RECENT) { |
264 | mFlags.setBit(FLAG_RECENT); | 260 | mFlags.setBit(FLAG_RECENT); |
265 | } | 261 | } |
266 | cf = cf->next; | 262 | cf = cf->next; |
267 | } | 263 | } |
268 | continue; | 264 | continue; |
269 | } | 265 | } |
270 | if ( item->msg_att_static->type == MAILIMAP_MSG_ATT_RFC822_HEADER ) { | 266 | if ( item->msg_att_static->type == MAILIMAP_MSG_ATT_RFC822_HEADER ) { |
271 | qDebug( "header: \n%s", item->msg_att_static->rfc822_header ); | 267 | qDebug( "header: \n%s", item->msg_att_static->rfc822_header ); |
272 | } else if (item->msg_att_static->type==MAILIMAP_MSG_ATT_ENVELOPE) { | 268 | } else if (item->msg_att_static->type==MAILIMAP_MSG_ATT_ENVELOPE) { |
273 | mailimap_envelope * head = item->msg_att_static->env; | 269 | mailimap_envelope * head = item->msg_att_static->env; |
274 | date = head->date; | ||
275 | subject = head->subject; | ||
276 | m = new RecMail(); | 270 | m = new RecMail(); |
271 | m->setDate(head->date); | ||
272 | m->setSubject(head->subject); | ||
277 | if (head->from!=NULL) { | 273 | if (head->from!=NULL) { |
278 | addresslist = address_list_to_stringlist(head->from->list); | 274 | addresslist = address_list_to_stringlist(head->from->list); |
279 | if (addresslist.count()) { | 275 | if (addresslist.count()) { |
280 | from = addresslist.first(); | 276 | m->setFrom(addresslist.first()); |
281 | } | 277 | } |
282 | } | 278 | } |
283 | if (head->to!=NULL) { | 279 | if (head->to!=NULL) { |
284 | addresslist = address_list_to_stringlist(head->to->list); | 280 | addresslist = address_list_to_stringlist(head->to->list); |
285 | m->setTo(addresslist); | 281 | m->setTo(addresslist); |
286 | } | 282 | } |
287 | if (head->cc!=NULL) { | 283 | if (head->cc!=NULL) { |
288 | addresslist = address_list_to_stringlist(head->cc->list); | 284 | addresslist = address_list_to_stringlist(head->cc->list); |
289 | m->setCC(addresslist); | 285 | m->setCC(addresslist); |
290 | } | 286 | } |
291 | if (head->bcc!=NULL) { | 287 | if (head->bcc!=NULL) { |
292 | addresslist = address_list_to_stringlist(head->bcc->list); | 288 | addresslist = address_list_to_stringlist(head->bcc->list); |
293 | m->setBcc(addresslist); | 289 | m->setBcc(addresslist); |
294 | } | 290 | } |
295 | m->setSubject(subject); | 291 | if (head->reply_to!=NULL) { |
296 | m->setFrom(from); | 292 | addresslist = address_list_to_stringlist(head->bcc->list); |
297 | m->setDate(date); | 293 | if (addresslist.count()) { |
294 | m->setReplyto(addresslist.first()); | ||
295 | } | ||
296 | } | ||
298 | m->setMsgid(QString(head->message_id)); | 297 | m->setMsgid(QString(head->message_id)); |
299 | qDebug("header: \nFrom: %s\nSubject: %s\nDate: %s\nMsgid: %s", | 298 | qDebug("header: \nFrom: %s\nSubject: %s\nDate: %s\nMsgid: %s", |
300 | from.latin1(), | 299 | m->getFrom().latin1(), |
301 | subject.latin1(),date.latin1(),m->Msgid().latin1()); | 300 | m->getSubject().latin1(),m->getDate().latin1(),m->Msgid().latin1()); |
302 | } else if (item->msg_att_static->type==MAILIMAP_MSG_ATT_INTERNALDATE) { | 301 | } else if (item->msg_att_static->type==MAILIMAP_MSG_ATT_INTERNALDATE) { |
303 | mailimap_date_time*d = item->msg_att_static->internal_date; | 302 | mailimap_date_time*d = item->msg_att_static->internal_date; |
304 | QDateTime da(QDate(d->year,d->month,d->day),QTime(d->hour,d->min,d->sec)); | 303 | QDateTime da(QDate(d->year,d->month,d->day),QTime(d->hour,d->min,d->sec)); |
305 | qDebug("%i %i %i - %i %i %i",d->year,d->month,d->day,d->hour,d->min,d->sec); | 304 | qDebug("%i %i %i - %i %i %i",d->year,d->month,d->day,d->hour,d->min,d->sec); |
306 | qDebug(da.toString()); | 305 | qDebug(da.toString()); |
307 | } else { | 306 | } else { |
308 | qDebug("Another type"); | 307 | qDebug("Another type"); |
309 | } | 308 | } |
310 | } | 309 | } |
311 | /* msg is already deleted */ | 310 | /* msg is already deleted */ |
312 | if (mFlags.testBit(FLAG_DELETED) && m) { | 311 | if (mFlags.testBit(FLAG_DELETED) && m) { |
313 | delete m; | 312 | delete m; |
314 | m = 0; | 313 | m = 0; |
315 | } | 314 | } |
316 | if (m) { | 315 | if (m) { |
317 | m->setFlags(mFlags); | 316 | m->setFlags(mFlags); |
@@ -426,43 +425,47 @@ void IMAPwrapper::fillPlainBody(const RecMail&mail,RecBody&target_body, mailimap | |||
426 | clist_free(result); | 425 | clist_free(result); |
427 | target_body.setBodytext(body); | 426 | target_body.setBodytext(body); |
428 | return; | 427 | return; |
429 | } | 428 | } |
430 | 429 | ||
431 | QStringList IMAPwrapper::address_list_to_stringlist(clist*list) | 430 | QStringList IMAPwrapper::address_list_to_stringlist(clist*list) |
432 | { | 431 | { |
433 | QStringList l; | 432 | QStringList l; |
434 | QString from; | 433 | QString from; |
435 | bool named_from; | 434 | bool named_from; |
436 | clistcell *current = NULL; | 435 | clistcell *current = NULL; |
437 | mailimap_address * current_address=NULL; | 436 | mailimap_address * current_address=NULL; |
438 | if (!list) { | 437 | if (!list) { |
439 | return l; | 438 | return l; |
440 | } | 439 | } |
441 | current = clist_begin(list); | 440 | current = clist_begin(list); |
441 | unsigned int count = 0; | ||
442 | while (current!= NULL) { | 442 | while (current!= NULL) { |
443 | from = ""; | 443 | from = ""; |
444 | named_from = false; | 444 | named_from = false; |
445 | current_address=(mailimap_address*)current->data; | 445 | current_address=(mailimap_address*)current->data; |
446 | current = current->next; | 446 | current = current->next; |
447 | if (current_address->personal_name){ | 447 | if (current_address->personal_name){ |
448 | from+=QString(current_address->personal_name); | 448 | from+=QString(current_address->personal_name); |
449 | from+=" "; | 449 | from+=" "; |
450 | named_from = true; | 450 | named_from = true; |
451 | } | 451 | } |
452 | if (named_from && (current_address->mailbox_name || current_address->host_name)) { | 452 | if (named_from && (current_address->mailbox_name || current_address->host_name)) { |
453 | from+="<"; | 453 | from+="<"; |
454 | } | 454 | } |
455 | if (current_address->mailbox_name) { | 455 | if (current_address->mailbox_name) { |
456 | from+=QString(current_address->mailbox_name); | 456 | from+=QString(current_address->mailbox_name); |
457 | from+="@"; | 457 | from+="@"; |
458 | } | 458 | } |
459 | if (current_address->host_name) { | 459 | if (current_address->host_name) { |
460 | from+=QString(current_address->host_name); | 460 | from+=QString(current_address->host_name); |
461 | } | 461 | } |
462 | if (named_from && (current_address->mailbox_name || current_address->host_name)) { | 462 | if (named_from && (current_address->mailbox_name || current_address->host_name)) { |
463 | from+=">"; | 463 | from+=">"; |
464 | } | 464 | } |
465 | l.append(QString(from)); | 465 | l.append(QString(from)); |
466 | if (++count > 99) { | ||
467 | break; | ||
468 | } | ||
466 | } | 469 | } |
467 | return l; | 470 | return l; |
468 | } | 471 | } |
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.h b/noncore/net/mail/libmailwrapper/imapwrapper.h index 6565896..faab43c 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.h +++ b/noncore/net/mail/libmailwrapper/imapwrapper.h | |||
@@ -15,24 +15,24 @@ class IMAPwrapper : public QObject | |||
15 | Q_OBJECT | 15 | Q_OBJECT |
16 | 16 | ||
17 | public: | 17 | public: |
18 | IMAPwrapper( IMAPaccount *a ); | 18 | IMAPwrapper( IMAPaccount *a ); |
19 | virtual ~IMAPwrapper(); | 19 | virtual ~IMAPwrapper(); |
20 | QList<IMAPFolder>* listFolders(); | 20 | QList<IMAPFolder>* listFolders(); |
21 | void listMessages(const QString & mailbox,QList<RecMail>&target ); | 21 | void listMessages(const QString & mailbox,QList<RecMail>&target ); |
22 | RecBody fetchBody(const RecMail&mail); | 22 | RecBody fetchBody(const RecMail&mail); |
23 | static void imap_progress( size_t current, size_t maximum ); | 23 | static void imap_progress( size_t current, size_t maximum ); |
24 | 24 | ||
25 | protected: | 25 | protected: |
26 | RecMail*parse_list_result(mailimap_msg_att*); | 26 | RecMail*parse_list_result(mailimap_msg_att*); |
27 | void login(); | 27 | void login(); |
28 | void logout(); | 28 | void logout(); |
29 | void searchBodyText(const RecMail&mail,mailimap_body_type_1part*mailDescription,RecBody&target_body); | 29 | void searchBodyText(const RecMail&mail,mailimap_body_type_1part*mailDescription,RecBody&target_body); |
30 | void fillPlainBody(const RecMail&mail,RecBody&target_body, mailimap_body_type_text * text_body); | 30 | void fillPlainBody(const RecMail&mail,RecBody&target_body, mailimap_body_type_text * text_body); |
31 | QStringList address_list_to_stringlist(clist*list); | 31 | static QStringList address_list_to_stringlist(clist*list); |
32 | 32 | ||
33 | private: | 33 | private: |
34 | IMAPaccount *account; | 34 | IMAPaccount *account; |
35 | mailimap *m_imap; | 35 | mailimap *m_imap; |
36 | }; | 36 | }; |
37 | 37 | ||
38 | #endif | 38 | #endif |
diff --git a/noncore/net/mail/libmailwrapper/mailtypes.h b/noncore/net/mail/libmailwrapper/mailtypes.h index c8d533a..6d6b080 100644 --- a/noncore/net/mail/libmailwrapper/mailtypes.h +++ b/noncore/net/mail/libmailwrapper/mailtypes.h | |||
@@ -31,44 +31,47 @@ public: | |||
31 | RecMail(); | 31 | RecMail(); |
32 | RecMail(const RecMail&old); | 32 | RecMail(const RecMail&old); |
33 | virtual ~RecMail(){} | 33 | virtual ~RecMail(){} |
34 | 34 | ||
35 | const int getNumber()const{return msg_number;} | 35 | const int getNumber()const{return msg_number;} |
36 | void setNumber(int number){msg_number=number;} | 36 | void setNumber(int number){msg_number=number;} |
37 | const QString&getDate()const{ return date; } | 37 | const QString&getDate()const{ return date; } |
38 | void setDate( const QString&a ) { date = a; } | 38 | void setDate( const QString&a ) { date = a; } |
39 | const QString&getFrom()const{ return from; } | 39 | const QString&getFrom()const{ return from; } |
40 | void setFrom( const QString&a ) { from = a; } | 40 | void setFrom( const QString&a ) { from = a; } |
41 | const QString&getSubject()const { return subject; } | 41 | const QString&getSubject()const { return subject; } |
42 | void setSubject( const QString&s ) { subject = s; } | 42 | void setSubject( const QString&s ) { subject = s; } |
43 | const QString&getMbox()const{return mbox;} | 43 | const QString&getMbox()const{return mbox;} |
44 | void setMbox(const QString&box){mbox = box;} | 44 | void setMbox(const QString&box){mbox = box;} |
45 | void setMsgid(const QString&id){msg_id=id;} | 45 | void setMsgid(const QString&id){msg_id=id;} |
46 | const QString&Msgid()const{return msg_id;} | 46 | const QString&Msgid()const{return msg_id;} |
47 | void setReplyto(const QString&reply){replyto=reply;} | ||
48 | const QString&Replyto()const{return replyto;} | ||
49 | |||
47 | 50 | ||
48 | void setTo(const QStringList&list); | 51 | void setTo(const QStringList&list); |
49 | const QStringList&To()const; | 52 | const QStringList&To()const; |
50 | void setCC(const QStringList&list); | 53 | void setCC(const QStringList&list); |
51 | const QStringList&CC()const; | 54 | const QStringList&CC()const; |
52 | void setBcc(const QStringList&list); | 55 | void setBcc(const QStringList&list); |
53 | const QStringList&Bcc()const; | 56 | const QStringList&Bcc()const; |
54 | const QBitArray&getFlags()const{return msg_flags;} | 57 | const QBitArray&getFlags()const{return msg_flags;} |
55 | void setFlags(const QBitArray&flags){msg_flags = flags;} | 58 | void setFlags(const QBitArray&flags){msg_flags = flags;} |
56 | 59 | ||
57 | protected: | 60 | protected: |
58 | QString subject,date,from,mbox,msg_id; | 61 | QString subject,date,from,mbox,msg_id,replyto; |
59 | int msg_number; | 62 | int msg_number; |
60 | QBitArray msg_flags; | 63 | QBitArray msg_flags; |
61 | QStringList to,cc,bcc; | 64 | QStringList to,cc,bcc; |
62 | void init(); | 65 | void init(); |
63 | void copy_old(const RecMail&old); | 66 | void copy_old(const RecMail&old); |
64 | }; | 67 | }; |
65 | 68 | ||
66 | class RecPart | 69 | class RecPart |
67 | { | 70 | { |
68 | protected: | 71 | protected: |
69 | QString m_type,m_subtype,m_identifier,m_encoding; | 72 | QString m_type,m_subtype,m_identifier,m_encoding; |
70 | public: | 73 | public: |
71 | RecPart(); | 74 | RecPart(); |
72 | RecPart(const QString&identifier,const QString&type="",const QString&subtype="",const QString&encoding="BASE64"); | 75 | RecPart(const QString&identifier,const QString&type="",const QString&subtype="",const QString&encoding="BASE64"); |
73 | virtual ~RecPart(); | 76 | virtual ~RecPart(); |
74 | 77 | ||
diff --git a/noncore/net/mail/mailtypes.h b/noncore/net/mail/mailtypes.h index c8d533a..6d6b080 100644 --- a/noncore/net/mail/mailtypes.h +++ b/noncore/net/mail/mailtypes.h | |||
@@ -31,44 +31,47 @@ public: | |||
31 | RecMail(); | 31 | RecMail(); |
32 | RecMail(const RecMail&old); | 32 | RecMail(const RecMail&old); |
33 | virtual ~RecMail(){} | 33 | virtual ~RecMail(){} |
34 | 34 | ||
35 | const int getNumber()const{return msg_number;} | 35 | const int getNumber()const{return msg_number;} |
36 | void setNumber(int number){msg_number=number;} | 36 | void setNumber(int number){msg_number=number;} |
37 | const QString&getDate()const{ return date; } | 37 | const QString&getDate()const{ return date; } |
38 | void setDate( const QString&a ) { date = a; } | 38 | void setDate( const QString&a ) { date = a; } |
39 | const QString&getFrom()const{ return from; } | 39 | const QString&getFrom()const{ return from; } |
40 | void setFrom( const QString&a ) { from = a; } | 40 | void setFrom( const QString&a ) { from = a; } |
41 | const QString&getSubject()const { return subject; } | 41 | const QString&getSubject()const { return subject; } |
42 | void setSubject( const QString&s ) { subject = s; } | 42 | void setSubject( const QString&s ) { subject = s; } |
43 | const QString&getMbox()const{return mbox;} | 43 | const QString&getMbox()const{return mbox;} |
44 | void setMbox(const QString&box){mbox = box;} | 44 | void setMbox(const QString&box){mbox = box;} |
45 | void setMsgid(const QString&id){msg_id=id;} | 45 | void setMsgid(const QString&id){msg_id=id;} |
46 | const QString&Msgid()const{return msg_id;} | 46 | const QString&Msgid()const{return msg_id;} |
47 | void setReplyto(const QString&reply){replyto=reply;} | ||
48 | const QString&Replyto()const{return replyto;} | ||
49 | |||
47 | 50 | ||
48 | void setTo(const QStringList&list); | 51 | void setTo(const QStringList&list); |
49 | const QStringList&To()const; | 52 | const QStringList&To()const; |
50 | void setCC(const QStringList&list); | 53 | void setCC(const QStringList&list); |
51 | const QStringList&CC()const; | 54 | const QStringList&CC()const; |
52 | void setBcc(const QStringList&list); | 55 | void setBcc(const QStringList&list); |
53 | const QStringList&Bcc()const; | 56 | const QStringList&Bcc()const; |
54 | const QBitArray&getFlags()const{return msg_flags;} | 57 | const QBitArray&getFlags()const{return msg_flags;} |
55 | void setFlags(const QBitArray&flags){msg_flags = flags;} | 58 | void setFlags(const QBitArray&flags){msg_flags = flags;} |
56 | 59 | ||
57 | protected: | 60 | protected: |
58 | QString subject,date,from,mbox,msg_id; | 61 | QString subject,date,from,mbox,msg_id,replyto; |
59 | int msg_number; | 62 | int msg_number; |
60 | QBitArray msg_flags; | 63 | QBitArray msg_flags; |
61 | QStringList to,cc,bcc; | 64 | QStringList to,cc,bcc; |
62 | void init(); | 65 | void init(); |
63 | void copy_old(const RecMail&old); | 66 | void copy_old(const RecMail&old); |
64 | }; | 67 | }; |
65 | 68 | ||
66 | class RecPart | 69 | class RecPart |
67 | { | 70 | { |
68 | protected: | 71 | protected: |
69 | QString m_type,m_subtype,m_identifier,m_encoding; | 72 | QString m_type,m_subtype,m_identifier,m_encoding; |
70 | public: | 73 | public: |
71 | RecPart(); | 74 | RecPart(); |
72 | RecPart(const QString&identifier,const QString&type="",const QString&subtype="",const QString&encoding="BASE64"); | 75 | RecPart(const QString&identifier,const QString&type="",const QString&subtype="",const QString&encoding="BASE64"); |
73 | virtual ~RecPart(); | 76 | virtual ~RecPart(); |
74 | 77 | ||