summaryrefslogtreecommitdiff
path: root/noncore/net/mail
Unidiff
Diffstat (limited to 'noncore/net/mail') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/accountitem.cpp18
-rw-r--r--noncore/net/mail/accountview.cpp12
-rw-r--r--noncore/net/mail/composemail.cpp6
-rw-r--r--noncore/net/mail/editaccounts.cpp22
-rw-r--r--noncore/net/mail/libmailwrapper/abstractmail.cpp8
-rw-r--r--noncore/net/mail/libmailwrapper/generatemail.cpp30
-rw-r--r--noncore/net/mail/libmailwrapper/genericwrapper.cpp14
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.cpp66
-rw-r--r--noncore/net/mail/libmailwrapper/logindialog.cpp2
-rw-r--r--noncore/net/mail/libmailwrapper/mailtypes.cpp10
-rw-r--r--noncore/net/mail/libmailwrapper/mailwrapper.cpp2
-rw-r--r--noncore/net/mail/libmailwrapper/mboxwrapper.cpp22
-rw-r--r--noncore/net/mail/libmailwrapper/mhwrapper.cpp60
-rw-r--r--noncore/net/mail/libmailwrapper/nntpwrapper.cpp8
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.cpp10
-rw-r--r--noncore/net/mail/libmailwrapper/settings.cpp18
-rw-r--r--noncore/net/mail/libmailwrapper/smtpwrapper.cpp30
-rw-r--r--noncore/net/mail/libmailwrapper/statusmail.cpp6
-rw-r--r--noncore/net/mail/libmailwrapper/storemail.cpp4
-rw-r--r--noncore/net/mail/mainwindow.cpp14
-rw-r--r--noncore/net/mail/nntpgroups.cpp2
-rw-r--r--noncore/net/mail/opiemail.cpp16
-rw-r--r--noncore/net/mail/taskbarapplet/mailapplet.cpp2
-rw-r--r--noncore/net/mail/viewmail.cpp2
24 files changed, 192 insertions, 192 deletions
diff --git a/noncore/net/mail/accountitem.cpp b/noncore/net/mail/accountitem.cpp
index 54d2da2..ae28313 100644
--- a/noncore/net/mail/accountitem.cpp
+++ b/noncore/net/mail/accountitem.cpp
@@ -57,49 +57,49 @@ void POP3viewItem::refresh(QValueList<Opie::Core::OSmartPointer<RecMail> > & )
57 57
58void POP3viewItem::refresh() 58void POP3viewItem::refresh()
59{ 59{
60 if (account->getOffline()) return; 60 if (account->getOffline()) return;
61 QValueList<FolderP> *folders = wrapper->listFolders(); 61 QValueList<FolderP> *folders = wrapper->listFolders();
62 QListViewItem *child = firstChild(); 62 QListViewItem *child = firstChild();
63 while ( child ) 63 while ( child )
64 { 64 {
65 QListViewItem *tmp = child; 65 QListViewItem *tmp = child;
66 child = child->nextSibling(); 66 child = child->nextSibling();
67 delete tmp; 67 delete tmp;
68 } 68 }
69 QValueList<FolderP>::ConstIterator it; 69 QValueList<FolderP>::ConstIterator it;
70 QListViewItem*item = 0; 70 QListViewItem*item = 0;
71 for ( it = folders->begin(); it!=folders->end(); ++it) 71 for ( it = folders->begin(); it!=folders->end(); ++it)
72 { 72 {
73 item = new POP3folderItem( (*it), this , item ); 73 item = new POP3folderItem( (*it), this , item );
74 item->setSelectable( (*it)->may_select()); 74 item->setSelectable( (*it)->may_select());
75 } 75 }
76 delete folders; 76 delete folders;
77} 77}
78 78
79RECBODYP POP3viewItem::fetchBody( const RecMailP &mail ) 79RECBODYP POP3viewItem::fetchBody( const RecMailP &mail )
80{ 80{
81 qDebug( "POP3 fetchBody" ); 81 odebug << "POP3 fetchBody" << oendl;
82 return wrapper->fetchBody( mail ); 82 return wrapper->fetchBody( mail );
83} 83}
84 84
85QPopupMenu * POP3viewItem::getContextMenu() 85QPopupMenu * POP3viewItem::getContextMenu()
86{ 86{
87 QPopupMenu *m = new QPopupMenu(0); 87 QPopupMenu *m = new QPopupMenu(0);
88 if (m) 88 if (m)
89 { 89 {
90 if (!account->getOffline()) 90 if (!account->getOffline())
91 { 91 {
92 m->insertItem(QObject::tr("Disconnect",contextName),0); 92 m->insertItem(QObject::tr("Disconnect",contextName),0);
93 m->insertItem(QObject::tr("Set offline",contextName),1); 93 m->insertItem(QObject::tr("Set offline",contextName),1);
94 } 94 }
95 else 95 else
96 { 96 {
97 m->insertItem(QObject::tr("Set online",contextName),1); 97 m->insertItem(QObject::tr("Set online",contextName),1);
98 } 98 }
99 } 99 }
100 return m; 100 return m;
101} 101}
102 102
103void POP3viewItem::disconnect() 103void POP3viewItem::disconnect()
104{ 104{
105 QListViewItem *child = firstChild(); 105 QListViewItem *child = firstChild();
@@ -248,49 +248,49 @@ void NNTPviewItem::refresh( QValueList<RecMailP> & )
248void NNTPviewItem::refresh() 248void NNTPviewItem::refresh()
249{ 249{
250 if (account->getOffline()) return; 250 if (account->getOffline()) return;
251 QValueList<FolderP> *folders = wrapper->listFolders(); 251 QValueList<FolderP> *folders = wrapper->listFolders();
252 252
253 QListViewItem *child = firstChild(); 253 QListViewItem *child = firstChild();
254 while ( child ) 254 while ( child )
255 { 255 {
256 QListViewItem *tmp = child; 256 QListViewItem *tmp = child;
257 child = child->nextSibling(); 257 child = child->nextSibling();
258 delete tmp; 258 delete tmp;
259 } 259 }
260 QValueList<FolderP>::ConstIterator it; 260 QValueList<FolderP>::ConstIterator it;
261 QListViewItem*item = 0; 261 QListViewItem*item = 0;
262 for ( it = folders->begin(); it!=folders->end(); ++it) 262 for ( it = folders->begin(); it!=folders->end(); ++it)
263 { 263 {
264 item = new NNTPfolderItem( (*it), this , item ); 264 item = new NNTPfolderItem( (*it), this , item );
265 item->setSelectable( (*it)->may_select()); 265 item->setSelectable( (*it)->may_select());
266 } 266 }
267 delete folders; 267 delete folders;
268} 268}
269 269
270RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail ) 270RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail )
271{ 271{
272 qDebug( "NNTP fetchBody" ); 272 odebug << "NNTP fetchBody" << oendl;
273 return wrapper->fetchBody( mail ); 273 return wrapper->fetchBody( mail );
274} 274}
275 275
276QPopupMenu * NNTPviewItem::getContextMenu() 276QPopupMenu * NNTPviewItem::getContextMenu()
277{ 277{
278 QPopupMenu *m = new QPopupMenu(0); 278 QPopupMenu *m = new QPopupMenu(0);
279 if (m) 279 if (m)
280 { 280 {
281 if (!account->getOffline()) 281 if (!account->getOffline())
282 { 282 {
283 m->insertItem(QObject::tr("Disconnect",contextName),0); 283 m->insertItem(QObject::tr("Disconnect",contextName),0);
284 m->insertItem(QObject::tr("Set offline",contextName),1); 284 m->insertItem(QObject::tr("Set offline",contextName),1);
285 m->insertItem(QObject::tr("(Un-)Subscribe groups",contextName),2); 285 m->insertItem(QObject::tr("(Un-)Subscribe groups",contextName),2);
286 } 286 }
287 else 287 else
288 { 288 {
289 m->insertItem(QObject::tr("Set online",contextName),1); 289 m->insertItem(QObject::tr("Set online",contextName),1);
290 } 290 }
291 } 291 }
292 return m; 292 return m;
293} 293}
294 294
295void NNTPviewItem::subscribeGroups() 295void NNTPviewItem::subscribeGroups()
296{ 296{
@@ -439,49 +439,49 @@ const QStringList&IMAPviewItem::subFolders()
439 return currentFolders; 439 return currentFolders;
440} 440}
441 441
442void IMAPviewItem::refreshFolders(bool force) 442void IMAPviewItem::refreshFolders(bool force)
443{ 443{
444 if (childCount()>0 && force==false) return; 444 if (childCount()>0 && force==false) return;
445 if (account->getOffline()) return; 445 if (account->getOffline()) return;
446 446
447 removeChilds(); 447 removeChilds();
448 currentFolders.clear(); 448 currentFolders.clear();
449 QValueList<FolderP> * folders = wrapper->listFolders(); 449 QValueList<FolderP> * folders = wrapper->listFolders();
450 450
451 QValueList<FolderP>::Iterator it; 451 QValueList<FolderP>::Iterator it;
452 QListViewItem*item = 0; 452 QListViewItem*item = 0;
453 QListViewItem*titem = 0; 453 QListViewItem*titem = 0;
454 QString fname,del,search; 454 QString fname,del,search;
455 int pos; 455 int pos;
456 456
457 for ( it = folders->begin(); it!=folders->end(); ++it) 457 for ( it = folders->begin(); it!=folders->end(); ++it)
458 { 458 {
459 if ((*it)->getDisplayName().lower()=="inbox") 459 if ((*it)->getDisplayName().lower()=="inbox")
460 { 460 {
461 item = new IMAPfolderItem( (*it), this , item ); 461 item = new IMAPfolderItem( (*it), this , item );
462 folders->remove(it); 462 folders->remove(it);
463 qDebug("inbox found"); 463 odebug << "inbox found" << oendl;
464 break; 464 break;
465 } 465 }
466 } 466 }
467 for ( it = folders->begin(); it!=folders->end(); ++it) 467 for ( it = folders->begin(); it!=folders->end(); ++it)
468 { 468 {
469 fname = (*it)->getDisplayName(); 469 fname = (*it)->getDisplayName();
470 currentFolders.append((*it)->getName()); 470 currentFolders.append((*it)->getName());
471 pos = fname.findRev((*it)->Separator()); 471 pos = fname.findRev((*it)->Separator());
472 if (pos != -1) 472 if (pos != -1)
473 { 473 {
474 fname = fname.left(pos); 474 fname = fname.left(pos);
475 } 475 }
476 IMAPfolderItem*pitem = (IMAPfolderItem*)findSubItem(fname); 476 IMAPfolderItem*pitem = (IMAPfolderItem*)findSubItem(fname);
477 if (pitem) 477 if (pitem)
478 { 478 {
479 titem = item; 479 titem = item;
480 item = new IMAPfolderItem( (*it),pitem,pitem->firstChild(),this); 480 item = new IMAPfolderItem( (*it),pitem,pitem->firstChild(),this);
481 /* setup the short name */ 481 /* setup the short name */
482 item->setText(0,(*it)->getDisplayName().right((*it)->getDisplayName().length()-pos-1)); 482 item->setText(0,(*it)->getDisplayName().right((*it)->getDisplayName().length()-pos-1));
483 item = titem; 483 item = titem;
484 } 484 }
485 else 485 else
486 { 486 {
487 item = new IMAPfolderItem( (*it), this , item ); 487 item = new IMAPfolderItem( (*it), this , item );
@@ -512,49 +512,49 @@ QPopupMenu * IMAPviewItem::getContextMenu()
512} 512}
513 513
514void IMAPviewItem::createNewFolder() 514void IMAPviewItem::createNewFolder()
515{ 515{
516 Newmdirdlg ndirdlg; 516 Newmdirdlg ndirdlg;
517 if ( QPEApplication::execDialog( &ndirdlg )) 517 if ( QPEApplication::execDialog( &ndirdlg ))
518 { 518 {
519 QString ndir = ndirdlg.Newdir(); 519 QString ndir = ndirdlg.Newdir();
520 bool makesubs = ndirdlg.subpossible(); 520 bool makesubs = ndirdlg.subpossible();
521 QString delemiter = "/"; 521 QString delemiter = "/";
522 IMAPfolderItem*item = (IMAPfolderItem*)firstChild(); 522 IMAPfolderItem*item = (IMAPfolderItem*)firstChild();
523 if (item) 523 if (item)
524 { 524 {
525 delemiter = item->Delemiter(); 525 delemiter = item->Delemiter();
526 } 526 }
527 if (wrapper->createMbox(ndir,0,delemiter,makesubs)) 527 if (wrapper->createMbox(ndir,0,delemiter,makesubs))
528 { 528 {
529 refreshFolders(true); 529 refreshFolders(true);
530 } 530 }
531 } 531 }
532} 532}
533 533
534void IMAPviewItem::contextMenuSelected(int id) 534void IMAPviewItem::contextMenuSelected(int id)
535{ 535{
536 qDebug("Id selected: %i",id); 536 odebug << "Id selected: " << id << "" << oendl;
537 switch (id) 537 switch (id)
538 { 538 {
539 case 0: 539 case 0:
540 refreshFolders(true); 540 refreshFolders(true);
541 break; 541 break;
542 case 1: 542 case 1:
543 createNewFolder(); 543 createNewFolder();
544 break; 544 break;
545 case 2: 545 case 2:
546 removeChilds(); 546 removeChilds();
547 wrapper->logout(); 547 wrapper->logout();
548 break; 548 break;
549 case 3: 549 case 3:
550 if (account->getOffline()==false) 550 if (account->getOffline()==false)
551 { 551 {
552 removeChilds(); 552 removeChilds();
553 wrapper->logout(); 553 wrapper->logout();
554 } 554 }
555 account->setOffline(!account->getOffline()); 555 account->setOffline(!account->getOffline());
556 account->save(); 556 account->save();
557 SETPIX(PIXMAP_IMAPFOLDER); 557 SETPIX(PIXMAP_IMAPFOLDER);
558 refreshFolders(false); 558 refreshFolders(false);
559 break; 559 break;
560 default: 560 default:
@@ -650,76 +650,76 @@ QPopupMenu * IMAPfolderItem::getContextMenu()
650 return m; 650 return m;
651} 651}
652 652
653void IMAPfolderItem::createNewFolder() 653void IMAPfolderItem::createNewFolder()
654{ 654{
655 Newmdirdlg ndirdlg; 655 Newmdirdlg ndirdlg;
656 if ( QPEApplication::execDialog( &ndirdlg ) ) 656 if ( QPEApplication::execDialog( &ndirdlg ) )
657 { 657 {
658 QString ndir = ndirdlg.Newdir(); 658 QString ndir = ndirdlg.Newdir();
659 bool makesubs = ndirdlg.subpossible(); 659 bool makesubs = ndirdlg.subpossible();
660 QString delemiter = Delemiter(); 660 QString delemiter = Delemiter();
661 if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs)) 661 if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs))
662 { 662 {
663 imap->refreshFolders(true); 663 imap->refreshFolders(true);
664 } 664 }
665 } 665 }
666} 666}
667 667
668void IMAPfolderItem::deleteFolder() 668void IMAPfolderItem::deleteFolder()
669{ 669{
670 int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), 670 int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName),
671 QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), 671 QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()),
672 QObject::tr("Yes",contextName), 672 QObject::tr("Yes",contextName),
673 QObject::tr("No",contextName),QString::null,1,1); 673 QObject::tr("No",contextName),QString::null,1,1);
674 qDebug("Auswahl: %i",yesno); 674 odebug << "Auswahl: " << yesno << "" << oendl;
675 if (yesno == 0) 675 if (yesno == 0)
676 { 676 {
677 if (imap->getWrapper()->deleteMbox(folder)) 677 if (imap->getWrapper()->deleteMbox(folder))
678 { 678 {
679 QListView*v=listView(); 679 QListView*v=listView();
680 IMAPviewItem * box = imap; 680 IMAPviewItem * box = imap;
681 /* be carefull - after that this object is destroyd so don't use 681 /* be carefull - after that this object is destroyd so don't use
682 * any member of it after that call!!*/ 682 * any member of it after that call!!*/
683 imap->refreshFolders(true); 683 imap->refreshFolders(true);
684 if (v) 684 if (v)
685 { 685 {
686 v->setSelected(box,true); 686 v->setSelected(box,true);
687 } 687 }
688 } 688 }
689 } 689 }
690} 690}
691 691
692void IMAPfolderItem::downloadMails() 692void IMAPfolderItem::downloadMails()
693{ 693{
694 AccountView*bl = imap->accountView(); 694 AccountView*bl = imap->accountView();
695 if (!bl) return; 695 if (!bl) return;
696 bl->downloadMails(folder,imap->getWrapper()); 696 bl->downloadMails(folder,imap->getWrapper());
697} 697}
698 698
699void IMAPfolderItem::contextMenuSelected(int id) 699void IMAPfolderItem::contextMenuSelected(int id)
700{ 700{
701 qDebug("Selected id: %i",id); 701 odebug << "Selected id: " << id << "" << oendl;
702 AccountView * view = (AccountView*)listView(); 702 AccountView * view = (AccountView*)listView();
703 switch(id) 703 switch(id)
704 { 704 {
705 case 0: 705 case 0:
706 view->refreshCurrent(); 706 view->refreshCurrent();
707 break; 707 break;
708 case 1: 708 case 1:
709 deleteAllMail(imap->getWrapper(),folder); 709 deleteAllMail(imap->getWrapper(),folder);
710 break; 710 break;
711 case 2: 711 case 2:
712 createNewFolder(); 712 createNewFolder();
713 break; 713 break;
714 case 3: 714 case 3:
715 deleteFolder(); 715 deleteFolder();
716 break; 716 break;
717 case 4: 717 case 4:
718 downloadMails(); 718 downloadMails();
719 break; 719 break;
720 default: 720 default:
721 break; 721 break;
722 } 722 }
723} 723}
724 724
725/** 725/**
@@ -781,49 +781,49 @@ void MHviewItem::refresh(bool force)
781 if (pos > 0) 781 if (pos > 0)
782 { 782 {
783 fname = fname.left(pos); 783 fname = fname.left(pos);
784 pmaster = (MHfolderItem*)findSubItem(fname); 784 pmaster = (MHfolderItem*)findSubItem(fname);
785 } 785 }
786 else 786 else
787 { 787 {
788 pmaster = 0; 788 pmaster = 0;
789 } 789 }
790 if (pmaster) 790 if (pmaster)
791 { 791 {
792 item = new MHfolderItem( (*it), pmaster, item, this ); 792 item = new MHfolderItem( (*it), pmaster, item, this );
793 } 793 }
794 else 794 else
795 { 795 {
796 item = new MHfolderItem( (*it), this , item ); 796 item = new MHfolderItem( (*it), this , item );
797 } 797 }
798 item->setSelectable((*it)->may_select()); 798 item->setSelectable((*it)->may_select());
799 } 799 }
800 delete folders; 800 delete folders;
801} 801}
802 802
803RECBODYP MHviewItem::fetchBody( const RecMailP &mail ) 803RECBODYP MHviewItem::fetchBody( const RecMailP &mail )
804{ 804{
805 qDebug( "MH fetchBody" ); 805 odebug << "MH fetchBody" << oendl;
806 return wrapper->fetchBody( mail ); 806 return wrapper->fetchBody( mail );
807} 807}
808 808
809QPopupMenu * MHviewItem::getContextMenu() 809QPopupMenu * MHviewItem::getContextMenu()
810{ 810{
811 QPopupMenu *m = new QPopupMenu(0); 811 QPopupMenu *m = new QPopupMenu(0);
812 if (m) 812 if (m)
813 { 813 {
814 m->insertItem(QObject::tr("Refresh folder list",contextName),0); 814 m->insertItem(QObject::tr("Refresh folder list",contextName),0);
815 m->insertItem(QObject::tr("Create new folder",contextName),1); 815 m->insertItem(QObject::tr("Create new folder",contextName),1);
816 m->insertItem(QObject::tr("Delete all mails",contextName),2); 816 m->insertItem(QObject::tr("Delete all mails",contextName),2);
817 m->insertItem(QObject::tr("Move/Copie all mails",contextName),3); 817 m->insertItem(QObject::tr("Move/Copie all mails",contextName),3);
818 } 818 }
819 return m; 819 return m;
820} 820}
821 821
822void MHviewItem::createFolder() 822void MHviewItem::createFolder()
823{ 823{
824 Newmdirdlg ndirdlg(0,0,true); 824 Newmdirdlg ndirdlg(0,0,true);
825 if ( QPEApplication::execDialog( &ndirdlg ) ) 825 if ( QPEApplication::execDialog( &ndirdlg ) )
826 { 826 {
827 QString ndir = ndirdlg.Newdir(); 827 QString ndir = ndirdlg.Newdir();
828 if (wrapper->createMbox(ndir)) 828 if (wrapper->createMbox(ndir))
829 { 829 {
@@ -911,49 +911,49 @@ void MHfolderItem::initName()
911} 911}
912 912
913const FolderP&MHfolderItem::getFolder()const 913const FolderP&MHfolderItem::getFolder()const
914{ 914{
915 return folder; 915 return folder;
916} 916}
917 917
918void MHfolderItem::refresh(QValueList<RecMailP>&target) 918void MHfolderItem::refresh(QValueList<RecMailP>&target)
919{ 919{
920 if (folder->may_select()) 920 if (folder->may_select())
921 mbox->getWrapper()->listMessages( folder->getName(),target ); 921 mbox->getWrapper()->listMessages( folder->getName(),target );
922} 922}
923 923
924RECBODYP MHfolderItem::fetchBody(const RecMailP&aMail) 924RECBODYP MHfolderItem::fetchBody(const RecMailP&aMail)
925{ 925{
926 return mbox->getWrapper()->fetchBody(aMail); 926 return mbox->getWrapper()->fetchBody(aMail);
927} 927}
928 928
929void MHfolderItem::deleteFolder() 929void MHfolderItem::deleteFolder()
930{ 930{
931 int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), 931 int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName),
932 QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), 932 QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()),
933 QObject::tr("Yes",contextName), 933 QObject::tr("Yes",contextName),
934 QObject::tr("No",contextName),QString::null,1,1); 934 QObject::tr("No",contextName),QString::null,1,1);
935 qDebug("Auswahl: %i",yesno); 935 odebug << "Auswahl: " << yesno << "" << oendl;
936 if (yesno == 0) 936 if (yesno == 0)
937 { 937 {
938 if (mbox->getWrapper()->deleteMbox(folder)) 938 if (mbox->getWrapper()->deleteMbox(folder))
939 { 939 {
940 QListView*v=listView(); 940 QListView*v=listView();
941 MHviewItem * box = mbox; 941 MHviewItem * box = mbox;
942 /* be carefull - after that this object is destroyd so don't use 942 /* be carefull - after that this object is destroyd so don't use
943 * any member of it after that call!!*/ 943 * any member of it after that call!!*/
944 mbox->refresh(true); 944 mbox->refresh(true);
945 if (v) 945 if (v)
946 { 946 {
947 v->setSelected(box,true); 947 v->setSelected(box,true);
948 } 948 }
949 } 949 }
950 } 950 }
951} 951}
952 952
953QPopupMenu * MHfolderItem::getContextMenu() 953QPopupMenu * MHfolderItem::getContextMenu()
954{ 954{
955 QPopupMenu *m = new QPopupMenu(0); 955 QPopupMenu *m = new QPopupMenu(0);
956 if (m) 956 if (m)
957 { 957 {
958 m->insertItem(QObject::tr("Move/Copie all mails",contextName),2); 958 m->insertItem(QObject::tr("Move/Copie all mails",contextName),2);
959 m->insertItem(QObject::tr("Delete all mails",contextName),0); 959 m->insertItem(QObject::tr("Delete all mails",contextName),0);
@@ -1053,49 +1053,49 @@ void AccountViewItem::init()
1053{ 1053{
1054 m_Backlink = 0; 1054 m_Backlink = 0;
1055} 1055}
1056 1056
1057AccountViewItem::~AccountViewItem() 1057AccountViewItem::~AccountViewItem()
1058{ 1058{
1059 folder = 0; 1059 folder = 0;
1060} 1060}
1061 1061
1062AccountView*AccountViewItem::accountView() 1062AccountView*AccountViewItem::accountView()
1063{ 1063{
1064 return m_Backlink; 1064 return m_Backlink;
1065} 1065}
1066 1066
1067void AccountViewItem::deleteAllMail(AbstractMail*wrapper,const FolderP&folder) 1067void AccountViewItem::deleteAllMail(AbstractMail*wrapper,const FolderP&folder)
1068{ 1068{
1069 if (!wrapper) return; 1069 if (!wrapper) return;
1070 QString fname=""; 1070 QString fname="";
1071 if (folder) fname = folder->getDisplayName(); 1071 if (folder) fname = folder->getDisplayName();
1072 int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName), 1072 int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName),
1073 QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName). 1073 QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName).
1074 arg(fname), 1074 arg(fname),
1075 QObject::tr("Yes",contextName), 1075 QObject::tr("Yes",contextName),
1076 QObject::tr("No",contextName),QString::null,1,1); 1076 QObject::tr("No",contextName),QString::null,1,1);
1077 qDebug("Auswahl: %i",yesno); 1077 odebug << "Auswahl: " << yesno << "" << oendl;
1078 if (yesno == 0) 1078 if (yesno == 0)
1079 { 1079 {
1080 if (wrapper->deleteAllMail(folder)) 1080 if (wrapper->deleteAllMail(folder))
1081 { 1081 {
1082 AccountView * view = (AccountView*)listView(); 1082 AccountView * view = (AccountView*)listView();
1083 if (view) view->refreshCurrent(); 1083 if (view) view->refreshCurrent();
1084 } 1084 }
1085 } 1085 }
1086} 1086}
1087 1087
1088void AccountViewItem::removeChilds() 1088void AccountViewItem::removeChilds()
1089{ 1089{
1090 QListViewItem *child = firstChild(); 1090 QListViewItem *child = firstChild();
1091 while ( child ) 1091 while ( child )
1092 { 1092 {
1093 QListViewItem *tmp = child; 1093 QListViewItem *tmp = child;
1094 child = child->nextSibling(); 1094 child = child->nextSibling();
1095 delete tmp; 1095 delete tmp;
1096 } 1096 }
1097} 1097}
1098 1098
1099bool AccountViewItem::matchName(const QString&name)const 1099bool AccountViewItem::matchName(const QString&name)const
1100{ 1100{
1101 if (!folder) return false; 1101 if (!folder) return false;
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp
index f0a163e..0052061 100644
--- a/noncore/net/mail/accountview.cpp
+++ b/noncore/net/mail/accountview.cpp
@@ -45,72 +45,72 @@ void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int)
45 AccountViewItem *view = static_cast<AccountViewItem *>(item); 45 AccountViewItem *view = static_cast<AccountViewItem *>(item);
46 QPopupMenu*m = view->getContextMenu(); 46 QPopupMenu*m = view->getContextMenu();
47 if (!m) return; 47 if (!m) return;
48 connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int))); 48 connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int)));
49 m->setFocus(); 49 m->setFocus();
50 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); 50 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
51 delete m; 51 delete m;
52} 52}
53 53
54void AccountView::populate( QList<Account> list ) 54void AccountView::populate( QList<Account> list )
55{ 55{
56 clear(); 56 clear();
57 57
58 imapAccounts.clear(); 58 imapAccounts.clear();
59 mhAccounts.clear(); 59 mhAccounts.clear();
60 60
61 mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this)); 61 mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this));
62 62
63 Account *it; 63 Account *it;
64 for ( it = list.first(); it; it = list.next() ) 64 for ( it = list.first(); it; it = list.next() )
65 { 65 {
66 if ( it->getType() == MAILLIB::A_IMAP ) 66 if ( it->getType() == MAILLIB::A_IMAP )
67 { 67 {
68 IMAPaccount *imap = static_cast<IMAPaccount *>(it); 68 IMAPaccount *imap = static_cast<IMAPaccount *>(it);
69 qDebug( "added IMAP " + imap->getAccountName() ); 69 odebug << "added IMAP " + imap->getAccountName() << oendl;
70 imapAccounts.append(new IMAPviewItem( imap, this )); 70 imapAccounts.append(new IMAPviewItem( imap, this ));
71 } 71 }
72 else if ( it->getType() == MAILLIB::A_POP3 ) 72 else if ( it->getType() == MAILLIB::A_POP3 )
73 { 73 {
74 POP3account *pop3 = static_cast<POP3account *>(it); 74 POP3account *pop3 = static_cast<POP3account *>(it);
75 qDebug( "added POP3 " + pop3->getAccountName() ); 75 odebug << "added POP3 " + pop3->getAccountName() << oendl;
76 /* must not be hold 'cause it isn't required */ 76 /* must not be hold 'cause it isn't required */
77 (void) new POP3viewItem( pop3, this ); 77 (void) new POP3viewItem( pop3, this );
78 } 78 }
79 else if ( it->getType() == MAILLIB::A_NNTP ) 79 else if ( it->getType() == MAILLIB::A_NNTP )
80 { 80 {
81 NNTPaccount *nntp = static_cast<NNTPaccount *>(it); 81 NNTPaccount *nntp = static_cast<NNTPaccount *>(it);
82 qDebug( "added NNTP " + nntp->getAccountName() ); 82 odebug << "added NNTP " + nntp->getAccountName() << oendl;
83 /* must not be hold 'cause it isn't required */ 83 /* must not be hold 'cause it isn't required */
84 (void) new NNTPviewItem( nntp, this ); 84 (void) new NNTPviewItem( nntp, this );
85 } 85 }
86 } 86 }
87} 87}
88 88
89void AccountView::refresh(QListViewItem *item) 89void AccountView::refresh(QListViewItem *item)
90{ 90{
91 91
92 qDebug("AccountView refresh..."); 92 odebug << "AccountView refresh..." << oendl;
93 if ( item ) 93 if ( item )
94 { 94 {
95 m_currentItem = item; 95 m_currentItem = item;
96 QValueList<RecMailP> headerlist; 96 QValueList<RecMailP> headerlist;
97 AccountViewItem *view = static_cast<AccountViewItem *>(item); 97 AccountViewItem *view = static_cast<AccountViewItem *>(item);
98 view->refresh(headerlist); 98 view->refresh(headerlist);
99 emit refreshMailview(headerlist); 99 emit refreshMailview(headerlist);
100 } 100 }
101} 101}
102 102
103void AccountView::refreshCurrent() 103void AccountView::refreshCurrent()
104{ 104{
105 m_currentItem = currentItem(); 105 m_currentItem = currentItem();
106 if ( !m_currentItem ) return; 106 if ( !m_currentItem ) return;
107 QValueList<RecMailP> headerlist; 107 QValueList<RecMailP> headerlist;
108 AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); 108 AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem);
109 view->refresh(headerlist); 109 view->refresh(headerlist);
110 emit refreshMailview(headerlist); 110 emit refreshMailview(headerlist);
111} 111}
112 112
113void AccountView::refreshAll() 113void AccountView::refreshAll()
114{ 114{
115} 115}
116 116
@@ -141,36 +141,36 @@ void AccountView::setupFolderselect(Selectstore*sels)
141 sels->addAccounts(imapAccounts[i]->getWrapper(),imapAccounts[i]->subFolders()); 141 sels->addAccounts(imapAccounts[i]->getWrapper(),imapAccounts[i]->subFolders());
142 } 142 }
143} 143}
144 144
145void AccountView::downloadMails(const FolderP&fromFolder,AbstractMail*fromWrapper) 145void AccountView::downloadMails(const FolderP&fromFolder,AbstractMail*fromWrapper)
146{ 146{
147 AbstractMail*targetMail = 0; 147 AbstractMail*targetMail = 0;
148 QString targetFolder = ""; 148 QString targetFolder = "";
149 Selectstore sels; 149 Selectstore sels;
150 setupFolderselect(&sels); 150 setupFolderselect(&sels);
151 if (!sels.exec()) return; 151 if (!sels.exec()) return;
152 targetMail = sels.currentMail(); 152 targetMail = sels.currentMail();
153 targetFolder = sels.currentFolder(); 153 targetFolder = sels.currentFolder();
154 if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) || 154 if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) ||
155 targetFolder.isEmpty()) 155 targetFolder.isEmpty())
156 { 156 {
157 return; 157 return;
158 } 158 }
159 if (sels.newFolder() && !targetMail->createMbox(targetFolder)) 159 if (sels.newFolder() && !targetMail->createMbox(targetFolder))
160 { 160 {
161 QMessageBox::critical(0,tr("Error creating new Folder"), 161 QMessageBox::critical(0,tr("Error creating new Folder"),
162 tr("<center>Error while creating<br>new folder - breaking.</center>")); 162 tr("<center>Error while creating<br>new folder - breaking.</center>"));
163 return; 163 return;
164 } 164 }
165 qDebug("Targetfolder: %s",targetFolder.latin1()); 165 odebug << "Targetfolder: " << targetFolder.latin1() << "" << oendl;
166 qDebug("Fromfolder: %s",fromFolder->getName().latin1()); 166 odebug << "Fromfolder: " << fromFolder->getName().latin1() << "" << oendl;
167 fromWrapper->mvcpAllMails(fromFolder,targetFolder,targetMail,sels.moveMails()); 167 fromWrapper->mvcpAllMails(fromFolder,targetFolder,targetMail,sels.moveMails());
168 refreshCurrent(); 168 refreshCurrent();
169} 169}
170 170
171bool AccountView::currentisDraft() 171bool AccountView::currentisDraft()
172{ 172{
173 AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); 173 AccountViewItem *view = static_cast<AccountViewItem *>(currentItem());
174 if (!view) return false; 174 if (!view) return false;
175 return view->isDraftfolder(); 175 return view->isDraftfolder();
176} 176}
diff --git a/noncore/net/mail/composemail.cpp b/noncore/net/mail/composemail.cpp
index 988a1d9..fa703c4 100644
--- a/noncore/net/mail/composemail.cpp
+++ b/noncore/net/mail/composemail.cpp
@@ -162,49 +162,49 @@ void ComposeMail::slotAdjustColumns()
162 162
163void ComposeMail::addAttachment() 163void ComposeMail::addAttachment()
164{ 164{
165 DocLnk lnk = OFileDialog::getOpenFileName( 1, "/" ); 165 DocLnk lnk = OFileDialog::getOpenFileName( 1, "/" );
166 if ( !lnk.name().isEmpty() ) { 166 if ( !lnk.name().isEmpty() ) {
167 Attachment *att = new Attachment( lnk ); 167 Attachment *att = new Attachment( lnk );
168 (void) new AttachViewItem( attList, att ); 168 (void) new AttachViewItem( attList, att );
169 } 169 }
170} 170}
171 171
172void ComposeMail::removeAttachment() 172void ComposeMail::removeAttachment()
173{ 173{
174 if ( !attList->currentItem() ) { 174 if ( !attList->currentItem() ) {
175 QMessageBox::information( this, tr( "Error" ), 175 QMessageBox::information( this, tr( "Error" ),
176 tr( "<p>Please select a File.</p>" ), 176 tr( "<p>Please select a File.</p>" ),
177 tr( "Ok" ) ); 177 tr( "Ok" ) );
178 } else { 178 } else {
179 attList->takeItem( attList->currentItem() ); 179 attList->takeItem( attList->currentItem() );
180 } 180 }
181} 181}
182 182
183void ComposeMail::accept() 183void ComposeMail::accept()
184{ 184{
185 if ( checkBoxLater->isChecked() ) { 185 if ( checkBoxLater->isChecked() ) {
186 qDebug( "Send later" ); 186 odebug << "Send later" << oendl;
187 } 187 }
188 188
189#if 0 189#if 0
190 qDebug( "Sending Mail with " + 190 qDebug( "Sending Mail with " +
191 smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() ); 191 smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() );
192#endif 192#endif
193 Opie::Core::OSmartPointer<Mail> mail=new Mail; 193 Opie::Core::OSmartPointer<Mail> mail=new Mail;
194 194
195 SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); 195 SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() );
196 mail->setMail(fromBox->currentText()); 196 mail->setMail(fromBox->currentText());
197 197
198 if ( !toLine->text().isEmpty() ) { 198 if ( !toLine->text().isEmpty() ) {
199 mail->setTo( toLine->text() ); 199 mail->setTo( toLine->text() );
200 } else { 200 } else {
201 QMessageBox::warning(0,tr("Sending mail"), 201 QMessageBox::warning(0,tr("Sending mail"),
202 tr("No Receiver spezified" ) ); 202 tr("No Receiver spezified" ) );
203 return; 203 return;
204 } 204 }
205 mail->setName(senderNameEdit->text()); 205 mail->setName(senderNameEdit->text());
206 mail->setCC( ccLine->text() ); 206 mail->setCC( ccLine->text() );
207 mail->setBCC( bccLine->text() ); 207 mail->setBCC( bccLine->text() );
208 mail->setReply( replyLine->text() ); 208 mail->setReply( replyLine->text() );
209 mail->setSubject( subjectLine->text() ); 209 mail->setSubject( subjectLine->text() );
210 if (!m_replyid.isEmpty()) { 210 if (!m_replyid.isEmpty()) {
@@ -235,68 +235,68 @@ void ComposeMail::reject()
235 int yesno = QMessageBox::warning(0,tr("Store message"), 235 int yesno = QMessageBox::warning(0,tr("Store message"),
236 tr("Store message into drafts?"), 236 tr("Store message into drafts?"),
237 tr("Yes"), 237 tr("Yes"),
238 tr("No"),QString::null,0,1); 238 tr("No"),QString::null,0,1);
239 239
240 if (yesno == 0) { 240 if (yesno == 0) {
241 Opie::Core::OSmartPointer<Mail> mail=new Mail(); 241 Opie::Core::OSmartPointer<Mail> mail=new Mail();
242 mail->setMail(fromBox->currentText()); 242 mail->setMail(fromBox->currentText());
243 mail->setTo( toLine->text() ); 243 mail->setTo( toLine->text() );
244 mail->setName(senderNameEdit->text()); 244 mail->setName(senderNameEdit->text());
245 mail->setCC( ccLine->text() ); 245 mail->setCC( ccLine->text() );
246 mail->setBCC( bccLine->text() ); 246 mail->setBCC( bccLine->text() );
247 mail->setReply( replyLine->text() ); 247 mail->setReply( replyLine->text() );
248 mail->setSubject( subjectLine->text() ); 248 mail->setSubject( subjectLine->text() );
249 if (!m_replyid.isEmpty()) { 249 if (!m_replyid.isEmpty()) {
250 QStringList ids; 250 QStringList ids;
251 ids.append(m_replyid); 251 ids.append(m_replyid);
252 mail->setInreply(ids); 252 mail->setInreply(ids);
253 } 253 }
254 QString txt = message->text(); 254 QString txt = message->text();
255 if ( !sigMultiLine->text().isEmpty() ) { 255 if ( !sigMultiLine->text().isEmpty() ) {
256 txt.append( "\n--\n" ); 256 txt.append( "\n--\n" );
257 txt.append( sigMultiLine->text() ); 257 txt.append( sigMultiLine->text() );
258 } 258 }
259 qDebug(txt); 259 odebug << txt << oendl;
260 mail->setMessage( txt ); 260 mail->setMessage( txt );
261 261
262 /* only use the default drafts folder name! */ 262 /* only use the default drafts folder name! */
263 Storemail wrapper(AbstractMail::draftFolder()); 263 Storemail wrapper(AbstractMail::draftFolder());
264 wrapper.storeMail(mail); 264 wrapper.storeMail(mail);
265 265
266 AttachViewItem *it = (AttachViewItem *) attList->firstChild(); 266 AttachViewItem *it = (AttachViewItem *) attList->firstChild();
267 /* attachments we will ignore! */ 267 /* attachments we will ignore! */
268 if ( it != NULL ) { 268 if ( it != NULL ) {
269 QMessageBox::warning(0,tr("Store message"), 269 QMessageBox::warning(0,tr("Store message"),
270 tr("<center>Attachments will not be stored in \"Draft\" folder</center>")); 270 tr("<center>Attachments will not be stored in \"Draft\" folder</center>"));
271 } 271 }
272 } 272 }
273 QDialog::reject(); 273 QDialog::reject();
274} 274}
275 275
276ComposeMail::~ComposeMail() 276ComposeMail::~ComposeMail()
277{ 277{
278} 278}
279 279
280void ComposeMail::reEditMail(const RecMailP&current) 280void ComposeMail::reEditMail(const RecMailP&current)
281{ 281{
282 RecMailP data = current; 282 RecMailP data = current;
283 message->setText(data->Wrapper()->fetchBody(current)->Bodytext()); 283 message->setText(data->Wrapper()->fetchBody(current)->Bodytext());
284 subjectLine->setText( data->getSubject()); 284 subjectLine->setText( data->getSubject());
285 toLine->setText(data->To().join(",")); 285 toLine->setText(data->To().join(","));
286 ccLine->setText(data->CC().join(",")); 286 ccLine->setText(data->CC().join(","));
287 bccLine->setText(data->Bcc().join(",")); 287 bccLine->setText(data->Bcc().join(","));
288 replyLine->setText(data->Replyto()); 288 replyLine->setText(data->Replyto());
289} 289}
290 290
291AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) 291AttachViewItem::AttachViewItem( QListView *parent, Attachment *att )
292 : QListViewItem( parent ) 292 : QListViewItem( parent )
293{ 293{
294 attachment = att; 294 attachment = att;
295 qDebug( att->getMimeType() ); 295 odebug << att->getMimeType() << oendl;
296 setPixmap( 0, attachment->getDocLnk().pixmap().isNull() ? 296 setPixmap( 0, attachment->getDocLnk().pixmap().isNull() ?
297 Resource::loadPixmap( "UnknownDocument-14" ) : 297 Resource::loadPixmap( "UnknownDocument-14" ) :
298 attachment->getDocLnk().pixmap() ); 298 attachment->getDocLnk().pixmap() );
299 setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); 299 setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() );
300 setText( 1, QString::number( att->getSize() ) ); 300 setText( 1, QString::number( att->getSize() ) );
301} 301}
302 302
diff --git a/noncore/net/mail/editaccounts.cpp b/noncore/net/mail/editaccounts.cpp
index 5c4bdf7..de064ca 100644
--- a/noncore/net/mail/editaccounts.cpp
+++ b/noncore/net/mail/editaccounts.cpp
@@ -19,152 +19,152 @@ AccountListItem::AccountListItem( QListView *parent, Account *a)
19 QString ttext = ""; 19 QString ttext = "";
20 switch (account->getType()) { 20 switch (account->getType()) {
21 case MAILLIB::A_NNTP: 21 case MAILLIB::A_NNTP:
22 ttext="NNTP"; 22 ttext="NNTP";
23 break; 23 break;
24 case MAILLIB::A_POP3: 24 case MAILLIB::A_POP3:
25 ttext = "POP3"; 25 ttext = "POP3";
26 break; 26 break;
27 case MAILLIB::A_IMAP: 27 case MAILLIB::A_IMAP:
28 ttext = "IMAP"; 28 ttext = "IMAP";
29 break; 29 break;
30 case MAILLIB::A_SMTP: 30 case MAILLIB::A_SMTP:
31 ttext = "SMTP"; 31 ttext = "SMTP";
32 break; 32 break;
33 default: 33 default:
34 ttext = "UNKNOWN"; 34 ttext = "UNKNOWN";
35 break; 35 break;
36 } 36 }
37 setText( 1, ttext); 37 setText( 1, ttext);
38} 38}
39 39
40EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) 40EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags )
41 : EditAccountsUI( parent, name, modal, flags ) 41 : EditAccountsUI( parent, name, modal, flags )
42{ 42{
43 qDebug( "New Account Configuration Widget" ); 43 odebug << "New Account Configuration Widget" << oendl;
44 settings = s; 44 settings = s;
45 45
46 mailList->addColumn( tr( "Account" ) ); 46 mailList->addColumn( tr( "Account" ) );
47 mailList->addColumn( tr( "Type" ) ); 47 mailList->addColumn( tr( "Type" ) );
48 48
49 newsList->addColumn( tr( "Account" ) ); 49 newsList->addColumn( tr( "Account" ) );
50 50
51 connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) ); 51 connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) );
52 connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) ); 52 connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) );
53 connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) ); 53 connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) );
54 connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) ); 54 connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) );
55 connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) ); 55 connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) );
56 connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) ); 56 connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) );
57 57
58 slotFillLists(); 58 slotFillLists();
59} 59}
60 60
61void EditAccounts::slotFillLists() 61void EditAccounts::slotFillLists()
62{ 62{
63 mailList->clear(); 63 mailList->clear();
64 newsList->clear(); 64 newsList->clear();
65 65
66 QList<Account> accounts = settings->getAccounts(); 66 QList<Account> accounts = settings->getAccounts();
67 Account *it; 67 Account *it;
68 for ( it = accounts.first(); it; it = accounts.next() ) 68 for ( it = accounts.first(); it; it = accounts.next() )
69 { 69 {
70 if ( it->getType()==MAILLIB::A_NNTP ) 70 if ( it->getType()==MAILLIB::A_NNTP )
71 { 71 {
72 (void) new AccountListItem( newsList, it ); 72 (void) new AccountListItem( newsList, it );
73 } 73 }
74 else 74 else
75 { 75 {
76 (void) new AccountListItem( mailList, it ); 76 (void) new AccountListItem( mailList, it );
77 } 77 }
78 } 78 }
79} 79}
80 80
81void EditAccounts::slotNewMail() 81void EditAccounts::slotNewMail()
82{ 82{
83 qDebug( "New Mail Account" ); 83 odebug << "New Mail Account" << oendl;
84 QString *selection = new QString(); 84 QString *selection = new QString();
85 SelectMailType selType( selection, this, 0, true ); 85 SelectMailType selType( selection, this, 0, true );
86 selType.show(); 86 selType.show();
87 if ( QDialog::Accepted == selType.exec() ) 87 if ( QDialog::Accepted == selType.exec() )
88 { 88 {
89 slotNewAccount( *selection ); 89 slotNewAccount( *selection );
90 } 90 }
91} 91}
92 92
93void EditAccounts::slotNewAccount( const QString &type ) 93void EditAccounts::slotNewAccount( const QString &type )
94{ 94{
95 if ( type.compare( "IMAP" ) == 0 ) 95 if ( type.compare( "IMAP" ) == 0 )
96 { 96 {
97 qDebug( "-> config IMAP" ); 97 odebug << "-> config IMAP" << oendl;
98 IMAPaccount *account = new IMAPaccount(); 98 IMAPaccount *account = new IMAPaccount();
99 IMAPconfig imap( account, this, 0, true ); 99 IMAPconfig imap( account, this, 0, true );
100 if ( QDialog::Accepted == QPEApplication::execDialog( &imap ) ) 100 if ( QDialog::Accepted == QPEApplication::execDialog( &imap ) )
101 { 101 {
102 settings->addAccount( account ); 102 settings->addAccount( account );
103 account->save(); 103 account->save();
104 slotFillLists(); 104 slotFillLists();
105 } 105 }
106 else 106 else
107 { 107 {
108 account->remove(); 108 account->remove();
109 } 109 }
110 } 110 }
111 else if ( type.compare( "POP3" ) == 0 ) 111 else if ( type.compare( "POP3" ) == 0 )
112 { 112 {
113 qDebug( "-> config POP3" ); 113 odebug << "-> config POP3" << oendl;
114 POP3account *account = new POP3account(); 114 POP3account *account = new POP3account();
115 POP3config pop3( account, this, 0, true, WStyle_ContextHelp ); 115 POP3config pop3( account, this, 0, true, WStyle_ContextHelp );
116 if ( QDialog::Accepted == QPEApplication::execDialog( &pop3 ) ) 116 if ( QDialog::Accepted == QPEApplication::execDialog( &pop3 ) )
117 { 117 {
118 settings->addAccount( account ); 118 settings->addAccount( account );
119 account->save(); 119 account->save();
120 slotFillLists(); 120 slotFillLists();
121 } 121 }
122 else 122 else
123 { 123 {
124 account->remove(); 124 account->remove();
125 } 125 }
126 } 126 }
127 else if ( type.compare( "SMTP" ) == 0 ) 127 else if ( type.compare( "SMTP" ) == 0 )
128 { 128 {
129 qDebug( "-> config SMTP" ); 129 odebug << "-> config SMTP" << oendl;
130 SMTPaccount *account = new SMTPaccount(); 130 SMTPaccount *account = new SMTPaccount();
131 SMTPconfig smtp( account, this, 0, true, WStyle_ContextHelp ); 131 SMTPconfig smtp( account, this, 0, true, WStyle_ContextHelp );
132 if ( QDialog::Accepted == QPEApplication::execDialog( &smtp ) ) 132 if ( QDialog::Accepted == QPEApplication::execDialog( &smtp ) )
133 { 133 {
134 settings->addAccount( account ); 134 settings->addAccount( account );
135 account->save(); 135 account->save();
136 slotFillLists(); 136 slotFillLists();
137 137
138 } 138 }
139 else 139 else
140 { 140 {
141 account->remove(); 141 account->remove();
142 } 142 }
143 } 143 }
144 else if ( type.compare( "NNTP" ) == 0 ) 144 else if ( type.compare( "NNTP" ) == 0 )
145 { 145 {
146 qDebug( "-> config NNTP" ); 146 odebug << "-> config NNTP" << oendl;
147 NNTPaccount *account = new NNTPaccount(); 147 NNTPaccount *account = new NNTPaccount();
148 NNTPconfig nntp( account, this, 0, true, WStyle_ContextHelp ); 148 NNTPconfig nntp( account, this, 0, true, WStyle_ContextHelp );
149 if ( QDialog::Accepted == QPEApplication::execDialog( &nntp ) ) 149 if ( QDialog::Accepted == QPEApplication::execDialog( &nntp ) )
150 { 150 {
151 settings->addAccount( account ); 151 settings->addAccount( account );
152 account->save(); 152 account->save();
153 slotFillLists(); 153 slotFillLists();
154 } 154 }
155 else 155 else
156 { 156 {
157 account->remove(); 157 account->remove();
158 } 158 }
159 } 159 }
160} 160}
161 161
162void EditAccounts::slotEditAccount( Account *account ) 162void EditAccounts::slotEditAccount( Account *account )
163{ 163{
164 if ( account->getType() == MAILLIB::A_IMAP ) 164 if ( account->getType() == MAILLIB::A_IMAP )
165 { 165 {
166 IMAPaccount *imapAcc = static_cast<IMAPaccount *>(account); 166 IMAPaccount *imapAcc = static_cast<IMAPaccount *>(account);
167 IMAPconfig imap( imapAcc, this, 0, true, WStyle_ContextHelp ); 167 IMAPconfig imap( imapAcc, this, 0, true, WStyle_ContextHelp );
168 if ( QDialog::Accepted == QPEApplication::execDialog( &imap ) ) 168 if ( QDialog::Accepted == QPEApplication::execDialog( &imap ) )
169 { 169 {
170 slotFillLists(); 170 slotFillLists();
@@ -191,99 +191,99 @@ void EditAccounts::slotEditAccount( Account *account )
191 else if ( account->getType()==MAILLIB::A_NNTP) 191 else if ( account->getType()==MAILLIB::A_NNTP)
192 { 192 {
193 NNTPaccount *nntpAcc = static_cast<NNTPaccount *>(account); 193 NNTPaccount *nntpAcc = static_cast<NNTPaccount *>(account);
194 NNTPconfig nntp( nntpAcc, this, 0, true, WStyle_ContextHelp ); 194 NNTPconfig nntp( nntpAcc, this, 0, true, WStyle_ContextHelp );
195 if ( QDialog::Accepted == QPEApplication::execDialog( &nntp ) ) 195 if ( QDialog::Accepted == QPEApplication::execDialog( &nntp ) )
196 { 196 {
197 slotFillLists(); 197 slotFillLists();
198 } 198 }
199 } 199 }
200} 200}
201 201
202void EditAccounts::slotDeleteAccount( Account *account ) 202void EditAccounts::slotDeleteAccount( Account *account )
203{ 203{
204 if ( QMessageBox::information( this, tr( "Question" ), 204 if ( QMessageBox::information( this, tr( "Question" ),
205 tr( "<p>Do you really want to delete the selected Account?</p>" ), 205 tr( "<p>Do you really want to delete the selected Account?</p>" ),
206 tr( "Yes" ), tr( "No" ) ) == 0 ) 206 tr( "Yes" ), tr( "No" ) ) == 0 )
207 { 207 {
208 settings->delAccount( account ); 208 settings->delAccount( account );
209 slotFillLists(); 209 slotFillLists();
210 } 210 }
211} 211}
212 212
213void EditAccounts::slotEditMail() 213void EditAccounts::slotEditMail()
214{ 214{
215 qDebug( "Edit Mail Account" ); 215 odebug << "Edit Mail Account" << oendl;
216 if ( !mailList->currentItem() ) 216 if ( !mailList->currentItem() )
217 { 217 {
218 QMessageBox::information( this, tr( "Error" ), 218 QMessageBox::information( this, tr( "Error" ),
219 tr( "<p>Please select an account.</p>" ), 219 tr( "<p>Please select an account.</p>" ),
220 tr( "Ok" ) ); 220 tr( "Ok" ) );
221 return; 221 return;
222 } 222 }
223 223
224 Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); 224 Account *a = ((AccountListItem *) mailList->currentItem())->getAccount();
225 slotEditAccount( a ); 225 slotEditAccount( a );
226} 226}
227 227
228void EditAccounts::slotDeleteMail() 228void EditAccounts::slotDeleteMail()
229{ 229{
230 if ( !mailList->currentItem() ) 230 if ( !mailList->currentItem() )
231 { 231 {
232 QMessageBox::information( this, tr( "Error" ), 232 QMessageBox::information( this, tr( "Error" ),
233 tr( "<p>Please select an account.</p>" ), 233 tr( "<p>Please select an account.</p>" ),
234 tr( "Ok" ) ); 234 tr( "Ok" ) );
235 return; 235 return;
236 } 236 }
237 237
238 Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); 238 Account *a = ((AccountListItem *) mailList->currentItem())->getAccount();
239 slotDeleteAccount( a ); 239 slotDeleteAccount( a );
240} 240}
241 241
242void EditAccounts::slotNewNews() 242void EditAccounts::slotNewNews()
243{ 243{
244 qDebug( "New News Account" ); 244 odebug << "New News Account" << oendl;
245 slotNewAccount( "NNTP" ); 245 slotNewAccount( "NNTP" );
246} 246}
247 247
248void EditAccounts::slotEditNews() 248void EditAccounts::slotEditNews()
249{ 249{
250 qDebug( "Edit News Account" ); 250 odebug << "Edit News Account" << oendl;
251 if ( !newsList->currentItem() ) 251 if ( !newsList->currentItem() )
252 { 252 {
253 QMessageBox::information( this, tr( "Error" ), 253 QMessageBox::information( this, tr( "Error" ),
254 tr( "<p>Please select an account.</p>" ), 254 tr( "<p>Please select an account.</p>" ),
255 tr( "Ok" ) ); 255 tr( "Ok" ) );
256 return; 256 return;
257 } 257 }
258 258
259 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); 259 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount();
260 slotEditAccount( a ); 260 slotEditAccount( a );
261} 261}
262 262
263void EditAccounts::slotDeleteNews() 263void EditAccounts::slotDeleteNews()
264{ 264{
265 qDebug( "Delete News Account" ); 265 odebug << "Delete News Account" << oendl;
266 if ( !newsList->currentItem() ) 266 if ( !newsList->currentItem() )
267 { 267 {
268 QMessageBox::information( this, tr( "Error" ), 268 QMessageBox::information( this, tr( "Error" ),
269 tr( "<p>Please select an account.</p>" ), 269 tr( "<p>Please select an account.</p>" ),
270 tr( "Ok" ) ); 270 tr( "Ok" ) );
271 return; 271 return;
272 } 272 }
273 273
274 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); 274 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount();
275 slotDeleteAccount( a ); 275 slotDeleteAccount( a );
276} 276}
277 277
278void EditAccounts::slotAdjustColumns() 278void EditAccounts::slotAdjustColumns()
279{ 279{
280 int currPage = configTab->currentPageIndex(); 280 int currPage = configTab->currentPageIndex();
281 281
282 configTab->showPage( mailTab ); 282 configTab->showPage( mailTab );
283 mailList->setColumnWidth( 0, mailList->visibleWidth() - 50 ); 283 mailList->setColumnWidth( 0, mailList->visibleWidth() - 50 );
284 mailList->setColumnWidth( 1, 50 ); 284 mailList->setColumnWidth( 1, 50 );
285 285
286 configTab->showPage( newsTab ); 286 configTab->showPage( newsTab );
287 newsList->setColumnWidth( 0, newsList->visibleWidth() ); 287 newsList->setColumnWidth( 0, newsList->visibleWidth() );
288 288
289 configTab->setCurrentPage( currPage ); 289 configTab->setCurrentPage( currPage );
@@ -557,38 +557,38 @@ void NNTPconfig::fillValues()
557 /* don't forget that - you will overwrite values if user clicks cancel! */ 557 /* don't forget that - you will overwrite values if user clicks cancel! */
558 for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) { 558 for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) {
559 QCheckListItem *item; 559 QCheckListItem *item;
560 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); 560 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox );
561 item->setOn( true ); 561 item->setOn( true );
562 } 562 }
563} 563}
564 564
565void NNTPconfig::save() 565void NNTPconfig::save()
566{ 566{
567 data->setAccountName( accountLine->text() ); 567 data->setAccountName( accountLine->text() );
568 data->setServer( serverLine->text() ); 568 data->setServer( serverLine->text() );
569 data->setPort( portLine->text() ); 569 data->setPort( portLine->text() );
570 data->setSSL( sslBox->isChecked() ); 570 data->setSSL( sslBox->isChecked() );
571 data->setLogin( loginBox->isChecked() ); 571 data->setLogin( loginBox->isChecked() );
572 data->setUser( userLine->text() ); 572 data->setUser( userLine->text() );
573 data->setPassword( passLine->text() ); 573 data->setPassword( passLine->text() );
574 574
575 QListViewItemIterator list_it( ListViewGroups ); 575 QListViewItemIterator list_it( ListViewGroups );
576 576
577 QStringList groupList; 577 QStringList groupList;
578 for ( ; list_it.current(); ++list_it ) { 578 for ( ; list_it.current(); ++list_it ) {
579 579
580 if ( ( (QCheckListItem*)list_it.current() )->isOn() ) { 580 if ( ( (QCheckListItem*)list_it.current() )->isOn() ) {
581 qDebug(list_it.current()->text(0) ); 581 odebug << list_it.current()->text(0) << oendl;
582 groupList.append( list_it.current()->text(0) ); 582 groupList.append( list_it.current()->text(0) );
583 } 583 }
584 584
585 } 585 }
586 data->setGroups( groupList ); 586 data->setGroups( groupList );
587} 587}
588 588
589void NNTPconfig::accept() 589void NNTPconfig::accept()
590{ 590{
591 save(); 591 save();
592 QDialog::accept(); 592 QDialog::accept();
593} 593}
594 594
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.cpp b/noncore/net/mail/libmailwrapper/abstractmail.cpp
index 6bebb7b..1a26351 100644
--- a/noncore/net/mail/libmailwrapper/abstractmail.cpp
+++ b/noncore/net/mail/libmailwrapper/abstractmail.cpp
@@ -31,91 +31,91 @@ AbstractMail* AbstractMail::getWrapper(const QString&a,const QString&name)
31{ 31{
32 return new MHwrapper(a,name); 32 return new MHwrapper(a,name);
33} 33}
34 34
35AbstractMail* AbstractMail::getWrapper(Account*a) 35AbstractMail* AbstractMail::getWrapper(Account*a)
36{ 36{
37 if (!a) return 0; 37 if (!a) return 0;
38 switch (a->getType()) { 38 switch (a->getType()) {
39 case MAILLIB::A_IMAP: 39 case MAILLIB::A_IMAP:
40 return new IMAPwrapper((IMAPaccount*)a); 40 return new IMAPwrapper((IMAPaccount*)a);
41 break; 41 break;
42 case MAILLIB::A_POP3: 42 case MAILLIB::A_POP3:
43 return new POP3wrapper((POP3account*)a); 43 return new POP3wrapper((POP3account*)a);
44 break; 44 break;
45 case MAILLIB::A_NNTP: 45 case MAILLIB::A_NNTP:
46 return new NNTPwrapper((NNTPaccount*)a); 46 return new NNTPwrapper((NNTPaccount*)a);
47 break; 47 break;
48 default: 48 default:
49 return 0; 49 return 0;
50 } 50 }
51} 51}
52 52
53encodedString* AbstractMail::decode_String(const encodedString*text,const QString&enc) 53encodedString* AbstractMail::decode_String(const encodedString*text,const QString&enc)
54{ 54{
55 qDebug("Decode string start"); 55 odebug << "Decode string start" << oendl;
56 char*result_text; 56 char*result_text;
57 size_t index = 0; 57 size_t index = 0;
58 /* reset for recursive use! */ 58 /* reset for recursive use! */
59 size_t target_length = 0; 59 size_t target_length = 0;
60 result_text = 0; 60 result_text = 0;
61 int mimetype = MAILMIME_MECHANISM_7BIT; 61 int mimetype = MAILMIME_MECHANISM_7BIT;
62 if (enc.lower()=="quoted-printable") { 62 if (enc.lower()=="quoted-printable") {
63 mimetype = MAILMIME_MECHANISM_QUOTED_PRINTABLE; 63 mimetype = MAILMIME_MECHANISM_QUOTED_PRINTABLE;
64 } else if (enc.lower()=="base64") { 64 } else if (enc.lower()=="base64") {
65 mimetype = MAILMIME_MECHANISM_BASE64; 65 mimetype = MAILMIME_MECHANISM_BASE64;
66 } else if (enc.lower()=="8bit") { 66 } else if (enc.lower()=="8bit") {
67 mimetype = MAILMIME_MECHANISM_8BIT; 67 mimetype = MAILMIME_MECHANISM_8BIT;
68 } else if (enc.lower()=="binary") { 68 } else if (enc.lower()=="binary") {
69 mimetype = MAILMIME_MECHANISM_BINARY; 69 mimetype = MAILMIME_MECHANISM_BINARY;
70 } 70 }
71 71
72 int err = mailmime_part_parse(text->Content(),text->Length(),&index,mimetype, 72 int err = mailmime_part_parse(text->Content(),text->Length(),&index,mimetype,
73 &result_text,&target_length); 73 &result_text,&target_length);
74 74
75 encodedString* result = new encodedString(); 75 encodedString* result = new encodedString();
76 if (err == MAILIMF_NO_ERROR) { 76 if (err == MAILIMF_NO_ERROR) {
77 result->setContent(result_text,target_length); 77 result->setContent(result_text,target_length);
78 } 78 }
79 qDebug("Decode string finished"); 79 odebug << "Decode string finished" << oendl;
80 return result; 80 return result;
81} 81}
82 82
83QString AbstractMail::convert_String(const char*text) 83QString AbstractMail::convert_String(const char*text)
84{ 84{
85 //size_t index = 0; 85 //size_t index = 0;
86 char*res = 0; 86 char*res = 0;
87 int err = MAILIMF_NO_ERROR; 87 int err = MAILIMF_NO_ERROR;
88 88
89 QString result(text); 89 QString result(text);
90 90
91 /* due a bug in libetpan it isn't usable this moment */ 91 /* due a bug in libetpan it isn't usable this moment */
92/* int err = mailmime_encoded_phrase_parse("iso-8859-1", 92/* int err = mailmime_encoded_phrase_parse("iso-8859-1",
93 text, strlen(text),&index, "iso-8859-1",&res);*/ 93 text, strlen(text),&index, "iso-8859-1",&res);*/
94 //qDebug("Input: %s",text); 94 //odebug << "Input: " << text << "" << oendl;
95 if (err == MAILIMF_NO_ERROR && res && strlen(res)) { 95 if (err == MAILIMF_NO_ERROR && res && strlen(res)) {
96// result = QString(res); 96// result = QString(res);
97// qDebug("Res: %s, length: %i",res,strlen(res)); 97// odebug << "Res: " << res << ", length: " << strlen(res) << "" << oendl;
98 } 98 }
99 if (res) free(res); 99 if (res) free(res);
100 return result; 100 return result;
101} 101}
102 102
103/* cp & paste from launcher */ 103/* cp & paste from launcher */
104QString AbstractMail::gen_attachment_id() 104QString AbstractMail::gen_attachment_id()
105{ 105{
106 QFile file( "/proc/sys/kernel/random/uuid" ); 106 QFile file( "/proc/sys/kernel/random/uuid" );
107 if (!file.open(IO_ReadOnly ) ) 107 if (!file.open(IO_ReadOnly ) )
108 return QString::null; 108 return QString::null;
109 109
110 QTextStream stream(&file); 110 QTextStream stream(&file);
111 111
112 return "{" + stream.read().stripWhiteSpace() + "}"; 112 return "{" + stream.read().stripWhiteSpace() + "}";
113} 113}
114 114
115int AbstractMail::createMbox(const QString&,const FolderP&,const QString& ,bool) 115int AbstractMail::createMbox(const QString&,const FolderP&,const QString& ,bool)
116{ 116{
117 return 0; 117 return 0;
118} 118}
119 119
120QString AbstractMail::defaultLocalfolder() 120QString AbstractMail::defaultLocalfolder()
121{ 121{
diff --git a/noncore/net/mail/libmailwrapper/generatemail.cpp b/noncore/net/mail/libmailwrapper/generatemail.cpp
index cb58d82..36ec232 100644
--- a/noncore/net/mail/libmailwrapper/generatemail.cpp
+++ b/noncore/net/mail/libmailwrapper/generatemail.cpp
@@ -76,71 +76,71 @@ mailimf_field *Generatemail::getField( mailimf_fields *fields, int type ) {
76 76
77mailimf_address_list *Generatemail::parseAddresses(const QString&addr ) { 77mailimf_address_list *Generatemail::parseAddresses(const QString&addr ) {
78 mailimf_address_list *addresses; 78 mailimf_address_list *addresses;
79 79
80 if ( addr.isEmpty() ) 80 if ( addr.isEmpty() )
81 return NULL; 81 return NULL;
82 82
83 addresses = mailimf_address_list_new_empty(); 83 addresses = mailimf_address_list_new_empty();
84 84
85 bool literal_open = false; 85 bool literal_open = false;
86 unsigned int startpos = 0; 86 unsigned int startpos = 0;
87 QStringList list; 87 QStringList list;
88 QString s; 88 QString s;
89 unsigned int i = 0; 89 unsigned int i = 0;
90 for (; i < addr.length();++i) { 90 for (; i < addr.length();++i) {
91 switch (addr[i]) { 91 switch (addr[i]) {
92 case '\"': 92 case '\"':
93 literal_open = !literal_open; 93 literal_open = !literal_open;
94 break; 94 break;
95 case ',': 95 case ',':
96 if (!literal_open) { 96 if (!literal_open) {
97 s = addr.mid(startpos,i-startpos); 97 s = addr.mid(startpos,i-startpos);
98 if (!s.isEmpty()) { 98 if (!s.isEmpty()) {
99 list.append(s); 99 list.append(s);
100 qDebug("Appended %s",s.latin1()); 100 odebug << "Appended " << s.latin1() << "" << oendl;
101 } 101 }
102 // !!!! this is a MUST BE! 102 // !!!! this is a MUST BE!
103 startpos = ++i; 103 startpos = ++i;
104 } 104 }
105 break; 105 break;
106 default: 106 default:
107 break; 107 break;
108 } 108 }
109 } 109 }
110 s = addr.mid(startpos,i-startpos); 110 s = addr.mid(startpos,i-startpos);
111 if (!s.isEmpty()) { 111 if (!s.isEmpty()) {
112 list.append(s); 112 list.append(s);
113 qDebug("Appended %s",s.latin1()); 113 odebug << "Appended " << s.latin1() << "" << oendl;
114 } 114 }
115 QStringList::Iterator it; 115 QStringList::Iterator it;
116 for ( it = list.begin(); it != list.end(); it++ ) { 116 for ( it = list.begin(); it != list.end(); it++ ) {
117 int err = mailimf_address_list_add_parse( addresses, (char*)(*it).latin1() ); 117 int err = mailimf_address_list_add_parse( addresses, (char*)(*it).latin1() );
118 if ( err != MAILIMF_NO_ERROR ) { 118 if ( err != MAILIMF_NO_ERROR ) {
119 qDebug( "Error parsing" ); 119 odebug << "Error parsing" << oendl;
120 qDebug( *it ); 120 odebug << *it << oendl;
121 } else { 121 } else {
122 qDebug( "Parse success! %s",(*it).latin1()); 122 odebug << "Parse success! " << (*it).latin1() << "" << oendl;
123 } 123 }
124 } 124 }
125 return addresses; 125 return addresses;
126} 126}
127 127
128mailmime *Generatemail::buildFilePart(const QString&filename,const QString&mimetype,const QString&TextContent ) { 128mailmime *Generatemail::buildFilePart(const QString&filename,const QString&mimetype,const QString&TextContent ) {
129 mailmime * filePart = 0; 129 mailmime * filePart = 0;
130 mailmime_fields * fields = 0; 130 mailmime_fields * fields = 0;
131 mailmime_content * content = 0; 131 mailmime_content * content = 0;
132 mailmime_parameter * param = 0; 132 mailmime_parameter * param = 0;
133 char*name = 0; 133 char*name = 0;
134 char*file = 0; 134 char*file = 0;
135 int err; 135 int err;
136 136
137 int pos = filename.findRev( '/' ); 137 int pos = filename.findRev( '/' );
138 138
139 if (filename.length()>0) { 139 if (filename.length()>0) {
140 QString tmp = filename.right( filename.length() - ( pos + 1 ) ); 140 QString tmp = filename.right( filename.length() - ( pos + 1 ) );
141 name = strdup( tmp.latin1() ); // just filename 141 name = strdup( tmp.latin1() ); // just filename
142 file = strdup( filename.latin1() ); // full name with path 142 file = strdup( filename.latin1() ); // full name with path
143 } 143 }
144 144
145 int disptype = MAILMIME_DISPOSITION_TYPE_ATTACHMENT; 145 int disptype = MAILMIME_DISPOSITION_TYPE_ATTACHMENT;
146 int mechanism = MAILMIME_MECHANISM_BASE64; 146 int mechanism = MAILMIME_MECHANISM_BASE64;
@@ -154,144 +154,144 @@ mailmime *Generatemail::buildFilePart(const QString&filename,const QString&mimet
154 fields = mailmime_fields_new_filename( 154 fields = mailmime_fields_new_filename(
155 disptype, name, 155 disptype, name,
156 mechanism ); 156 mechanism );
157 content = mailmime_content_new_with_str( (char*)mimetype.latin1() ); 157 content = mailmime_content_new_with_str( (char*)mimetype.latin1() );
158 if (content!=0 && fields != 0) { 158 if (content!=0 && fields != 0) {
159 if (param) { 159 if (param) {
160 clist_append(content->ct_parameters,param); 160 clist_append(content->ct_parameters,param);
161 param = 0; 161 param = 0;
162 } 162 }
163 if (filename.length()>0) { 163 if (filename.length()>0) {
164 QFileInfo f(filename); 164 QFileInfo f(filename);
165 param = mailmime_parameter_new(strdup("name"),strdup(f.fileName().latin1())); 165 param = mailmime_parameter_new(strdup("name"),strdup(f.fileName().latin1()));
166 clist_append(content->ct_parameters,param); 166 clist_append(content->ct_parameters,param);
167 param = 0; 167 param = 0;
168 } 168 }
169 filePart = mailmime_new_empty( content, fields ); 169 filePart = mailmime_new_empty( content, fields );
170 } 170 }
171 if (filePart) { 171 if (filePart) {
172 if (filename.length()>0) { 172 if (filename.length()>0) {
173 err = mailmime_set_body_file( filePart, file ); 173 err = mailmime_set_body_file( filePart, file );
174 } else { 174 } else {
175 err = mailmime_set_body_text(filePart,strdup(TextContent.data()),TextContent.length()); 175 err = mailmime_set_body_text(filePart,strdup(TextContent.data()),TextContent.length());
176 } 176 }
177 if (err != MAILIMF_NO_ERROR) { 177 if (err != MAILIMF_NO_ERROR) {
178 qDebug("Error setting body with file %s",file); 178 odebug << "Error setting body with file " << file << "" << oendl;
179 mailmime_free( filePart ); 179 mailmime_free( filePart );
180 filePart = 0; 180 filePart = 0;
181 } 181 }
182 } 182 }
183 183
184 if (!filePart) { 184 if (!filePart) {
185 if ( param != NULL ) { 185 if ( param != NULL ) {
186 mailmime_parameter_free( param ); 186 mailmime_parameter_free( param );
187 } 187 }
188 if (content) { 188 if (content) {
189 mailmime_content_free( content ); 189 mailmime_content_free( content );
190 } 190 }
191 if (fields) { 191 if (fields) {
192 mailmime_fields_free( fields ); 192 mailmime_fields_free( fields );
193 } else { 193 } else {
194 if (name) { 194 if (name) {
195 free( name ); 195 free( name );
196 } 196 }
197 if (file) { 197 if (file) {
198 free( file ); 198 free( file );
199 } 199 }
200 } 200 }
201 } 201 }
202 return filePart; // Success :) 202 return filePart; // Success :)
203 203
204} 204}
205 205
206void Generatemail::addFileParts( mailmime *message,const QList<Attachment>&files ) { 206void Generatemail::addFileParts( mailmime *message,const QList<Attachment>&files ) {
207 const Attachment *it; 207 const Attachment *it;
208 unsigned int count = files.count(); 208 unsigned int count = files.count();
209 qDebug("List contains %i values",count); 209 odebug << "List contains " << count << " values" << oendl;
210 for ( unsigned int i = 0; i < count; ++i ) { 210 for ( unsigned int i = 0; i < count; ++i ) {
211 qDebug( "Adding file" ); 211 odebug << "Adding file" << oendl;
212 mailmime *filePart; 212 mailmime *filePart;
213 int err; 213 int err;
214 it = ((QList<Attachment>)files).at(i); 214 it = ((QList<Attachment>)files).at(i);
215 215
216 filePart = buildFilePart( it->getFileName(), it->getMimeType(),"" ); 216 filePart = buildFilePart( it->getFileName(), it->getMimeType(),"" );
217 if ( filePart == NULL ) { 217 if ( filePart == NULL ) {
218 qDebug( "addFileParts: error adding file:" ); 218 odebug << "addFileParts: error adding file:" << oendl;
219 qDebug( it->getFileName() ); 219 odebug << it->getFileName() << oendl;
220 continue; 220 continue;
221 } 221 }
222 err = mailmime_smart_add_part( message, filePart ); 222 err = mailmime_smart_add_part( message, filePart );
223 if ( err != MAILIMF_NO_ERROR ) { 223 if ( err != MAILIMF_NO_ERROR ) {
224 mailmime_free( filePart ); 224 mailmime_free( filePart );
225 qDebug("error smart add"); 225 odebug << "error smart add" << oendl;
226 } 226 }
227 } 227 }
228} 228}
229 229
230mailmime *Generatemail::buildTxtPart(const QString&str ) { 230mailmime *Generatemail::buildTxtPart(const QString&str ) {
231 mailmime *txtPart; 231 mailmime *txtPart;
232 mailmime_fields *fields; 232 mailmime_fields *fields;
233 mailmime_content *content; 233 mailmime_content *content;
234 mailmime_parameter *param; 234 mailmime_parameter *param;
235 int err; 235 int err;
236 236
237 param = mailmime_parameter_new( strdup( "charset" ), 237 param = mailmime_parameter_new( strdup( "charset" ),
238 strdup( "iso-8859-1" ) ); 238 strdup( "iso-8859-1" ) );
239 if ( param == NULL ) 239 if ( param == NULL )
240 goto err_free; 240 goto err_free;
241 241
242 content = mailmime_content_new_with_str( "text/plain" ); 242 content = mailmime_content_new_with_str( "text/plain" );
243 if ( content == NULL ) 243 if ( content == NULL )
244 goto err_free_param; 244 goto err_free_param;
245 245
246 err = clist_append( content->ct_parameters, param ); 246 err = clist_append( content->ct_parameters, param );
247 if ( err != MAILIMF_NO_ERROR ) 247 if ( err != MAILIMF_NO_ERROR )
248 goto err_free_content; 248 goto err_free_content;
249 249
250 fields = mailmime_fields_new_encoding(MAILMIME_MECHANISM_8BIT); 250 fields = mailmime_fields_new_encoding(MAILMIME_MECHANISM_8BIT);
251 if ( fields == NULL ) 251 if ( fields == NULL )
252 goto err_free_content; 252 goto err_free_content;
253 253
254 txtPart = mailmime_new_empty( content, fields ); 254 txtPart = mailmime_new_empty( content, fields );
255 if ( txtPart == NULL ) 255 if ( txtPart == NULL )
256 goto err_free_fields; 256 goto err_free_fields;
257 257
258 err = mailmime_set_body_text( txtPart, (char*)str.data(), str.length() ); 258 err = mailmime_set_body_text( txtPart, (char*)str.data(), str.length() );
259 if ( err != MAILIMF_NO_ERROR ) 259 if ( err != MAILIMF_NO_ERROR )
260 goto err_free_txtPart; 260 goto err_free_txtPart;
261 261
262 return txtPart; // Success :) 262 return txtPart; // Success :)
263 263
264err_free_txtPart: 264err_free_txtPart:
265 mailmime_free( txtPart ); 265 mailmime_free( txtPart );
266err_free_fields: 266err_free_fields:
267 mailmime_fields_free( fields ); 267 mailmime_fields_free( fields );
268err_free_content: 268err_free_content:
269 mailmime_content_free( content ); 269 mailmime_content_free( content );
270err_free_param: 270err_free_param:
271 mailmime_parameter_free( param ); 271 mailmime_parameter_free( param );
272err_free: 272err_free:
273 qDebug( "buildTxtPart - error" ); 273 odebug << "buildTxtPart - error" << oendl;
274 274
275 return NULL; // Error :( 275 return NULL; // Error :(
276} 276}
277 277
278mailimf_mailbox *Generatemail::newMailbox(const QString&name, const QString&mail ) { 278mailimf_mailbox *Generatemail::newMailbox(const QString&name, const QString&mail ) {
279 return mailimf_mailbox_new( strdup( name.latin1() ), 279 return mailimf_mailbox_new( strdup( name.latin1() ),
280 strdup( mail.latin1() ) ); 280 strdup( mail.latin1() ) );
281} 281}
282 282
283mailimf_fields *Generatemail::createImfFields(const Opie::Core::OSmartPointer<Mail>&mail ) 283mailimf_fields *Generatemail::createImfFields(const Opie::Core::OSmartPointer<Mail>&mail )
284{ 284{
285 mailimf_fields *fields = NULL; 285 mailimf_fields *fields = NULL;
286 mailimf_field *xmailer = NULL; 286 mailimf_field *xmailer = NULL;
287 mailimf_mailbox *sender=0,*fromBox=0; 287 mailimf_mailbox *sender=0,*fromBox=0;
288 mailimf_mailbox_list *from=0; 288 mailimf_mailbox_list *from=0;
289 mailimf_address_list *to=0, *cc=0, *bcc=0, *reply=0; 289 mailimf_address_list *to=0, *cc=0, *bcc=0, *reply=0;
290 clist*in_reply_to = 0; 290 clist*in_reply_to = 0;
291 char *subject = strdup( mail->getSubject().latin1() ); 291 char *subject = strdup( mail->getSubject().latin1() );
292 int err; 292 int err;
293 int res = 1; 293 int res = 1;
294 294
295 sender = newMailbox( mail->getName(), mail->getMail() ); 295 sender = newMailbox( mail->getName(), mail->getMail() );
296 if ( sender == NULL ) { 296 if ( sender == NULL ) {
297 res = 0; 297 res = 0;
@@ -324,57 +324,57 @@ mailimf_fields *Generatemail::createImfFields(const Opie::Core::OSmartPointer<Ma
324 if (res) reply = parseAddresses( mail->getReply() ); 324 if (res) reply = parseAddresses( mail->getReply() );
325 325
326 if (res && mail->Inreply().count()>0) { 326 if (res && mail->Inreply().count()>0) {
327 in_reply_to = clist_new(); 327 in_reply_to = clist_new();
328 char*c_reply; 328 char*c_reply;
329 unsigned int nsize = 0; 329 unsigned int nsize = 0;
330 for (QStringList::ConstIterator it=mail->Inreply().begin(); 330 for (QStringList::ConstIterator it=mail->Inreply().begin();
331 it != mail->Inreply().end();++it) { 331 it != mail->Inreply().end();++it) {
332 if ((*it).isEmpty()) 332 if ((*it).isEmpty())
333 continue; 333 continue;
334 QString h((*it)); 334 QString h((*it));
335 while (h.length()>0 && h[0]=='<') { 335 while (h.length()>0 && h[0]=='<') {
336 h.remove(0,1); 336 h.remove(0,1);
337 } 337 }
338 while (h.length()>0 && h[h.length()-1]=='>') { 338 while (h.length()>0 && h[h.length()-1]=='>') {
339 h.remove(h.length()-1,1); 339 h.remove(h.length()-1,1);
340 } 340 }
341 if (h.isEmpty()) continue; 341 if (h.isEmpty()) continue;
342 nsize = strlen(h.latin1()); 342 nsize = strlen(h.latin1());
343 /* yes! must be malloc! */ 343 /* yes! must be malloc! */
344 c_reply = (char*)malloc( (nsize+1)*sizeof(char)); 344 c_reply = (char*)malloc( (nsize+1)*sizeof(char));
345 memset(c_reply,0,nsize+1); 345 memset(c_reply,0,nsize+1);
346 memcpy(c_reply,h.latin1(),nsize); 346 memcpy(c_reply,h.latin1(),nsize);
347 clist_append(in_reply_to,c_reply); 347 clist_append(in_reply_to,c_reply);
348 qDebug("In reply to: %s",c_reply); 348 odebug << "In reply to: " << c_reply << "" << oendl;
349 } 349 }
350 } 350 }
351 351
352 if (res) { 352 if (res) {
353 fields = mailimf_fields_new_with_data( from, sender, reply, to, cc, bcc, 353 fields = mailimf_fields_new_with_data( from, sender, reply, to, cc, bcc,
354 in_reply_to, NULL, subject ); 354 in_reply_to, NULL, subject );
355 if ( fields == NULL ) { 355 if ( fields == NULL ) {
356 qDebug("Error creating mailimf fields"); 356 odebug << "Error creating mailimf fields" << oendl;
357 res = 0; 357 res = 0;
358 } 358 }
359 } 359 }
360 if (res) xmailer = mailimf_field_new_custom( strdup( "User-Agent" ), 360 if (res) xmailer = mailimf_field_new_custom( strdup( "User-Agent" ),
361 strdup( USER_AGENT ) ); 361 strdup( USER_AGENT ) );
362 if ( xmailer == NULL ) { 362 if ( xmailer == NULL ) {
363 res = 0; 363 res = 0;
364 } else { 364 } else {
365 err = mailimf_fields_add( fields, xmailer ); 365 err = mailimf_fields_add( fields, xmailer );
366 if ( err != MAILIMF_NO_ERROR ) { 366 if ( err != MAILIMF_NO_ERROR ) {
367 res = 0; 367 res = 0;
368 } 368 }
369 } 369 }
370 if (!res ) { 370 if (!res ) {
371 if (xmailer) { 371 if (xmailer) {
372 mailimf_field_free( xmailer ); 372 mailimf_field_free( xmailer );
373 xmailer = NULL; 373 xmailer = NULL;
374 } 374 }
375 if (fields) { 375 if (fields) {
376 mailimf_fields_free( fields ); 376 mailimf_fields_free( fields );
377 fields = NULL; 377 fields = NULL;
378 } else { 378 } else {
379 if (reply) 379 if (reply)
380 mailimf_address_list_free( reply ); 380 mailimf_address_list_free( reply );
@@ -414,49 +414,49 @@ mailmime *Generatemail::createMimeMail(const Opie::Core::OSmartPointer<Mail> &ma
414 goto err_free_fields; 414 goto err_free_fields;
415 415
416 mailmime_set_imf_fields( message, fields ); 416 mailmime_set_imf_fields( message, fields );
417 417
418 txtPart = buildTxtPart( mail->getMessage() ); 418 txtPart = buildTxtPart( mail->getMessage() );
419 419
420 if ( txtPart == NULL ) 420 if ( txtPart == NULL )
421 goto err_free_message; 421 goto err_free_message;
422 422
423 err = mailmime_smart_add_part( message, txtPart ); 423 err = mailmime_smart_add_part( message, txtPart );
424 if ( err != MAILIMF_NO_ERROR ) 424 if ( err != MAILIMF_NO_ERROR )
425 goto err_free_txtPart; 425 goto err_free_txtPart;
426 426
427 addFileParts( message, mail->getAttachments() ); 427 addFileParts( message, mail->getAttachments() );
428 428
429 return message; // Success :) 429 return message; // Success :)
430 430
431err_free_txtPart: 431err_free_txtPart:
432 mailmime_free( txtPart ); 432 mailmime_free( txtPart );
433err_free_message: 433err_free_message:
434 mailmime_free( message ); 434 mailmime_free( message );
435err_free_fields: 435err_free_fields:
436 mailimf_fields_free( fields ); 436 mailimf_fields_free( fields );
437err_free: 437err_free:
438 qDebug( "createMimeMail: error" ); 438 odebug << "createMimeMail: error" << oendl;
439 439
440 return NULL; // Error :( 440 return NULL; // Error :(
441} 441}
442 442
443clist *Generatemail::createRcptList( mailimf_fields *fields ) { 443clist *Generatemail::createRcptList( mailimf_fields *fields ) {
444 clist *rcptList; 444 clist *rcptList;
445 mailimf_field *field; 445 mailimf_field *field;
446 446
447 rcptList = esmtp_address_list_new(); 447 rcptList = esmtp_address_list_new();
448 448
449 field = getField( fields, MAILIMF_FIELD_TO ); 449 field = getField( fields, MAILIMF_FIELD_TO );
450 if ( field && (field->fld_type == MAILIMF_FIELD_TO) 450 if ( field && (field->fld_type == MAILIMF_FIELD_TO)
451 && field->fld_data.fld_to->to_addr_list ) { 451 && field->fld_data.fld_to->to_addr_list ) {
452 addRcpts( rcptList, field->fld_data.fld_to->to_addr_list ); 452 addRcpts( rcptList, field->fld_data.fld_to->to_addr_list );
453 } 453 }
454 454
455 field = getField( fields, MAILIMF_FIELD_CC ); 455 field = getField( fields, MAILIMF_FIELD_CC );
456 if ( field && (field->fld_type == MAILIMF_FIELD_CC) 456 if ( field && (field->fld_type == MAILIMF_FIELD_CC)
457 && field->fld_data.fld_cc->cc_addr_list ) { 457 && field->fld_data.fld_cc->cc_addr_list ) {
458 addRcpts( rcptList, field->fld_data.fld_cc->cc_addr_list ); 458 addRcpts( rcptList, field->fld_data.fld_cc->cc_addr_list );
459 } 459 }
460 460
461 field = getField( fields, MAILIMF_FIELD_BCC ); 461 field = getField( fields, MAILIMF_FIELD_BCC );
462 if ( field && (field->fld_type == MAILIMF_FIELD_BCC) 462 if ( field && (field->fld_type == MAILIMF_FIELD_BCC)
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.cpp b/noncore/net/mail/libmailwrapper/genericwrapper.cpp
index 0c68280..fae4c99 100644
--- a/noncore/net/mail/libmailwrapper/genericwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/genericwrapper.cpp
@@ -114,49 +114,49 @@ QString Genericwrapper::getencoding(mailmime_mechanism*aEnc)
114 enc = "8bit"; 114 enc = "8bit";
115 break; 115 break;
116 case MAILMIME_MECHANISM_BINARY: 116 case MAILMIME_MECHANISM_BINARY:
117 enc = "binary"; 117 enc = "binary";
118 break; 118 break;
119 case MAILMIME_MECHANISM_QUOTED_PRINTABLE: 119 case MAILMIME_MECHANISM_QUOTED_PRINTABLE:
120 enc = "quoted-printable"; 120 enc = "quoted-printable";
121 break; 121 break;
122 case MAILMIME_MECHANISM_BASE64: 122 case MAILMIME_MECHANISM_BASE64:
123 enc = "base64"; 123 enc = "base64";
124 break; 124 break;
125 case MAILMIME_MECHANISM_TOKEN: 125 case MAILMIME_MECHANISM_TOKEN:
126 default: 126 default:
127 if (aEnc->enc_token) { 127 if (aEnc->enc_token) {
128 enc = QString(aEnc->enc_token); 128 enc = QString(aEnc->enc_token);
129 } 129 }
130 break; 130 break;
131 } 131 }
132 return enc; 132 return enc;
133} 133}
134 134
135void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rec,int current_count) 135void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rec,int current_count)
136{ 136{
137 if (current_rec >= 10) { 137 if (current_rec >= 10) {
138 qDebug("too deep recursion!"); 138 odebug << "too deep recursion!" << oendl;
139 } 139 }
140 if (!message || !mime) { 140 if (!message || !mime) {
141 return; 141 return;
142 } 142 }
143 int r; 143 int r;
144 char*data = 0; 144 char*data = 0;
145 size_t len; 145 size_t len;
146 clistiter * cur = 0; 146 clistiter * cur = 0;
147 QString b; 147 QString b;
148 RecPartP part = new RecPart(); 148 RecPartP part = new RecPart();
149 149
150 switch (mime->mm_type) { 150 switch (mime->mm_type) {
151 case MAILMIME_SINGLE: 151 case MAILMIME_SINGLE:
152 { 152 {
153 QValueList<int>countlist = recList; 153 QValueList<int>countlist = recList;
154 countlist.append(current_count); 154 countlist.append(current_count);
155 r = mailmessage_fetch_section(message,mime,&data,&len); 155 r = mailmessage_fetch_section(message,mime,&data,&len);
156 part->setSize(len); 156 part->setSize(len);
157 part->setPositionlist(countlist); 157 part->setPositionlist(countlist);
158 b = gen_attachment_id(); 158 b = gen_attachment_id();
159 part->setIdentifier(b); 159 part->setIdentifier(b);
160 fillSingleBody(part,message,mime); 160 fillSingleBody(part,message,mime);
161 if (part->Type()=="text" && target->Bodytext().isNull()) { 161 if (part->Type()=="text" && target->Bodytext().isNull()) {
162 encodedString*rs = new encodedString(); 162 encodedString*rs = new encodedString();
@@ -251,49 +251,49 @@ QString Genericwrapper::parseDateTime( mailimf_date_time *date )
251 251
252QString Genericwrapper::parseAddressList( mailimf_address_list *list ) 252QString Genericwrapper::parseAddressList( mailimf_address_list *list )
253{ 253{
254 QString result( "" ); 254 QString result( "" );
255 255
256 bool first = true; 256 bool first = true;
257 if (list == 0) return result; 257 if (list == 0) return result;
258 for ( clistiter *current = clist_begin( list->ad_list ); current != NULL; current = current->next ) { 258 for ( clistiter *current = clist_begin( list->ad_list ); current != NULL; current = current->next ) {
259 mailimf_address *addr = (mailimf_address *) current->data; 259 mailimf_address *addr = (mailimf_address *) current->data;
260 260
261 if ( !first ) { 261 if ( !first ) {
262 result.append( "," ); 262 result.append( "," );
263 } else { 263 } else {
264 first = false; 264 first = false;
265 } 265 }
266 266
267 switch ( addr->ad_type ) { 267 switch ( addr->ad_type ) {
268 case MAILIMF_ADDRESS_MAILBOX: 268 case MAILIMF_ADDRESS_MAILBOX:
269 result.append( parseMailbox( addr->ad_data.ad_mailbox ) ); 269 result.append( parseMailbox( addr->ad_data.ad_mailbox ) );
270 break; 270 break;
271 case MAILIMF_ADDRESS_GROUP: 271 case MAILIMF_ADDRESS_GROUP:
272 result.append( parseGroup( addr->ad_data.ad_group ) ); 272 result.append( parseGroup( addr->ad_data.ad_group ) );
273 break; 273 break;
274 default: 274 default:
275 qDebug( "Generic: unkown mailimf address type" ); 275 odebug << "Generic: unkown mailimf address type" << oendl;
276 break; 276 break;
277 } 277 }
278 } 278 }
279 279
280 return result; 280 return result;
281} 281}
282 282
283QString Genericwrapper::parseGroup( mailimf_group *group ) 283QString Genericwrapper::parseGroup( mailimf_group *group )
284{ 284{
285 QString result( "" ); 285 QString result( "" );
286 286
287 result.append( group->grp_display_name ); 287 result.append( group->grp_display_name );
288 result.append( ": " ); 288 result.append( ": " );
289 289
290 if ( group->grp_mb_list != NULL ) { 290 if ( group->grp_mb_list != NULL ) {
291 result.append( parseMailboxList( group->grp_mb_list ) ); 291 result.append( parseMailboxList( group->grp_mb_list ) );
292 } 292 }
293 293
294 result.append( ";" ); 294 result.append( ";" );
295 295
296 return result; 296 return result;
297} 297}
298 298
299QString Genericwrapper::parseMailbox( mailimf_mailbox *box ) 299QString Genericwrapper::parseMailbox( mailimf_mailbox *box )
@@ -344,132 +344,132 @@ encodedString* Genericwrapper::fetchRawPart(const RecMailP&,const RecPartP&part)
344{ 344{
345 QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part->Identifier()); 345 QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part->Identifier());
346 if (it==bodyCache.end()) return new encodedString(); 346 if (it==bodyCache.end()) return new encodedString();
347 encodedString*t = it.data(); 347 encodedString*t = it.data();
348 return t; 348 return t;
349} 349}
350 350
351QString Genericwrapper::fetchTextPart(const RecMailP&mail,const RecPartP&part) 351QString Genericwrapper::fetchTextPart(const RecMailP&mail,const RecPartP&part)
352{ 352{
353 encodedString*t = fetchDecodedPart(mail,part); 353 encodedString*t = fetchDecodedPart(mail,part);
354 QString text=t->Content(); 354 QString text=t->Content();
355 delete t; 355 delete t;
356 return text; 356 return text;
357} 357}
358 358
359void Genericwrapper::cleanMimeCache() 359void Genericwrapper::cleanMimeCache()
360{ 360{
361 QMap<QString,encodedString*>::Iterator it = bodyCache.begin(); 361 QMap<QString,encodedString*>::Iterator it = bodyCache.begin();
362 for (;it!=bodyCache.end();++it) { 362 for (;it!=bodyCache.end();++it) {
363 encodedString*t = it.data(); 363 encodedString*t = it.data();
364 //it.setValue(0); 364 //it.setValue(0);
365 if (t) delete t; 365 if (t) delete t;
366 } 366 }
367 bodyCache.clear(); 367 bodyCache.clear();
368 qDebug("Genericwrapper: cache cleaned"); 368 odebug << "Genericwrapper: cache cleaned" << oendl;
369} 369}
370 370
371QStringList Genericwrapper::parseInreplies(mailimf_in_reply_to * in_replies) 371QStringList Genericwrapper::parseInreplies(mailimf_in_reply_to * in_replies)
372{ 372{
373 QStringList res; 373 QStringList res;
374 if (!in_replies || !in_replies->mid_list) return res; 374 if (!in_replies || !in_replies->mid_list) return res;
375 clistiter * current = 0; 375 clistiter * current = 0;
376 for ( current = clist_begin( in_replies->mid_list ); current != NULL; current = current->next ) { 376 for ( current = clist_begin( in_replies->mid_list ); current != NULL; current = current->next ) {
377 QString h((char*)current->data); 377 QString h((char*)current->data);
378 while (h.length()>0 && h[0]=='<') { 378 while (h.length()>0 && h[0]=='<') {
379 h.remove(0,1); 379 h.remove(0,1);
380 } 380 }
381 while (h.length()>0 && h[h.length()-1]=='>') { 381 while (h.length()>0 && h[h.length()-1]=='>') {
382 h.remove(h.length()-1,1); 382 h.remove(h.length()-1,1);
383 } 383 }
384 if (h.length()>0) { 384 if (h.length()>0) {
385 res.append(h); 385 res.append(h);
386 } 386 }
387 } 387 }
388 return res; 388 return res;
389} 389}
390 390
391void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to) 391void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to)
392{ 392{
393 int r; 393 int r;
394 mailmessage_list * env_list = 0; 394 mailmessage_list * env_list = 0;
395 r = mailsession_get_messages_list(session,&env_list); 395 r = mailsession_get_messages_list(session,&env_list);
396 if (r != MAIL_NO_ERROR) { 396 if (r != MAIL_NO_ERROR) {
397 qDebug("Error message list"); 397 odebug << "Error message list" << oendl;
398 return; 398 return;
399 } 399 }
400 r = mailsession_get_envelopes_list(session, env_list); 400 r = mailsession_get_envelopes_list(session, env_list);
401 if (r != MAIL_NO_ERROR) { 401 if (r != MAIL_NO_ERROR) {
402 qDebug("Error filling message list"); 402 odebug << "Error filling message list" << oendl;
403 if (env_list) { 403 if (env_list) {
404 mailmessage_list_free(env_list); 404 mailmessage_list_free(env_list);
405 } 405 }
406 return; 406 return;
407 } 407 }
408 mailimf_references * refs = 0; 408 mailimf_references * refs = 0;
409 mailimf_in_reply_to * in_replies = 0; 409 mailimf_in_reply_to * in_replies = 0;
410 uint32_t i = 0; 410 uint32_t i = 0;
411 for(; i < carray_count(env_list->msg_tab) ; ++i) { 411 for(; i < carray_count(env_list->msg_tab) ; ++i) {
412 mailmessage * msg; 412 mailmessage * msg;
413 QBitArray mFlags(7); 413 QBitArray mFlags(7);
414 msg = (mailmessage*)carray_get(env_list->msg_tab, i); 414 msg = (mailmessage*)carray_get(env_list->msg_tab, i);
415 if (msg->msg_fields == NULL) { 415 if (msg->msg_fields == NULL) {
416 //qDebug("could not fetch envelope of message %i", i); 416 //odebug << "could not fetch envelope of message " << i << "" << oendl;
417 continue; 417 continue;
418 } 418 }
419 RecMailP mail = new RecMail(); 419 RecMailP mail = new RecMail();
420 mail->setWrapper(this); 420 mail->setWrapper(this);
421 mail_flags * flag_result = 0; 421 mail_flags * flag_result = 0;
422 r = mailmessage_get_flags(msg,&flag_result); 422 r = mailmessage_get_flags(msg,&flag_result);
423 if (r == MAIL_ERROR_NOT_IMPLEMENTED) { 423 if (r == MAIL_ERROR_NOT_IMPLEMENTED) {
424 mFlags.setBit(FLAG_SEEN); 424 mFlags.setBit(FLAG_SEEN);
425 } 425 }
426 mailimf_single_fields single_fields; 426 mailimf_single_fields single_fields;
427 mailimf_single_fields_init(&single_fields, msg->msg_fields); 427 mailimf_single_fields_init(&single_fields, msg->msg_fields);
428 mail->setMsgsize(msg->msg_size); 428 mail->setMsgsize(msg->msg_size);
429 mail->setFlags(mFlags); 429 mail->setFlags(mFlags);
430 mail->setMbox(mailbox); 430 mail->setMbox(mailbox);
431 mail->setNumber(msg->msg_index); 431 mail->setNumber(msg->msg_index);
432 if (single_fields.fld_subject) 432 if (single_fields.fld_subject)
433 mail->setSubject( convert_String(single_fields.fld_subject->sbj_value)); 433 mail->setSubject( convert_String(single_fields.fld_subject->sbj_value));
434 if (single_fields.fld_from) 434 if (single_fields.fld_from)
435 mail->setFrom(parseMailboxList(single_fields.fld_from->frm_mb_list)); 435 mail->setFrom(parseMailboxList(single_fields.fld_from->frm_mb_list));
436 if (!mbox_as_to) { 436 if (!mbox_as_to) {
437 if (single_fields.fld_to) 437 if (single_fields.fld_to)
438 mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) ); 438 mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) );
439 } else { 439 } else {
440 mail->setTo(mailbox); 440 mail->setTo(mailbox);
441 } 441 }
442 if (single_fields.fld_cc) 442 if (single_fields.fld_cc)
443 mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) ); 443 mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) );
444 if (single_fields.fld_bcc) 444 if (single_fields.fld_bcc)
445 mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); 445 mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) );
446 if (single_fields.fld_orig_date) 446 if (single_fields.fld_orig_date)
447 mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) ); 447 mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) );
448 // crashes when accessing pop3 account? 448 // crashes when accessing pop3 account?
449 if (single_fields.fld_message_id->mid_value) { 449 if (single_fields.fld_message_id->mid_value) {
450 mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); 450 mail->setMsgid(QString(single_fields.fld_message_id->mid_value));
451 qDebug("Msgid == %s",mail->Msgid().latin1()); 451 odebug << "Msgid == " << mail->Msgid().latin1() << "" << oendl;
452 } 452 }
453 453
454 if (single_fields.fld_reply_to) { 454 if (single_fields.fld_reply_to) {
455 QStringList t = parseAddressList(single_fields.fld_reply_to->rt_addr_list); 455 QStringList t = parseAddressList(single_fields.fld_reply_to->rt_addr_list);
456 if (t.count()>0) { 456 if (t.count()>0) {
457 mail->setReplyto(t[0]); 457 mail->setReplyto(t[0]);
458 } 458 }
459 } 459 }
460#if 0 460#if 0
461 refs = single_fields.fld_references; 461 refs = single_fields.fld_references;
462 if (refs && refs->mid_list && clist_count(refs->mid_list)) { 462 if (refs && refs->mid_list && clist_count(refs->mid_list)) {
463 char * text = (char*)refs->mid_list->first->data; 463 char * text = (char*)refs->mid_list->first->data;
464 mail->setReplyto(QString(text)); 464 mail->setReplyto(QString(text));
465 } 465 }
466#endif 466#endif
467 if (single_fields.fld_in_reply_to && single_fields.fld_in_reply_to->mid_list && 467 if (single_fields.fld_in_reply_to && single_fields.fld_in_reply_to->mid_list &&
468 clist_count(single_fields.fld_in_reply_to->mid_list)) { 468 clist_count(single_fields.fld_in_reply_to->mid_list)) {
469 mail->setInreply(parseInreplies(single_fields.fld_in_reply_to)); 469 mail->setInreply(parseInreplies(single_fields.fld_in_reply_to));
470 } 470 }
471 target.append(mail); 471 target.append(mail);
472 } 472 }
473 if (env_list) { 473 if (env_list) {
474 mailmessage_list_free(env_list); 474 mailmessage_list_free(env_list);
475 } 475 }
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
@@ -9,93 +9,93 @@
9 9
10using namespace Opie::Core; 10using namespace Opie::Core;
11IMAPwrapper::IMAPwrapper( IMAPaccount *a ) 11IMAPwrapper::IMAPwrapper( IMAPaccount *a )
12 : AbstractMail() 12 : AbstractMail()
13{ 13{
14 account = a; 14 account = a;
15 m_imap = 0; 15 m_imap = 0;
16 m_Lastmbox = ""; 16 m_Lastmbox = "";
17} 17}
18 18
19IMAPwrapper::~IMAPwrapper() 19IMAPwrapper::~IMAPwrapper()
20{ 20{
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);
90 } else { 90 } else {
91 try_tls = false; 91 try_tls = false;
92 } 92 }
93 } 93 }
94 } 94 }
95 } 95 }
96 return try_tls; 96 return try_tls;
97} 97}
98 98
99void IMAPwrapper::login() 99void IMAPwrapper::login()
100{ 100{
101 const char *server, *user, *pass; 101 const char *server, *user, *pass;
@@ -104,100 +104,100 @@ void IMAPwrapper::login()
104 104
105 if (account->getOffline()) return; 105 if (account->getOffline()) return;
106 /* we are connected this moment */ 106 /* we are connected this moment */
107 /* TODO: setup a timer holding the line or if connection closed - delete the value */ 107 /* TODO: setup a timer holding the line or if connection closed - delete the value */
108 if (m_imap) { 108 if (m_imap) {
109 err = mailimap_noop(m_imap); 109 err = mailimap_noop(m_imap);
110 if (err!=MAILIMAP_NO_ERROR) { 110 if (err!=MAILIMAP_NO_ERROR) {
111 logout(); 111 logout();
112 } else { 112 } else {
113 mailstream_flush(m_imap->imap_stream); 113 mailstream_flush(m_imap->imap_stream);
114 return; 114 return;
115 } 115 }
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 {
164 failure="Unknown failure"; 164 failure="Unknown failure";
165 } 165 }
166 Global::statusMessage(tr("error connecting imap server: %1").arg(failure)); 166 Global::statusMessage(tr("error connecting imap server: %1").arg(failure));
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 }
192 } 192 }
193 if (!ok) { 193 if (!ok) {
194 err = mailimap_close( m_imap ); 194 err = mailimap_close( m_imap );
195 mailimap_free( m_imap ); 195 mailimap_free( m_imap );
196 m_imap = 0; 196 m_imap = 0;
197 } 197 }
198} 198}
199 199
200void IMAPwrapper::logout() 200void IMAPwrapper::logout()
201{ 201{
202 int err = MAILIMAP_NO_ERROR; 202 int err = MAILIMAP_NO_ERROR;
203 if (!m_imap) return; 203 if (!m_imap) return;
@@ -296,86 +296,86 @@ QValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders()
296 QString del; 296 QString del;
297 bool selectable = true; 297 bool selectable = true;
298 bool no_inferiors = false; 298 bool no_inferiors = false;
299 if ( err == MAILIMAP_NO_ERROR ) { 299 if ( err == MAILIMAP_NO_ERROR ) {
300 current = result->first; 300 current = result->first;
301 for ( int i = result->count; i > 0; i-- ) { 301 for ( int i = result->count; i > 0; i-- ) {
302 list = (mailimap_mailbox_list *) current->data; 302 list = (mailimap_mailbox_list *) current->data;
303 // it is better use the deep copy mechanism of qt itself 303 // it is better use the deep copy mechanism of qt itself
304 // instead of using strdup! 304 // instead of using strdup!
305 temp = list->mb_name; 305 temp = list->mb_name;
306 del = list->mb_delimiter; 306 del = list->mb_delimiter;
307 current = current->next; 307 current = current->next;
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())
343 continue; 343 continue;
344 if ( (bflags = list->mb_flag) ) { 344 if ( (bflags = list->mb_flag) ) {
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;
370 int size; 370 int size;
371 QBitArray mFlags(7); 371 QBitArray mFlags(7);
372 QStringList addresslist; 372 QStringList addresslist;
373 373
374 if (!m_att) { 374 if (!m_att) {
375 return m; 375 return m;
376 } 376 }
377 m = new RecMail(); 377 m = new RecMail();
378 for (c = clist_begin(m_att->att_list); c!=NULL;c=clist_next(c) ) { 378 for (c = clist_begin(m_att->att_list); c!=NULL;c=clist_next(c) ) {
379 current = c; 379 current = c;
380 size = 0; 380 size = 0;
381 item = (mailimap_msg_att_item*)current->data; 381 item = (mailimap_msg_att_item*)current->data;
@@ -445,50 +445,50 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
445 addresslist = address_list_to_stringlist(head->env_reply_to->rt_list); 445 addresslist = address_list_to_stringlist(head->env_reply_to->rt_list);
446 if (addresslist.count()) { 446 if (addresslist.count()) {
447 m->setReplyto(addresslist.first()); 447 m->setReplyto(addresslist.first());
448 } 448 }
449 } 449 }
450 if (head->env_in_reply_to!=NULL) { 450 if (head->env_in_reply_to!=NULL) {
451 QString h(head->env_in_reply_to); 451 QString h(head->env_in_reply_to);
452 while (h.length()>0 && h[0]=='<') { 452 while (h.length()>0 && h[0]=='<') {
453 h.remove(0,1); 453 h.remove(0,1);
454 } 454 }
455 while (h.length()>0 && h[h.length()-1]=='>') { 455 while (h.length()>0 && h[h.length()-1]=='>') {
456 h.remove(h.length()-1,1); 456 h.remove(h.length()-1,1);
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);
483 m->setMsgsize(size); 483 m->setMsgsize(size);
484 } 484 }
485 return m; 485 return m;
486} 486}
487 487
488RecBodyP IMAPwrapper::fetchBody(const RecMailP&mail) 488RecBodyP IMAPwrapper::fetchBody(const RecMailP&mail)
489{ 489{
490 RecBodyP body = new RecBody(); 490 RecBodyP body = new RecBody();
491 const char *mb; 491 const char *mb;
492 int err = MAILIMAP_NO_ERROR; 492 int err = MAILIMAP_NO_ERROR;
493 clist *result = 0; 493 clist *result = 0;
494 clistcell *current; 494 clistcell *current;
@@ -503,49 +503,49 @@ RecBodyP IMAPwrapper::fetchBody(const RecMailP&mail)
503 if (!m_imap) { 503 if (!m_imap) {
504 return body; 504 return body;
505 } 505 }
506 err = selectMbox(mail->getMbox()); 506 err = selectMbox(mail->getMbox());
507 if ( err != MAILIMAP_NO_ERROR ) { 507 if ( err != MAILIMAP_NO_ERROR ) {
508 return body; 508 return body;
509 } 509 }
510 510
511 /* the range has to start at 1!!! not with 0!!!! */ 511 /* the range has to start at 1!!! not with 0!!!! */
512 set = mailimap_set_new_interval( mail->getNumber(),mail->getNumber() ); 512 set = mailimap_set_new_interval( mail->getNumber(),mail->getNumber() );
513 fetchAtt = mailimap_fetch_att_new_bodystructure(); 513 fetchAtt = mailimap_fetch_att_new_bodystructure();
514 fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt); 514 fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt);
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;
540 if (!list) { 540 if (!list) {
541 return l; 541 return l;
542 } 542 }
543 unsigned int count = 0; 543 unsigned int count = 0;
544 for (current=clist_begin(list);current!= NULL;current=clist_next(current)) { 544 for (current=clist_begin(list);current!= NULL;current=clist_next(current)) {
545 from = ""; 545 from = "";
546 named_from = false; 546 named_from = false;
547 current_address=(mailimap_address*)current->data; 547 current_address=(mailimap_address*)current->data;
548 if (current_address->ad_personal_name){ 548 if (current_address->ad_personal_name){
549 from+=convert_String((const char*)current_address->ad_personal_name); 549 from+=convert_String((const char*)current_address->ad_personal_name);
550 from+=" "; 550 from+=" ";
551 named_from = true; 551 named_from = true;
@@ -615,173 +615,173 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMailP&mail,const QValueList<int
615 fetchType = mailimap_fetch_type_new_fetch_att(fetch_att); 615 fetchType = mailimap_fetch_type_new_fetch_att(fetch_att);
616 616
617 clist*result = 0; 617 clist*result = 0;
618 618
619 err = mailimap_fetch( m_imap, set, fetchType, &result ); 619 err = mailimap_fetch( m_imap, set, fetchType, &result );
620 mailimap_set_free( set ); 620 mailimap_set_free( set );
621 mailimap_fetch_type_free( fetchType ); 621 mailimap_fetch_type_free( fetchType );
622 622
623 if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { 623 if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) {
624 mailimap_msg_att * msg_att; 624 mailimap_msg_att * msg_att;
625 msg_att = (mailimap_msg_att*)current->data; 625 msg_att = (mailimap_msg_att*)current->data;
626 mailimap_msg_att_item*msg_att_item; 626 mailimap_msg_att_item*msg_att_item;
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;
652 } 652 }
653 switch (body->bd_type) { 653 switch (body->bd_type) {
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 {
679 target_body->addPart(currentPart); 679 target_body->addPart(currentPart);
680 } 680 }
681 if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_MSG) { 681 if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_MSG) {
682 traverseBody(mail,part1->bd_data.bd_type_msg->bd_body,target_body,current_recursion+1,countlist); 682 traverseBody(mail,part1->bd_data.bd_type_msg->bd_body,target_body,current_recursion+1,countlist);
683 } 683 }
684 } 684 }
685 break; 685 break;
686 case MAILIMAP_BODY_MPART: 686 case MAILIMAP_BODY_MPART:
687 { 687 {
688 QValueList<int>countlist = recList; 688 QValueList<int>countlist = recList;
689 clistcell*current=0; 689 clistcell*current=0;
690 mailimap_body*current_body=0; 690 mailimap_body*current_body=0;
691 unsigned int ccount = 1; 691 unsigned int ccount = 1;
692 mailimap_body_type_mpart*mailDescription = body->bd_data.bd_body_mpart; 692 mailimap_body_type_mpart*mailDescription = body->bd_data.bd_body_mpart;
693 for (current=clist_begin(mailDescription->bd_list);current!=0;current=clist_next(current)) { 693 for (current=clist_begin(mailDescription->bd_list);current!=0;current=clist_next(current)) {
694 current_body = (mailimap_body*)current->data; 694 current_body = (mailimap_body*)current->data;
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 }
720} 720}
721 721
722void IMAPwrapper::fillSinglePart(RecPartP&target_part,mailimap_body_type_1part*Description) 722void IMAPwrapper::fillSinglePart(RecPartP&target_part,mailimap_body_type_1part*Description)
723{ 723{
724 if (!Description) { 724 if (!Description) {
725 return; 725 return;
726 } 726 }
727 switch (Description->bd_type) { 727 switch (Description->bd_type) {
728 case MAILIMAP_BODY_TYPE_1PART_TEXT: 728 case MAILIMAP_BODY_TYPE_1PART_TEXT:
729 target_part->setType("text"); 729 target_part->setType("text");
730 fillSingleTextPart(target_part,Description->bd_data.bd_type_text); 730 fillSingleTextPart(target_part,Description->bd_data.bd_type_text);
731 break; 731 break;
732 case MAILIMAP_BODY_TYPE_1PART_BASIC: 732 case MAILIMAP_BODY_TYPE_1PART_BASIC:
733 fillSingleBasicPart(target_part,Description->bd_data.bd_type_basic); 733 fillSingleBasicPart(target_part,Description->bd_data.bd_type_basic);
734 break; 734 break;
735 case MAILIMAP_BODY_TYPE_1PART_MSG: 735 case MAILIMAP_BODY_TYPE_1PART_MSG:
736 target_part->setType("message"); 736 target_part->setType("message");
737 fillSingleMsgPart(target_part,Description->bd_data.bd_type_msg); 737 fillSingleMsgPart(target_part,Description->bd_data.bd_type_msg);
738 break; 738 break;
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;
776 mailimap_single_body_fld_param*param=0; 776 mailimap_single_body_fld_param*param=0;
777 for (cur = clist_begin(which->bd_ext_mpart->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) { 777 for (cur = clist_begin(which->bd_ext_mpart->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) {
778 param = (mailimap_single_body_fld_param*)cur->data; 778 param = (mailimap_single_body_fld_param*)cur->data;
779 if (param) { 779 if (param) {
780 target_part->addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); 780 target_part->addParameter(QString(param->pa_name).lower(),QString(param->pa_value));
781 } 781 }
782 } 782 }
783 } 783 }
784} 784}
785 785
786void IMAPwrapper::fillSingleBasicPart(RecPartP&target_part,mailimap_body_type_basic*which) 786void IMAPwrapper::fillSingleBasicPart(RecPartP&target_part,mailimap_body_type_basic*which)
787{ 787{
@@ -798,49 +798,49 @@ void IMAPwrapper::fillSingleBasicPart(RecPartP&target_part,mailimap_body_type_ba
798 break; 798 break;
799 case MAILIMAP_MEDIA_BASIC_IMAGE: 799 case MAILIMAP_MEDIA_BASIC_IMAGE:
800 type = "image"; 800 type = "image";
801 break; 801 break;
802 case MAILIMAP_MEDIA_BASIC_MESSAGE: 802 case MAILIMAP_MEDIA_BASIC_MESSAGE:
803 type = "message"; 803 type = "message";
804 break; 804 break;
805 case MAILIMAP_MEDIA_BASIC_VIDEO: 805 case MAILIMAP_MEDIA_BASIC_VIDEO:
806 type = "video"; 806 type = "video";
807 break; 807 break;
808 case MAILIMAP_MEDIA_BASIC_OTHER: 808 case MAILIMAP_MEDIA_BASIC_OTHER:
809 default: 809 default:
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)) {
835 param = (mailimap_single_body_fld_param*)cur->data; 835 param = (mailimap_single_body_fld_param*)cur->data;
836 if (param) { 836 if (param) {
837 target_part->addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); 837 target_part->addParameter(QString(param->pa_name).lower(),QString(param->pa_value));
838 } 838 }
839 } 839 }
840 } 840 }
841 mailimap_body_fld_enc*enc = which->bd_encoding; 841 mailimap_body_fld_enc*enc = which->bd_encoding;
842 QString encoding(""); 842 QString encoding("");
843 switch (enc->enc_type) { 843 switch (enc->enc_type) {
844 case MAILIMAP_BODY_FLD_ENC_7BIT: 844 case MAILIMAP_BODY_FLD_ENC_7BIT:
845 encoding = "7bit"; 845 encoding = "7bit";
846 break; 846 break;
@@ -874,84 +874,84 @@ void IMAPwrapper::fillBodyFields(RecPartP&target_part,mailimap_body_fields*which
874 874
875void IMAPwrapper::deleteMail(const RecMailP&mail) 875void IMAPwrapper::deleteMail(const RecMailP&mail)
876{ 876{
877 mailimap_flag_list*flist; 877 mailimap_flag_list*flist;
878 mailimap_set *set; 878 mailimap_set *set;
879 mailimap_store_att_flags * store_flags; 879 mailimap_store_att_flags * store_flags;
880 int err; 880 int err;
881 login(); 881 login();
882 if (!m_imap) { 882 if (!m_imap) {
883 return; 883 return;
884 } 884 }
885 err = selectMbox(mail->getMbox()); 885 err = selectMbox(mail->getMbox());
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 }
920 err = selectMbox(mail->getMbox()); 920 err = selectMbox(mail->getMbox());
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) {
946 body = r->Content(); 946 body = r->Content();
947 } 947 }
948 delete r; 948 delete r;
949 } 949 }
950 return body; 950 return body;
951} 951}
952 952
953QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const RecPartP&part) 953QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const RecPartP&part)
954{ 954{
955 return fetchTextPart(mail,part->Positionlist(),false,part->Encoding()); 955 return fetchTextPart(mail,part->Positionlist(),false,part->Encoding());
956} 956}
957 957
@@ -977,81 +977,81 @@ int IMAPwrapper::deleteAllMail(const FolderP&folder)
977 mailimap_flag_list*flist; 977 mailimap_flag_list*flist;
978 mailimap_set *set; 978 mailimap_set *set;
979 mailimap_store_att_flags * store_flags; 979 mailimap_store_att_flags * store_flags;
980 int err = selectMbox(folder->getName()); 980 int err = selectMbox(folder->getName());
981 if ( err != MAILIMAP_NO_ERROR ) { 981 if ( err != MAILIMAP_NO_ERROR ) {
982 return 0; 982 return 0;
983 } 983 }
984 984
985 int last = m_imap->imap_selection_info->sel_exists; 985 int last = m_imap->imap_selection_info->sel_exists;
986 if (last == 0) { 986 if (last == 0) {
987 Global::statusMessage(tr("Mailbox has no mails!")); 987 Global::statusMessage(tr("Mailbox has no mails!"));
988 return 0; 988 return 0;
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();
1046 if (!m_imap) {return 0;} 1046 if (!m_imap) {return 0;}
1047 int res = mailimap_delete(m_imap,folder->getName()); 1047 int res = mailimap_delete(m_imap,folder->getName());
1048 if (res != MAILIMAP_NO_ERROR) { 1048 if (res != MAILIMAP_NO_ERROR) {
1049 Global::statusMessage(tr("%1").arg(m_imap->imap_response)); 1049 Global::statusMessage(tr("%1").arg(m_imap->imap_response));
1050 return 0; 1050 return 0;
1051 } 1051 }
1052 return 1; 1052 return 1;
1053} 1053}
1054 1054
1055void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) 1055void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox)
1056{ 1056{
1057 mailimap_status_att_list * att_list =0; 1057 mailimap_status_att_list * att_list =0;
@@ -1068,120 +1068,120 @@ void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox)
1068 att_list = mailimap_status_att_list_new_empty(); 1068 att_list = mailimap_status_att_list_new_empty();
1069 if (!att_list) return; 1069 if (!att_list) return;
1070 r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_MESSAGES); 1070 r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_MESSAGES);
1071 r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_RECENT); 1071 r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_RECENT);
1072 r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_UNSEEN); 1072 r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_UNSEEN);
1073 r = mailimap_status(m_imap, mailbox.latin1(), att_list, &status); 1073 r = mailimap_status(m_imap, mailbox.latin1(), att_list, &status);
1074 if (r==MAILIMAP_NO_ERROR&&status->st_info_list!=0) { 1074 if (r==MAILIMAP_NO_ERROR&&status->st_info_list!=0) {
1075 for (cur = clist_begin(status->st_info_list); 1075 for (cur = clist_begin(status->st_info_list);
1076 cur != NULL ; cur = clist_next(cur)) { 1076 cur != NULL ; cur = clist_next(cur)) {
1077 mailimap_status_info * status_info; 1077 mailimap_status_info * status_info;
1078 status_info = (mailimap_status_info *)clist_content(cur); 1078 status_info = (mailimap_status_info *)clist_content(cur);
1079 switch (status_info->st_att) { 1079 switch (status_info->st_att) {
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}
diff --git a/noncore/net/mail/libmailwrapper/logindialog.cpp b/noncore/net/mail/libmailwrapper/logindialog.cpp
index 01d177e..c9ae190 100644
--- a/noncore/net/mail/libmailwrapper/logindialog.cpp
+++ b/noncore/net/mail/libmailwrapper/logindialog.cpp
@@ -3,27 +3,27 @@
3#include "logindialog.h" 3#include "logindialog.h"
4 4
5LoginDialog::LoginDialog(const QString&user,const QString&pass, QWidget *parent, const char *name, bool modal, WFlags flags ) 5LoginDialog::LoginDialog(const QString&user,const QString&pass, QWidget *parent, const char *name, bool modal, WFlags flags )
6 : LoginDialogUI( parent, name, modal, flags ) 6 : LoginDialogUI( parent, name, modal, flags )
7{ 7{
8 userLine->setText( (user.isEmpty()?QString(""):user) ); 8 userLine->setText( (user.isEmpty()?QString(""):user) );
9 passLine->setText( (pass.isEmpty()?QString(""):pass) ); 9 passLine->setText( (pass.isEmpty()?QString(""):pass) );
10 _user = user; 10 _user = user;
11 _pass = pass; 11 _pass = pass;
12 12
13 if ( user.isEmpty() ) { 13 if ( user.isEmpty() ) {
14 userLine->setFocus(); 14 userLine->setFocus();
15 } else { 15 } else {
16 passLine->setFocus(); 16 passLine->setFocus();
17 } 17 }
18} 18}
19 19
20void LoginDialog::accept() 20void LoginDialog::accept()
21{ 21{
22 //_user.replace( 0, _user.length(), userLine->text() ); 22 //_user.replace( 0, _user.length(), userLine->text() );
23 //_pass.replace( 0, _pass.length(), passLine->text() ); 23 //_pass.replace( 0, _pass.length(), passLine->text() );
24 _user = userLine->text(); 24 _user = userLine->text();
25 _pass = passLine->text(); 25 _pass = passLine->text();
26 26
27 qDebug("User im accept: |%s|",_user.latin1()); 27 odebug << "User im accept: |" << _user.latin1() << "|" << oendl;
28 QDialog::accept(); 28 QDialog::accept();
29} 29}
diff --git a/noncore/net/mail/libmailwrapper/mailtypes.cpp b/noncore/net/mail/libmailwrapper/mailtypes.cpp
index 90b8865..6d44db4 100644
--- a/noncore/net/mail/libmailwrapper/mailtypes.cpp
+++ b/noncore/net/mail/libmailwrapper/mailtypes.cpp
@@ -1,40 +1,40 @@
1#include "mailtypes.h" 1#include "mailtypes.h"
2#include <stdlib.h> 2#include <stdlib.h>
3 3
4using namespace Opie::Core; 4using namespace Opie::Core;
5RecMail::RecMail() 5RecMail::RecMail()
6 :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7) 6 :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7)
7{ 7{
8 init(); 8 init();
9} 9}
10 10
11RecMail::RecMail(const RecMail&old) 11RecMail::RecMail(const RecMail&old)
12 :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7) 12 :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7)
13{ 13{
14 init(); 14 init();
15 copy_old(old); 15 copy_old(old);
16 qDebug("Copy constructor RecMail"); 16 odebug << "Copy constructor RecMail" << oendl;
17} 17}
18 18
19RecMail::~RecMail() 19RecMail::~RecMail()
20{ 20{
21 wrapper = 0; 21 wrapper = 0;
22} 22}
23 23
24void RecMail::copy_old(const RecMail&old) 24void RecMail::copy_old(const RecMail&old)
25{ 25{
26 subject = old.subject; 26 subject = old.subject;
27 date = old.date; 27 date = old.date;
28 mbox = old.mbox; 28 mbox = old.mbox;
29 msg_id = old.msg_id; 29 msg_id = old.msg_id;
30 msg_size = old.msg_size; 30 msg_size = old.msg_size;
31 msg_number = old.msg_number; 31 msg_number = old.msg_number;
32 from = old.from; 32 from = old.from;
33 msg_flags = old.msg_flags; 33 msg_flags = old.msg_flags;
34 to = old.to; 34 to = old.to;
35 cc = old.cc; 35 cc = old.cc;
36 bcc = old.bcc; 36 bcc = old.bcc;
37 wrapper = old.wrapper; 37 wrapper = old.wrapper;
38 in_reply_to = old.in_reply_to; 38 in_reply_to = old.in_reply_to;
39 references = old.references; 39 references = old.references;
40 replyto = old.replyto; 40 replyto = old.replyto;
@@ -110,49 +110,49 @@ const QStringList& RecMail::References()const
110 return references; 110 return references;
111} 111}
112 112
113RecPart::RecPart() 113RecPart::RecPart()
114 : Opie::Core::ORefCount(), 114 : Opie::Core::ORefCount(),
115 m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_description(""),m_lines(0),m_size(0) 115 m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_description(""),m_lines(0),m_size(0)
116{ 116{
117 m_Parameters.clear(); 117 m_Parameters.clear();
118 m_poslist.clear(); 118 m_poslist.clear();
119} 119}
120 120
121RecPart::RecPart(const RecPart&old) 121RecPart::RecPart(const RecPart&old)
122 : Opie::Core::ORefCount(), 122 : Opie::Core::ORefCount(),
123 m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_description(""),m_lines(0),m_size(0) 123 m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_description(""),m_lines(0),m_size(0)
124{ 124{
125 m_type = old.m_type; 125 m_type = old.m_type;
126 m_subtype = old.m_subtype; 126 m_subtype = old.m_subtype;
127 m_identifier = old.m_identifier; 127 m_identifier = old.m_identifier;
128 m_encoding = old.m_encoding; 128 m_encoding = old.m_encoding;
129 m_description = old.m_description; 129 m_description = old.m_description;
130 m_lines = old.m_lines; 130 m_lines = old.m_lines;
131 m_size = old.m_size; 131 m_size = old.m_size;
132 m_Parameters = old.m_Parameters; 132 m_Parameters = old.m_Parameters;
133 m_poslist = old.m_poslist; 133 m_poslist = old.m_poslist;
134 qDebug("RecPart copy constructor"); 134 odebug << "RecPart copy constructor" << oendl;
135} 135}
136 136
137RecPart::~RecPart() 137RecPart::~RecPart()
138{ 138{
139} 139}
140 140
141void RecPart::setSize(unsigned int size) 141void RecPart::setSize(unsigned int size)
142{ 142{
143 m_size = size; 143 m_size = size;
144} 144}
145 145
146const unsigned int RecPart::Size()const 146const unsigned int RecPart::Size()const
147{ 147{
148 return m_size; 148 return m_size;
149} 149}
150 150
151void RecPart::setLines(unsigned int lines) 151void RecPart::setLines(unsigned int lines)
152{ 152{
153 m_lines = lines; 153 m_lines = lines;
154} 154}
155 155
156const unsigned int RecPart::Lines()const 156const unsigned int RecPart::Lines()const
157{ 157{
158 return m_lines; 158 return m_lines;
@@ -234,49 +234,49 @@ const QString RecPart::searchParamter(const QString&key)const
234} 234}
235 235
236void RecPart::setPositionlist(const QValueList<int>&poslist) 236void RecPart::setPositionlist(const QValueList<int>&poslist)
237{ 237{
238 m_poslist = poslist; 238 m_poslist = poslist;
239} 239}
240 240
241const QValueList<int>& RecPart::Positionlist()const 241const QValueList<int>& RecPart::Positionlist()const
242{ 242{
243 return m_poslist; 243 return m_poslist;
244} 244}
245 245
246RecBody::RecBody() 246RecBody::RecBody()
247 : Opie::Core::ORefCount(),m_BodyText(),m_description(new RecPart()) 247 : Opie::Core::ORefCount(),m_BodyText(),m_description(new RecPart())
248{ 248{
249 m_PartsList.clear(); 249 m_PartsList.clear();
250} 250}
251 251
252RecBody::RecBody(const RecBody&old) 252RecBody::RecBody(const RecBody&old)
253 :Opie::Core::ORefCount(),m_BodyText(),m_PartsList(),m_description(new RecPart()) 253 :Opie::Core::ORefCount(),m_BodyText(),m_PartsList(),m_description(new RecPart())
254{ 254{
255 m_BodyText = old.m_BodyText; 255 m_BodyText = old.m_BodyText;
256 m_PartsList = old.m_PartsList; 256 m_PartsList = old.m_PartsList;
257 m_description = old.m_description; 257 m_description = old.m_description;
258 qDebug("Recbody copy constructor"); 258 odebug << "Recbody copy constructor" << oendl;
259} 259}
260 260
261RecBody::~RecBody() 261RecBody::~RecBody()
262{ 262{
263} 263}
264 264
265void RecBody::setBodytext(const QString&bodyText) 265void RecBody::setBodytext(const QString&bodyText)
266{ 266{
267 m_BodyText = bodyText; 267 m_BodyText = bodyText;
268} 268}
269 269
270const QString& RecBody::Bodytext()const 270const QString& RecBody::Bodytext()const
271{ 271{
272 return m_BodyText; 272 return m_BodyText;
273} 273}
274 274
275void RecBody::setParts(const QValueList<RecPartP>&parts) 275void RecBody::setParts(const QValueList<RecPartP>&parts)
276{ 276{
277 m_PartsList.clear(); 277 m_PartsList.clear();
278 m_PartsList = parts; 278 m_PartsList = parts;
279} 279}
280 280
281const QValueList<RecPartP>& RecBody::Parts()const 281const QValueList<RecPartP>& RecBody::Parts()const
282{ 282{
@@ -299,56 +299,56 @@ const RecPartP& RecBody::Description()const
299} 299}
300 300
301/* handling encoded content */ 301/* handling encoded content */
302encodedString::encodedString() 302encodedString::encodedString()
303{ 303{
304 init(); 304 init();
305} 305}
306 306
307encodedString::encodedString(const char*nContent,unsigned int nSize) 307encodedString::encodedString(const char*nContent,unsigned int nSize)
308{ 308{
309 init(); 309 init();
310 setContent(nContent,nSize); 310 setContent(nContent,nSize);
311} 311}
312 312
313encodedString::encodedString(char*nContent,unsigned int nSize) 313encodedString::encodedString(char*nContent,unsigned int nSize)
314{ 314{
315 init(); 315 init();
316 setContent(nContent,nSize); 316 setContent(nContent,nSize);
317} 317}
318 318
319encodedString::encodedString(const encodedString&old) 319encodedString::encodedString(const encodedString&old)
320{ 320{
321 init(); 321 init();
322 copy_old(old); 322 copy_old(old);
323 qDebug("encodedeString: copy constructor!"); 323 odebug << "encodedeString: copy constructor!" << oendl;
324} 324}
325 325
326encodedString& encodedString::operator=(const encodedString&old) 326encodedString& encodedString::operator=(const encodedString&old)
327{ 327{
328 init(); 328 init();
329 copy_old(old); 329 copy_old(old);
330 qDebug("encodedString: assign operator!"); 330 odebug << "encodedString: assign operator!" << oendl;
331 return *this; 331 return *this;
332} 332}
333 333
334encodedString::~encodedString() 334encodedString::~encodedString()
335{ 335{
336 clean(); 336 clean();
337} 337}
338 338
339void encodedString::init() 339void encodedString::init()
340{ 340{
341 content = 0; 341 content = 0;
342 size = 0; 342 size = 0;
343} 343}
344 344
345void encodedString::clean() 345void encodedString::clean()
346{ 346{
347 if (content) { 347 if (content) {
348 free(content); 348 free(content);
349 } 349 }
350 content = 0; 350 content = 0;
351 size = 0; 351 size = 0;
352} 352}
353 353
354void encodedString::copy_old(const encodedString&old) 354void encodedString::copy_old(const encodedString&old)
diff --git a/noncore/net/mail/libmailwrapper/mailwrapper.cpp b/noncore/net/mail/libmailwrapper/mailwrapper.cpp
index eddc0b9..2b0d112 100644
--- a/noncore/net/mail/libmailwrapper/mailwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/mailwrapper.cpp
@@ -30,49 +30,49 @@ Attachment::Attachment( DocLnk lnk )
30 30
31Folder::Folder(const QString&tmp_name, const QString&sep ) 31Folder::Folder(const QString&tmp_name, const QString&sep )
32{ 32{
33 name = tmp_name; 33 name = tmp_name;
34 nameDisplay = name; 34 nameDisplay = name;
35 separator = sep; 35 separator = sep;
36 prefix = ""; 36 prefix = "";
37} 37}
38 38
39Folder::~Folder() 39Folder::~Folder()
40{ 40{
41} 41}
42 42
43const QString& Folder::Separator()const 43const QString& Folder::Separator()const
44{ 44{
45 return separator; 45 return separator;
46} 46}
47 47
48IMAPFolder::IMAPFolder(const QString&name,const QString&sep, bool select,bool no_inf, const QString&aprefix ) 48IMAPFolder::IMAPFolder(const QString&name,const QString&sep, bool select,bool no_inf, const QString&aprefix )
49 : Folder( name,sep ),m_MaySelect(select),m_NoInferior(no_inf) 49 : Folder( name,sep ),m_MaySelect(select),m_NoInferior(no_inf)
50{ 50{
51 // Decode IMAP foldername 51 // Decode IMAP foldername
52 nameDisplay = IMAPFolder::decodeFolderName( name ); 52 nameDisplay = IMAPFolder::decodeFolderName( name );
53 /* 53 /*
54 qDebug( "folder " + name + " - displayed as " + nameDisplay ); 54 odebug << "folder " + name + " - displayed as " + nameDisplay << oendl;
55 */ 55 */
56 prefix = aprefix; 56 prefix = aprefix;
57 57
58 if (prefix.length()>0) { 58 if (prefix.length()>0) {
59 if (nameDisplay.startsWith(prefix) && nameDisplay.length()>prefix.length()) { 59 if (nameDisplay.startsWith(prefix) && nameDisplay.length()>prefix.length()) {
60 nameDisplay=nameDisplay.right(nameDisplay.length()-prefix.length()); 60 nameDisplay=nameDisplay.right(nameDisplay.length()-prefix.length());
61 } 61 }
62 } 62 }
63} 63}
64 64
65IMAPFolder::~IMAPFolder() 65IMAPFolder::~IMAPFolder()
66{ 66{
67} 67}
68 68
69static unsigned char base64chars[] = 69static unsigned char base64chars[] =
70 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+,"; 70 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+,";
71 71
72/** 72/**
73 * Decodes base64 encoded parts of the imapfolder name 73 * Decodes base64 encoded parts of the imapfolder name
74 * Code taken from kde cvs: kdebase/kioslave/imap4/rfcdecoder.cc 74 * Code taken from kde cvs: kdebase/kioslave/imap4/rfcdecoder.cc
75 */ 75 */
76QString IMAPFolder::decodeFolderName( const QString &name ) 76QString IMAPFolder::decodeFolderName( const QString &name )
77{ 77{
78 unsigned char c, i, bitcount; 78 unsigned char c, i, bitcount;
diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp
index e3c75f3..df2112f 100644
--- a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp
@@ -10,150 +10,150 @@ using namespace Opie::Core;
10MBOXwrapper::MBOXwrapper(const QString & mbox_dir,const QString&mbox_name) 10MBOXwrapper::MBOXwrapper(const QString & mbox_dir,const QString&mbox_name)
11 : Genericwrapper(),MBOXPath(mbox_dir),MBOXName(mbox_name) 11 : Genericwrapper(),MBOXPath(mbox_dir),MBOXName(mbox_name)
12{ 12{
13 QDir dir(MBOXPath); 13 QDir dir(MBOXPath);
14 if (!dir.exists()) { 14 if (!dir.exists()) {
15 dir.mkdir(MBOXPath); 15 dir.mkdir(MBOXPath);
16 } 16 }
17} 17}
18 18
19MBOXwrapper::~MBOXwrapper() 19MBOXwrapper::~MBOXwrapper()
20{ 20{
21} 21}
22 22
23void MBOXwrapper::listMessages(const QString & mailbox, QValueList<RecMailP> &target ) 23void MBOXwrapper::listMessages(const QString & mailbox, QValueList<RecMailP> &target )
24{ 24{
25 mailstorage*storage = mailstorage_new(NULL); 25 mailstorage*storage = mailstorage_new(NULL);
26 QString p = MBOXPath+"/"; 26 QString p = MBOXPath+"/";
27 p+=mailbox; 27 p+=mailbox;
28 28
29 int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); 29 int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0);
30 mailfolder*folder; 30 mailfolder*folder;
31 folder = mailfolder_new( storage,(char*)p.latin1(),NULL); 31 folder = mailfolder_new( storage,(char*)p.latin1(),NULL);
32 r = mailfolder_connect(folder); 32 r = mailfolder_connect(folder);
33 if (r != MAIL_NO_ERROR) { 33 if (r != MAIL_NO_ERROR) {
34 qDebug("Error initializing mbox"); 34 odebug << "Error initializing mbox" << oendl;
35 mailfolder_free(folder); 35 mailfolder_free(folder);
36 mailstorage_free(storage); 36 mailstorage_free(storage);
37 return; 37 return;
38 } 38 }
39 39
40 parseList(target,folder->fld_session,mailbox); 40 parseList(target,folder->fld_session,mailbox);
41 41
42 mailfolder_disconnect(folder); 42 mailfolder_disconnect(folder);
43 mailfolder_free(folder); 43 mailfolder_free(folder);
44 mailstorage_free(storage); 44 mailstorage_free(storage);
45 Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count())); 45 Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count()));
46} 46}
47 47
48QValueList<Opie::Core::OSmartPointer<Folder> >* MBOXwrapper::listFolders() 48QValueList<Opie::Core::OSmartPointer<Folder> >* MBOXwrapper::listFolders()
49{ 49{
50 QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<Opie::Core::OSmartPointer<Folder> >(); 50 QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<Opie::Core::OSmartPointer<Folder> >();
51 QDir dir(MBOXPath); 51 QDir dir(MBOXPath);
52 if (!dir.exists()) return folders; 52 if (!dir.exists()) return folders;
53 dir.setFilter(QDir::Files|QDir::Writable|QDir::Readable); 53 dir.setFilter(QDir::Files|QDir::Writable|QDir::Readable);
54 QStringList entries = dir.entryList(); 54 QStringList entries = dir.entryList();
55 QStringList::ConstIterator it = entries.begin(); 55 QStringList::ConstIterator it = entries.begin();
56 for (;it!=entries.end();++it) { 56 for (;it!=entries.end();++it) {
57 FolderP inb=new Folder(*it,"/"); 57 FolderP inb=new Folder(*it,"/");
58 folders->append(inb); 58 folders->append(inb);
59 } 59 }
60 return folders; 60 return folders;
61} 61}
62 62
63void MBOXwrapper::deleteMail(const RecMailP & mail) 63void MBOXwrapper::deleteMail(const RecMailP & mail)
64{ 64{
65 mailstorage*storage = mailstorage_new(NULL); 65 mailstorage*storage = mailstorage_new(NULL);
66 QString p = MBOXPath+"/"; 66 QString p = MBOXPath+"/";
67 p+=mail->getMbox(); 67 p+=mail->getMbox();
68 int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); 68 int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0);
69 mailfolder*folder; 69 mailfolder*folder;
70 folder = mailfolder_new( storage,(char*)p.latin1(),NULL); 70 folder = mailfolder_new( storage,(char*)p.latin1(),NULL);
71 r = mailfolder_connect(folder); 71 r = mailfolder_connect(folder);
72 if (r != MAIL_NO_ERROR) { 72 if (r != MAIL_NO_ERROR) {
73 qDebug("Error initializing mbox"); 73 odebug << "Error initializing mbox" << oendl;
74 mailfolder_free(folder); 74 mailfolder_free(folder);
75 mailstorage_free(storage); 75 mailstorage_free(storage);
76 return; 76 return;
77 } 77 }
78 r = mailsession_remove_message(folder->fld_session,mail->getNumber()); 78 r = mailsession_remove_message(folder->fld_session,mail->getNumber());
79 if (r != MAIL_NO_ERROR) { 79 if (r != MAIL_NO_ERROR) {
80 qDebug("error deleting mail"); 80 odebug << "error deleting mail" << oendl;
81 } 81 }
82 mailfolder_free(folder); 82 mailfolder_free(folder);
83 mailstorage_free(storage); 83 mailstorage_free(storage);
84} 84}
85 85
86void MBOXwrapper::answeredMail(const RecMailP&) 86void MBOXwrapper::answeredMail(const RecMailP&)
87{ 87{
88} 88}
89 89
90RecBodyP MBOXwrapper::fetchBody( const RecMailP &mail ) 90RecBodyP MBOXwrapper::fetchBody( const RecMailP &mail )
91{ 91{
92 RecBodyP body = new RecBody(); 92 RecBodyP body = new RecBody();
93 mailstorage*storage = mailstorage_new(NULL); 93 mailstorage*storage = mailstorage_new(NULL);
94 QString p = MBOXPath+"/"; 94 QString p = MBOXPath+"/";
95 p+=mail->getMbox(); 95 p+=mail->getMbox();
96 mailmessage * msg; 96 mailmessage * msg;
97 char*data=0; 97 char*data=0;
98 size_t size; 98 size_t size;
99 99
100 int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); 100 int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0);
101 mailfolder*folder; 101 mailfolder*folder;
102 folder = mailfolder_new( storage,(char*)p.latin1(),NULL); 102 folder = mailfolder_new( storage,(char*)p.latin1(),NULL);
103 r = mailfolder_connect(folder); 103 r = mailfolder_connect(folder);
104 if (r != MAIL_NO_ERROR) { 104 if (r != MAIL_NO_ERROR) {
105 qDebug("Error initializing mbox"); 105 odebug << "Error initializing mbox" << oendl;
106 mailfolder_free(folder); 106 mailfolder_free(folder);
107 mailstorage_free(storage); 107 mailstorage_free(storage);
108 return body; 108 return body;
109 } 109 }
110 r = mailsession_get_message(folder->fld_session, mail->getNumber(), &msg); 110 r = mailsession_get_message(folder->fld_session, mail->getNumber(), &msg);
111 if (r != MAIL_NO_ERROR) { 111 if (r != MAIL_NO_ERROR) {
112 qDebug("Error fetching mail %i",mail->getNumber()); 112 odebug << "Error fetching mail " << mail->getNumber() << "" << oendl;
113 mailfolder_free(folder); 113 mailfolder_free(folder);
114 mailstorage_free(storage); 114 mailstorage_free(storage);
115 return body; 115 return body;
116 } 116 }
117 r = mailmessage_fetch(msg,&data,&size); 117 r = mailmessage_fetch(msg,&data,&size);
118 if (r != MAIL_NO_ERROR) { 118 if (r != MAIL_NO_ERROR) {
119 qDebug("Error fetching mail %i",mail->getNumber()); 119 odebug << "Error fetching mail " << mail->getNumber() << "" << oendl;
120 mailfolder_free(folder); 120 mailfolder_free(folder);
121 mailstorage_free(storage); 121 mailstorage_free(storage);
122 mailmessage_free(msg); 122 mailmessage_free(msg);
123 return body; 123 return body;
124 } 124 }
125 body = parseMail(msg); 125 body = parseMail(msg);
126 mailmessage_fetch_result_free(msg,data); 126 mailmessage_fetch_result_free(msg,data);
127 mailfolder_free(folder); 127 mailfolder_free(folder);
128 mailstorage_free(storage); 128 mailstorage_free(storage);
129 129
130 return body; 130 return body;
131} 131}
132 132
133void MBOXwrapper::mbox_progress( size_t current, size_t maximum ) 133void MBOXwrapper::mbox_progress( size_t current, size_t maximum )
134{ 134{
135 qDebug("MBOX %i von %i",current,maximum); 135 odebug << "MBOX " << current << " von " << maximum << "" << oendl;
136} 136}
137 137
138int MBOXwrapper::createMbox(const QString&folder,const FolderP&,const QString&,bool ) 138int MBOXwrapper::createMbox(const QString&folder,const FolderP&,const QString&,bool )
139{ 139{
140 QString p = MBOXPath+"/"; 140 QString p = MBOXPath+"/";
141 p+=folder; 141 p+=folder;
142 QFileInfo fi(p); 142 QFileInfo fi(p);
143 if (fi.exists()) { 143 if (fi.exists()) {
144 Global::statusMessage(tr("Mailbox exists.")); 144 Global::statusMessage(tr("Mailbox exists."));
145 return 0; 145 return 0;
146 } 146 }
147 mailmbox_folder*f = 0; 147 mailmbox_folder*f = 0;
148 if (mailmbox_init(p.latin1(),0,1,0,&f) != MAIL_NO_ERROR) { 148 if (mailmbox_init(p.latin1(),0,1,0,&f) != MAIL_NO_ERROR) {
149 Global::statusMessage(tr("Error init folder")); 149 Global::statusMessage(tr("Error init folder"));
150 return 0; 150 return 0;
151 } 151 }
152 if (f) mailmbox_done(f); 152 if (f) mailmbox_done(f);
153 return 1; 153 return 1;
154} 154}
155 155
156void MBOXwrapper::storeMessage(const char*msg,size_t length, const QString&folder) 156void MBOXwrapper::storeMessage(const char*msg,size_t length, const QString&folder)
157{ 157{
158 QString p = MBOXPath+"/"; 158 QString p = MBOXPath+"/";
159 p+=folder; 159 p+=folder;
@@ -199,98 +199,98 @@ encodedString* MBOXwrapper::fetchRawBody(const RecMailP&mail)
199 } 199 }
200 r = mailmessage_fetch(msg,&data,&size); 200 r = mailmessage_fetch(msg,&data,&size);
201 if (r != MAIL_NO_ERROR) { 201 if (r != MAIL_NO_ERROR) {
202 Global::statusMessage(tr("Error fetching mail %i").arg(mail->getNumber())); 202 Global::statusMessage(tr("Error fetching mail %i").arg(mail->getNumber()));
203 mailfolder_free(folder); 203 mailfolder_free(folder);
204 mailstorage_free(storage); 204 mailstorage_free(storage);
205 mailmessage_free(msg); 205 mailmessage_free(msg);
206 return 0; 206 return 0;
207 } 207 }
208 encodedString*result = new encodedString(data,size); 208 encodedString*result = new encodedString(data,size);
209 209
210 mailfolder_free(folder); 210 mailfolder_free(folder);
211 mailstorage_free(storage); 211 mailstorage_free(storage);
212 mailmessage_free(msg); 212 mailmessage_free(msg);
213 return result; 213 return result;
214} 214}
215 215
216void MBOXwrapper::deleteMails(const QString & mailbox,const QValueList<RecMailP> &target) 216void MBOXwrapper::deleteMails(const QString & mailbox,const QValueList<RecMailP> &target)
217{ 217{
218 QString p = MBOXPath+"/"; 218 QString p = MBOXPath+"/";
219 p+=mailbox; 219 p+=mailbox;
220 mailmbox_folder*f = 0; 220 mailmbox_folder*f = 0;
221 int r = mailmbox_init(p.latin1(),0,1,0,&f); 221 int r = mailmbox_init(p.latin1(),0,1,0,&f);
222 if (r != MAIL_NO_ERROR) { 222 if (r != MAIL_NO_ERROR) {
223 qDebug("Error init folder"); 223 odebug << "Error init folder" << oendl;
224 return; 224 return;
225 } 225 }
226 deleteMails(f,target); 226 deleteMails(f,target);
227 mailmbox_done(f); 227 mailmbox_done(f);
228} 228}
229 229
230void MBOXwrapper::deleteMails(mailmbox_folder*f,const QValueList<RecMailP> &target) 230void MBOXwrapper::deleteMails(mailmbox_folder*f,const QValueList<RecMailP> &target)
231{ 231{
232 if (!f) return; 232 if (!f) return;
233 int r; 233 int r;
234 QValueList<RecMailP>::ConstIterator it; 234 QValueList<RecMailP>::ConstIterator it;
235 for (it=target.begin(); it != target.end();++it) { 235 for (it=target.begin(); it != target.end();++it) {
236 r = mailmbox_delete_msg(f,(*it)->getNumber()); 236 r = mailmbox_delete_msg(f,(*it)->getNumber());
237 if (r!=MAILMBOX_NO_ERROR) { 237 if (r!=MAILMBOX_NO_ERROR) {
238 qDebug("error delete mail"); 238 odebug << "error delete mail" << oendl;
239 } 239 }
240 } 240 }
241 r = mailmbox_expunge(f); 241 r = mailmbox_expunge(f);
242 if (r != MAILMBOX_NO_ERROR) { 242 if (r != MAILMBOX_NO_ERROR) {
243 qDebug("error expunge mailbox"); 243 odebug << "error expunge mailbox" << oendl;
244 } 244 }
245} 245}
246 246
247int MBOXwrapper::deleteAllMail(const FolderP&tfolder) 247int MBOXwrapper::deleteAllMail(const FolderP&tfolder)
248{ 248{
249 if (!tfolder) return 0; 249 if (!tfolder) return 0;
250 QString p = MBOXPath+"/"+tfolder->getDisplayName(); 250 QString p = MBOXPath+"/"+tfolder->getDisplayName();
251 int res = 1; 251 int res = 1;
252 252
253 mailfolder*folder = 0; 253 mailfolder*folder = 0;
254 mailmessage_list*l=0; 254 mailmessage_list*l=0;
255 mailstorage*storage = mailstorage_new(NULL); 255 mailstorage*storage = mailstorage_new(NULL);
256 int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); 256 int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0);
257 if (r != MAIL_NO_ERROR) { 257 if (r != MAIL_NO_ERROR) {
258 Global::statusMessage(tr("Error initializing mbox")); 258 Global::statusMessage(tr("Error initializing mbox"));
259 res = 0; 259 res = 0;
260 } 260 }
261 if (res) { 261 if (res) {
262 folder = mailfolder_new( storage,(char*)p.latin1(),NULL); 262 folder = mailfolder_new( storage,(char*)p.latin1(),NULL);
263 r = mailfolder_connect(folder); 263 r = mailfolder_connect(folder);
264 if (r != MAIL_NO_ERROR) { 264 if (r != MAIL_NO_ERROR) {
265 Global::statusMessage(tr("Error initializing mbox")); 265 Global::statusMessage(tr("Error initializing mbox"));
266 res = 0; 266 res = 0;
267 } 267 }
268 } 268 }
269 if (res) { 269 if (res) {
270 r = mailsession_get_messages_list(folder->fld_session,&l); 270 r = mailsession_get_messages_list(folder->fld_session,&l);
271 if (r != MAIL_NO_ERROR) { 271 if (r != MAIL_NO_ERROR) {
272 qDebug("Error message list"); 272 odebug << "Error message list" << oendl;
273 res=0; 273 res=0;
274 } 274 }
275 } 275 }
276 for(unsigned int i = 0 ; l!= 0 && res==1 && i < carray_count(l->msg_tab) ; ++i) { 276 for(unsigned int i = 0 ; l!= 0 && res==1 && i < carray_count(l->msg_tab) ; ++i) {
277 r = mailsession_remove_message(folder->fld_session,i+1); 277 r = mailsession_remove_message(folder->fld_session,i+1);
278 if (r != MAIL_NO_ERROR) { 278 if (r != MAIL_NO_ERROR) {
279 Global::statusMessage(tr("Error deleting mail %1").arg(i+1)); 279 Global::statusMessage(tr("Error deleting mail %1").arg(i+1));
280 res = 0; 280 res = 0;
281 break; 281 break;
282 } 282 }
283 } 283 }
284 if (l) mailmessage_list_free(l); 284 if (l) mailmessage_list_free(l);
285 if (folder) mailfolder_free(folder); 285 if (folder) mailfolder_free(folder);
286 if (storage) mailstorage_free(storage); 286 if (storage) mailstorage_free(storage);
287 return res; 287 return res;
288} 288}
289 289
290int MBOXwrapper::deleteMbox(const FolderP&tfolder) 290int MBOXwrapper::deleteMbox(const FolderP&tfolder)
291{ 291{
292 if (!tfolder) return 0; 292 if (!tfolder) return 0;
293 QString p = MBOXPath+"/"+tfolder->getDisplayName(); 293 QString p = MBOXPath+"/"+tfolder->getDisplayName();
294 QFile fi(p); 294 QFile fi(p);
295 if (!fi.exists()) { 295 if (!fi.exists()) {
296 Global::statusMessage(tr("Mailbox doesn't exist.")); 296 Global::statusMessage(tr("Mailbox doesn't exist."));
diff --git a/noncore/net/mail/libmailwrapper/mhwrapper.cpp b/noncore/net/mail/libmailwrapper/mhwrapper.cpp
index 12472e9..cd7cecb 100644
--- a/noncore/net/mail/libmailwrapper/mhwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/mhwrapper.cpp
@@ -1,442 +1,442 @@
1#include "mhwrapper.h" 1#include "mhwrapper.h"
2#include "mailtypes.h" 2#include "mailtypes.h"
3#include "mailwrapper.h" 3#include "mailwrapper.h"
4#include <libetpan/libetpan.h> 4#include <libetpan/libetpan.h>
5#include <qdir.h> 5#include <qdir.h>
6#include <qmessagebox.h> 6#include <qmessagebox.h>
7#include <stdlib.h> 7#include <stdlib.h>
8#include <qpe/global.h> 8#include <qpe/global.h>
9#include <opie2/oprocess.h> 9#include <opie2/oprocess.h>
10 10
11using namespace Opie::Core; 11using namespace Opie::Core;
12MHwrapper::MHwrapper(const QString & mbox_dir,const QString&mbox_name) 12MHwrapper::MHwrapper(const QString & mbox_dir,const QString&mbox_name)
13 : Genericwrapper(),MHPath(mbox_dir),MHName(mbox_name) 13 : Genericwrapper(),MHPath(mbox_dir),MHName(mbox_name)
14{ 14{
15 if (MHPath.length()>0) { 15 if (MHPath.length()>0) {
16 if (MHPath[MHPath.length()-1]=='/') { 16 if (MHPath[MHPath.length()-1]=='/') {
17 MHPath=MHPath.left(MHPath.length()-1); 17 MHPath=MHPath.left(MHPath.length()-1);
18 } 18 }
19 qDebug(MHPath); 19 odebug << MHPath << oendl;
20 QDir dir(MHPath); 20 QDir dir(MHPath);
21 if (!dir.exists()) { 21 if (!dir.exists()) {
22 dir.mkdir(MHPath); 22 dir.mkdir(MHPath);
23 } 23 }
24 init_storage(); 24 init_storage();
25 } 25 }
26} 26}
27 27
28void MHwrapper::init_storage() 28void MHwrapper::init_storage()
29{ 29{
30 int r; 30 int r;
31 QString pre = MHPath; 31 QString pre = MHPath;
32 if (!m_storage) { 32 if (!m_storage) {
33 m_storage = mailstorage_new(NULL); 33 m_storage = mailstorage_new(NULL);
34 r = mh_mailstorage_init(m_storage,(char*)pre.latin1(),0,0,0); 34 r = mh_mailstorage_init(m_storage,(char*)pre.latin1(),0,0,0);
35 if (r != MAIL_NO_ERROR) { 35 if (r != MAIL_NO_ERROR) {
36 qDebug("error initializing storage"); 36 odebug << "error initializing storage" << oendl;
37 mailstorage_free(m_storage); 37 mailstorage_free(m_storage);
38 m_storage = 0; 38 m_storage = 0;
39 return; 39 return;
40 } 40 }
41 } 41 }
42 r = mailstorage_connect(m_storage); 42 r = mailstorage_connect(m_storage);
43 if (r!=MAIL_NO_ERROR) { 43 if (r!=MAIL_NO_ERROR) {
44 qDebug("error connecting storage"); 44 odebug << "error connecting storage" << oendl;
45 mailstorage_free(m_storage); 45 mailstorage_free(m_storage);
46 m_storage = 0; 46 m_storage = 0;
47 } 47 }
48} 48}
49 49
50void MHwrapper::clean_storage() 50void MHwrapper::clean_storage()
51{ 51{
52 if (m_storage) { 52 if (m_storage) {
53 mailstorage_disconnect(m_storage); 53 mailstorage_disconnect(m_storage);
54 mailstorage_free(m_storage); 54 mailstorage_free(m_storage);
55 m_storage = 0; 55 m_storage = 0;
56 } 56 }
57} 57}
58 58
59MHwrapper::~MHwrapper() 59MHwrapper::~MHwrapper()
60{ 60{
61 clean_storage(); 61 clean_storage();
62} 62}
63 63
64void MHwrapper::listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target ) 64void MHwrapper::listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target )
65{ 65{
66 init_storage(); 66 init_storage();
67 if (!m_storage) { 67 if (!m_storage) {
68 return; 68 return;
69 } 69 }
70 QString f = buildPath(mailbox); 70 QString f = buildPath(mailbox);
71 int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); 71 int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1());
72 if (r!=MAIL_NO_ERROR) { 72 if (r!=MAIL_NO_ERROR) {
73 qDebug("listMessages: error selecting folder!"); 73 odebug << "listMessages: error selecting folder!" << oendl;
74 return; 74 return;
75 } 75 }
76 parseList(target,m_storage->sto_session,f); 76 parseList(target,m_storage->sto_session,f);
77 Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count())); 77 Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count()));
78} 78}
79 79
80QValueList<Opie::Core::OSmartPointer<Folder> >* MHwrapper::listFolders() 80QValueList<Opie::Core::OSmartPointer<Folder> >* MHwrapper::listFolders()
81{ 81{
82 QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<Opie::Core::OSmartPointer<Folder> >(); 82 QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<Opie::Core::OSmartPointer<Folder> >();
83 /* this is needed! */ 83 /* this is needed! */
84 if (m_storage) mailstorage_disconnect(m_storage); 84 if (m_storage) mailstorage_disconnect(m_storage);
85 init_storage(); 85 init_storage();
86 if (!m_storage) { 86 if (!m_storage) {
87 return folders; 87 return folders;
88 } 88 }
89 mail_list*flist = 0; 89 mail_list*flist = 0;
90 clistcell*current=0; 90 clistcell*current=0;
91 int r = mailsession_list_folders(m_storage->sto_session,NULL,&flist); 91 int r = mailsession_list_folders(m_storage->sto_session,NULL,&flist);
92 if (r != MAIL_NO_ERROR || !flist) { 92 if (r != MAIL_NO_ERROR || !flist) {
93 qDebug("error getting folder list"); 93 odebug << "error getting folder list" << oendl;
94 return folders; 94 return folders;
95 } 95 }
96 for (current=clist_begin(flist->mb_list);current!=0;current=clist_next(current)) { 96 for (current=clist_begin(flist->mb_list);current!=0;current=clist_next(current)) {
97 QString t = (char*)current->data; 97 QString t = (char*)current->data;
98 t.replace(0,MHPath.length(),""); 98 t.replace(0,MHPath.length(),"");
99 folders->append(new MHFolder(t,MHPath)); 99 folders->append(new MHFolder(t,MHPath));
100 } 100 }
101 mail_list_free(flist); 101 mail_list_free(flist);
102 return folders; 102 return folders;
103} 103}
104 104
105void MHwrapper::deleteMail(const RecMailP&mail) 105void MHwrapper::deleteMail(const RecMailP&mail)
106{ 106{
107 init_storage(); 107 init_storage();
108 if (!m_storage) { 108 if (!m_storage) {
109 return; 109 return;
110 } 110 }
111 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1()); 111 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1());
112 if (r!=MAIL_NO_ERROR) { 112 if (r!=MAIL_NO_ERROR) {
113 qDebug("error selecting folder!"); 113 odebug << "error selecting folder!" << oendl;
114 return; 114 return;
115 } 115 }
116 r = mailsession_remove_message(m_storage->sto_session,mail->getNumber()); 116 r = mailsession_remove_message(m_storage->sto_session,mail->getNumber());
117 if (r != MAIL_NO_ERROR) { 117 if (r != MAIL_NO_ERROR) {
118 qDebug("error deleting mail"); 118 odebug << "error deleting mail" << oendl;
119 } 119 }
120} 120}
121 121
122void MHwrapper::answeredMail(const RecMailP&) 122void MHwrapper::answeredMail(const RecMailP&)
123{ 123{
124} 124}
125 125
126RecBodyP MHwrapper::fetchBody( const RecMailP &mail ) 126RecBodyP MHwrapper::fetchBody( const RecMailP &mail )
127{ 127{
128 RecBodyP body = new RecBody(); 128 RecBodyP body = new RecBody();
129 init_storage(); 129 init_storage();
130 if (!m_storage) { 130 if (!m_storage) {
131 return body; 131 return body;
132 } 132 }
133 mailmessage * msg; 133 mailmessage * msg;
134 char*data=0; 134 char*data=0;
135 135
136 /* mail should hold the complete path! */ 136 /* mail should hold the complete path! */
137 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1()); 137 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1());
138 if (r != MAIL_NO_ERROR) { 138 if (r != MAIL_NO_ERROR) {
139 return body; 139 return body;
140 } 140 }
141 r = mailsession_get_message(m_storage->sto_session, mail->getNumber(), &msg); 141 r = mailsession_get_message(m_storage->sto_session, mail->getNumber(), &msg);
142 if (r != MAIL_NO_ERROR) { 142 if (r != MAIL_NO_ERROR) {
143 qDebug("Error fetching mail %i",mail->getNumber()); 143 odebug << "Error fetching mail " << mail->getNumber() << "" << oendl;
144 return body; 144 return body;
145 } 145 }
146 body = parseMail(msg); 146 body = parseMail(msg);
147 mailmessage_fetch_result_free(msg,data); 147 mailmessage_fetch_result_free(msg,data);
148 return body; 148 return body;
149} 149}
150 150
151void MHwrapper::mbox_progress( size_t current, size_t maximum ) 151void MHwrapper::mbox_progress( size_t current, size_t maximum )
152{ 152{
153 qDebug("MH %i von %i",current,maximum); 153 odebug << "MH " << current << " von " << maximum << "" << oendl;
154} 154}
155 155
156QString MHwrapper::buildPath(const QString&p) 156QString MHwrapper::buildPath(const QString&p)
157{ 157{
158 QString f=""; 158 QString f="";
159 if (p.length()==0||p=="/") 159 if (p.length()==0||p=="/")
160 return MHPath; 160 return MHPath;
161 if (!p.startsWith(MHPath)) { 161 if (!p.startsWith(MHPath)) {
162 f+=MHPath; 162 f+=MHPath;
163 } 163 }
164 if (!p.startsWith("/")) { 164 if (!p.startsWith("/")) {
165 f+="/"; 165 f+="/";
166 } 166 }
167 f+=p; 167 f+=p;
168 return f; 168 return f;
169} 169}
170 170
171int MHwrapper::createMbox(const QString&folder,const FolderP&pfolder,const QString&,bool ) 171int MHwrapper::createMbox(const QString&folder,const FolderP&pfolder,const QString&,bool )
172{ 172{
173 init_storage(); 173 init_storage();
174 if (!m_storage) { 174 if (!m_storage) {
175 return 0; 175 return 0;
176 } 176 }
177 QString f; 177 QString f;
178 if (!pfolder) { 178 if (!pfolder) {
179 // toplevel folder 179 // toplevel folder
180 f = buildPath(folder); 180 f = buildPath(folder);
181 } else { 181 } else {
182 f = pfolder->getName(); 182 f = pfolder->getName();
183 f+="/"; 183 f+="/";
184 f+=folder; 184 f+=folder;
185 } 185 }
186 qDebug(f); 186 odebug << f << oendl;
187 int r = mailsession_create_folder(m_storage->sto_session,(char*)f.latin1()); 187 int r = mailsession_create_folder(m_storage->sto_session,(char*)f.latin1());
188 if (r != MAIL_NO_ERROR) { 188 if (r != MAIL_NO_ERROR) {
189 qDebug("error creating folder %i",r); 189 odebug << "error creating folder " << r << "" << oendl;
190 return 0; 190 return 0;
191 } 191 }
192 qDebug("Folder created"); 192 odebug << "Folder created" << oendl;
193 return 1; 193 return 1;
194} 194}
195 195
196void MHwrapper::storeMessage(const char*msg,size_t length, const QString&Folder) 196void MHwrapper::storeMessage(const char*msg,size_t length, const QString&Folder)
197{ 197{
198 init_storage(); 198 init_storage();
199 if (!m_storage) { 199 if (!m_storage) {
200 return; 200 return;
201 } 201 }
202 QString f = buildPath(Folder); 202 QString f = buildPath(Folder);
203 int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); 203 int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1());
204 if (r!=MAIL_NO_ERROR) { 204 if (r!=MAIL_NO_ERROR) {
205 qDebug("error selecting folder!"); 205 odebug << "error selecting folder!" << oendl;
206 return; 206 return;
207 } 207 }
208 r = mailsession_append_message(m_storage->sto_session,(char*)msg,length); 208 r = mailsession_append_message(m_storage->sto_session,(char*)msg,length);
209 if (r!=MAIL_NO_ERROR) { 209 if (r!=MAIL_NO_ERROR) {
210 qDebug("error storing mail"); 210 odebug << "error storing mail" << oendl;
211 } 211 }
212 return; 212 return;
213} 213}
214 214
215encodedString* MHwrapper::fetchRawBody(const RecMailP&mail) 215encodedString* MHwrapper::fetchRawBody(const RecMailP&mail)
216{ 216{
217 encodedString*result = 0; 217 encodedString*result = 0;
218 init_storage(); 218 init_storage();
219 if (!m_storage) { 219 if (!m_storage) {
220 return result; 220 return result;
221 } 221 }
222 mailmessage * msg = 0; 222 mailmessage * msg = 0;
223 char*data=0; 223 char*data=0;
224 size_t size; 224 size_t size;
225 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1()); 225 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1());
226 if (r!=MAIL_NO_ERROR) { 226 if (r!=MAIL_NO_ERROR) {
227 qDebug("error selecting folder!"); 227 odebug << "error selecting folder!" << oendl;
228 return result; 228 return result;
229 } 229 }
230 r = mailsession_get_message(m_storage->sto_session, mail->getNumber(), &msg); 230 r = mailsession_get_message(m_storage->sto_session, mail->getNumber(), &msg);
231 if (r != MAIL_NO_ERROR) { 231 if (r != MAIL_NO_ERROR) {
232 Global::statusMessage(tr("Error fetching mail %i").arg(mail->getNumber())); 232 Global::statusMessage(tr("Error fetching mail %i").arg(mail->getNumber()));
233 return 0; 233 return 0;
234 } 234 }
235 r = mailmessage_fetch(msg,&data,&size); 235 r = mailmessage_fetch(msg,&data,&size);
236 if (r != MAIL_NO_ERROR) { 236 if (r != MAIL_NO_ERROR) {
237 Global::statusMessage(tr("Error fetching mail %i").arg(mail->getNumber())); 237 Global::statusMessage(tr("Error fetching mail %i").arg(mail->getNumber()));
238 if (msg) mailmessage_free(msg); 238 if (msg) mailmessage_free(msg);
239 return 0; 239 return 0;
240 } 240 }
241 result = new encodedString(data,size); 241 result = new encodedString(data,size);
242 if (msg) mailmessage_free(msg); 242 if (msg) mailmessage_free(msg);
243 return result; 243 return result;
244} 244}
245 245
246void MHwrapper::deleteMails(const QString & mailbox,const QValueList<RecMailP> &target) 246void MHwrapper::deleteMails(const QString & mailbox,const QValueList<RecMailP> &target)
247{ 247{
248 QString f = buildPath(mailbox); 248 QString f = buildPath(mailbox);
249 int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); 249 int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1());
250 if (r!=MAIL_NO_ERROR) { 250 if (r!=MAIL_NO_ERROR) {
251 qDebug("deleteMails: error selecting folder!"); 251 odebug << "deleteMails: error selecting folder!" << oendl;
252 return; 252 return;
253 } 253 }
254 QValueList<RecMailP>::ConstIterator it; 254 QValueList<RecMailP>::ConstIterator it;
255 for (it=target.begin(); it!=target.end();++it) { 255 for (it=target.begin(); it!=target.end();++it) {
256 r = mailsession_remove_message(m_storage->sto_session,(*it)->getNumber()); 256 r = mailsession_remove_message(m_storage->sto_session,(*it)->getNumber());
257 if (r != MAIL_NO_ERROR) { 257 if (r != MAIL_NO_ERROR) {
258 qDebug("error deleting mail"); 258 odebug << "error deleting mail" << oendl;
259 break; 259 break;
260 } 260 }
261 } 261 }
262} 262}
263 263
264int MHwrapper::deleteAllMail(const FolderP&tfolder) 264int MHwrapper::deleteAllMail(const FolderP&tfolder)
265{ 265{
266 init_storage(); 266 init_storage();
267 if (!m_storage) { 267 if (!m_storage) {
268 return 0; 268 return 0;
269 } 269 }
270 int res = 1; 270 int res = 1;
271 if (!tfolder) return 0; 271 if (!tfolder) return 0;
272 int r = mailsession_select_folder(m_storage->sto_session,(char*)tfolder->getName().latin1()); 272 int r = mailsession_select_folder(m_storage->sto_session,(char*)tfolder->getName().latin1());
273 if (r!=MAIL_NO_ERROR) { 273 if (r!=MAIL_NO_ERROR) {
274 qDebug("error selecting folder!"); 274 odebug << "error selecting folder!" << oendl;
275 return 0; 275 return 0;
276 } 276 }
277 mailmessage_list*l=0; 277 mailmessage_list*l=0;
278 r = mailsession_get_messages_list(m_storage->sto_session,&l); 278 r = mailsession_get_messages_list(m_storage->sto_session,&l);
279 if (r != MAIL_NO_ERROR) { 279 if (r != MAIL_NO_ERROR) {
280 qDebug("Error message list"); 280 odebug << "Error message list" << oendl;
281 res = 0; 281 res = 0;
282 } 282 }
283 unsigned j = 0; 283 unsigned j = 0;
284 for(unsigned int i = 0 ; l!= 0 && res==1 && i < carray_count(l->msg_tab) ; ++i) { 284 for(unsigned int i = 0 ; l!= 0 && res==1 && i < carray_count(l->msg_tab) ; ++i) {
285 mailmessage * msg; 285 mailmessage * msg;
286 msg = (mailmessage*)carray_get(l->msg_tab, i); 286 msg = (mailmessage*)carray_get(l->msg_tab, i);
287 j = msg->msg_index; 287 j = msg->msg_index;
288 r = mailsession_remove_message(m_storage->sto_session,j); 288 r = mailsession_remove_message(m_storage->sto_session,j);
289 if (r != MAIL_NO_ERROR) { 289 if (r != MAIL_NO_ERROR) {
290 Global::statusMessage(tr("Error deleting mail %1").arg(i+1)); 290 Global::statusMessage(tr("Error deleting mail %1").arg(i+1));
291 res = 0; 291 res = 0;
292 break; 292 break;
293 } 293 }
294 } 294 }
295 if (l) mailmessage_list_free(l); 295 if (l) mailmessage_list_free(l);
296 return res; 296 return res;
297} 297}
298 298
299int MHwrapper::deleteMbox(const FolderP&tfolder) 299int MHwrapper::deleteMbox(const FolderP&tfolder)
300{ 300{
301 init_storage(); 301 init_storage();
302 if (!m_storage) { 302 if (!m_storage) {
303 return 0; 303 return 0;
304 } 304 }
305 if (!tfolder) return 0; 305 if (!tfolder) return 0;
306 if (tfolder->getName()=="/" || tfolder->getName().isEmpty()) return 0; 306 if (tfolder->getName()=="/" || tfolder->getName().isEmpty()) return 0;
307 307
308 int r = mailsession_delete_folder(m_storage->sto_session,(char*)tfolder->getName().latin1()); 308 int r = mailsession_delete_folder(m_storage->sto_session,(char*)tfolder->getName().latin1());
309 309
310 if (r != MAIL_NO_ERROR) { 310 if (r != MAIL_NO_ERROR) {
311 qDebug("error deleting mail box"); 311 odebug << "error deleting mail box" << oendl;
312 return 0; 312 return 0;
313 } 313 }
314 QString cmd = "rm -rf "+tfolder->getName(); 314 QString cmd = "rm -rf "+tfolder->getName();
315 QStringList command; 315 QStringList command;
316 command << "/bin/sh"; 316 command << "/bin/sh";
317 command << "-c"; 317 command << "-c";
318 command << cmd.latin1(); 318 command << cmd.latin1();
319 OProcess *process = new OProcess(); 319 OProcess *process = new OProcess();
320 320
321 connect(process, SIGNAL(processExited(Opie::Core::OProcess*)), 321 connect(process, SIGNAL(processExited(Opie::Core::OProcess*)),
322 this, SLOT( processEnded(Opie::Core::OProcess*))); 322 this, SLOT( processEnded(Opie::Core::OProcess*)));
323 connect(process, SIGNAL( receivedStderr(Opie::Core::OProcess*,char*,int)), 323 connect(process, SIGNAL( receivedStderr(Opie::Core::OProcess*,char*,int)),
324 this, SLOT( oprocessStderr(Opie::Core::OProcess*,char*,int))); 324 this, SLOT( oprocessStderr(Opie::Core::OProcess*,char*,int)));
325 325
326 *process << command; 326 *process << command;
327 removeMboxfailed = false; 327 removeMboxfailed = false;
328 if(!process->start(OProcess::Block, OProcess::All) ) { 328 if(!process->start(OProcess::Block, OProcess::All) ) {
329 qDebug("could not start process"); 329 odebug << "could not start process" << oendl;
330 return 0; 330 return 0;
331 } 331 }
332 qDebug("mail box deleted"); 332 odebug << "mail box deleted" << oendl;
333 return 1; 333 return 1;
334} 334}
335 335
336void MHwrapper::processEnded(OProcess *p) 336void MHwrapper::processEnded(OProcess *p)
337{ 337{
338 if (p) delete p; 338 if (p) delete p;
339} 339}
340 340
341void MHwrapper::oprocessStderr(OProcess*, char *buffer, int ) 341void MHwrapper::oprocessStderr(OProcess*, char *buffer, int )
342{ 342{
343 QString lineStr = buffer; 343 QString lineStr = buffer;
344 QMessageBox::warning( 0, tr("Error"), lineStr ,tr("Ok") ); 344 QMessageBox::warning( 0, tr("Error"), lineStr ,tr("Ok") );
345 removeMboxfailed = true; 345 removeMboxfailed = true;
346} 346}
347 347
348void MHwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) 348void MHwrapper::statusFolder(folderStat&target_stat,const QString & mailbox)
349{ 349{
350 init_storage(); 350 init_storage();
351 if (!m_storage) { 351 if (!m_storage) {
352 return; 352 return;
353 } 353 }
354 target_stat.message_count = 0; 354 target_stat.message_count = 0;
355 target_stat.message_unseen = 0; 355 target_stat.message_unseen = 0;
356 target_stat.message_recent = 0; 356 target_stat.message_recent = 0;
357 QString f = buildPath(mailbox); 357 QString f = buildPath(mailbox);
358 int r = mailsession_status_folder(m_storage->sto_session,(char*)f.latin1(),&target_stat.message_count, 358 int r = mailsession_status_folder(m_storage->sto_session,(char*)f.latin1(),&target_stat.message_count,
359 &target_stat.message_recent,&target_stat.message_unseen); 359 &target_stat.message_recent,&target_stat.message_unseen);
360 if (r != MAIL_NO_ERROR) { 360 if (r != MAIL_NO_ERROR) {
361 Global::statusMessage(tr("Error retrieving status")); 361 Global::statusMessage(tr("Error retrieving status"));
362 } 362 }
363} 363}
364 364
365MAILLIB::ATYPE MHwrapper::getType()const 365MAILLIB::ATYPE MHwrapper::getType()const
366{ 366{
367 return MAILLIB::A_MH; 367 return MAILLIB::A_MH;
368} 368}
369 369
370const QString&MHwrapper::getName()const 370const QString&MHwrapper::getName()const
371{ 371{
372 return MHName; 372 return MHName;
373} 373}
374void MHwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) 374void MHwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
375{ 375{
376 init_storage(); 376 init_storage();
377 if (!m_storage) { 377 if (!m_storage) {
378 return; 378 return;
379 } 379 }
380 if (targetWrapper != this) { 380 if (targetWrapper != this) {
381 qDebug("Using generic"); 381 odebug << "Using generic" << oendl;
382 Genericwrapper::mvcpMail(mail,targetFolder,targetWrapper,moveit); 382 Genericwrapper::mvcpMail(mail,targetFolder,targetWrapper,moveit);
383 return; 383 return;
384 } 384 }
385 qDebug("Using internal routines for move/copy"); 385 odebug << "Using internal routines for move/copy" << oendl;
386 QString tf = buildPath(targetFolder); 386 QString tf = buildPath(targetFolder);
387 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1()); 387 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1());
388 if (r != MAIL_NO_ERROR) { 388 if (r != MAIL_NO_ERROR) {
389 qDebug("Error selecting source mailbox"); 389 odebug << "Error selecting source mailbox" << oendl;
390 return; 390 return;
391 } 391 }
392 if (moveit) { 392 if (moveit) {
393 r = mailsession_move_message(m_storage->sto_session,mail->getNumber(),(char*)tf.latin1()); 393 r = mailsession_move_message(m_storage->sto_session,mail->getNumber(),(char*)tf.latin1());
394 } else { 394 } else {
395 r = mailsession_copy_message(m_storage->sto_session,mail->getNumber(),(char*)tf.latin1()); 395 r = mailsession_copy_message(m_storage->sto_session,mail->getNumber(),(char*)tf.latin1());
396 } 396 }
397 if (r != MAIL_NO_ERROR) { 397 if (r != MAIL_NO_ERROR) {
398 qDebug("Error copy/moving mail internal (%i)",r); 398 odebug << "Error copy/moving mail internal (" << r << ")" << oendl;
399 } 399 }
400} 400}
401 401
402void MHwrapper::mvcpAllMails(const FolderP&fromFolder, 402void MHwrapper::mvcpAllMails(const FolderP&fromFolder,
403 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) 403 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
404{ 404{
405 init_storage(); 405 init_storage();
406 if (!m_storage) { 406 if (!m_storage) {
407 return; 407 return;
408 } 408 }
409 if (targetWrapper != this) { 409 if (targetWrapper != this) {
410 qDebug("Using generic"); 410 odebug << "Using generic" << oendl;
411 Genericwrapper::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit); 411 Genericwrapper::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit);
412 return; 412 return;
413 } 413 }
414 if (!fromFolder) return; 414 if (!fromFolder) return;
415 int r = mailsession_select_folder(m_storage->sto_session,(char*)fromFolder->getName().latin1()); 415 int r = mailsession_select_folder(m_storage->sto_session,(char*)fromFolder->getName().latin1());
416 if (r!=MAIL_NO_ERROR) { 416 if (r!=MAIL_NO_ERROR) {
417 qDebug("error selecting source folder!"); 417 odebug << "error selecting source folder!" << oendl;
418 return; 418 return;
419 } 419 }
420 QString tf = buildPath(targetFolder); 420 QString tf = buildPath(targetFolder);
421 mailmessage_list*l=0; 421 mailmessage_list*l=0;
422 r = mailsession_get_messages_list(m_storage->sto_session,&l); 422 r = mailsession_get_messages_list(m_storage->sto_session,&l);
423 if (r != MAIL_NO_ERROR) { 423 if (r != MAIL_NO_ERROR) {
424 qDebug("Error message list"); 424 odebug << "Error message list" << oendl;
425 } 425 }
426 unsigned j = 0; 426 unsigned j = 0;
427 for(unsigned int i = 0 ; l!= 0 && i < carray_count(l->msg_tab) ; ++i) { 427 for(unsigned int i = 0 ; l!= 0 && i < carray_count(l->msg_tab) ; ++i) {
428 mailmessage * msg; 428 mailmessage * msg;
429 msg = (mailmessage*)carray_get(l->msg_tab, i); 429 msg = (mailmessage*)carray_get(l->msg_tab, i);
430 j = msg->msg_index; 430 j = msg->msg_index;
431 if (moveit) { 431 if (moveit) {
432 r = mailsession_move_message(m_storage->sto_session,j,(char*)tf.latin1()); 432 r = mailsession_move_message(m_storage->sto_session,j,(char*)tf.latin1());
433 } else { 433 } else {
434 r = mailsession_copy_message(m_storage->sto_session,j,(char*)tf.latin1()); 434 r = mailsession_copy_message(m_storage->sto_session,j,(char*)tf.latin1());
435 } 435 }
436 if (r != MAIL_NO_ERROR) { 436 if (r != MAIL_NO_ERROR) {
437 qDebug("Error copy/moving mail internal (%i)",r); 437 odebug << "Error copy/moving mail internal (" << r << ")" << oendl;
438 break; 438 break;
439 } 439 }
440 } 440 }
441 if (l) mailmessage_list_free(l); 441 if (l) mailmessage_list_free(l);
442} 442}
diff --git a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp
index cfded43..5d5011a 100644
--- a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp
@@ -8,66 +8,66 @@
8 8
9#include <libetpan/libetpan.h> 9#include <libetpan/libetpan.h>
10 10
11 11
12#define HARD_MSG_SIZE_LIMIT 5242880 12#define HARD_MSG_SIZE_LIMIT 5242880
13 13
14using namespace Opie::Core; 14using namespace Opie::Core;
15NNTPwrapper::NNTPwrapper( NNTPaccount *a ) 15NNTPwrapper::NNTPwrapper( NNTPaccount *a )
16: Genericwrapper() { 16: Genericwrapper() {
17 account = a; 17 account = a;
18 m_nntp = NULL; 18 m_nntp = NULL;
19 msgTempName = a->getFileName()+"_msg_cache"; 19 msgTempName = a->getFileName()+"_msg_cache";
20 last_msg_id = 0; 20 last_msg_id = 0;
21} 21}
22 22
23NNTPwrapper::~NNTPwrapper() { 23NNTPwrapper::~NNTPwrapper() {
24 logout(); 24 logout();
25 QFile msg_cache(msgTempName); 25 QFile msg_cache(msgTempName);
26 if (msg_cache.exists()) { 26 if (msg_cache.exists()) {
27 msg_cache.remove(); 27 msg_cache.remove();
28 } 28 }
29} 29}
30 30
31void NNTPwrapper::nntp_progress( size_t current, size_t maximum ) { 31void NNTPwrapper::nntp_progress( size_t current, size_t maximum ) {
32 qDebug( "NNTP: %i of %i", current, maximum ); 32 odebug << "NNTP: " << current << " of " << maximum << "" << oendl;
33} 33}
34 34
35 35
36RecBodyP NNTPwrapper::fetchBody( const RecMailP &mail ) { 36RecBodyP NNTPwrapper::fetchBody( const RecMailP &mail ) {
37 int err = NEWSNNTP_NO_ERROR; 37 int err = NEWSNNTP_NO_ERROR;
38 char *message = 0; 38 char *message = 0;
39 size_t length = 0; 39 size_t length = 0;
40 40
41 RecBodyP body = new RecBody(); 41 RecBodyP body = new RecBody();
42 login(); 42 login();
43 if ( !m_nntp ) { 43 if ( !m_nntp ) {
44 return body; 44 return body;
45 } 45 }
46 46
47 mailmessage * mailmsg; 47 mailmessage * mailmsg;
48 if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) { 48 if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) {
49 qDebug("Message to large: %i",mail->Msgsize()); 49 odebug << "Message to large: " << mail->Msgsize() << "" << oendl;
50 return body; 50 return body;
51 } 51 }
52 52
53 QFile msg_cache(msgTempName); 53 QFile msg_cache(msgTempName);
54 54
55 cleanMimeCache(); 55 cleanMimeCache();
56 56
57 if (mail->getNumber()!=last_msg_id) { 57 if (mail->getNumber()!=last_msg_id) {
58 if (msg_cache.exists()) { 58 if (msg_cache.exists()) {
59 msg_cache.remove(); 59 msg_cache.remove();
60 } 60 }
61 msg_cache.open(IO_ReadWrite|IO_Truncate); 61 msg_cache.open(IO_ReadWrite|IO_Truncate);
62 last_msg_id = mail->getNumber(); 62 last_msg_id = mail->getNumber();
63 err = mailsession_get_message(m_nntp->sto_session, mail->getNumber(), &mailmsg); 63 err = mailsession_get_message(m_nntp->sto_session, mail->getNumber(), &mailmsg);
64 err = mailmessage_fetch(mailmsg,&message,&length); 64 err = mailmessage_fetch(mailmsg,&message,&length);
65 msg_cache.writeBlock(message,length); 65 msg_cache.writeBlock(message,length);
66 } else { 66 } else {
67 QString msg=""; 67 QString msg="";
68 msg_cache.open(IO_ReadOnly); 68 msg_cache.open(IO_ReadOnly);
69 message = new char[4096]; 69 message = new char[4096];
70 memset(message,0,4096); 70 memset(message,0,4096);
71 while (msg_cache.readBlock(message,4095)>0) { 71 while (msg_cache.readBlock(message,4095)>0) {
72 msg+=message; 72 msg+=message;
73 memset(message,0,4096); 73 memset(message,0,4096);
@@ -113,86 +113,86 @@ void NNTPwrapper::login()
113 return; 113 return;
114 /* we'll hold the line */ 114 /* we'll hold the line */
115 if ( m_nntp != NULL ) 115 if ( m_nntp != NULL )
116 return; 116 return;
117 117
118 const char *server, *user, *pass; 118 const char *server, *user, *pass;
119 QString User,Pass; 119 QString User,Pass;
120 uint16_t port; 120 uint16_t port;
121 int err = NEWSNNTP_NO_ERROR; 121 int err = NEWSNNTP_NO_ERROR;
122 122
123 server = account->getServer().latin1(); 123 server = account->getServer().latin1();
124 port = account->getPort().toUInt(); 124 port = account->getPort().toUInt();
125 125
126 user = pass = 0; 126 user = pass = 0;
127 127
128 if ( ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) && account->getLogin() ) { 128 if ( ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) && account->getLogin() ) {
129 LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); 129 LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true );
130 login.show(); 130 login.show();
131 if ( QDialog::Accepted == login.exec() ) { 131 if ( QDialog::Accepted == login.exec() ) {
132 // ok 132 // ok
133 User = login.getUser().latin1(); 133 User = login.getUser().latin1();
134 Pass = login.getPassword().latin1(); 134 Pass = login.getPassword().latin1();
135 } else { 135 } else {
136 // cancel 136 // cancel
137 qDebug( "NNTP: Login canceled" ); 137 odebug << "NNTP: Login canceled" << oendl;
138 return; 138 return;
139 } 139 }
140 } else { 140 } else {
141 User = account->getUser().latin1(); 141 User = account->getUser().latin1();
142 Pass = account->getPassword().latin1(); 142 Pass = account->getPassword().latin1();
143 } 143 }
144 144
145 if (User.isEmpty()) { 145 if (User.isEmpty()) {
146 user=0; 146 user=0;
147 pass = 0; 147 pass = 0;
148 } else { 148 } else {
149 user=User.latin1(); 149 user=User.latin1();
150 pass=Pass.latin1(); 150 pass=Pass.latin1();
151 } 151 }
152 // bool ssl = account->getSSL(); 152 // bool ssl = account->getSSL();
153 153
154 m_nntp=mailstorage_new(NULL); 154 m_nntp=mailstorage_new(NULL);
155 155
156 int conntypeset = account->ConnectionType(); 156 int conntypeset = account->ConnectionType();
157 int conntype = 0; 157 int conntype = 0;
158 if ( conntypeset == 3 ) { 158 if ( conntypeset == 3 ) {
159 conntype = CONNECTION_TYPE_COMMAND; 159 conntype = CONNECTION_TYPE_COMMAND;
160 } else if ( conntypeset == 2 ) { 160 } else if ( conntypeset == 2 ) {
161 conntype = CONNECTION_TYPE_TLS; 161 conntype = CONNECTION_TYPE_TLS;
162 } else if ( conntypeset == 1 ) { 162 } else if ( conntypeset == 1 ) {
163 conntype = CONNECTION_TYPE_STARTTLS; 163 conntype = CONNECTION_TYPE_STARTTLS;
164 } else if ( conntypeset == 0 ) { 164 } else if ( conntypeset == 0 ) {
165 conntype = CONNECTION_TYPE_TRY_STARTTLS; 165 conntype = CONNECTION_TYPE_TRY_STARTTLS;
166 } 166 }
167 167
168 nntp_mailstorage_init(m_nntp,(char*)server, port, NULL, CONNECTION_TYPE_PLAIN, NNTP_AUTH_TYPE_PLAIN, 168 nntp_mailstorage_init(m_nntp,(char*)server, port, NULL, CONNECTION_TYPE_PLAIN, NNTP_AUTH_TYPE_PLAIN,
169 (char*)user,(char*)pass,0,0,0); 169 (char*)user,(char*)pass,0,0,0);
170 170
171 err = mailstorage_connect( m_nntp ); 171 err = mailstorage_connect( m_nntp );
172 172
173 if (err != NEWSNNTP_NO_ERROR) { 173 if (err != NEWSNNTP_NO_ERROR) {
174 qDebug( QString( "FEHLERNUMMER %1" ).arg( err ) ); 174 odebug << QString( "FEHLERNUMMER %1" ).arg( err ) << oendl;
175 // Global::statusMessage(tr("Error initializing folder")); 175 // Global::statusMessage(tr("Error initializing folder"));
176 mailstorage_free(m_nntp); 176 mailstorage_free(m_nntp);
177 m_nntp = 0; 177 m_nntp = 0;
178 178
179 } else { 179 } else {
180 mailsession * session = m_nntp->sto_session; 180 mailsession * session = m_nntp->sto_session;
181 newsnntp * news = ( ( nntp_session_state_data * )session->sess_data )->nntp_session; 181 newsnntp * news = ( ( nntp_session_state_data * )session->sess_data )->nntp_session;
182 news->nntp_progr_fun = &nntp_progress; 182 news->nntp_progr_fun = &nntp_progress;
183 } 183 }
184 184
185} 185}
186 186
187void NNTPwrapper::logout() 187void NNTPwrapper::logout()
188{ 188{
189 int err = NEWSNNTP_NO_ERROR; 189 int err = NEWSNNTP_NO_ERROR;
190 if ( m_nntp == NULL ) 190 if ( m_nntp == NULL )
191 return; 191 return;
192 mailstorage_free(m_nntp); 192 mailstorage_free(m_nntp);
193 m_nntp = 0; 193 m_nntp = 0;
194} 194}
195 195
196QValueList<Opie::Core::OSmartPointer<Folder> >* NNTPwrapper::listFolders() { 196QValueList<Opie::Core::OSmartPointer<Folder> >* NNTPwrapper::listFolders() {
197 197
198 QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<Opie::Core::OSmartPointer<Folder> >(); 198 QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<Opie::Core::OSmartPointer<Folder> >();
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
index 5467547..c586c29 100644
--- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
@@ -7,66 +7,66 @@
7#include <qfile.h> 7#include <qfile.h>
8//#include <qstring.h> 8//#include <qstring.h>
9 9
10/* we don't fetch messages larger than 5 MB */ 10/* we don't fetch messages larger than 5 MB */
11#define HARD_MSG_SIZE_LIMIT 5242880 11#define HARD_MSG_SIZE_LIMIT 5242880
12 12
13using namespace Opie::Core; 13using namespace Opie::Core;
14POP3wrapper::POP3wrapper( POP3account *a ) 14POP3wrapper::POP3wrapper( POP3account *a )
15: Genericwrapper() { 15: Genericwrapper() {
16 account = a; 16 account = a;
17 m_pop3 = NULL; 17 m_pop3 = NULL;
18 msgTempName = a->getFileName()+"_msg_cache"; 18 msgTempName = a->getFileName()+"_msg_cache";
19 last_msg_id = 0; 19 last_msg_id = 0;
20} 20}
21 21
22POP3wrapper::~POP3wrapper() { 22POP3wrapper::~POP3wrapper() {
23 logout(); 23 logout();
24 QFile msg_cache(msgTempName); 24 QFile msg_cache(msgTempName);
25 if (msg_cache.exists()) { 25 if (msg_cache.exists()) {
26 msg_cache.remove(); 26 msg_cache.remove();
27 } 27 }
28} 28}
29 29
30void POP3wrapper::pop3_progress( size_t current, size_t maximum ) { 30void POP3wrapper::pop3_progress( size_t current, size_t maximum ) {
31 qDebug( "POP3: %i of %i", current, maximum ); 31 odebug << "POP3: " << current << " of " << maximum << "" << oendl;
32} 32}
33 33
34RecBodyP POP3wrapper::fetchBody( const RecMailP &mail ) { 34RecBodyP POP3wrapper::fetchBody( const RecMailP &mail ) {
35 int err = MAILPOP3_NO_ERROR; 35 int err = MAILPOP3_NO_ERROR;
36 char *message = 0; 36 char *message = 0;
37 size_t length = 0; 37 size_t length = 0;
38 38
39 RecBodyP body = new RecBody(); 39 RecBodyP body = new RecBody();
40 40
41 login(); 41 login();
42 if ( !m_pop3 ) { 42 if ( !m_pop3 ) {
43 return body; 43 return body;
44 } 44 }
45 45
46 mailmessage * mailmsg; 46 mailmessage * mailmsg;
47 if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) { 47 if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) {
48 qDebug("Message to large: %i",mail->Msgsize()); 48 odebug << "Message to large: " << mail->Msgsize() << "" << oendl;
49 return body; 49 return body;
50 } 50 }
51 51
52 QFile msg_cache(msgTempName); 52 QFile msg_cache(msgTempName);
53 53
54 cleanMimeCache(); 54 cleanMimeCache();
55 55
56 if (mail->getNumber()!=last_msg_id) { 56 if (mail->getNumber()!=last_msg_id) {
57 if (msg_cache.exists()) { 57 if (msg_cache.exists()) {
58 msg_cache.remove(); 58 msg_cache.remove();
59 } 59 }
60 msg_cache.open(IO_ReadWrite|IO_Truncate); 60 msg_cache.open(IO_ReadWrite|IO_Truncate);
61 last_msg_id = mail->getNumber(); 61 last_msg_id = mail->getNumber();
62 err = mailsession_get_message(m_pop3->sto_session, mail->getNumber(), &mailmsg); 62 err = mailsession_get_message(m_pop3->sto_session, mail->getNumber(), &mailmsg);
63 err = mailmessage_fetch(mailmsg,&message,&length); 63 err = mailmessage_fetch(mailmsg,&message,&length);
64 msg_cache.writeBlock(message,length); 64 msg_cache.writeBlock(message,length);
65 } else { 65 } else {
66 QString msg=""; 66 QString msg="";
67 msg_cache.open(IO_ReadOnly); 67 msg_cache.open(IO_ReadOnly);
68 message = new char[4096]; 68 message = new char[4096];
69 memset(message,0,4096); 69 memset(message,0,4096);
70 while (msg_cache.readBlock(message,4095)>0) { 70 while (msg_cache.readBlock(message,4095)>0) {
71 msg+=message; 71 msg+=message;
72 memset(message,0,4096); 72 memset(message,0,4096);
@@ -109,81 +109,81 @@ void POP3wrapper::listMessages(const QString &, QValueList<Opie::Core::OSmartPoi
109void POP3wrapper::login() 109void POP3wrapper::login()
110{ 110{
111 if (account->getOffline()) 111 if (account->getOffline())
112 return; 112 return;
113 /* we'll hold the line */ 113 /* we'll hold the line */
114 if ( m_pop3 != NULL ) 114 if ( m_pop3 != NULL )
115 return; 115 return;
116 116
117 const char *server, *user, *pass; 117 const char *server, *user, *pass;
118 uint16_t port; 118 uint16_t port;
119 int err = MAILPOP3_NO_ERROR; 119 int err = MAILPOP3_NO_ERROR;
120 120
121 server = account->getServer().latin1(); 121 server = account->getServer().latin1();
122 port = account->getPort().toUInt(); 122 port = account->getPort().toUInt();
123 123
124 if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { 124 if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) {
125 LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); 125 LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true );
126 login.show(); 126 login.show();
127 if ( QDialog::Accepted == login.exec() ) { 127 if ( QDialog::Accepted == login.exec() ) {
128 // ok 128 // ok
129 user = login.getUser().latin1(); 129 user = login.getUser().latin1();
130 pass = login.getPassword().latin1(); 130 pass = login.getPassword().latin1();
131 } else { 131 } else {
132 // cancel 132 // cancel
133 qDebug( "POP3: Login canceled" ); 133 odebug << "POP3: Login canceled" << oendl;
134 return; 134 return;
135 } 135 }
136 } else { 136 } else {
137 user = account->getUser().latin1(); 137 user = account->getUser().latin1();
138 pass = account->getPassword().latin1(); 138 pass = account->getPassword().latin1();
139 } 139 }
140 140
141 // bool ssl = account->getSSL(); 141 // bool ssl = account->getSSL();
142 142
143 m_pop3=mailstorage_new(NULL); 143 m_pop3=mailstorage_new(NULL);
144 144
145 int conntypeset = account->ConnectionType(); 145 int conntypeset = account->ConnectionType();
146 int conntype = 0; 146 int conntype = 0;
147 if ( conntypeset == 3 ) { 147 if ( conntypeset == 3 ) {
148 conntype = CONNECTION_TYPE_COMMAND; 148 conntype = CONNECTION_TYPE_COMMAND;
149 } else if ( conntypeset == 2 ) { 149 } else if ( conntypeset == 2 ) {
150 conntype = CONNECTION_TYPE_TLS; 150 conntype = CONNECTION_TYPE_TLS;
151 } else if ( conntypeset == 1 ) { 151 } else if ( conntypeset == 1 ) {
152 conntype = CONNECTION_TYPE_STARTTLS; 152 conntype = CONNECTION_TYPE_STARTTLS;
153 } else if ( conntypeset == 0 ) { 153 } else if ( conntypeset == 0 ) {
154 conntype = CONNECTION_TYPE_TRY_STARTTLS; 154 conntype = CONNECTION_TYPE_TRY_STARTTLS;
155 } 155 }
156 156
157 //(ssl?CONNECTION_TYPE_TLS:CONNECTION_TYPE_PLAIN); 157 //(ssl?CONNECTION_TYPE_TLS:CONNECTION_TYPE_PLAIN);
158 158
159 pop3_mailstorage_init(m_pop3,(char*)server, port, NULL, conntype, POP3_AUTH_TYPE_PLAIN, 159 pop3_mailstorage_init(m_pop3,(char*)server, port, NULL, conntype, POP3_AUTH_TYPE_PLAIN,
160 (char*)user,(char*)pass,0,0,0); 160 (char*)user,(char*)pass,0,0,0);
161 161
162 162
163 err = mailstorage_connect(m_pop3); 163 err = mailstorage_connect(m_pop3);
164 if (err != MAIL_NO_ERROR) { 164 if (err != MAIL_NO_ERROR) {
165 qDebug( QString( "FEHLERNUMMER %1" ).arg( err ) ); 165 odebug << QString( "FEHLERNUMMER %1" ).arg( err ) << oendl;
166 Global::statusMessage(tr("Error initializing folder")); 166 Global::statusMessage(tr("Error initializing folder"));
167 mailstorage_free(m_pop3); 167 mailstorage_free(m_pop3);
168 m_pop3 = 0; 168 m_pop3 = 0;
169 } else { 169 } else {
170 mailsession * session = m_pop3->sto_session; 170 mailsession * session = m_pop3->sto_session;
171 mailpop3 * mail = ( ( pop3_session_state_data * )session->sess_data )->pop3_session; 171 mailpop3 * mail = ( ( pop3_session_state_data * )session->sess_data )->pop3_session;
172 if (mail) { 172 if (mail) {
173 mail->pop3_progr_fun = &pop3_progress; 173 mail->pop3_progr_fun = &pop3_progress;
174 } 174 }
175 } 175 }
176} 176}
177 177
178void POP3wrapper::logout() 178void POP3wrapper::logout()
179{ 179{
180 if ( m_pop3 == NULL ) 180 if ( m_pop3 == NULL )
181 return; 181 return;
182 mailstorage_free(m_pop3); 182 mailstorage_free(m_pop3);
183 m_pop3 = 0; 183 m_pop3 = 0;
184} 184}
185 185
186 186
187QValueList<Opie::Core::OSmartPointer<Folder> >* POP3wrapper::listFolders() { 187QValueList<Opie::Core::OSmartPointer<Folder> >* POP3wrapper::listFolders() {
188 QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<FolderP>(); 188 QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<FolderP>();
189 FolderP inb=new Folder("INBOX","/"); 189 FolderP inb=new Folder("INBOX","/");
@@ -215,49 +215,49 @@ int POP3wrapper::deleteAllMail(const FolderP&) {
215 Global::statusMessage(tr("Error getting folder info")); 215 Global::statusMessage(tr("Error getting folder info"));
216 return 0; 216 return 0;
217 } 217 }
218 for (unsigned int i = 0; i < result; ++i) { 218 for (unsigned int i = 0; i < result; ++i) {
219 err = mailsession_remove_message(m_pop3->sto_session,i+1); 219 err = mailsession_remove_message(m_pop3->sto_session,i+1);
220 if (err != MAIL_NO_ERROR) { 220 if (err != MAIL_NO_ERROR) {
221 Global::statusMessage(tr("Error deleting mail %1").arg(i+1)); 221 Global::statusMessage(tr("Error deleting mail %1").arg(i+1));
222 res=0; 222 res=0;
223 } 223 }
224 break; 224 break;
225 } 225 }
226 return res; 226 return res;
227} 227}
228 228
229void POP3wrapper::statusFolder(folderStat&target_stat,const QString&) { 229void POP3wrapper::statusFolder(folderStat&target_stat,const QString&) {
230 login(); 230 login();
231 target_stat.message_count = 0; 231 target_stat.message_count = 0;
232 target_stat.message_unseen = 0; 232 target_stat.message_unseen = 0;
233 target_stat.message_recent = 0; 233 target_stat.message_recent = 0;
234 if (!m_pop3) 234 if (!m_pop3)
235 return; 235 return;
236 int r = mailsession_status_folder(m_pop3->sto_session,0,&target_stat.message_count, 236 int r = mailsession_status_folder(m_pop3->sto_session,0,&target_stat.message_count,
237 &target_stat.message_recent,&target_stat.message_unseen); 237 &target_stat.message_recent,&target_stat.message_unseen);
238 if (r != MAIL_NO_ERROR) { 238 if (r != MAIL_NO_ERROR) {
239 qDebug("error getting folter status."); 239 odebug << "error getting folter status." << oendl;
240 } 240 }
241} 241}
242 242
243encodedString* POP3wrapper::fetchRawBody(const RecMailP&mail) { 243encodedString* POP3wrapper::fetchRawBody(const RecMailP&mail) {
244 char*target=0; 244 char*target=0;
245 size_t length=0; 245 size_t length=0;
246 encodedString*res = 0; 246 encodedString*res = 0;
247 mailmessage * mailmsg = 0; 247 mailmessage * mailmsg = 0;
248 int err = mailsession_get_message(m_pop3->sto_session, mail->getNumber(), &mailmsg); 248 int err = mailsession_get_message(m_pop3->sto_session, mail->getNumber(), &mailmsg);
249 err = mailmessage_fetch(mailmsg,&target,&length); 249 err = mailmessage_fetch(mailmsg,&target,&length);
250 if (mailmsg) 250 if (mailmsg)
251 mailmessage_free(mailmsg); 251 mailmessage_free(mailmsg);
252 if (target) { 252 if (target) {
253 res = new encodedString(target,length); 253 res = new encodedString(target,length);
254 } 254 }
255 return res; 255 return res;
256} 256}
257 257
258MAILLIB::ATYPE POP3wrapper::getType()const { 258MAILLIB::ATYPE POP3wrapper::getType()const {
259 return account->getType(); 259 return account->getType();
260} 260}
261 261
262const QString&POP3wrapper::getName()const{ 262const QString&POP3wrapper::getName()const{
263 return account->getAccountName(); 263 return account->getAccountName();
diff --git a/noncore/net/mail/libmailwrapper/settings.cpp b/noncore/net/mail/libmailwrapper/settings.cpp
index 2c81963..de36eeb 100644
--- a/noncore/net/mail/libmailwrapper/settings.cpp
+++ b/noncore/net/mail/libmailwrapper/settings.cpp
@@ -5,98 +5,98 @@
5 5
6#include "settings.h" 6#include "settings.h"
7//#include "defines.h" 7//#include "defines.h"
8 8
9#define IMAP_PORT "143" 9#define IMAP_PORT "143"
10#define IMAP_SSL_PORT "993" 10#define IMAP_SSL_PORT "993"
11#define SMTP_PORT "25" 11#define SMTP_PORT "25"
12#define SMTP_SSL_PORT "465" 12#define SMTP_SSL_PORT "465"
13#define POP3_PORT "110" 13#define POP3_PORT "110"
14#define POP3_SSL_PORT "995" 14#define POP3_SSL_PORT "995"
15#define NNTP_PORT "119" 15#define NNTP_PORT "119"
16#define NNTP_SSL_PORT "563" 16#define NNTP_SSL_PORT "563"
17 17
18 18
19Settings::Settings() 19Settings::Settings()
20 : QObject() 20 : QObject()
21{ 21{
22 updateAccounts(); 22 updateAccounts();
23} 23}
24 24
25void Settings::checkDirectory() 25void Settings::checkDirectory()
26{ 26{
27 if ( !QDir( (QString) getenv( "HOME" ) + "/Applications/opiemail/" ).exists() ) { 27 if ( !QDir( (QString) getenv( "HOME" ) + "/Applications/opiemail/" ).exists() ) {
28 system( "mkdir -p $HOME/Applications/opiemail" ); 28 system( "mkdir -p $HOME/Applications/opiemail" );
29 qDebug( "$HOME/Applications/opiemail created" ); 29 odebug << "$HOME/Applications/opiemail created" << oendl;
30 } 30 }
31} 31}
32 32
33QList<Account> Settings::getAccounts() 33QList<Account> Settings::getAccounts()
34{ 34{
35 return accounts; 35 return accounts;
36} 36}
37 37
38void Settings::addAccount( Account *account ) 38void Settings::addAccount( Account *account )
39{ 39{
40 accounts.append( account ); 40 accounts.append( account );
41} 41}
42 42
43void Settings::delAccount( Account *account ) 43void Settings::delAccount( Account *account )
44{ 44{
45 accounts.remove( account ); 45 accounts.remove( account );
46 account->remove(); 46 account->remove();
47} 47}
48 48
49void Settings::updateAccounts() 49void Settings::updateAccounts()
50{ 50{
51 accounts.clear(); 51 accounts.clear();
52 QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); 52 QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" );
53 QStringList::Iterator it; 53 QStringList::Iterator it;
54 54
55 QStringList imap = dir.entryList( "imap-*" ); 55 QStringList imap = dir.entryList( "imap-*" );
56 for ( it = imap.begin(); it != imap.end(); it++ ) { 56 for ( it = imap.begin(); it != imap.end(); it++ ) {
57 qDebug( "Added IMAP account" ); 57 odebug << "Added IMAP account" << oendl;
58 IMAPaccount *account = new IMAPaccount( (*it).replace(0, 5, "") ); 58 IMAPaccount *account = new IMAPaccount( (*it).replace(0, 5, "") );
59 accounts.append( account ); 59 accounts.append( account );
60 } 60 }
61 61
62 QStringList pop3 = dir.entryList( "pop3-*" ); 62 QStringList pop3 = dir.entryList( "pop3-*" );
63 for ( it = pop3.begin(); it != pop3.end(); it++ ) { 63 for ( it = pop3.begin(); it != pop3.end(); it++ ) {
64 qDebug( "Added POP account" ); 64 odebug << "Added POP account" << oendl;
65 POP3account *account = new POP3account( (*it).replace(0, 5, "") ); 65 POP3account *account = new POP3account( (*it).replace(0, 5, "") );
66 accounts.append( account ); 66 accounts.append( account );
67 } 67 }
68 68
69 QStringList smtp = dir.entryList( "smtp-*" ); 69 QStringList smtp = dir.entryList( "smtp-*" );
70 for ( it = smtp.begin(); it != smtp.end(); it++ ) { 70 for ( it = smtp.begin(); it != smtp.end(); it++ ) {
71 qDebug( "Added SMTP account" ); 71 odebug << "Added SMTP account" << oendl;
72 SMTPaccount *account = new SMTPaccount( (*it).replace(0, 5, "") ); 72 SMTPaccount *account = new SMTPaccount( (*it).replace(0, 5, "") );
73 accounts.append( account ); 73 accounts.append( account );
74 } 74 }
75 75
76 QStringList nntp = dir.entryList( "nntp-*" ); 76 QStringList nntp = dir.entryList( "nntp-*" );
77 for ( it = nntp.begin(); it != nntp.end(); it++ ) { 77 for ( it = nntp.begin(); it != nntp.end(); it++ ) {
78 qDebug( "Added NNTP account" ); 78 odebug << "Added NNTP account" << oendl;
79 NNTPaccount *account = new NNTPaccount( (*it).replace(0, 5, "") ); 79 NNTPaccount *account = new NNTPaccount( (*it).replace(0, 5, "") );
80 accounts.append( account ); 80 accounts.append( account );
81 } 81 }
82 82
83 readAccounts(); 83 readAccounts();
84} 84}
85 85
86void Settings::saveAccounts() 86void Settings::saveAccounts()
87{ 87{
88 checkDirectory(); 88 checkDirectory();
89 Account *it; 89 Account *it;
90 90
91 for ( it = accounts.first(); it; it = accounts.next() ) { 91 for ( it = accounts.first(); it; it = accounts.next() ) {
92 it->save(); 92 it->save();
93 } 93 }
94} 94}
95 95
96void Settings::readAccounts() 96void Settings::readAccounts()
97{ 97{
98 checkDirectory(); 98 checkDirectory();
99 Account *it; 99 Account *it;
100 100
101 for ( it = accounts.first(); it; it = accounts.next() ) { 101 for ( it = accounts.first(); it; it = accounts.next() ) {
102 it->read(); 102 it->read();
@@ -158,49 +158,49 @@ QString IMAPaccount::getUniqueFileName()
158void IMAPaccount::read() 158void IMAPaccount::read()
159{ 159{
160 Config *conf = new Config( getFileName(), Config::File ); 160 Config *conf = new Config( getFileName(), Config::File );
161 conf->setGroup( "IMAP Account" ); 161 conf->setGroup( "IMAP Account" );
162 accountName = conf->readEntry( "Account","" ); 162 accountName = conf->readEntry( "Account","" );
163 if (accountName.isNull()) accountName = ""; 163 if (accountName.isNull()) accountName = "";
164 server = conf->readEntry( "Server","" ); 164 server = conf->readEntry( "Server","" );
165 if (server.isNull()) server=""; 165 if (server.isNull()) server="";
166 port = conf->readEntry( "Port","" ); 166 port = conf->readEntry( "Port","" );
167 if (port.isNull()) port="143"; 167 if (port.isNull()) port="143";
168 connectionType = conf->readNumEntry( "ConnectionType" ); 168 connectionType = conf->readNumEntry( "ConnectionType" );
169 ssl = conf->readBoolEntry( "SSL",false ); 169 ssl = conf->readBoolEntry( "SSL",false );
170 user = conf->readEntry( "User","" ); 170 user = conf->readEntry( "User","" );
171 if (user.isNull()) user = ""; 171 if (user.isNull()) user = "";
172 password = conf->readEntryCrypt( "Password","" ); 172 password = conf->readEntryCrypt( "Password","" );
173 if (password.isNull()) password = ""; 173 if (password.isNull()) password = "";
174 prefix = conf->readEntry("MailPrefix",""); 174 prefix = conf->readEntry("MailPrefix","");
175 if (prefix.isNull()) prefix = ""; 175 if (prefix.isNull()) prefix = "";
176 offline = conf->readBoolEntry("Offline",false); 176 offline = conf->readBoolEntry("Offline",false);
177 delete conf; 177 delete conf;
178} 178}
179 179
180void IMAPaccount::save() 180void IMAPaccount::save()
181{ 181{
182 qDebug( "saving " + getFileName() ); 182 odebug << "saving " + getFileName() << oendl;
183 Settings::checkDirectory(); 183 Settings::checkDirectory();
184 184
185 Config *conf = new Config( getFileName(), Config::File ); 185 Config *conf = new Config( getFileName(), Config::File );
186 conf->setGroup( "IMAP Account" ); 186 conf->setGroup( "IMAP Account" );
187 conf->writeEntry( "Account", accountName ); 187 conf->writeEntry( "Account", accountName );
188 conf->writeEntry( "Server", server ); 188 conf->writeEntry( "Server", server );
189 conf->writeEntry( "Port", port ); 189 conf->writeEntry( "Port", port );
190 conf->writeEntry( "SSL", ssl ); 190 conf->writeEntry( "SSL", ssl );
191 conf->writeEntry( "ConnectionType", connectionType ); 191 conf->writeEntry( "ConnectionType", connectionType );
192 conf->writeEntry( "User", user ); 192 conf->writeEntry( "User", user );
193 conf->writeEntryCrypt( "Password", password ); 193 conf->writeEntryCrypt( "Password", password );
194 conf->writeEntry( "MailPrefix",prefix); 194 conf->writeEntry( "MailPrefix",prefix);
195 conf->writeEntry( "Offline",offline); 195 conf->writeEntry( "Offline",offline);
196 conf->write(); 196 conf->write();
197 delete conf; 197 delete conf;
198} 198}
199 199
200 200
201QString IMAPaccount::getFileName() 201QString IMAPaccount::getFileName()
202{ 202{
203 return (QString) getenv( "HOME" ) + "/Applications/opiemail/imap-" + file; 203 return (QString) getenv( "HOME" ) + "/Applications/opiemail/imap-" + file;
204} 204}
205 205
206POP3account::POP3account() 206POP3account::POP3account()
@@ -236,49 +236,49 @@ QString POP3account::getUniqueFileName()
236 do { 236 do {
237 unique.setNum( num++ ); 237 unique.setNum( num++ );
238 } while ( imap.contains( "pop3-" + unique ) > 0 ); 238 } while ( imap.contains( "pop3-" + unique ) > 0 );
239 239
240 return unique; 240 return unique;
241} 241}
242 242
243void POP3account::read() 243void POP3account::read()
244{ 244{
245 Config *conf = new Config( getFileName(), Config::File ); 245 Config *conf = new Config( getFileName(), Config::File );
246 conf->setGroup( "POP3 Account" ); 246 conf->setGroup( "POP3 Account" );
247 accountName = conf->readEntry( "Account" ); 247 accountName = conf->readEntry( "Account" );
248 server = conf->readEntry( "Server" ); 248 server = conf->readEntry( "Server" );
249 port = conf->readEntry( "Port" ); 249 port = conf->readEntry( "Port" );
250 ssl = conf->readBoolEntry( "SSL" ); 250 ssl = conf->readBoolEntry( "SSL" );
251 connectionType = conf->readNumEntry( "ConnectionType" ); 251 connectionType = conf->readNumEntry( "ConnectionType" );
252 user = conf->readEntry( "User" ); 252 user = conf->readEntry( "User" );
253 password = conf->readEntryCrypt( "Password" ); 253 password = conf->readEntryCrypt( "Password" );
254 offline = conf->readBoolEntry("Offline",false); 254 offline = conf->readBoolEntry("Offline",false);
255 delete conf; 255 delete conf;
256} 256}
257 257
258void POP3account::save() 258void POP3account::save()
259{ 259{
260 qDebug( "saving " + getFileName() ); 260 odebug << "saving " + getFileName() << oendl;
261 Settings::checkDirectory(); 261 Settings::checkDirectory();
262 262
263 Config *conf = new Config( getFileName(), Config::File ); 263 Config *conf = new Config( getFileName(), Config::File );
264 conf->setGroup( "POP3 Account" ); 264 conf->setGroup( "POP3 Account" );
265 conf->writeEntry( "Account", accountName ); 265 conf->writeEntry( "Account", accountName );
266 conf->writeEntry( "Server", server ); 266 conf->writeEntry( "Server", server );
267 conf->writeEntry( "Port", port ); 267 conf->writeEntry( "Port", port );
268 conf->writeEntry( "SSL", ssl ); 268 conf->writeEntry( "SSL", ssl );
269 conf->writeEntry( "ConnectionType", connectionType ); 269 conf->writeEntry( "ConnectionType", connectionType );
270 conf->writeEntry( "User", user ); 270 conf->writeEntry( "User", user );
271 conf->writeEntryCrypt( "Password", password ); 271 conf->writeEntryCrypt( "Password", password );
272 conf->writeEntry( "Offline",offline); 272 conf->writeEntry( "Offline",offline);
273 conf->write(); 273 conf->write();
274 delete conf; 274 delete conf;
275} 275}
276 276
277 277
278QString POP3account::getFileName() 278QString POP3account::getFileName()
279{ 279{
280 return (QString) getenv( "HOME" ) + "/Applications/opiemail/pop3-" + file; 280 return (QString) getenv( "HOME" ) + "/Applications/opiemail/pop3-" + file;
281} 281}
282 282
283SMTPaccount::SMTPaccount() 283SMTPaccount::SMTPaccount()
284 : Account() 284 : Account()
@@ -318,49 +318,49 @@ QString SMTPaccount::getUniqueFileName()
318 do { 318 do {
319 unique.setNum( num++ ); 319 unique.setNum( num++ );
320 } while ( imap.contains( "smtp-" + unique ) > 0 ); 320 } while ( imap.contains( "smtp-" + unique ) > 0 );
321 321
322 return unique; 322 return unique;
323} 323}
324 324
325void SMTPaccount::read() 325void SMTPaccount::read()
326{ 326{
327 Config *conf = new Config( getFileName(), Config::File ); 327 Config *conf = new Config( getFileName(), Config::File );
328 conf->setGroup( "SMTP Account" ); 328 conf->setGroup( "SMTP Account" );
329 accountName = conf->readEntry( "Account" ); 329 accountName = conf->readEntry( "Account" );
330 server = conf->readEntry( "Server" ); 330 server = conf->readEntry( "Server" );
331 port = conf->readEntry( "Port" ); 331 port = conf->readEntry( "Port" );
332 ssl = conf->readBoolEntry( "SSL" ); 332 ssl = conf->readBoolEntry( "SSL" );
333 connectionType = conf->readNumEntry( "ConnectionType" ); 333 connectionType = conf->readNumEntry( "ConnectionType" );
334 login = conf->readBoolEntry( "Login" ); 334 login = conf->readBoolEntry( "Login" );
335 user = conf->readEntry( "User" ); 335 user = conf->readEntry( "User" );
336 password = conf->readEntryCrypt( "Password" ); 336 password = conf->readEntryCrypt( "Password" );
337 delete conf; 337 delete conf;
338} 338}
339 339
340void SMTPaccount::save() 340void SMTPaccount::save()
341{ 341{
342 qDebug( "saving " + getFileName() ); 342 odebug << "saving " + getFileName() << oendl;
343 Settings::checkDirectory(); 343 Settings::checkDirectory();
344 344
345 Config *conf = new Config( getFileName(), Config::File ); 345 Config *conf = new Config( getFileName(), Config::File );
346 conf->setGroup( "SMTP Account" ); 346 conf->setGroup( "SMTP Account" );
347 conf->writeEntry( "Account", accountName ); 347 conf->writeEntry( "Account", accountName );
348 conf->writeEntry( "Server", server ); 348 conf->writeEntry( "Server", server );
349 conf->writeEntry( "Port", port ); 349 conf->writeEntry( "Port", port );
350 conf->writeEntry( "SSL", ssl ); 350 conf->writeEntry( "SSL", ssl );
351 conf->writeEntry( "ConnectionType", connectionType ); 351 conf->writeEntry( "ConnectionType", connectionType );
352 conf->writeEntry( "Login", login ); 352 conf->writeEntry( "Login", login );
353 conf->writeEntry( "User", user ); 353 conf->writeEntry( "User", user );
354 conf->writeEntryCrypt( "Password", password ); 354 conf->writeEntryCrypt( "Password", password );
355 conf->write(); 355 conf->write();
356 delete conf; 356 delete conf;
357} 357}
358 358
359 359
360QString SMTPaccount::getFileName() 360QString SMTPaccount::getFileName()
361{ 361{
362 return (QString) getenv( "HOME" ) + "/Applications/opiemail/smtp-" + file; 362 return (QString) getenv( "HOME" ) + "/Applications/opiemail/smtp-" + file;
363} 363}
364 364
365NNTPaccount::NNTPaccount() 365NNTPaccount::NNTPaccount()
366 : Account() 366 : Account()
@@ -395,46 +395,46 @@ QString NNTPaccount::getUniqueFileName()
395 do { 395 do {
396 unique.setNum( num++ ); 396 unique.setNum( num++ );
397 } while ( imap.contains( "nntp-" + unique ) > 0 ); 397 } while ( imap.contains( "nntp-" + unique ) > 0 );
398 398
399 return unique; 399 return unique;
400} 400}
401 401
402void NNTPaccount::read() 402void NNTPaccount::read()
403{ 403{
404 Config *conf = new Config( getFileName(), Config::File ); 404 Config *conf = new Config( getFileName(), Config::File );
405 conf->setGroup( "NNTP Account" ); 405 conf->setGroup( "NNTP Account" );
406 accountName = conf->readEntry( "Account" ); 406 accountName = conf->readEntry( "Account" );
407 server = conf->readEntry( "Server" ); 407 server = conf->readEntry( "Server" );
408 port = conf->readEntry( "Port" ); 408 port = conf->readEntry( "Port" );
409 ssl = conf->readBoolEntry( "SSL" ); 409 ssl = conf->readBoolEntry( "SSL" );
410 login = conf->readBoolEntry( "Login" ); 410 login = conf->readBoolEntry( "Login" );
411 user = conf->readEntry( "User" ); 411 user = conf->readEntry( "User" );
412 password = conf->readEntryCrypt( "Password" ); 412 password = conf->readEntryCrypt( "Password" );
413 subscribedGroups = conf->readListEntry( "Subscribed", ',' ); 413 subscribedGroups = conf->readListEntry( "Subscribed", ',' );
414 delete conf; 414 delete conf;
415} 415}
416 416
417void NNTPaccount::save() 417void NNTPaccount::save()
418{ 418{
419 qDebug( "saving " + getFileName() ); 419 odebug << "saving " + getFileName() << oendl;
420 Settings::checkDirectory(); 420 Settings::checkDirectory();
421 421
422 Config *conf = new Config( getFileName(), Config::File ); 422 Config *conf = new Config( getFileName(), Config::File );
423 conf->setGroup( "NNTP Account" ); 423 conf->setGroup( "NNTP Account" );
424 conf->writeEntry( "Account", accountName ); 424 conf->writeEntry( "Account", accountName );
425 conf->writeEntry( "Server", server ); 425 conf->writeEntry( "Server", server );
426 conf->writeEntry( "Port", port ); 426 conf->writeEntry( "Port", port );
427 conf->writeEntry( "SSL", ssl ); 427 conf->writeEntry( "SSL", ssl );
428 conf->writeEntry( "Login", login ); 428 conf->writeEntry( "Login", login );
429 conf->writeEntry( "User", user ); 429 conf->writeEntry( "User", user );
430 conf->writeEntryCrypt( "Password", password ); 430 conf->writeEntryCrypt( "Password", password );
431 conf->writeEntry( "Subscribed" , subscribedGroups, ',' ); 431 conf->writeEntry( "Subscribed" , subscribedGroups, ',' );
432 conf->write(); 432 conf->write();
433 delete conf; 433 delete conf;
434} 434}
435 435
436 436
437QString NNTPaccount::getFileName() 437QString NNTPaccount::getFileName()
438{ 438{
439 return (QString) getenv( "HOME" ) + "/Applications/opiemail/nntp-" + file; 439 return (QString) getenv( "HOME" ) + "/Applications/opiemail/nntp-" + file;
440} 440}
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
index e2cea7a..ba78c3b 100644
--- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
@@ -94,49 +94,49 @@ void SMTPwrapper::storeMail(const char*mail, size_t length, const QString&box) {
94 return; 94 return;
95 QString localfolders = AbstractMail::defaultLocalfolder(); 95 QString localfolders = AbstractMail::defaultLocalfolder();
96 AbstractMail*wrap = AbstractMail::getWrapper(localfolders); 96 AbstractMail*wrap = AbstractMail::getWrapper(localfolders);
97 wrap->createMbox(box); 97 wrap->createMbox(box);
98 wrap->storeMessage(mail,length,box); 98 wrap->storeMessage(mail,length,box);
99 delete wrap; 99 delete wrap;
100} 100}
101 101
102void SMTPwrapper::smtpSend( mailmime *mail,bool later) { 102void SMTPwrapper::smtpSend( mailmime *mail,bool later) {
103 clist *rcpts = 0; 103 clist *rcpts = 0;
104 char *from, *data; 104 char *from, *data;
105 size_t size; 105 size_t size;
106 106
107 from = data = 0; 107 from = data = 0;
108 108
109 mailmessage * msg = 0; 109 mailmessage * msg = 0;
110 msg = mime_message_init(mail); 110 msg = mime_message_init(mail);
111 mime_message_set_tmpdir(msg,getenv( "HOME" )); 111 mime_message_set_tmpdir(msg,getenv( "HOME" ));
112 int r = mailmessage_fetch(msg,&data,&size); 112 int r = mailmessage_fetch(msg,&data,&size);
113 mime_message_detach_mime(msg); 113 mime_message_detach_mime(msg);
114 mailmessage_free(msg); 114 mailmessage_free(msg);
115 if (r != MAIL_NO_ERROR || !data) { 115 if (r != MAIL_NO_ERROR || !data) {
116 if (data) 116 if (data)
117 free(data); 117 free(data);
118 qDebug("Error fetching mime..."); 118 odebug << "Error fetching mime..." << oendl;
119 return; 119 return;
120 } 120 }
121 msg = 0; 121 msg = 0;
122 if (later) { 122 if (later) {
123 storeMail(data,size,"Outgoing"); 123 storeMail(data,size,"Outgoing");
124 if (data) 124 if (data)
125 free( data ); 125 free( data );
126 Config cfg( "mail" ); 126 Config cfg( "mail" );
127 cfg.setGroup( "Status" ); 127 cfg.setGroup( "Status" );
128 cfg.writeEntry( "outgoing", ++m_queuedMail ); 128 cfg.writeEntry( "outgoing", ++m_queuedMail );
129 emit queuedMails( m_queuedMail ); 129 emit queuedMails( m_queuedMail );
130 return; 130 return;
131 } 131 }
132 from = getFrom( mail ); 132 from = getFrom( mail );
133 rcpts = createRcptList( mail->mm_data.mm_message.mm_fields ); 133 rcpts = createRcptList( mail->mm_data.mm_message.mm_fields );
134 smtpSend(from,rcpts,data,size); 134 smtpSend(from,rcpts,data,size);
135 if (data) { 135 if (data) {
136 free(data); 136 free(data);
137 } 137 }
138 if (from) { 138 if (from) {
139 free(from); 139 free(from);
140 } 140 }
141 if (rcpts) 141 if (rcpts)
142 smtp_address_list_free( rcpts ); 142 smtp_address_list_free( rcpts );
@@ -187,166 +187,166 @@ void SMTPwrapper::connect_server()
187 server = user = pass = 0; 187 server = user = pass = 0;
188 QString failuretext = ""; 188 QString failuretext = "";
189 189
190 if (m_smtp || !m_SmtpAccount) { 190 if (m_smtp || !m_SmtpAccount) {
191 return; 191 return;
192 } 192 }
193 server = m_SmtpAccount->getServer().latin1(); 193 server = m_SmtpAccount->getServer().latin1();
194 if ( m_SmtpAccount->ConnectionType() == 2 ) { 194 if ( m_SmtpAccount->ConnectionType() == 2 ) {
195 ssl = true; 195 ssl = true;
196 try_tls = false; 196 try_tls = false;
197 } else if (m_SmtpAccount->ConnectionType() == 1) { 197 } else if (m_SmtpAccount->ConnectionType() == 1) {
198 force_tls = true; 198 force_tls = true;
199 } 199 }
200 int result = 1; 200 int result = 1;
201 port = m_SmtpAccount->getPort().toUInt(); 201 port = m_SmtpAccount->getPort().toUInt();
202 202
203 m_smtp = mailsmtp_new( 20, &progress ); 203 m_smtp = mailsmtp_new( 20, &progress );
204 if ( m_smtp == NULL ) { 204 if ( m_smtp == NULL ) {
205 /* no failure message cause this happens when problems with memory - than we 205 /* no failure message cause this happens when problems with memory - than we
206 we can not display any messagebox */ 206 we can not display any messagebox */
207 return; 207 return;
208 } 208 }
209 209
210 int err = MAILSMTP_NO_ERROR; 210 int err = MAILSMTP_NO_ERROR;
211 qDebug( "Servername %s at port %i", server, port ); 211 odebug << "Servername " << server << " at port " << port << "" << oendl;
212 if ( ssl ) { 212 if ( ssl ) {
213 qDebug( "SSL session" ); 213 odebug << "SSL session" << oendl;
214 err = mailsmtp_ssl_connect( m_smtp, server, port ); 214 err = mailsmtp_ssl_connect( m_smtp, server, port );
215 } else { 215 } else {
216 qDebug( "No SSL session" ); 216 odebug << "No SSL session" << oendl;
217 err = mailsmtp_socket_connect( m_smtp, server, port ); 217 err = mailsmtp_socket_connect( m_smtp, server, port );
218 } 218 }
219 if ( err != MAILSMTP_NO_ERROR ) { 219 if ( err != MAILSMTP_NO_ERROR ) {
220 qDebug("Error init connection"); 220 odebug << "Error init connection" << oendl;
221 failuretext = tr("Error init SMTP connection: %1").arg(mailsmtpError(err)); 221 failuretext = tr("Error init SMTP connection: %1").arg(mailsmtpError(err));
222 result = 0; 222 result = 0;
223 } 223 }
224 224
225 /* switch to tls after init 'cause there it will send the ehlo */ 225 /* switch to tls after init 'cause there it will send the ehlo */
226 if (result) { 226 if (result) {
227 err = mailsmtp_init( m_smtp ); 227 err = mailsmtp_init( m_smtp );
228 if (err != MAILSMTP_NO_ERROR) { 228 if (err != MAILSMTP_NO_ERROR) {
229 result = 0; 229 result = 0;
230 failuretext = tr("Error init SMTP connection: %1").arg(mailsmtpError(err)); 230 failuretext = tr("Error init SMTP connection: %1").arg(mailsmtpError(err));
231 } 231 }
232 } 232 }
233 233
234 if (try_tls) { 234 if (try_tls) {
235 err = start_smtp_tls(); 235 err = start_smtp_tls();
236 if (err != MAILSMTP_NO_ERROR) { 236 if (err != MAILSMTP_NO_ERROR) {
237 try_tls = false; 237 try_tls = false;
238 } else { 238 } else {
239 err = mailesmtp_ehlo(m_smtp); 239 err = mailesmtp_ehlo(m_smtp);
240 } 240 }
241 } 241 }
242 242
243 if (!try_tls && force_tls) { 243 if (!try_tls && force_tls) {
244 result = 0; 244 result = 0;
245 failuretext = tr("Error init SMTP tls: %1").arg(mailsmtpError(err)); 245 failuretext = tr("Error init SMTP tls: %1").arg(mailsmtpError(err));
246 } 246 }
247 247
248 if (result==1 && m_SmtpAccount->getLogin() ) { 248 if (result==1 && m_SmtpAccount->getLogin() ) {
249 qDebug("smtp with auth"); 249 odebug << "smtp with auth" << oendl;
250 if ( m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty() ) { 250 if ( m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty() ) {
251 // get'em 251 // get'em
252 LoginDialog login( m_SmtpAccount->getUser(), 252 LoginDialog login( m_SmtpAccount->getUser(),
253 m_SmtpAccount->getPassword(), NULL, 0, true ); 253 m_SmtpAccount->getPassword(), NULL, 0, true );
254 login.show(); 254 login.show();
255 if ( QDialog::Accepted == login.exec() ) { 255 if ( QDialog::Accepted == login.exec() ) {
256 // ok 256 // ok
257 user = login.getUser().latin1(); 257 user = login.getUser().latin1();
258 pass = login.getPassword().latin1(); 258 pass = login.getPassword().latin1();
259 } else { 259 } else {
260 result = 0; 260 result = 0;
261 failuretext=tr("Login aborted - storing mail to localfolder"); 261 failuretext=tr("Login aborted - storing mail to localfolder");
262 } 262 }
263 } else { 263 } else {
264 user = m_SmtpAccount->getUser().latin1(); 264 user = m_SmtpAccount->getUser().latin1();
265 pass = m_SmtpAccount->getPassword().latin1(); 265 pass = m_SmtpAccount->getPassword().latin1();
266 } 266 }
267 qDebug( "session->auth: %i", m_smtp->auth); 267 odebug << "session->auth: " << m_smtp->auth << "" << oendl;
268 if (result) { 268 if (result) {
269 err = mailsmtp_auth( m_smtp, (char*)user, (char*)pass ); 269 err = mailsmtp_auth( m_smtp, (char*)user, (char*)pass );
270 if ( err == MAILSMTP_NO_ERROR ) { 270 if ( err == MAILSMTP_NO_ERROR ) {
271 qDebug("auth ok"); 271 odebug << "auth ok" << oendl;
272 } else { 272 } else {
273 failuretext = tr("Authentification failed"); 273 failuretext = tr("Authentification failed");
274 result = 0; 274 result = 0;
275 } 275 }
276 } 276 }
277 } 277 }
278} 278}
279 279
280void SMTPwrapper::disc_server() 280void SMTPwrapper::disc_server()
281{ 281{
282 if (m_smtp) { 282 if (m_smtp) {
283 mailsmtp_quit( m_smtp ); 283 mailsmtp_quit( m_smtp );
284 mailsmtp_free( m_smtp ); 284 mailsmtp_free( m_smtp );
285 m_smtp = 0; 285 m_smtp = 0;
286 } 286 }
287} 287}
288 288
289int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size ) 289int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size )
290{ 290{
291 int err,result; 291 int err,result;
292 QString failuretext = ""; 292 QString failuretext = "";
293 293
294 connect_server(); 294 connect_server();
295 295
296 result = 1; 296 result = 1;
297 if (m_smtp) { 297 if (m_smtp) {
298 err = mailsmtp_send( m_smtp, from, rcpts, data, size ); 298 err = mailsmtp_send( m_smtp, from, rcpts, data, size );
299 if ( err != MAILSMTP_NO_ERROR ) { 299 if ( err != MAILSMTP_NO_ERROR ) {
300 failuretext=tr("Error sending mail: %1").arg(mailsmtpError(err)); 300 failuretext=tr("Error sending mail: %1").arg(mailsmtpError(err));
301 result = 0; 301 result = 0;
302 } 302 }
303 } else { 303 } else {
304 result = 0; 304 result = 0;
305 } 305 }
306 306
307 if (!result) { 307 if (!result) {
308 storeFailedMail(data,size,failuretext); 308 storeFailedMail(data,size,failuretext);
309 } else { 309 } else {
310 qDebug( "Mail sent." ); 310 odebug << "Mail sent." << oendl;
311 storeMail(data,size,"Sent"); 311 storeMail(data,size,"Sent");
312 } 312 }
313 return result; 313 return result;
314} 314}
315 315
316void SMTPwrapper::sendMail(const Opie::Core::OSmartPointer<Mail>&mail,bool later ) 316void SMTPwrapper::sendMail(const Opie::Core::OSmartPointer<Mail>&mail,bool later )
317{ 317{
318 mailmime * mimeMail; 318 mailmime * mimeMail;
319 319
320 mimeMail = createMimeMail(mail ); 320 mimeMail = createMimeMail(mail );
321 if ( mimeMail == NULL ) { 321 if ( mimeMail == NULL ) {
322 qDebug( "sendMail: error creating mime mail" ); 322 odebug << "sendMail: error creating mime mail" << oendl;
323 } else { 323 } else {
324 sendProgress = new progressMailSend(); 324 sendProgress = new progressMailSend();
325 sendProgress->show(); 325 sendProgress->show();
326 sendProgress->setMaxMails(1); 326 sendProgress->setMaxMails(1);
327 smtpSend( mimeMail,later); 327 smtpSend( mimeMail,later);
328 qDebug("Clean up done"); 328 odebug << "Clean up done" << oendl;
329 sendProgress->hide(); 329 sendProgress->hide();
330 delete sendProgress; 330 delete sendProgress;
331 sendProgress = 0; 331 sendProgress = 0;
332 mailmime_free( mimeMail ); 332 mailmime_free( mimeMail );
333 } 333 }
334} 334}
335 335
336int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,const RecMailP&which) { 336int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,const RecMailP&which) {
337 size_t curTok = 0; 337 size_t curTok = 0;
338 mailimf_fields *fields = 0; 338 mailimf_fields *fields = 0;
339 mailimf_field*ffrom = 0; 339 mailimf_field*ffrom = 0;
340 clist *rcpts = 0; 340 clist *rcpts = 0;
341 char*from = 0; 341 char*from = 0;
342 int res = 0; 342 int res = 0;
343 343
344 encodedString * data = wrap->fetchRawBody(which); 344 encodedString * data = wrap->fetchRawBody(which);
345 if (!data) 345 if (!data)
346 return 0; 346 return 0;
347 int err = mailimf_fields_parse( data->Content(), data->Length(), &curTok, &fields ); 347 int err = mailimf_fields_parse( data->Content(), data->Length(), &curTok, &fields );
348 if (err != MAILIMF_NO_ERROR) { 348 if (err != MAILIMF_NO_ERROR) {
349 delete data; 349 delete data;
350 delete wrap; 350 delete wrap;
351 return 0; 351 return 0;
352 } 352 }
@@ -357,69 +357,69 @@ int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,const RecMailP&which) {
357 357
358 if (rcpts && from) { 358 if (rcpts && from) {
359 res = smtpSend(from,rcpts,data->Content(),data->Length()); 359 res = smtpSend(from,rcpts,data->Content(),data->Length());
360 } 360 }
361 if (fields) { 361 if (fields) {
362 mailimf_fields_free(fields); 362 mailimf_fields_free(fields);
363 fields = 0; 363 fields = 0;
364 } 364 }
365 if (data) { 365 if (data) {
366 delete data; 366 delete data;
367 } 367 }
368 if (from) { 368 if (from) {
369 free(from); 369 free(from);
370 } 370 }
371 if (rcpts) { 371 if (rcpts) {
372 smtp_address_list_free( rcpts ); 372 smtp_address_list_free( rcpts );
373 } 373 }
374 return res; 374 return res;
375} 375}
376 376
377/* this is a special fun */ 377/* this is a special fun */
378bool SMTPwrapper::flushOutbox() { 378bool SMTPwrapper::flushOutbox() {
379 bool returnValue = true; 379 bool returnValue = true;
380 380
381 qDebug("Sending the queue"); 381 odebug << "Sending the queue" << oendl;
382 if (!m_SmtpAccount) { 382 if (!m_SmtpAccount) {
383 qDebug("No smtp account given"); 383 odebug << "No smtp account given" << oendl;
384 return false; 384 return false;
385 } 385 }
386 386
387 bool reset_user_value = false; 387 bool reset_user_value = false;
388 QString localfolders = AbstractMail::defaultLocalfolder(); 388 QString localfolders = AbstractMail::defaultLocalfolder();
389 AbstractMail*wrap = AbstractMail::getWrapper(localfolders); 389 AbstractMail*wrap = AbstractMail::getWrapper(localfolders);
390 if (!wrap) { 390 if (!wrap) {
391 qDebug("memory error"); 391 odebug << "memory error" << oendl;
392 return false; 392 return false;
393 } 393 }
394 QString oldPw, oldUser; 394 QString oldPw, oldUser;
395 QValueList<RecMailP> mailsToSend; 395 QValueList<RecMailP> mailsToSend;
396 QValueList<RecMailP> mailsToRemove; 396 QValueList<RecMailP> mailsToRemove;
397 QString mbox("Outgoing"); 397 QString mbox("Outgoing");
398 wrap->listMessages(mbox,mailsToSend); 398 wrap->listMessages(mbox,mailsToSend);
399 if (mailsToSend.count()==0) { 399 if (mailsToSend.count()==0) {
400 delete wrap; 400 delete wrap;
401 qDebug("No mails to send"); 401 odebug << "No mails to send" << oendl;
402 return false; 402 return false;
403 } 403 }
404 404
405 oldPw = m_SmtpAccount->getPassword(); 405 oldPw = m_SmtpAccount->getPassword();
406 oldUser = m_SmtpAccount->getUser(); 406 oldUser = m_SmtpAccount->getUser();
407 if (m_SmtpAccount->getLogin() && (m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty()) ) { 407 if (m_SmtpAccount->getLogin() && (m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty()) ) {
408 // get'em 408 // get'em
409 QString user,pass; 409 QString user,pass;
410 LoginDialog login( m_SmtpAccount->getUser(), m_SmtpAccount->getPassword(), NULL, 0, true ); 410 LoginDialog login( m_SmtpAccount->getUser(), m_SmtpAccount->getPassword(), NULL, 0, true );
411 login.show(); 411 login.show();
412 if ( QDialog::Accepted == login.exec() ) { 412 if ( QDialog::Accepted == login.exec() ) {
413 // ok 413 // ok
414 user = login.getUser().latin1(); 414 user = login.getUser().latin1();
415 pass = login.getPassword().latin1(); 415 pass = login.getPassword().latin1();
416 reset_user_value = true; 416 reset_user_value = true;
417 m_SmtpAccount->setUser(user); 417 m_SmtpAccount->setUser(user);
418 m_SmtpAccount->setPassword(pass); 418 m_SmtpAccount->setPassword(pass);
419 } else { 419 } else {
420 return true; 420 return true;
421 } 421 }
422 } 422 }
423 423
424 424
425 sendProgress = new progressMailSend(); 425 sendProgress = new progressMailSend();
diff --git a/noncore/net/mail/libmailwrapper/statusmail.cpp b/noncore/net/mail/libmailwrapper/statusmail.cpp
index b78244d..51383f6 100644
--- a/noncore/net/mail/libmailwrapper/statusmail.cpp
+++ b/noncore/net/mail/libmailwrapper/statusmail.cpp
@@ -22,69 +22,69 @@ void StatusMail::initAccounts(QList<Account>&accounts)
22 Account *it; 22 Account *it;
23 folderStat currentStat; 23 folderStat currentStat;
24 AbstractMail * current = 0; 24 AbstractMail * current = 0;
25 currentPop3Stat.message_count=0; 25 currentPop3Stat.message_count=0;
26 currentPop3Stat.message_recent=0; 26 currentPop3Stat.message_recent=0;
27 currentPop3Stat.message_unseen=0; 27 currentPop3Stat.message_unseen=0;
28 for ( it = accounts.first(); it; it = accounts.next() ) { 28 for ( it = accounts.first(); it; it = accounts.next() ) {
29 if ( it->getType()==MAILLIB::A_IMAP && !it->getOffline() ) { 29 if ( it->getType()==MAILLIB::A_IMAP && !it->getOffline() ) {
30 IMAPaccount*ima = static_cast<IMAPaccount *>(it); 30 IMAPaccount*ima = static_cast<IMAPaccount *>(it);
31 current = AbstractMail::getWrapper(ima); 31 current = AbstractMail::getWrapper(ima);
32 connectionList.append(current); 32 connectionList.append(current);
33 current->statusFolder(currentStat); 33 current->statusFolder(currentStat);
34 currentImapStat.message_count+=currentStat.message_unseen; 34 currentImapStat.message_count+=currentStat.message_unseen;
35 currentImapStat.message_count+=currentStat.message_recent; 35 currentImapStat.message_count+=currentStat.message_recent;
36 currentImapStat.message_count+=currentStat.message_count; 36 currentImapStat.message_count+=currentStat.message_count;
37 } else if ( it->getType() == MAILLIB::A_POP3 && !it->getOffline() ) { 37 } else if ( it->getType() == MAILLIB::A_POP3 && !it->getOffline() ) {
38 POP3account *pop3 = static_cast<POP3account *>(it); 38 POP3account *pop3 = static_cast<POP3account *>(it);
39 current = AbstractMail::getWrapper(pop3); 39 current = AbstractMail::getWrapper(pop3);
40 connectionList.append(current); 40 connectionList.append(current);
41 current->statusFolder(currentStat); 41 current->statusFolder(currentStat);
42 currentPop3Stat.message_count+=currentStat.message_count; 42 currentPop3Stat.message_count+=currentStat.message_count;
43 } 43 }
44 current->logout(); 44 current->logout();
45 } 45 }
46 qDebug("Pop3 init count: %i",currentPop3Stat.message_count); 46 odebug << "Pop3 init count: " << currentPop3Stat.message_count << "" << oendl;
47 currentPop3Stat.message_recent = currentPop3Stat.message_unseen = 0; 47 currentPop3Stat.message_recent = currentPop3Stat.message_unseen = 0;
48 lastPop3Stat.message_unseen = currentPop3Stat.message_unseen; 48 lastPop3Stat.message_unseen = currentPop3Stat.message_unseen;
49 lastPop3Stat.message_recent = currentPop3Stat.message_recent; 49 lastPop3Stat.message_recent = currentPop3Stat.message_recent;
50 lastPop3Stat.message_count = currentPop3Stat.message_count; 50 lastPop3Stat.message_count = currentPop3Stat.message_count;
51} 51}
52 52
53void StatusMail::reset_status() 53void StatusMail::reset_status()
54{ 54{
55 lastPop3Stat = currentPop3Stat; 55 lastPop3Stat = currentPop3Stat;
56} 56}
57 57
58void StatusMail::check_current_stat(folderStat&targetStat) 58void StatusMail::check_current_stat(folderStat&targetStat)
59{ 59{
60 AbstractMail*it = 0; 60 AbstractMail*it = 0;
61 folderStat currentStat; 61 folderStat currentStat;
62 currentPop3Stat.message_recent = 0; 62 currentPop3Stat.message_recent = 0;
63 currentPop3Stat.message_count = 0; 63 currentPop3Stat.message_count = 0;
64 currentPop3Stat.message_unseen = 0; 64 currentPop3Stat.message_unseen = 0;
65 currentImapStat = currentPop3Stat; 65 currentImapStat = currentPop3Stat;
66 for ( it = connectionList.first(); it; it = connectionList.next() ) { 66 for ( it = connectionList.first(); it; it = connectionList.next() ) {
67 it->statusFolder(currentStat); 67 it->statusFolder(currentStat);
68 it->logout(); 68 it->logout();
69 if (it->getType() == MAILLIB::A_IMAP) { 69 if (it->getType() == MAILLIB::A_IMAP) {
70 currentImapStat.message_unseen+=currentStat.message_unseen; 70 currentImapStat.message_unseen+=currentStat.message_unseen;
71 currentImapStat.message_recent+=currentStat.message_recent; 71 currentImapStat.message_recent+=currentStat.message_recent;
72 currentImapStat.message_count+=currentStat.message_count; 72 currentImapStat.message_count+=currentStat.message_count;
73 } else if (it->getType() == MAILLIB::A_POP3) { 73 } else if (it->getType() == MAILLIB::A_POP3) {
74 currentPop3Stat.message_count+=currentStat.message_count; 74 currentPop3Stat.message_count+=currentStat.message_count;
75 qDebug("Pop3 count: %i",currentPop3Stat.message_count); 75 odebug << "Pop3 count: " << currentPop3Stat.message_count << "" << oendl;
76 } 76 }
77 } 77 }
78 qDebug("Pop3 last: %i",lastPop3Stat.message_count); 78 odebug << "Pop3 last: " << lastPop3Stat.message_count << "" << oendl;
79 if (currentPop3Stat.message_count > lastPop3Stat.message_count) { 79 if (currentPop3Stat.message_count > lastPop3Stat.message_count) {
80 currentPop3Stat.message_recent = currentPop3Stat.message_count - lastPop3Stat.message_count; 80 currentPop3Stat.message_recent = currentPop3Stat.message_count - lastPop3Stat.message_count;
81 currentPop3Stat.message_unseen = currentPop3Stat.message_recent; 81 currentPop3Stat.message_unseen = currentPop3Stat.message_recent;
82 } else { 82 } else {
83 lastPop3Stat.message_count = currentPop3Stat.message_count; 83 lastPop3Stat.message_count = currentPop3Stat.message_count;
84 currentPop3Stat.message_recent = currentPop3Stat.message_unseen = 0; 84 currentPop3Stat.message_recent = currentPop3Stat.message_unseen = 0;
85 } 85 }
86 targetStat = currentImapStat; 86 targetStat = currentImapStat;
87 targetStat.message_unseen+=currentPop3Stat.message_unseen; 87 targetStat.message_unseen+=currentPop3Stat.message_unseen;
88 targetStat.message_recent+=currentPop3Stat.message_recent; 88 targetStat.message_recent+=currentPop3Stat.message_recent;
89 targetStat.message_count+=currentPop3Stat.message_count; 89 targetStat.message_count+=currentPop3Stat.message_count;
90} 90}
diff --git a/noncore/net/mail/libmailwrapper/storemail.cpp b/noncore/net/mail/libmailwrapper/storemail.cpp
index 914a11d..546d756 100644
--- a/noncore/net/mail/libmailwrapper/storemail.cpp
+++ b/noncore/net/mail/libmailwrapper/storemail.cpp
@@ -37,55 +37,55 @@ Storemail::Storemail(const QString&dir,const QString&aFolder)
37Storemail::Storemail(const QString&aFolder) 37Storemail::Storemail(const QString&aFolder)
38 : Generatemail() 38 : Generatemail()
39{ 39{
40 wrapper = 0; 40 wrapper = 0;
41 m_Account = 0; 41 m_Account = 0;
42 m_tfolder = aFolder; 42 m_tfolder = aFolder;
43 wrapper = AbstractMail::getWrapper(AbstractMail::defaultLocalfolder()); 43 wrapper = AbstractMail::getWrapper(AbstractMail::defaultLocalfolder());
44 if (wrapper) { 44 if (wrapper) {
45 wrapper->createMbox(m_tfolder); 45 wrapper->createMbox(m_tfolder);
46 } 46 }
47} 47}
48 48
49Storemail::~Storemail() 49Storemail::~Storemail()
50{ 50{
51} 51}
52 52
53int Storemail::storeMail(const Opie::Core::OSmartPointer<Mail>&mail) 53int Storemail::storeMail(const Opie::Core::OSmartPointer<Mail>&mail)
54{ 54{
55 if (!wrapper) return 0; 55 if (!wrapper) return 0;
56 int ret = 1; 56 int ret = 1;
57 57
58 mailmime * mimeMail = 0; 58 mailmime * mimeMail = 0;
59 mimeMail = createMimeMail(mail ); 59 mimeMail = createMimeMail(mail );
60 if ( mimeMail == NULL ) { 60 if ( mimeMail == NULL ) {
61 qDebug( "storeMail: error creating mime mail" ); 61 odebug << "storeMail: error creating mime mail" << oendl;
62 return 0; 62 return 0;
63 } 63 }
64 char *data; 64 char *data;
65 size_t size; 65 size_t size;
66 data = 0; 66 data = 0;
67 67
68 mailmessage * msg = 0; 68 mailmessage * msg = 0;
69 msg = mime_message_init(mimeMail); 69 msg = mime_message_init(mimeMail);
70 mime_message_set_tmpdir(msg,getenv( "HOME" )); 70 mime_message_set_tmpdir(msg,getenv( "HOME" ));
71 int r = mailmessage_fetch(msg,&data,&size); 71 int r = mailmessage_fetch(msg,&data,&size);
72 mime_message_detach_mime(msg); 72 mime_message_detach_mime(msg);
73 mailmessage_free(msg); 73 mailmessage_free(msg);
74 msg = 0; 74 msg = 0;
75 if (r != MAIL_NO_ERROR || !data) { 75 if (r != MAIL_NO_ERROR || !data) {
76 qDebug("Error fetching mime..."); 76 odebug << "Error fetching mime..." << oendl;
77 ret = 0; 77 ret = 0;
78 } 78 }
79 79
80 if (ret) { 80 if (ret) {
81 wrapper->storeMessage(data,size,m_tfolder); 81 wrapper->storeMessage(data,size,m_tfolder);
82 } 82 }
83 83
84 if (data) { 84 if (data) {
85 free(data); 85 free(data);
86 } 86 }
87 if (mimeMail) { 87 if (mimeMail) {
88 mailmime_free( mimeMail ); 88 mailmime_free( mimeMail );
89 } 89 }
90 return ret; 90 return ret;
91} 91}
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp
index c23ad3f..4c87d64 100644
--- a/noncore/net/mail/mainwindow.cpp
+++ b/noncore/net/mail/mainwindow.cpp
@@ -120,97 +120,97 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
120 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, 120 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this,
121 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); 121 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) );
122 connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), 122 connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)),
123 this,SLOT(refreshMailView(const QValueList<RecMailP>&))); 123 this,SLOT(refreshMailView(const QValueList<RecMailP>&)));
124 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); 124 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) );
125 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); 125 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) );
126// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); 126// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) );
127 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); 127 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) );
128 // Added by Stefan Eilers to allow starting by addressbook.. 128 // Added by Stefan Eilers to allow starting by addressbook..
129 // copied from old mail2 129 // copied from old mail2
130#if !defined(QT_NO_COP) 130#if !defined(QT_NO_COP)
131 connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ), 131 connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ),
132 this, SLOT( appMessage(const QCString&,const QByteArray&) ) ); 132 this, SLOT( appMessage(const QCString&,const QByteArray&) ) );
133#endif 133#endif
134 134
135 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); 135 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) );
136} 136}
137 137
138MainWindow::~MainWindow() 138MainWindow::~MainWindow()
139{ 139{
140} 140}
141 141
142void MainWindow::appMessage(const QCString &, const QByteArray &) 142void MainWindow::appMessage(const QCString &, const QByteArray &)
143{ 143{
144 qDebug("appMessage not reached"); 144 odebug << "appMessage not reached" << oendl;
145} 145}
146 146
147void MainWindow::slotAdjustLayout() { 147void MainWindow::slotAdjustLayout() {
148 148
149 QWidget *d = QApplication::desktop(); 149 QWidget *d = QApplication::desktop();
150 150
151 if ( d->width() < d->height() ) { 151 if ( d->width() < d->height() ) {
152 layout->setDirection( QBoxLayout::TopToBottom ); 152 layout->setDirection( QBoxLayout::TopToBottom );
153 } else { 153 } else {
154 layout->setDirection( QBoxLayout::LeftToRight ); 154 layout->setDirection( QBoxLayout::LeftToRight );
155 } 155 }
156} 156}
157 157
158void MainWindow::slotAdjustColumns() 158void MainWindow::slotAdjustColumns()
159{ 159{
160 bool hidden = folderView->isHidden(); 160 bool hidden = folderView->isHidden();
161 if ( hidden ) folderView->show(); 161 if ( hidden ) folderView->show();
162 folderView->setColumnWidth( 0, folderView->visibleWidth() ); 162 folderView->setColumnWidth( 0, folderView->visibleWidth() );
163 if ( hidden ) folderView->hide(); 163 if ( hidden ) folderView->hide();
164 164
165 mailView->setColumnWidth( 0, 10 ); 165 mailView->setColumnWidth( 0, 10 );
166 mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 ); 166 mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 );
167 mailView->setColumnWidth( 2, 80 ); 167 mailView->setColumnWidth( 2, 80 );
168 mailView->setColumnWidth( 3, 50 ); 168 mailView->setColumnWidth( 3, 50 );
169 mailView->setColumnWidth( 4, 50 ); 169 mailView->setColumnWidth( 4, 50 );
170} 170}
171 171
172void MainWindow::slotEditSettings() 172void MainWindow::slotEditSettings()
173{ 173{
174} 174}
175 175
176void MainWindow::slotShowFolders( bool ) 176void MainWindow::slotShowFolders( bool )
177{ 177{
178 qDebug( "slotShowFolders not reached" ); 178 odebug << "slotShowFolders not reached" << oendl;
179} 179}
180 180
181void MainWindow::refreshMailView(const QValueList<RecMailP>&) 181void MainWindow::refreshMailView(const QValueList<RecMailP>&)
182{ 182{
183 qDebug( "refreshMailView not reached" ); 183 odebug << "refreshMailView not reached" << oendl;
184} 184}
185 185
186void MainWindow::mailLeftClicked(int, QListViewItem *,const QPoint&,int ) 186void MainWindow::mailLeftClicked(int, QListViewItem *,const QPoint&,int )
187{ 187{
188 qDebug( "mailLeftClicked not reached" ); 188 odebug << "mailLeftClicked not reached" << oendl;
189} 189}
190 190
191void MainWindow::displayMail() 191void MainWindow::displayMail()
192{ 192{
193 qDebug("displayMail not reached"); 193 odebug << "displayMail not reached" << oendl;
194} 194}
195 195
196void MainWindow::slotDeleteMail() 196void MainWindow::slotDeleteMail()
197{ 197{
198 qDebug("deleteMail not reached"); 198 odebug << "deleteMail not reached" << oendl;
199} 199}
200 200
201void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) 201void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int )
202{ 202{
203 qDebug("mailHold not reached"); 203 odebug << "mailHold not reached" << oendl;
204} 204}
205 205
206void MainWindow::slotSendQueued() 206void MainWindow::slotSendQueued()
207{ 207{
208} 208}
209 209
210void MainWindow::slotEditAccounts() 210void MainWindow::slotEditAccounts()
211{ 211{
212} 212}
213 213
214void MainWindow::slotComposeMail() 214void MainWindow::slotComposeMail()
215{ 215{
216} 216}
diff --git a/noncore/net/mail/nntpgroups.cpp b/noncore/net/mail/nntpgroups.cpp
index 8741c4b..3243ee3 100644
--- a/noncore/net/mail/nntpgroups.cpp
+++ b/noncore/net/mail/nntpgroups.cpp
@@ -32,31 +32,31 @@ void NNTPGroups::slotGetNG()
32 item->setOn( true ); 32 item->setOn( true );
33 subscribedGroupsNotListed.remove((*it)); 33 subscribedGroupsNotListed.remove((*it));
34 } 34 }
35 } 35 }
36} 36}
37 37
38void NNTPGroups::fillGroups() 38void NNTPGroups::fillGroups()
39{ 39{
40 if (!m_Account) return; 40 if (!m_Account) return;
41 subscribedGroups = m_Account->getGroups(); 41 subscribedGroups = m_Account->getGroups();
42 for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) { 42 for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) {
43 QCheckListItem *item; 43 QCheckListItem *item;
44 item = new QCheckListItem( GroupListView, (*it), QCheckListItem::CheckBox ); 44 item = new QCheckListItem( GroupListView, (*it), QCheckListItem::CheckBox );
45 item->setOn( true ); 45 item->setOn( true );
46 } 46 }
47} 47}
48 48
49void NNTPGroups::storeValues() 49void NNTPGroups::storeValues()
50{ 50{
51 if (!m_Account) return; 51 if (!m_Account) return;
52 QListViewItemIterator list_it( GroupListView ); 52 QListViewItemIterator list_it( GroupListView );
53 subscribedGroups.clear(); 53 subscribedGroups.clear();
54 for ( ; list_it.current(); ++list_it ) { 54 for ( ; list_it.current(); ++list_it ) {
55 if ( ( (QCheckListItem*)list_it.current() )->isOn() ) { 55 if ( ( (QCheckListItem*)list_it.current() )->isOn() ) {
56 qDebug(list_it.current()->text(0) ); 56 odebug << list_it.current()->text(0) << oendl;
57 subscribedGroups.append( list_it.current()->text(0) ); 57 subscribedGroups.append( list_it.current()->text(0) );
58 } 58 }
59 } 59 }
60 subscribedGroups+=subscribedGroupsNotListed; 60 subscribedGroups+=subscribedGroupsNotListed;
61 m_Account->setGroups( subscribedGroups ); 61 m_Account->setGroups( subscribedGroups );
62} 62}
diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp
index 5da2161..0669b5a 100644
--- a/noncore/net/mail/opiemail.cpp
+++ b/noncore/net/mail/opiemail.cpp
@@ -46,194 +46,194 @@ void OpieMail::appMessage(const QCString &msg, const QByteArray &data)
46 slotComposeMail(); 46 slotComposeMail();
47 } 47 }
48} 48}
49 49
50void OpieMail::slotwriteMail(const QString&name,const QString&email) 50void OpieMail::slotwriteMail(const QString&name,const QString&email)
51{ 51{
52 ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); 52 ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp );
53 if (!email.isEmpty()) 53 if (!email.isEmpty())
54 { 54 {
55 if (!name.isEmpty()) 55 if (!name.isEmpty())
56 { 56 {
57 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); 57 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">");
58 } 58 }
59 else 59 else
60 { 60 {
61 compose.setTo(email); 61 compose.setTo(email);
62 } 62 }
63 } 63 }
64 compose.slotAdjustColumns(); 64 compose.slotAdjustColumns();
65 QPEApplication::execDialog( &compose ); 65 QPEApplication::execDialog( &compose );
66} 66}
67 67
68void OpieMail::slotComposeMail() 68void OpieMail::slotComposeMail()
69{ 69{
70 qDebug( "Compose Mail" ); 70 odebug << "Compose Mail" << oendl;
71 slotwriteMail(0l,0l); 71 slotwriteMail(0l,0l);
72} 72}
73 73
74void OpieMail::slotSendQueued() 74void OpieMail::slotSendQueued()
75{ 75{
76 qDebug( "Send Queued" ); 76 odebug << "Send Queued" << oendl;
77 SMTPaccount *smtp = 0; 77 SMTPaccount *smtp = 0;
78 78
79 QList<Account> list = settings->getAccounts(); 79 QList<Account> list = settings->getAccounts();
80 QList<SMTPaccount> smtpList; 80 QList<SMTPaccount> smtpList;
81 smtpList.setAutoDelete(false); 81 smtpList.setAutoDelete(false);
82 Account *it; 82 Account *it;
83 for ( it = list.first(); it; it = list.next() ) 83 for ( it = list.first(); it; it = list.next() )
84 { 84 {
85 if ( it->getType() == MAILLIB::A_SMTP ) 85 if ( it->getType() == MAILLIB::A_SMTP )
86 { 86 {
87 smtp = static_cast<SMTPaccount *>(it); 87 smtp = static_cast<SMTPaccount *>(it);
88 smtpList.append(smtp); 88 smtpList.append(smtp);
89 } 89 }
90 } 90 }
91 if (smtpList.count()==0) 91 if (smtpList.count()==0)
92 { 92 {
93 QMessageBox::information(0,tr("Info"),tr("Define a smtp account first")); 93 QMessageBox::information(0,tr("Info"),tr("Define a smtp account first"));
94 return; 94 return;
95 } 95 }
96 if (smtpList.count()==1) 96 if (smtpList.count()==1)
97 { 97 {
98 smtp = smtpList.at(0); 98 smtp = smtpList.at(0);
99 } 99 }
100 else 100 else
101 { 101 {
102 smtp = 0; 102 smtp = 0;
103 selectsmtp selsmtp; 103 selectsmtp selsmtp;
104 selsmtp.setSelectionlist(&smtpList); 104 selsmtp.setSelectionlist(&smtpList);
105 if ( QPEApplication::execDialog( &selsmtp ) == QDialog::Accepted ) 105 if ( QPEApplication::execDialog( &selsmtp ) == QDialog::Accepted )
106 { 106 {
107 smtp = selsmtp.selected_smtp(); 107 smtp = selsmtp.selected_smtp();
108 } 108 }
109 } 109 }
110 if (smtp) 110 if (smtp)
111 { 111 {
112 SMTPwrapper * wrap = new SMTPwrapper(smtp); 112 SMTPwrapper * wrap = new SMTPwrapper(smtp);
113 if ( wrap->flushOutbox() ) 113 if ( wrap->flushOutbox() )
114 { 114 {
115 QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); 115 QMessageBox::information(0,tr("Info"),tr("Mail queue flushed"));
116 } 116 }
117 delete wrap; 117 delete wrap;
118 } 118 }
119} 119}
120 120
121void OpieMail::slotSearchMails() 121void OpieMail::slotSearchMails()
122{ 122{
123 qDebug( "Search Mails" ); 123 odebug << "Search Mails" << oendl;
124} 124}
125 125
126void OpieMail::slotEditSettings() 126void OpieMail::slotEditSettings()
127{ 127{
128 SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); 128 SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp );
129 QPEApplication::execDialog( &settingsDialog ); 129 QPEApplication::execDialog( &settingsDialog );
130} 130}
131 131
132void OpieMail::slotEditAccounts() 132void OpieMail::slotEditAccounts()
133{ 133{
134 qDebug( "Edit Accounts" ); 134 odebug << "Edit Accounts" << oendl;
135 EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp ); 135 EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp );
136 eaDialog.slotAdjustColumns(); 136 eaDialog.slotAdjustColumns();
137 QPEApplication::execDialog( &eaDialog ); 137 QPEApplication::execDialog( &eaDialog );
138 if ( settings ) delete settings; 138 if ( settings ) delete settings;
139 settings = new Settings(); 139 settings = new Settings();
140 140
141 folderView->populate( settings->getAccounts() ); 141 folderView->populate( settings->getAccounts() );
142} 142}
143 143
144void OpieMail::displayMail() 144void OpieMail::displayMail()
145{ 145{
146 QListViewItem*item = mailView->currentItem(); 146 QListViewItem*item = mailView->currentItem();
147 if (!item) return; 147 if (!item) return;
148 RecMailP mail = ((MailListViewItem*)item)->data(); 148 RecMailP mail = ((MailListViewItem*)item)->data();
149 RecBodyP body = folderView->fetchBody(mail); 149 RecBodyP body = folderView->fetchBody(mail);
150 ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp ); 150 ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp );
151 readMail.setBody( body ); 151 readMail.setBody( body );
152 readMail.setMail( mail ); 152 readMail.setMail( mail );
153 readMail.showMaximized(); 153 readMail.showMaximized();
154 readMail.exec(); 154 readMail.exec();
155 155
156 if ( readMail.deleted ) 156 if ( readMail.deleted )
157 { 157 {
158 folderView->refreshCurrent(); 158 folderView->refreshCurrent();
159 } 159 }
160 else 160 else
161 { 161 {
162 ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "" ) ); 162 ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "" ) );
163 } 163 }
164} 164}
165 165
166void OpieMail::slotDeleteMail() 166void OpieMail::slotDeleteMail()
167{ 167{
168 if (!mailView->currentItem()) return; 168 if (!mailView->currentItem()) return;
169 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); 169 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
170 if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 170 if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
171 { 171 {
172 mail->Wrapper()->deleteMail( mail ); 172 mail->Wrapper()->deleteMail( mail );
173 folderView->refreshCurrent(); 173 folderView->refreshCurrent();
174 } 174 }
175} 175}
176 176
177void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) 177void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int )
178{ 178{
179 if (!mailView->currentItem()) return; 179 if (!mailView->currentItem()) return;
180 MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); 180 MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType();
181 /* just the RIGHT button - or hold on pda */ 181 /* just the RIGHT button - or hold on pda */
182 if (button!=2) {return;} 182 if (button!=2) {return;}
183 qDebug("Event right/hold"); 183 odebug << "Event right/hold" << oendl;
184 if (!item) return; 184 if (!item) return;
185 QPopupMenu *m = new QPopupMenu(0); 185 QPopupMenu *m = new QPopupMenu(0);
186 if (m) 186 if (m)
187 { 187 {
188 if (mailtype==MAILLIB::A_NNTP) { 188 if (mailtype==MAILLIB::A_NNTP) {
189 m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); 189 m->insertItem(tr("Read this posting"),this,SLOT(displayMail()));
190// m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); 190// m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail()));
191 } else { 191 } else {
192 if (folderView->currentisDraft()) { 192 if (folderView->currentisDraft()) {
193 m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail())); 193 m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail()));
194 } 194 }
195 m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); 195 m->insertItem(tr("Read this mail"),this,SLOT(displayMail()));
196 m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); 196 m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail()));
197 m->insertItem(tr("Copy/Move this mail"),this,SLOT(slotMoveCopyMail())); 197 m->insertItem(tr("Copy/Move this mail"),this,SLOT(slotMoveCopyMail()));
198 } 198 }
199 m->setFocus(); 199 m->setFocus();
200 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); 200 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
201 delete m; 201 delete m;
202 } 202 }
203} 203}
204 204
205void OpieMail::slotShowFolders( bool show ) 205void OpieMail::slotShowFolders( bool show )
206{ 206{
207 qDebug( "Show Folders" ); 207 odebug << "Show Folders" << oendl;
208 if ( show && folderView->isHidden() ) 208 if ( show && folderView->isHidden() )
209 { 209 {
210 qDebug( "-> showing" ); 210 odebug << "-> showing" << oendl;
211 folderView->show(); 211 folderView->show();
212 } 212 }
213 else if ( !show && !folderView->isHidden() ) 213 else if ( !show && !folderView->isHidden() )
214 { 214 {
215 qDebug( "-> hiding" ); 215 odebug << "-> hiding" << oendl;
216 folderView->hide(); 216 folderView->hide();
217 } 217 }
218} 218}
219 219
220void OpieMail::refreshMailView(const QValueList<RecMailP>&list) 220void OpieMail::refreshMailView(const QValueList<RecMailP>&list)
221{ 221{
222 MailListViewItem*item = 0; 222 MailListViewItem*item = 0;
223 mailView->clear(); 223 mailView->clear();
224 224
225 QValueList<RecMailP>::ConstIterator it; 225 QValueList<RecMailP>::ConstIterator it;
226 for (it = list.begin(); it != list.end();++it) 226 for (it = list.begin(); it != list.end();++it)
227 { 227 {
228 item = new MailListViewItem(mailView,item); 228 item = new MailListViewItem(mailView,item);
229 item->storeData((*it)); 229 item->storeData((*it));
230 item->showEntry(); 230 item->showEntry();
231 } 231 }
232} 232}
233 233
234void OpieMail::mailLeftClicked(int button, QListViewItem *item,const QPoint&,int ) 234void OpieMail::mailLeftClicked(int button, QListViewItem *item,const QPoint&,int )
235{ 235{
236 /* just LEFT button - or tap with stylus on pda */ 236 /* just LEFT button - or tap with stylus on pda */
237 if (button!=1) return; 237 if (button!=1) return;
238 if (!item) return; 238 if (!item) return;
239 if (folderView->currentisDraft()) { 239 if (folderView->currentisDraft()) {
diff --git a/noncore/net/mail/taskbarapplet/mailapplet.cpp b/noncore/net/mail/taskbarapplet/mailapplet.cpp
index f672a36..cac9048 100644
--- a/noncore/net/mail/taskbarapplet/mailapplet.cpp
+++ b/noncore/net/mail/taskbarapplet/mailapplet.cpp
@@ -83,49 +83,49 @@ void MailApplet::startup() {
83 delete settings; 83 delete settings;
84 84
85 m_intervalMs = m_config->readNumEntry( "CheckEvery", 5 ) * 60000; 85 m_intervalMs = m_config->readNumEntry( "CheckEvery", 5 ) * 60000;
86 m_intervalTimer = new QTimer(); 86 m_intervalTimer = new QTimer();
87 m_intervalTimer->start( m_intervalMs ); 87 m_intervalTimer->start( m_intervalMs );
88 connect( m_intervalTimer, SIGNAL( timeout() ), this, SLOT( slotCheck() ) ); 88 connect( m_intervalTimer, SIGNAL( timeout() ), this, SLOT( slotCheck() ) );
89} 89}
90 90
91void MailApplet::slotCheck() { 91void MailApplet::slotCheck() {
92 // Check wether the check interval has been changed. 92 // Check wether the check interval has been changed.
93 int newIntervalMs = m_config->readNumEntry( "CheckEvery", 5 ) * 60000; 93 int newIntervalMs = m_config->readNumEntry( "CheckEvery", 5 ) * 60000;
94 if ( newIntervalMs != m_intervalMs ) { 94 if ( newIntervalMs != m_intervalMs ) {
95 m_intervalTimer->changeInterval( newIntervalMs ); 95 m_intervalTimer->changeInterval( newIntervalMs );
96 m_intervalMs = newIntervalMs; 96 m_intervalMs = newIntervalMs;
97 } 97 }
98 98
99 if (m_statusMail == 0) { 99 if (m_statusMail == 0) {
100 return; 100 return;
101 } 101 }
102 102
103 folderStat stat; 103 folderStat stat;
104 m_statusMail->check_current_stat( stat ); 104 m_statusMail->check_current_stat( stat );
105 int newMailsOld = m_newMails; 105 int newMailsOld = m_newMails;
106 m_newMails = stat.message_unseen; 106 m_newMails = stat.message_unseen;
107 qDebug( QString( "test %1" ).arg( m_newMails ) ); 107 odebug << QString( "test %1" ).arg( m_newMails ) << oendl;
108 if ( m_newMails > 0 && newMailsOld != m_newMails ) { 108 if ( m_newMails > 0 && newMailsOld != m_newMails ) {
109 ODevice *device = ODevice::inst(); 109 ODevice *device = ODevice::inst();
110 if ( isHidden() ) 110 if ( isHidden() )
111 show(); 111 show();
112 if ( m_config->readBoolEntry( "BlinkLed", true ) ) { 112 if ( m_config->readBoolEntry( "BlinkLed", true ) ) {
113 if ( !device->ledList().isEmpty() ) { 113 if ( !device->ledList().isEmpty() ) {
114 OLed led = ( device->ledList().contains( Led_Mail ) ) ? Led_Mail : device->ledList()[0]; 114 OLed led = ( device->ledList().contains( Led_Mail ) ) ? Led_Mail : device->ledList()[0];
115 device->setLedState( led, device->ledStateList( led ).contains( Led_BlinkSlow ) ? Led_BlinkSlow : Led_On ); 115 device->setLedState( led, device->ledStateList( led ).contains( Led_BlinkSlow ) ? Led_BlinkSlow : Led_On );
116 } 116 }
117 } 117 }
118 if ( m_config->readBoolEntry( "PlaySound", false ) ) 118 if ( m_config->readBoolEntry( "PlaySound", false ) )
119 device->playAlarmSound(); 119 device->playAlarmSound();
120 120
121 Config cfg( "mail" ); 121 Config cfg( "mail" );
122 cfg.setGroup( "Status" ); 122 cfg.setGroup( "Status" );
123 cfg.writeEntry( "newMails", m_newMails ); 123 cfg.writeEntry( "newMails", m_newMails );
124 QCopEnvelope env( "QPE/Pim", "newMails(int)" ); 124 QCopEnvelope env( "QPE/Pim", "newMails(int)" );
125 env << m_newMails; 125 env << m_newMails;
126 repaint( true ); 126 repaint( true );
127 127
128 } else { 128 } else {
129 ODevice *device = ODevice::inst(); 129 ODevice *device = ODevice::inst();
130 if ( !isHidden() ) 130 if ( !isHidden() )
131 hide(); 131 hide();
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp
index 156e11d..a574ea1 100644
--- a/noncore/net/mail/viewmail.cpp
+++ b/noncore/net/mail/viewmail.cpp
@@ -118,49 +118,49 @@ void ViewMail::setBody(const RecBodyP&body )
118 } 118 }
119 119
120 { 120 {
121 /* I did not found a method to make a CONTENT reset on a QTextStream 121 /* I did not found a method to make a CONTENT reset on a QTextStream
122 so I use this construct that the stream will re-constructed in each 122 so I use this construct that the stream will re-constructed in each
123 loop. To let it work, the textstream is packed into a own area of 123 loop. To let it work, the textstream is packed into a own area of
124 code is it will be destructed after finishing its small job. 124 code is it will be destructed after finishing its small job.
125 */ 125 */
126 QTextOStream o(&fsize); 126 QTextOStream o(&fsize);
127 if (w>0) o.precision(2); else o.precision(0); 127 if (w>0) o.precision(2); else o.precision(0);
128 o.setf(QTextStream::fixed); 128 o.setf(QTextStream::fixed);
129 o << s << " " << q << "Byte"; 129 o << s << " " << q << "Byte";
130 } 130 }
131 131
132 curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body->Description()->Positionlist()); 132 curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body->Description()->Positionlist());
133 QString filename = ""; 133 QString filename = "";
134 134
135 for (unsigned int i = 0; i < body->Parts().count();++i) 135 for (unsigned int i = 0; i < body->Parts().count();++i)
136 { 136 {
137 filename = ""; 137 filename = "";
138 type = body->Parts()[i]->Type()+"/"+body->Parts()[i]->Subtype(); 138 type = body->Parts()[i]->Type()+"/"+body->Parts()[i]->Subtype();
139 part_plist_t::ConstIterator it = body->Parts()[i]->Parameters().begin(); 139 part_plist_t::ConstIterator it = body->Parts()[i]->Parameters().begin();
140 for (;it!=body->Parts()[i]->Parameters().end();++it) 140 for (;it!=body->Parts()[i]->Parameters().end();++it)
141 { 141 {
142 qDebug(it.key()); 142 odebug << it.key() << oendl;
143 if (it.key().lower()=="name") 143 if (it.key().lower()=="name")
144 { 144 {
145 filename=it.data(); 145 filename=it.data();
146 } 146 }
147 } 147 }
148 s = body->Parts()[i]->Size(); 148 s = body->Parts()[i]->Size();
149 w = 0; 149 w = 0;
150 while (s>1024) 150 while (s>1024)
151 { 151 {
152 s/=1024; 152 s/=1024;
153 ++w; 153 ++w;
154 if (w>=2) break; 154 if (w>=2) break;
155 } 155 }
156 switch(w) 156 switch(w)
157 { 157 {
158 case 1: 158 case 1:
159 q="k"; 159 q="k";
160 break; 160 break;
161 case 2: 161 case 2:
162 q="M"; 162 q="M";
163 break; 163 break;
164 default: 164 default:
165 q=""; 165 q="";
166 break; 166 break;