-rw-r--r-- | noncore/net/mail/imapwrapper.cpp | 25 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.cpp | 25 |
2 files changed, 22 insertions, 28 deletions
diff --git a/noncore/net/mail/imapwrapper.cpp b/noncore/net/mail/imapwrapper.cpp index 0178e33..89ec7ab 100644 --- a/noncore/net/mail/imapwrapper.cpp +++ b/noncore/net/mail/imapwrapper.cpp | |||
@@ -158,10 +158,10 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) | |||
158 | QList<Folder>* IMAPwrapper::listFolders() | 158 | QList<Folder>* IMAPwrapper::listFolders() |
159 | { | 159 | { |
160 | const char *path, *mask; | 160 | const char *path, *mask; |
161 | int err = MAILIMAP_NO_ERROR; | 161 | int err = MAILIMAP_NO_ERROR; |
162 | clist *result; | 162 | clist *result = 0; |
163 | clistcell *current; | 163 | clistcell *current = 0; |
164 | 164 | ||
165 | QList<Folder> * folders = new QList<Folder>(); | 165 | QList<Folder> * folders = new QList<Folder>(); |
166 | folders->setAutoDelete( false ); | 166 | folders->setAutoDelete( false ); |
167 | login(); | 167 | login(); |
@@ -175,9 +175,8 @@ QList<Folder>* IMAPwrapper::listFolders() | |||
175 | * it seems like ugly code. and yes - it is ugly code. but the best way. | 175 | * it seems like ugly code. and yes - it is ugly code. but the best way. |
176 | */ | 176 | */ |
177 | QString temp; | 177 | QString temp; |
178 | mask = "INBOX" ; | 178 | mask = "INBOX" ; |
179 | result = clist_new(); | ||
180 | mailimap_mailbox_list *list; | 179 | mailimap_mailbox_list *list; |
181 | err = mailimap_list( m_imap, (char*)"", (char*)mask, &result ); | 180 | err = mailimap_list( m_imap, (char*)"", (char*)mask, &result ); |
182 | QString del; | 181 | QString del; |
183 | if ( err == MAILIMAP_NO_ERROR ) { | 182 | if ( err == MAILIMAP_NO_ERROR ) { |
@@ -201,9 +200,8 @@ QList<Folder>* IMAPwrapper::listFolders() | |||
201 | */ | 200 | */ |
202 | mask = "*" ; | 201 | mask = "*" ; |
203 | path = account->getPrefix().latin1(); | 202 | path = account->getPrefix().latin1(); |
204 | if (!path) path = ""; | 203 | if (!path) path = ""; |
205 | result = clist_new(); | ||
206 | qDebug(path); | 204 | qDebug(path); |
207 | bool selectable = true; | 205 | bool selectable = true; |
208 | mailimap_mbx_list_flags*bflags; | 206 | mailimap_mbx_list_flags*bflags; |
209 | err = mailimap_list( m_imap, (char*)path, (char*)mask, &result ); | 207 | err = mailimap_list( m_imap, (char*)path, (char*)mask, &result ); |
@@ -227,9 +225,9 @@ QList<Folder>* IMAPwrapper::listFolders() | |||
227 | } | 225 | } |
228 | } else { | 226 | } else { |
229 | qDebug("error fetching folders %s",m_imap->imap_response); | 227 | qDebug("error fetching folders %s",m_imap->imap_response); |
230 | } | 228 | } |
231 | mailimap_list_result_free( result ); | 229 | if (result) mailimap_list_result_free( result ); |
232 | return folders; | 230 | return folders; |
233 | } | 231 | } |
234 | 232 | ||
235 | RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | 233 | RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) |
@@ -346,14 +344,14 @@ RecBody IMAPwrapper::fetchBody(const RecMail&mail) | |||
346 | { | 344 | { |
347 | RecBody body; | 345 | RecBody body; |
348 | const char *mb; | 346 | const char *mb; |
349 | int err = MAILIMAP_NO_ERROR; | 347 | int err = MAILIMAP_NO_ERROR; |
350 | clist *result; | 348 | clist *result = 0; |
351 | clistcell *current; | 349 | clistcell *current; |
352 | mailimap_fetch_att *fetchAtt; | 350 | mailimap_fetch_att *fetchAtt = 0; |
353 | mailimap_fetch_type *fetchType; | 351 | mailimap_fetch_type *fetchType = 0; |
354 | mailimap_set *set; | 352 | mailimap_set *set = 0; |
355 | mailimap_body*body_desc; | 353 | mailimap_body*body_desc = 0; |
356 | 354 | ||
357 | mb = mail.getMbox().latin1(); | 355 | mb = mail.getMbox().latin1(); |
358 | 356 | ||
359 | login(); | 357 | login(); |
@@ -366,9 +364,8 @@ RecBody IMAPwrapper::fetchBody(const RecMail&mail) | |||
366 | qDebug("error selecting mailbox: %s",m_imap->imap_response); | 364 | qDebug("error selecting mailbox: %s",m_imap->imap_response); |
367 | return body; | 365 | return body; |
368 | } | 366 | } |
369 | 367 | ||
370 | result = clist_new(); | ||
371 | /* the range has to start at 1!!! not with 0!!!! */ | 368 | /* the range has to start at 1!!! not with 0!!!! */ |
372 | set = mailimap_set_new_interval( mail.getNumber(),mail.getNumber() ); | 369 | set = mailimap_set_new_interval( mail.getNumber(),mail.getNumber() ); |
373 | fetchAtt = mailimap_fetch_att_new_bodystructure(); | 370 | fetchAtt = mailimap_fetch_att_new_bodystructure(); |
374 | fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt); | 371 | fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt); |
@@ -389,9 +386,9 @@ RecBody IMAPwrapper::fetchBody(const RecMail&mail) | |||
389 | } | 386 | } |
390 | } else { | 387 | } else { |
391 | qDebug("error fetching body: %s",m_imap->imap_response); | 388 | qDebug("error fetching body: %s",m_imap->imap_response); |
392 | } | 389 | } |
393 | mailimap_fetch_list_free(result); | 390 | if (result) mailimap_fetch_list_free(result); |
394 | return body; | 391 | return body; |
395 | } | 392 | } |
396 | 393 | ||
397 | /* this routine is just called when the mail has only ONE part. | 394 | /* this routine is just called when the mail has only ONE part. |
@@ -508,9 +505,9 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMail&mail,const QValueList<int> | |||
508 | mailimap_fetch_att * fetch_att = mailimap_fetch_att_new_body_section(section); | 505 | mailimap_fetch_att * fetch_att = mailimap_fetch_att_new_body_section(section); |
509 | 506 | ||
510 | fetchType = mailimap_fetch_type_new_fetch_att(fetch_att); | 507 | fetchType = mailimap_fetch_type_new_fetch_att(fetch_att); |
511 | 508 | ||
512 | clist*result = clist_new(); | 509 | clist*result = 0; |
513 | 510 | ||
514 | err = mailimap_fetch( m_imap, set, fetchType, &result ); | 511 | err = mailimap_fetch( m_imap, set, fetchType, &result ); |
515 | mailimap_set_free( set ); | 512 | mailimap_set_free( set ); |
516 | mailimap_fetch_type_free( fetchType ); | 513 | mailimap_fetch_type_free( fetchType ); |
@@ -532,9 +529,9 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMail&mail,const QValueList<int> | |||
532 | } | 529 | } |
533 | } else { | 530 | } else { |
534 | qDebug("error fetching text: %s",m_imap->imap_response); | 531 | qDebug("error fetching text: %s",m_imap->imap_response); |
535 | } | 532 | } |
536 | mailimap_fetch_list_free(result); | 533 | if (result) mailimap_fetch_list_free(result); |
537 | return res; | 534 | return res; |
538 | } | 535 | } |
539 | 536 | ||
540 | void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_mpart*mailDescription,RecBody&target_body,int current_recursion,QValueList<int>recList) | 537 | void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_mpart*mailDescription,RecBody&target_body,int current_recursion,QValueList<int>recList) |
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp index 0178e33..89ec7ab 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp | |||
@@ -158,10 +158,10 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) | |||
158 | QList<Folder>* IMAPwrapper::listFolders() | 158 | QList<Folder>* IMAPwrapper::listFolders() |
159 | { | 159 | { |
160 | const char *path, *mask; | 160 | const char *path, *mask; |
161 | int err = MAILIMAP_NO_ERROR; | 161 | int err = MAILIMAP_NO_ERROR; |
162 | clist *result; | 162 | clist *result = 0; |
163 | clistcell *current; | 163 | clistcell *current = 0; |
164 | 164 | ||
165 | QList<Folder> * folders = new QList<Folder>(); | 165 | QList<Folder> * folders = new QList<Folder>(); |
166 | folders->setAutoDelete( false ); | 166 | folders->setAutoDelete( false ); |
167 | login(); | 167 | login(); |
@@ -175,9 +175,8 @@ QList<Folder>* IMAPwrapper::listFolders() | |||
175 | * it seems like ugly code. and yes - it is ugly code. but the best way. | 175 | * it seems like ugly code. and yes - it is ugly code. but the best way. |
176 | */ | 176 | */ |
177 | QString temp; | 177 | QString temp; |
178 | mask = "INBOX" ; | 178 | mask = "INBOX" ; |
179 | result = clist_new(); | ||
180 | mailimap_mailbox_list *list; | 179 | mailimap_mailbox_list *list; |
181 | err = mailimap_list( m_imap, (char*)"", (char*)mask, &result ); | 180 | err = mailimap_list( m_imap, (char*)"", (char*)mask, &result ); |
182 | QString del; | 181 | QString del; |
183 | if ( err == MAILIMAP_NO_ERROR ) { | 182 | if ( err == MAILIMAP_NO_ERROR ) { |
@@ -201,9 +200,8 @@ QList<Folder>* IMAPwrapper::listFolders() | |||
201 | */ | 200 | */ |
202 | mask = "*" ; | 201 | mask = "*" ; |
203 | path = account->getPrefix().latin1(); | 202 | path = account->getPrefix().latin1(); |
204 | if (!path) path = ""; | 203 | if (!path) path = ""; |
205 | result = clist_new(); | ||
206 | qDebug(path); | 204 | qDebug(path); |
207 | bool selectable = true; | 205 | bool selectable = true; |
208 | mailimap_mbx_list_flags*bflags; | 206 | mailimap_mbx_list_flags*bflags; |
209 | err = mailimap_list( m_imap, (char*)path, (char*)mask, &result ); | 207 | err = mailimap_list( m_imap, (char*)path, (char*)mask, &result ); |
@@ -227,9 +225,9 @@ QList<Folder>* IMAPwrapper::listFolders() | |||
227 | } | 225 | } |
228 | } else { | 226 | } else { |
229 | qDebug("error fetching folders %s",m_imap->imap_response); | 227 | qDebug("error fetching folders %s",m_imap->imap_response); |
230 | } | 228 | } |
231 | mailimap_list_result_free( result ); | 229 | if (result) mailimap_list_result_free( result ); |
232 | return folders; | 230 | return folders; |
233 | } | 231 | } |
234 | 232 | ||
235 | RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | 233 | RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) |
@@ -346,14 +344,14 @@ RecBody IMAPwrapper::fetchBody(const RecMail&mail) | |||
346 | { | 344 | { |
347 | RecBody body; | 345 | RecBody body; |
348 | const char *mb; | 346 | const char *mb; |
349 | int err = MAILIMAP_NO_ERROR; | 347 | int err = MAILIMAP_NO_ERROR; |
350 | clist *result; | 348 | clist *result = 0; |
351 | clistcell *current; | 349 | clistcell *current; |
352 | mailimap_fetch_att *fetchAtt; | 350 | mailimap_fetch_att *fetchAtt = 0; |
353 | mailimap_fetch_type *fetchType; | 351 | mailimap_fetch_type *fetchType = 0; |
354 | mailimap_set *set; | 352 | mailimap_set *set = 0; |
355 | mailimap_body*body_desc; | 353 | mailimap_body*body_desc = 0; |
356 | 354 | ||
357 | mb = mail.getMbox().latin1(); | 355 | mb = mail.getMbox().latin1(); |
358 | 356 | ||
359 | login(); | 357 | login(); |
@@ -366,9 +364,8 @@ RecBody IMAPwrapper::fetchBody(const RecMail&mail) | |||
366 | qDebug("error selecting mailbox: %s",m_imap->imap_response); | 364 | qDebug("error selecting mailbox: %s",m_imap->imap_response); |
367 | return body; | 365 | return body; |
368 | } | 366 | } |
369 | 367 | ||
370 | result = clist_new(); | ||
371 | /* the range has to start at 1!!! not with 0!!!! */ | 368 | /* the range has to start at 1!!! not with 0!!!! */ |
372 | set = mailimap_set_new_interval( mail.getNumber(),mail.getNumber() ); | 369 | set = mailimap_set_new_interval( mail.getNumber(),mail.getNumber() ); |
373 | fetchAtt = mailimap_fetch_att_new_bodystructure(); | 370 | fetchAtt = mailimap_fetch_att_new_bodystructure(); |
374 | fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt); | 371 | fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt); |
@@ -389,9 +386,9 @@ RecBody IMAPwrapper::fetchBody(const RecMail&mail) | |||
389 | } | 386 | } |
390 | } else { | 387 | } else { |
391 | qDebug("error fetching body: %s",m_imap->imap_response); | 388 | qDebug("error fetching body: %s",m_imap->imap_response); |
392 | } | 389 | } |
393 | mailimap_fetch_list_free(result); | 390 | if (result) mailimap_fetch_list_free(result); |
394 | return body; | 391 | return body; |
395 | } | 392 | } |
396 | 393 | ||
397 | /* this routine is just called when the mail has only ONE part. | 394 | /* this routine is just called when the mail has only ONE part. |
@@ -508,9 +505,9 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMail&mail,const QValueList<int> | |||
508 | mailimap_fetch_att * fetch_att = mailimap_fetch_att_new_body_section(section); | 505 | mailimap_fetch_att * fetch_att = mailimap_fetch_att_new_body_section(section); |
509 | 506 | ||
510 | fetchType = mailimap_fetch_type_new_fetch_att(fetch_att); | 507 | fetchType = mailimap_fetch_type_new_fetch_att(fetch_att); |
511 | 508 | ||
512 | clist*result = clist_new(); | 509 | clist*result = 0; |
513 | 510 | ||
514 | err = mailimap_fetch( m_imap, set, fetchType, &result ); | 511 | err = mailimap_fetch( m_imap, set, fetchType, &result ); |
515 | mailimap_set_free( set ); | 512 | mailimap_set_free( set ); |
516 | mailimap_fetch_type_free( fetchType ); | 513 | mailimap_fetch_type_free( fetchType ); |
@@ -532,9 +529,9 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMail&mail,const QValueList<int> | |||
532 | } | 529 | } |
533 | } else { | 530 | } else { |
534 | qDebug("error fetching text: %s",m_imap->imap_response); | 531 | qDebug("error fetching text: %s",m_imap->imap_response); |
535 | } | 532 | } |
536 | mailimap_fetch_list_free(result); | 533 | if (result) mailimap_fetch_list_free(result); |
537 | return res; | 534 | return res; |
538 | } | 535 | } |
539 | 536 | ||
540 | void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_mpart*mailDescription,RecBody&target_body,int current_recursion,QValueList<int>recList) | 537 | void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_mpart*mailDescription,RecBody&target_body,int current_recursion,QValueList<int>recList) |