summaryrefslogtreecommitdiff
path: root/noncore/net/mail/libmailwrapper/imapwrapper.cpp
Unidiff
Diffstat (limited to 'noncore/net/mail/libmailwrapper/imapwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.cpp66
1 files changed, 33 insertions, 33 deletions
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
index 657c2ba..35468fe 100644
--- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
@@ -21,69 +21,69 @@ IMAPwrapper::~IMAPwrapper()
21 logout(); 21 logout();
22} 22}
23 23
24/* to avoid to often select statements in loops etc. 24/* to avoid to often select statements in loops etc.
25 we trust that we are logged in and connection is established!*/ 25 we trust that we are logged in and connection is established!*/
26int IMAPwrapper::selectMbox(const QString&mbox) 26int IMAPwrapper::selectMbox(const QString&mbox)
27{ 27{
28 if (mbox == m_Lastmbox) { 28 if (mbox == m_Lastmbox) {
29 return MAILIMAP_NO_ERROR; 29 return MAILIMAP_NO_ERROR;
30 } 30 }
31 int err = mailimap_select( m_imap, (char*)mbox.latin1()); 31 int err = mailimap_select( m_imap, (char*)mbox.latin1());
32 if ( err != MAILIMAP_NO_ERROR ) { 32 if ( err != MAILIMAP_NO_ERROR ) {
33 qDebug("error selecting mailbox: %s",m_imap->imap_response); 33 odebug << "error selecting mailbox: " << m_imap->imap_response << "" << oendl;
34 m_Lastmbox = ""; 34 m_Lastmbox = "";
35 return err; 35 return err;
36 } 36 }
37 m_Lastmbox = mbox; 37 m_Lastmbox = mbox;
38 return err; 38 return err;
39} 39}
40 40
41void IMAPwrapper::imap_progress( size_t current, size_t maximum ) 41void IMAPwrapper::imap_progress( size_t current, size_t maximum )
42{ 42{
43 qApp->processEvents(); 43 qApp->processEvents();
44 qDebug( "IMAP: %i of %i", current, maximum ); 44 odebug << "IMAP: " << current << " of " << maximum << "" << oendl;
45} 45}
46 46
47bool IMAPwrapper::start_tls(bool force_tls) 47bool IMAPwrapper::start_tls(bool force_tls)
48{ 48{
49 int err; 49 int err;
50 bool try_tls; 50 bool try_tls;
51 mailimap_capability_data * cap_data = 0; 51 mailimap_capability_data * cap_data = 0;
52 52
53 err = mailimap_capability(m_imap,&cap_data); 53 err = mailimap_capability(m_imap,&cap_data);
54 if (err != MAILIMAP_NO_ERROR) { 54 if (err != MAILIMAP_NO_ERROR) {
55 Global::statusMessage("error getting capabilities!"); 55 Global::statusMessage("error getting capabilities!");
56 qDebug("error getting capabilities!"); 56 odebug << "error getting capabilities!" << oendl;
57 return false; 57 return false;
58 } 58 }
59 clistiter * cur; 59 clistiter * cur;
60 for(cur = clist_begin(cap_data->cap_list) ; cur != NULL;cur = clist_next(cur)) { 60 for(cur = clist_begin(cap_data->cap_list) ; cur != NULL;cur = clist_next(cur)) {
61 struct mailimap_capability * cap; 61 struct mailimap_capability * cap;
62 cap = (struct mailimap_capability *)clist_content(cur); 62 cap = (struct mailimap_capability *)clist_content(cur);
63 if (cap->cap_type == MAILIMAP_CAPABILITY_NAME) { 63 if (cap->cap_type == MAILIMAP_CAPABILITY_NAME) {
64 if (strcasecmp(cap->cap_data.cap_name, "STARTTLS") == 0) { 64 if (strcasecmp(cap->cap_data.cap_name, "STARTTLS") == 0) {
65 try_tls = true; 65 try_tls = true;
66 break; 66 break;
67 } 67 }
68 } 68 }
69 } 69 }
70 if (cap_data) { 70 if (cap_data) {
71 mailimap_capability_data_free(cap_data); 71 mailimap_capability_data_free(cap_data);
72 } 72 }
73 if (try_tls) { 73 if (try_tls) {
74 err = mailimap_starttls(m_imap); 74 err = mailimap_starttls(m_imap);
75 if (err != MAILIMAP_NO_ERROR && force_tls) { 75 if (err != MAILIMAP_NO_ERROR && force_tls) {
76 Global::statusMessage(tr("Server has no TLS support!")); 76 Global::statusMessage(tr("Server has no TLS support!"));
77 qDebug("Server has no TLS support!"); 77 odebug << "Server has no TLS support!" << oendl;
78 try_tls = false; 78 try_tls = false;
79 } else { 79 } else {
80 mailstream_low * low; 80 mailstream_low * low;
81 mailstream_low * new_low; 81 mailstream_low * new_low;
82 low = mailstream_get_low(m_imap->imap_stream); 82 low = mailstream_get_low(m_imap->imap_stream);
83 if (!low) { 83 if (!low) {
84 try_tls = false; 84 try_tls = false;
85 } else { 85 } else {
86 int fd = mailstream_low_get_fd(low); 86 int fd = mailstream_low_get_fd(low);
87 if (fd > -1 && (new_low = mailstream_low_ssl_open(fd))!=0) { 87 if (fd > -1 && (new_low = mailstream_low_ssl_open(fd))!=0) {
88 mailstream_low_free(low); 88 mailstream_low_free(low);
89 mailstream_set_low(m_imap->imap_stream, new_low); 89 mailstream_set_low(m_imap->imap_stream, new_low);
@@ -116,48 +116,48 @@ void IMAPwrapper::login()
116 } 116 }
117 server = account->getServer().latin1(); 117 server = account->getServer().latin1();
118 port = account->getPort().toUInt(); 118 port = account->getPort().toUInt();
119 if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { 119 if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) {
120 LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); 120 LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true );
121 login.show(); 121 login.show();
122 if ( QDialog::Accepted == login.exec() ) { 122 if ( QDialog::Accepted == login.exec() ) {
123 // ok 123 // ok
124 user = login.getUser().latin1(); 124 user = login.getUser().latin1();
125 pass = login.getPassword().latin1(); 125 pass = login.getPassword().latin1();
126 } else { 126 } else {
127 // cancel 127 // cancel
128 qDebug( "IMAP: Login canceled" ); 128 odebug << "IMAP: Login canceled" << oendl;
129 return; 129 return;
130 } 130 }
131 } else { 131 } else {
132 user = account->getUser().latin1(); 132 user = account->getUser().latin1();
133 pass = account->getPassword().latin1(); 133 pass = account->getPassword().latin1();
134 } 134 }
135 135
136 m_imap = mailimap_new( 20, &imap_progress ); 136 m_imap = mailimap_new( 20, &imap_progress );
137 137
138 /* connect */ 138 /* connect */
139 bool ssl = false; 139 bool ssl = false;
140 bool try_tls = false; 140 bool try_tls = false;
141 bool force_tls = false; 141 bool force_tls = false;
142 142
143 if ( account->ConnectionType() == 2 ) { 143 if ( account->ConnectionType() == 2 ) {
144 ssl = true; 144 ssl = true;
145 } 145 }
146 if (account->ConnectionType()==1) { 146 if (account->ConnectionType()==1) {
147 force_tls = true; 147 force_tls = true;
148 } 148 }
149 149
150 if ( ssl ) { 150 if ( ssl ) {
151 qDebug( "using ssl" ); 151 odebug << "using ssl" << oendl;
152 err = mailimap_ssl_connect( m_imap, (char*)server, port ); 152 err = mailimap_ssl_connect( m_imap, (char*)server, port );
153 } else { 153 } else {
154 err = mailimap_socket_connect( m_imap, (char*)server, port ); 154 err = mailimap_socket_connect( m_imap, (char*)server, port );
155 } 155 }
156 156
157 if ( err != MAILIMAP_NO_ERROR && 157 if ( err != MAILIMAP_NO_ERROR &&
158 err != MAILIMAP_NO_ERROR_AUTHENTICATED && 158 err != MAILIMAP_NO_ERROR_AUTHENTICATED &&
159 err != MAILIMAP_NO_ERROR_NON_AUTHENTICATED ) { 159 err != MAILIMAP_NO_ERROR_NON_AUTHENTICATED ) {
160 QString failure = ""; 160 QString failure = "";
161 if (err == MAILIMAP_ERROR_CONNECTION_REFUSED) { 161 if (err == MAILIMAP_ERROR_CONNECTION_REFUSED) {
162 failure="Connection refused"; 162 failure="Connection refused";
163 } else { 163 } else {
@@ -167,25 +167,25 @@ void IMAPwrapper::login()
167 mailimap_free( m_imap ); 167 mailimap_free( m_imap );
168 m_imap = 0; 168 m_imap = 0;
169 return; 169 return;
170 } 170 }
171 171
172 if (!ssl) { 172 if (!ssl) {
173 try_tls = start_tls(force_tls); 173 try_tls = start_tls(force_tls);
174 } 174 }
175 175
176 bool ok = true; 176 bool ok = true;
177 if (force_tls && !try_tls) { 177 if (force_tls && !try_tls) {
178 Global::statusMessage(tr("Server has no TLS support!")); 178 Global::statusMessage(tr("Server has no TLS support!"));
179 qDebug("Server has no TLS support!"); 179 odebug << "Server has no TLS support!" << oendl;
180 ok = false; 180 ok = false;
181 } 181 }
182 182
183 183
184 /* login */ 184 /* login */
185 185
186 if (ok) { 186 if (ok) {
187 err = mailimap_login_simple( m_imap, (char*)user, (char*)pass ); 187 err = mailimap_login_simple( m_imap, (char*)user, (char*)pass );
188 if ( err != MAILIMAP_NO_ERROR ) { 188 if ( err != MAILIMAP_NO_ERROR ) {
189 Global::statusMessage(tr("error logging in imap server: %1").arg(m_imap->imap_response)); 189 Global::statusMessage(tr("error logging in imap server: %1").arg(m_imap->imap_response));
190 ok = false; 190 ok = false;
191 } 191 }
@@ -308,35 +308,35 @@ QValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders()
308 if ( (bflags = list->mb_flag) ) { 308 if ( (bflags = list->mb_flag) ) {
309 selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&& 309 selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&&
310 bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT); 310 bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT);
311 for(cur_flag=clist_begin(bflags->mbf_oflags);cur_flag;cur_flag=clist_next(cur_flag)) { 311 for(cur_flag=clist_begin(bflags->mbf_oflags);cur_flag;cur_flag=clist_next(cur_flag)) {
312 if ( ((mailimap_mbx_list_oflag*)cur_flag->data)->of_type==MAILIMAP_MBX_LIST_OFLAG_NOINFERIORS) { 312 if ( ((mailimap_mbx_list_oflag*)cur_flag->data)->of_type==MAILIMAP_MBX_LIST_OFLAG_NOINFERIORS) {
313 no_inferiors = true; 313 no_inferiors = true;
314 } 314 }
315 } 315 }
316 } 316 }
317 folders->append( new IMAPFolder(temp,del,selectable,no_inferiors,account->getPrefix())); 317 folders->append( new IMAPFolder(temp,del,selectable,no_inferiors,account->getPrefix()));
318 } 318 }
319 } else { 319 } else {
320 qDebug("error fetching folders: %s",m_imap->imap_response); 320 odebug << "error fetching folders: " << m_imap->imap_response << "" << oendl;
321 } 321 }
322 mailimap_list_result_free( result ); 322 mailimap_list_result_free( result );
323 323
324/* 324/*
325 * second stage - get the other then inbox folders 325 * second stage - get the other then inbox folders
326 */ 326 */
327 mask = "*" ; 327 mask = "*" ;
328 path = account->getPrefix().latin1(); 328 path = account->getPrefix().latin1();
329 if (!path) path = ""; 329 if (!path) path = "";
330 qDebug(path); 330 odebug << path << oendl;
331 err = mailimap_list( m_imap, (char*)path, (char*)mask, &result ); 331 err = mailimap_list( m_imap, (char*)path, (char*)mask, &result );
332 if ( err == MAILIMAP_NO_ERROR ) { 332 if ( err == MAILIMAP_NO_ERROR ) {
333 current = result->first; 333 current = result->first;
334 for ( current=clist_begin(result);current!=NULL;current=clist_next(current)) { 334 for ( current=clist_begin(result);current!=NULL;current=clist_next(current)) {
335 no_inferiors = false; 335 no_inferiors = false;
336 list = (mailimap_mailbox_list *) current->data; 336 list = (mailimap_mailbox_list *) current->data;
337 // it is better use the deep copy mechanism of qt itself 337 // it is better use the deep copy mechanism of qt itself
338 // instead of using strdup! 338 // instead of using strdup!
339 temp = list->mb_name; 339 temp = list->mb_name;
340 if (temp.lower()=="inbox") 340 if (temp.lower()=="inbox")
341 continue; 341 continue;
342 if (temp.lower()==account->getPrefix().lower()) 342 if (temp.lower()==account->getPrefix().lower())
@@ -345,25 +345,25 @@ QValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders()
345 selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&& 345 selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&&
346 bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT); 346 bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT);
347 for(cur_flag=clist_begin(bflags->mbf_oflags);cur_flag;cur_flag=clist_next(cur_flag)) { 347 for(cur_flag=clist_begin(bflags->mbf_oflags);cur_flag;cur_flag=clist_next(cur_flag)) {
348 if ( ((mailimap_mbx_list_oflag*)cur_flag->data)->of_type==MAILIMAP_MBX_LIST_OFLAG_NOINFERIORS) { 348 if ( ((mailimap_mbx_list_oflag*)cur_flag->data)->of_type==MAILIMAP_MBX_LIST_OFLAG_NOINFERIORS) {
349 no_inferiors = true; 349 no_inferiors = true;
350 } 350 }
351 } 351 }
352 } 352 }
353 del = list->mb_delimiter; 353 del = list->mb_delimiter;
354 folders->append(new IMAPFolder(temp,del,selectable,no_inferiors,account->getPrefix())); 354 folders->append(new IMAPFolder(temp,del,selectable,no_inferiors,account->getPrefix()));
355 } 355 }
356 } else { 356 } else {
357 qDebug("error fetching folders %s",m_imap->imap_response); 357 odebug << "error fetching folders " << m_imap->imap_response << "" << oendl;
358 } 358 }
359 if (result) mailimap_list_result_free( result ); 359 if (result) mailimap_list_result_free( result );
360 return folders; 360 return folders;
361} 361}
362 362
363RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) 363RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
364{ 364{
365 RecMail * m = 0; 365 RecMail * m = 0;
366 mailimap_msg_att_item *item=0; 366 mailimap_msg_att_item *item=0;
367 clistcell *current,*c,*cf; 367 clistcell *current,*c,*cf;
368 mailimap_msg_att_dynamic*flist; 368 mailimap_msg_att_dynamic*flist;
369 mailimap_flag_fetch*cflag; 369 mailimap_flag_fetch*cflag;
@@ -457,26 +457,26 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
457 } 457 }
458 if (h.length()>0) { 458 if (h.length()>0) {
459 m->setInreply(QStringList(h)); 459 m->setInreply(QStringList(h));
460 } 460 }
461 } 461 }
462 if (head->env_message_id) { 462 if (head->env_message_id) {
463 m->setMsgid(QString(head->env_message_id)); 463 m->setMsgid(QString(head->env_message_id));
464 } 464 }
465 } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_INTERNALDATE) { 465 } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_INTERNALDATE) {
466#if 0 466#if 0
467 mailimap_date_time*d = item->att_data.att_static->att_data.att_internal_date; 467 mailimap_date_time*d = item->att_data.att_static->att_data.att_internal_date;
468 QDateTime da(QDate(d->dt_year,d->dt_month,d->dt_day),QTime(d->dt_hour,d->dt_min,d->dt_sec)); 468 QDateTime da(QDate(d->dt_year,d->dt_month,d->dt_day),QTime(d->dt_hour,d->dt_min,d->dt_sec));
469 qDebug("%i %i %i - %i %i %i",d->dt_year,d->dt_month,d->dt_day,d->dt_hour,d->dt_min,d->dt_sec); 469 odebug << "" << d->dt_year << " " << d->dt_month << " " << d->dt_day << " - " << d->dt_hour << " " << d->dt_min << " " << d->dt_sec << "" << oendl;
470 qDebug(da.toString()); 470 odebug << da.toString() << oendl;
471#endif 471#endif
472 } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_RFC822_SIZE) { 472 } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_RFC822_SIZE) {
473 size = item->att_data.att_static->att_data.att_rfc822_size; 473 size = item->att_data.att_static->att_data.att_rfc822_size;
474 } 474 }
475 } 475 }
476 /* msg is already deleted */ 476 /* msg is already deleted */
477 if (mFlags.testBit(FLAG_DELETED) && m) { 477 if (mFlags.testBit(FLAG_DELETED) && m) {
478 delete m; 478 delete m;
479 m = 0; 479 m = 0;
480 } 480 }
481 if (m) { 481 if (m) {
482 m->setFlags(mFlags); 482 m->setFlags(mFlags);
@@ -515,25 +515,25 @@ RecBodyP IMAPwrapper::fetchBody(const RecMailP&mail)
515 err = mailimap_fetch( m_imap, set, fetchType, &result ); 515 err = mailimap_fetch( m_imap, set, fetchType, &result );
516 mailimap_set_free( set ); 516 mailimap_set_free( set );
517 mailimap_fetch_type_free( fetchType ); 517 mailimap_fetch_type_free( fetchType );
518 518
519 if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { 519 if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) {
520 mailimap_msg_att * msg_att; 520 mailimap_msg_att * msg_att;
521 msg_att = (mailimap_msg_att*)current->data; 521 msg_att = (mailimap_msg_att*)current->data;
522 mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->att_list->first->data; 522 mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->att_list->first->data;
523 QValueList<int> path; 523 QValueList<int> path;
524 body_desc = item->att_data.att_static->att_data.att_body; 524 body_desc = item->att_data.att_static->att_data.att_body;
525 traverseBody(mail,body_desc,body,0,path); 525 traverseBody(mail,body_desc,body,0,path);
526 } else { 526 } else {
527 qDebug("error fetching body: %s",m_imap->imap_response); 527 odebug << "error fetching body: " << m_imap->imap_response << "" << oendl;
528 } 528 }
529 if (result) mailimap_fetch_list_free(result); 529 if (result) mailimap_fetch_list_free(result);
530 return body; 530 return body;
531} 531}
532 532
533QStringList IMAPwrapper::address_list_to_stringlist(clist*list) 533QStringList IMAPwrapper::address_list_to_stringlist(clist*list)
534{ 534{
535 QStringList l; 535 QStringList l;
536 QString from; 536 QString from;
537 bool named_from; 537 bool named_from;
538 clistcell *current = NULL; 538 clistcell *current = NULL;
539 mailimap_address * current_address=NULL; 539 mailimap_address * current_address=NULL;
@@ -627,25 +627,25 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMailP&mail,const QValueList<int
627 for(cur = clist_begin(msg_att->att_list) ; cur != NULL ; cur = clist_next(cur)) { 627 for(cur = clist_begin(msg_att->att_list) ; cur != NULL ; cur = clist_next(cur)) {
628 msg_att_item = (mailimap_msg_att_item*)clist_content(cur); 628 msg_att_item = (mailimap_msg_att_item*)clist_content(cur);
629 if (msg_att_item->att_type == MAILIMAP_MSG_ATT_ITEM_STATIC) { 629 if (msg_att_item->att_type == MAILIMAP_MSG_ATT_ITEM_STATIC) {
630 if (msg_att_item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_BODY_SECTION) { 630 if (msg_att_item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_BODY_SECTION) {
631 char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part; 631 char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part;
632 /* detach - we take over the content */ 632 /* detach - we take over the content */
633 msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L; 633 msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L;
634 res->setContent(text,msg_att_item->att_data.att_static->att_data.att_body_section->sec_length); 634 res->setContent(text,msg_att_item->att_data.att_static->att_data.att_body_section->sec_length);
635 } 635 }
636 } 636 }
637 } 637 }
638 } else { 638 } else {
639 qDebug("error fetching text: %s",m_imap->imap_response); 639 odebug << "error fetching text: " << m_imap->imap_response << "" << oendl;
640 } 640 }
641 if (result) mailimap_fetch_list_free(result); 641 if (result) mailimap_fetch_list_free(result);
642 return res; 642 return res;
643} 643}
644 644
645/* current_recursion is for recursive calls. 645/* current_recursion is for recursive calls.
646 current_count means the position inside the internal loop! */ 646 current_count means the position inside the internal loop! */
647void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&target_body, 647void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&target_body,
648 int current_recursion,QValueList<int>recList,int current_count) 648 int current_recursion,QValueList<int>recList,int current_count)
649{ 649{
650 if (!body || current_recursion>=10) { 650 if (!body || current_recursion>=10) {
651 return; 651 return;
@@ -654,25 +654,25 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&t
654 case MAILIMAP_BODY_1PART: 654 case MAILIMAP_BODY_1PART:
655 { 655 {
656 QValueList<int>countlist = recList; 656 QValueList<int>countlist = recList;
657 countlist.append(current_count); 657 countlist.append(current_count);
658 RecPartP currentPart = new RecPart(); 658 RecPartP currentPart = new RecPart();
659 mailimap_body_type_1part*part1 = body->bd_data.bd_body_1part; 659 mailimap_body_type_1part*part1 = body->bd_data.bd_body_1part;
660 QString id(""); 660 QString id("");
661 currentPart->setPositionlist(countlist); 661 currentPart->setPositionlist(countlist);
662 for (unsigned int j = 0; j < countlist.count();++j) { 662 for (unsigned int j = 0; j < countlist.count();++j) {
663 id+=(j>0?" ":""); 663 id+=(j>0?" ":"");
664 id+=QString("%1").arg(countlist[j]); 664 id+=QString("%1").arg(countlist[j]);
665 } 665 }
666 qDebug("ID = %s",id.latin1()); 666 odebug << "ID = " << id.latin1() << "" << oendl;
667 currentPart->setIdentifier(id); 667 currentPart->setIdentifier(id);
668 fillSinglePart(currentPart,part1); 668 fillSinglePart(currentPart,part1);
669 /* important: Check for is NULL 'cause a body can be empty! 669 /* important: Check for is NULL 'cause a body can be empty!
670 And we put it only into the mail if it is the FIRST part */ 670 And we put it only into the mail if it is the FIRST part */
671 if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_TEXT && target_body->Bodytext().isNull() && countlist[0]==1) { 671 if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_TEXT && target_body->Bodytext().isNull() && countlist[0]==1) {
672 QString body_text = fetchTextPart(mail,countlist,true,currentPart->Encoding()); 672 QString body_text = fetchTextPart(mail,countlist,true,currentPart->Encoding());
673 target_body->setDescription(currentPart); 673 target_body->setDescription(currentPart);
674 target_body->setBodytext(body_text); 674 target_body->setBodytext(body_text);
675 if (countlist.count()>1) { 675 if (countlist.count()>1) {
676 target_body->addPart(currentPart); 676 target_body->addPart(currentPart);
677 } 677 }
678 } else { 678 } else {
@@ -695,25 +695,25 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&t
695 if (current_body->bd_type==MAILIMAP_BODY_MPART) { 695 if (current_body->bd_type==MAILIMAP_BODY_MPART) {
696 RecPartP targetPart = new RecPart(); 696 RecPartP targetPart = new RecPart();
697 targetPart->setType("multipart"); 697 targetPart->setType("multipart");
698 fillMultiPart(targetPart,mailDescription); 698 fillMultiPart(targetPart,mailDescription);
699 countlist.append(current_count); 699 countlist.append(current_count);
700 targetPart->setPositionlist(countlist); 700 targetPart->setPositionlist(countlist);
701 target_body->addPart(targetPart); 701 target_body->addPart(targetPart);
702 QString id(""); 702 QString id("");
703 for (unsigned int j = 0; j < countlist.count();++j) { 703 for (unsigned int j = 0; j < countlist.count();++j) {
704 id+=(j>0?" ":""); 704 id+=(j>0?" ":"");
705 id+=QString("%1").arg(countlist[j]); 705 id+=QString("%1").arg(countlist[j]);
706 } 706 }
707 qDebug("ID(mpart) = %s",id.latin1()); 707 odebug << "ID(mpart) = " << id.latin1() << "" << oendl;
708 } 708 }
709 traverseBody(mail,current_body,target_body,current_recursion+1,countlist,ccount); 709 traverseBody(mail,current_body,target_body,current_recursion+1,countlist,ccount);
710 if (current_body->bd_type==MAILIMAP_BODY_MPART) { 710 if (current_body->bd_type==MAILIMAP_BODY_MPART) {
711 countlist = recList; 711 countlist = recList;
712 } 712 }
713 ++ccount; 713 ++ccount;
714 } 714 }
715 } 715 }
716 break; 716 break;
717 default: 717 default:
718 break; 718 break;
719 } 719 }
@@ -739,37 +739,37 @@ void IMAPwrapper::fillSinglePart(RecPartP&target_part,mailimap_body_type_1part*D
739 default: 739 default:
740 break; 740 break;
741 } 741 }
742} 742}
743 743
744void IMAPwrapper::fillSingleTextPart(RecPartP&target_part,mailimap_body_type_text*which) 744void IMAPwrapper::fillSingleTextPart(RecPartP&target_part,mailimap_body_type_text*which)
745{ 745{
746 if (!which) { 746 if (!which) {
747 return; 747 return;
748 } 748 }
749 QString sub; 749 QString sub;
750 sub = which->bd_media_text; 750 sub = which->bd_media_text;
751 qDebug("Type= text/%s",which->bd_media_text); 751 odebug << "Type= text/" << which->bd_media_text << "" << oendl;
752 target_part->setSubtype(sub.lower()); 752 target_part->setSubtype(sub.lower());
753 target_part->setLines(which->bd_lines); 753 target_part->setLines(which->bd_lines);
754 fillBodyFields(target_part,which->bd_fields); 754 fillBodyFields(target_part,which->bd_fields);
755} 755}
756 756
757void IMAPwrapper::fillSingleMsgPart(RecPartP&target_part,mailimap_body_type_msg*which) 757void IMAPwrapper::fillSingleMsgPart(RecPartP&target_part,mailimap_body_type_msg*which)
758{ 758{
759 if (!which) { 759 if (!which) {
760 return; 760 return;
761 } 761 }
762 target_part->setSubtype("rfc822"); 762 target_part->setSubtype("rfc822");
763 qDebug("Message part"); 763 odebug << "Message part" << oendl;
764 /* we set this type to text/plain */ 764 /* we set this type to text/plain */
765 target_part->setLines(which->bd_lines); 765 target_part->setLines(which->bd_lines);
766 fillBodyFields(target_part,which->bd_fields); 766 fillBodyFields(target_part,which->bd_fields);
767} 767}
768 768
769void IMAPwrapper::fillMultiPart(RecPartP&target_part,mailimap_body_type_mpart*which) 769void IMAPwrapper::fillMultiPart(RecPartP&target_part,mailimap_body_type_mpart*which)
770{ 770{
771 if (!which) return; 771 if (!which) return;
772 QString sub = which->bd_media_subtype; 772 QString sub = which->bd_media_subtype;
773 target_part->setSubtype(sub.lower()); 773 target_part->setSubtype(sub.lower());
774 if (which->bd_ext_mpart && which->bd_ext_mpart->bd_parameter && which->bd_ext_mpart->bd_parameter->pa_list) { 774 if (which->bd_ext_mpart && which->bd_ext_mpart->bd_parameter && which->bd_ext_mpart->bd_parameter->pa_list) {
775 clistcell*cur = 0; 775 clistcell*cur = 0;
@@ -810,25 +810,25 @@ void IMAPwrapper::fillSingleBasicPart(RecPartP&target_part,mailimap_body_type_ba
810 if (which->bd_media_basic->med_basic_type) { 810 if (which->bd_media_basic->med_basic_type) {
811 type = which->bd_media_basic->med_basic_type; 811 type = which->bd_media_basic->med_basic_type;
812 } else { 812 } else {
813 type = ""; 813 type = "";
814 } 814 }
815 break; 815 break;
816 } 816 }
817 if (which->bd_media_basic->med_subtype) { 817 if (which->bd_media_basic->med_subtype) {
818 sub = which->bd_media_basic->med_subtype; 818 sub = which->bd_media_basic->med_subtype;
819 } else { 819 } else {
820 sub = ""; 820 sub = "";
821 } 821 }
822 qDebug("Type = %s/%s",type.latin1(),sub.latin1()); 822 odebug << "Type = " << type.latin1() << "/" << sub.latin1() << "" << oendl;
823 target_part->setType(type.lower()); 823 target_part->setType(type.lower());
824 target_part->setSubtype(sub.lower()); 824 target_part->setSubtype(sub.lower());
825 fillBodyFields(target_part,which->bd_fields); 825 fillBodyFields(target_part,which->bd_fields);
826} 826}
827 827
828void IMAPwrapper::fillBodyFields(RecPartP&target_part,mailimap_body_fields*which) 828void IMAPwrapper::fillBodyFields(RecPartP&target_part,mailimap_body_fields*which)
829{ 829{
830 if (!which) return; 830 if (!which) return;
831 if (which->bd_parameter && which->bd_parameter->pa_list && which->bd_parameter->pa_list->count>0) { 831 if (which->bd_parameter && which->bd_parameter->pa_list && which->bd_parameter->pa_list->count>0) {
832 clistcell*cur; 832 clistcell*cur;
833 mailimap_single_body_fld_param*param=0; 833 mailimap_single_body_fld_param*param=0;
834 for (cur = clist_begin(which->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) { 834 for (cur = clist_begin(which->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) {
@@ -886,34 +886,34 @@ void IMAPwrapper::deleteMail(const RecMailP&mail)
886 if ( err != MAILIMAP_NO_ERROR ) { 886 if ( err != MAILIMAP_NO_ERROR ) {
887 return; 887 return;
888 } 888 }
889 flist = mailimap_flag_list_new_empty(); 889 flist = mailimap_flag_list_new_empty();
890 mailimap_flag_list_add(flist,mailimap_flag_new_deleted()); 890 mailimap_flag_list_add(flist,mailimap_flag_new_deleted());
891 store_flags = mailimap_store_att_flags_new_set_flags(flist); 891 store_flags = mailimap_store_att_flags_new_set_flags(flist);
892 set = mailimap_set_new_single(mail->getNumber()); 892 set = mailimap_set_new_single(mail->getNumber());
893 err = mailimap_store(m_imap,set,store_flags); 893 err = mailimap_store(m_imap,set,store_flags);
894 mailimap_set_free( set ); 894 mailimap_set_free( set );
895 mailimap_store_att_flags_free(store_flags); 895 mailimap_store_att_flags_free(store_flags);
896 896
897 if (err != MAILIMAP_NO_ERROR) { 897 if (err != MAILIMAP_NO_ERROR) {
898 qDebug("error deleting mail: %s",m_imap->imap_response); 898 odebug << "error deleting mail: " << m_imap->imap_response << "" << oendl;
899 return; 899 return;
900 } 900 }
901 qDebug("deleting mail: %s",m_imap->imap_response); 901 odebug << "deleting mail: " << m_imap->imap_response << "" << oendl;
902 /* should we realy do that at this moment? */ 902 /* should we realy do that at this moment? */
903 err = mailimap_expunge(m_imap); 903 err = mailimap_expunge(m_imap);
904 if (err != MAILIMAP_NO_ERROR) { 904 if (err != MAILIMAP_NO_ERROR) {
905 qDebug("error deleting mail: %s",m_imap->imap_response); 905 odebug << "error deleting mail: " << m_imap->imap_response << "" << oendl;
906 } 906 }
907 qDebug("Delete successfull %s",m_imap->imap_response); 907 odebug << "Delete successfull " << m_imap->imap_response << "" << oendl;
908} 908}
909 909
910void IMAPwrapper::answeredMail(const RecMailP&mail) 910void IMAPwrapper::answeredMail(const RecMailP&mail)
911{ 911{
912 mailimap_flag_list*flist; 912 mailimap_flag_list*flist;
913 mailimap_set *set; 913 mailimap_set *set;
914 mailimap_store_att_flags * store_flags; 914 mailimap_store_att_flags * store_flags;
915 int err; 915 int err;
916 login(); 916 login();
917 if (!m_imap) { 917 if (!m_imap) {
918 return; 918 return;
919 } 919 }
@@ -921,25 +921,25 @@ void IMAPwrapper::answeredMail(const RecMailP&mail)
921 if ( err != MAILIMAP_NO_ERROR ) { 921 if ( err != MAILIMAP_NO_ERROR ) {
922 return; 922 return;
923 } 923 }
924 flist = mailimap_flag_list_new_empty(); 924 flist = mailimap_flag_list_new_empty();
925 mailimap_flag_list_add(flist,mailimap_flag_new_answered()); 925 mailimap_flag_list_add(flist,mailimap_flag_new_answered());
926 store_flags = mailimap_store_att_flags_new_add_flags(flist); 926 store_flags = mailimap_store_att_flags_new_add_flags(flist);
927 set = mailimap_set_new_single(mail->getNumber()); 927 set = mailimap_set_new_single(mail->getNumber());
928 err = mailimap_store(m_imap,set,store_flags); 928 err = mailimap_store(m_imap,set,store_flags);
929 mailimap_set_free( set ); 929 mailimap_set_free( set );
930 mailimap_store_att_flags_free(store_flags); 930 mailimap_store_att_flags_free(store_flags);
931 931
932 if (err != MAILIMAP_NO_ERROR) { 932 if (err != MAILIMAP_NO_ERROR) {
933 qDebug("error marking mail: %s",m_imap->imap_response); 933 odebug << "error marking mail: " << m_imap->imap_response << "" << oendl;
934 return; 934 return;
935 } 935 }
936} 936}
937 937
938QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call,const QString&enc) 938QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call,const QString&enc)
939{ 939{
940 QString body(""); 940 QString body("");
941 encodedString*res = fetchRawPart(mail,path,internal_call); 941 encodedString*res = fetchRawPart(mail,path,internal_call);
942 encodedString*r = decode_String(res,enc); 942 encodedString*r = decode_String(res,enc);
943 delete res; 943 delete res;
944 if (r) { 944 if (r) {
945 if (r->Length()>0) { 945 if (r->Length()>0) {
@@ -989,57 +989,57 @@ int IMAPwrapper::deleteAllMail(const FolderP&folder)
989 } 989 }
990 flist = mailimap_flag_list_new_empty(); 990 flist = mailimap_flag_list_new_empty();
991 mailimap_flag_list_add(flist,mailimap_flag_new_deleted()); 991 mailimap_flag_list_add(flist,mailimap_flag_new_deleted());
992 store_flags = mailimap_store_att_flags_new_set_flags(flist); 992 store_flags = mailimap_store_att_flags_new_set_flags(flist);
993 set = mailimap_set_new_interval( 1, last ); 993 set = mailimap_set_new_interval( 1, last );
994 err = mailimap_store(m_imap,set,store_flags); 994 err = mailimap_store(m_imap,set,store_flags);
995 mailimap_set_free( set ); 995 mailimap_set_free( set );
996 mailimap_store_att_flags_free(store_flags); 996 mailimap_store_att_flags_free(store_flags);
997 if (err != MAILIMAP_NO_ERROR) { 997 if (err != MAILIMAP_NO_ERROR) {
998 Global::statusMessage(tr("error deleting mail: %s").arg(m_imap->imap_response)); 998 Global::statusMessage(tr("error deleting mail: %s").arg(m_imap->imap_response));
999 return 0; 999 return 0;
1000 } 1000 }
1001 qDebug("deleting mail: %s",m_imap->imap_response); 1001 odebug << "deleting mail: " << m_imap->imap_response << "" << oendl;
1002 /* should we realy do that at this moment? */ 1002 /* should we realy do that at this moment? */
1003 err = mailimap_expunge(m_imap); 1003 err = mailimap_expunge(m_imap);
1004 if (err != MAILIMAP_NO_ERROR) { 1004 if (err != MAILIMAP_NO_ERROR) {
1005 Global::statusMessage(tr("error deleting mail: %s").arg(m_imap->imap_response)); 1005 Global::statusMessage(tr("error deleting mail: %s").arg(m_imap->imap_response));
1006 return 0; 1006 return 0;
1007 } 1007 }
1008 qDebug("Delete successfull %s",m_imap->imap_response); 1008 odebug << "Delete successfull " << m_imap->imap_response << "" << oendl;
1009 return 1; 1009 return 1;
1010} 1010}
1011 1011
1012int IMAPwrapper::createMbox(const QString&folder,const FolderP&parentfolder,const QString& delemiter,bool getsubfolder) 1012int IMAPwrapper::createMbox(const QString&folder,const FolderP&parentfolder,const QString& delemiter,bool getsubfolder)
1013{ 1013{
1014 if (folder.length()==0) return 0; 1014 if (folder.length()==0) return 0;
1015 login(); 1015 login();
1016 if (!m_imap) {return 0;} 1016 if (!m_imap) {return 0;}
1017 QString pre = account->getPrefix(); 1017 QString pre = account->getPrefix();
1018 if (delemiter.length()>0 && pre.findRev(delemiter)!=pre.length()-1) { 1018 if (delemiter.length()>0 && pre.findRev(delemiter)!=pre.length()-1) {
1019 pre+=delemiter; 1019 pre+=delemiter;
1020 } 1020 }
1021 if (parentfolder) { 1021 if (parentfolder) {
1022 pre += parentfolder->getDisplayName()+delemiter; 1022 pre += parentfolder->getDisplayName()+delemiter;
1023 } 1023 }
1024 pre+=folder; 1024 pre+=folder;
1025 if (getsubfolder) { 1025 if (getsubfolder) {
1026 if (delemiter.length()>0) { 1026 if (delemiter.length()>0) {
1027 pre+=delemiter; 1027 pre+=delemiter;
1028 } else { 1028 } else {
1029 Global::statusMessage(tr("Cannot create folder %1 for holding subfolders").arg(pre)); 1029 Global::statusMessage(tr("Cannot create folder %1 for holding subfolders").arg(pre));
1030 return 0; 1030 return 0;
1031 } 1031 }
1032 } 1032 }
1033 qDebug("Creating %s",pre.latin1()); 1033 odebug << "Creating " << pre.latin1() << "" << oendl;
1034 int res = mailimap_create(m_imap,pre.latin1()); 1034 int res = mailimap_create(m_imap,pre.latin1());
1035 if (res != MAILIMAP_NO_ERROR) { 1035 if (res != MAILIMAP_NO_ERROR) {
1036 Global::statusMessage(tr("%1").arg(m_imap->imap_response)); 1036 Global::statusMessage(tr("%1").arg(m_imap->imap_response));
1037 return 0; 1037 return 0;
1038 } 1038 }
1039 return 1; 1039 return 1;
1040} 1040}
1041 1041
1042int IMAPwrapper::deleteMbox(const FolderP&folder) 1042int IMAPwrapper::deleteMbox(const FolderP&folder)
1043{ 1043{
1044 if (!folder) return 0; 1044 if (!folder) return 0;
1045 login(); 1045 login();
@@ -1080,108 +1080,108 @@ void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox)
1080 case MAILIMAP_STATUS_ATT_MESSAGES: 1080 case MAILIMAP_STATUS_ATT_MESSAGES:
1081 target_stat.message_count = status_info->st_value; 1081 target_stat.message_count = status_info->st_value;
1082 break; 1082 break;
1083 case MAILIMAP_STATUS_ATT_RECENT: 1083 case MAILIMAP_STATUS_ATT_RECENT:
1084 target_stat.message_recent = status_info->st_value; 1084 target_stat.message_recent = status_info->st_value;
1085 break; 1085 break;
1086 case MAILIMAP_STATUS_ATT_UNSEEN: 1086 case MAILIMAP_STATUS_ATT_UNSEEN:
1087 target_stat.message_unseen = status_info->st_value; 1087 target_stat.message_unseen = status_info->st_value;
1088 break; 1088 break;
1089 } 1089 }
1090 } 1090 }
1091 } else { 1091 } else {
1092 qDebug("Error retrieving status"); 1092 odebug << "Error retrieving status" << oendl;
1093 } 1093 }
1094 if (status) mailimap_mailbox_data_status_free(status); 1094 if (status) mailimap_mailbox_data_status_free(status);
1095 if (att_list) mailimap_status_att_list_free(att_list); 1095 if (att_list) mailimap_status_att_list_free(att_list);
1096} 1096}
1097 1097
1098void IMAPwrapper::storeMessage(const char*msg,size_t length, const QString&folder) 1098void IMAPwrapper::storeMessage(const char*msg,size_t length, const QString&folder)
1099{ 1099{
1100 login(); 1100 login();
1101 if (!m_imap) return; 1101 if (!m_imap) return;
1102 if (!msg) return; 1102 if (!msg) return;
1103 int r = mailimap_append(m_imap,(char*)folder.latin1(),0,0,msg,length); 1103 int r = mailimap_append(m_imap,(char*)folder.latin1(),0,0,msg,length);
1104 if (r != MAILIMAP_NO_ERROR) { 1104 if (r != MAILIMAP_NO_ERROR) {
1105 Global::statusMessage("Error storing mail!"); 1105 Global::statusMessage("Error storing mail!");
1106 } 1106 }
1107} 1107}
1108 1108
1109MAILLIB::ATYPE IMAPwrapper::getType()const 1109MAILLIB::ATYPE IMAPwrapper::getType()const
1110{ 1110{
1111 return account->getType(); 1111 return account->getType();
1112} 1112}
1113 1113
1114const QString&IMAPwrapper::getName()const 1114const QString&IMAPwrapper::getName()const
1115{ 1115{
1116 qDebug("Get name: %s",account->getAccountName().latin1()); 1116 odebug << "Get name: " << account->getAccountName().latin1() << "" << oendl;
1117 return account->getAccountName(); 1117 return account->getAccountName();
1118} 1118}
1119 1119
1120encodedString* IMAPwrapper::fetchRawBody(const RecMailP&mail) 1120encodedString* IMAPwrapper::fetchRawBody(const RecMailP&mail)
1121{ 1121{
1122 // dummy 1122 // dummy
1123 QValueList<int> path; 1123 QValueList<int> path;
1124 return fetchRawPart(mail,path,false); 1124 return fetchRawPart(mail,path,false);
1125} 1125}
1126 1126
1127void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder, 1127void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder,
1128 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) 1128 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
1129{ 1129{
1130 if (targetWrapper != this) { 1130 if (targetWrapper != this) {
1131 AbstractMail::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit); 1131 AbstractMail::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit);
1132 qDebug("Using generic"); 1132 odebug << "Using generic" << oendl;
1133 return; 1133 return;
1134 } 1134 }
1135 mailimap_set *set = 0; 1135 mailimap_set *set = 0;
1136 login(); 1136 login();
1137 if (!m_imap) { 1137 if (!m_imap) {
1138 return; 1138 return;
1139 } 1139 }
1140 int err = selectMbox(fromFolder->getName()); 1140 int err = selectMbox(fromFolder->getName());
1141 if ( err != MAILIMAP_NO_ERROR ) { 1141 if ( err != MAILIMAP_NO_ERROR ) {
1142 return; 1142 return;
1143 } 1143 }
1144 int last = m_imap->imap_selection_info->sel_exists; 1144 int last = m_imap->imap_selection_info->sel_exists;
1145 set = mailimap_set_new_interval( 1, last ); 1145 set = mailimap_set_new_interval( 1, last );
1146 err = mailimap_copy(m_imap,set,targetFolder.latin1()); 1146 err = mailimap_copy(m_imap,set,targetFolder.latin1());
1147 mailimap_set_free( set ); 1147 mailimap_set_free( set );
1148 if ( err != MAILIMAP_NO_ERROR ) { 1148 if ( err != MAILIMAP_NO_ERROR ) {
1149 QString error_msg = tr("error copy mails: %1").arg(m_imap->imap_response); 1149 QString error_msg = tr("error copy mails: %1").arg(m_imap->imap_response);
1150 Global::statusMessage(error_msg); 1150 Global::statusMessage(error_msg);
1151 qDebug(error_msg); 1151 odebug << error_msg << oendl;
1152 return; 1152 return;
1153 } 1153 }
1154 if (moveit) { 1154 if (moveit) {
1155 deleteAllMail(fromFolder); 1155 deleteAllMail(fromFolder);
1156 } 1156 }
1157} 1157}
1158 1158
1159void IMAPwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) 1159void IMAPwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
1160{ 1160{
1161 if (targetWrapper != this) { 1161 if (targetWrapper != this) {
1162 qDebug("Using generic"); 1162 odebug << "Using generic" << oendl;
1163 AbstractMail::mvcpMail(mail,targetFolder,targetWrapper,moveit); 1163 AbstractMail::mvcpMail(mail,targetFolder,targetWrapper,moveit);
1164 return; 1164 return;
1165 } 1165 }
1166 mailimap_set *set = 0; 1166 mailimap_set *set = 0;
1167 login(); 1167 login();
1168 if (!m_imap) { 1168 if (!m_imap) {
1169 return; 1169 return;
1170 } 1170 }
1171 int err = selectMbox(mail->getMbox()); 1171 int err = selectMbox(mail->getMbox());
1172 if ( err != MAILIMAP_NO_ERROR ) { 1172 if ( err != MAILIMAP_NO_ERROR ) {
1173 return; 1173 return;
1174 } 1174 }
1175 set = mailimap_set_new_single(mail->getNumber()); 1175 set = mailimap_set_new_single(mail->getNumber());
1176 err = mailimap_copy(m_imap,set,targetFolder.latin1()); 1176 err = mailimap_copy(m_imap,set,targetFolder.latin1());
1177 mailimap_set_free( set ); 1177 mailimap_set_free( set );
1178 if ( err != MAILIMAP_NO_ERROR ) { 1178 if ( err != MAILIMAP_NO_ERROR ) {
1179 QString error_msg = tr("error copy mail: %1").arg(m_imap->imap_response); 1179 QString error_msg = tr("error copy mail: %1").arg(m_imap->imap_response);
1180 Global::statusMessage(error_msg); 1180 Global::statusMessage(error_msg);
1181 qDebug(error_msg); 1181 odebug << error_msg << oendl;
1182 return; 1182 return;
1183 } 1183 }
1184 if (moveit) { 1184 if (moveit) {
1185 deleteMail(mail); 1185 deleteMail(mail);
1186 } 1186 }
1187} 1187}