summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/accountview.cpp77
-rw-r--r--noncore/net/mail/accountview.h6
-rw-r--r--noncore/net/mail/libmailwrapper/mhwrapper.cpp68
-rw-r--r--noncore/net/mail/libmailwrapper/mhwrapper.h2
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.cpp43
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.h1
6 files changed, 157 insertions, 40 deletions
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp
index 62cbf62..3048e49 100644
--- a/noncore/net/mail/accountview.cpp
+++ b/noncore/net/mail/accountview.cpp
@@ -239,13 +239,12 @@ void IMAPviewItem::removeChilds()
239 QListViewItem *child = firstChild(); 239 QListViewItem *child = firstChild();
240 while ( child ) { 240 while ( child ) {
241 QListViewItem *tmp = child; 241 QListViewItem *tmp = child;
242 child = child->nextSibling(); 242 child = child->nextSibling();
243 delete tmp; 243 delete tmp;
244 } 244 }
245
246} 245}
247 246
248const QStringList&IMAPviewItem::subFolders() 247const QStringList&IMAPviewItem::subFolders()
249{ 248{
250 return currentFolders; 249 return currentFolders;
251} 250}
@@ -703,53 +702,74 @@ void AccountView::downloadMails(Folder*fromFolder,AbstractMail*fromWrapper)
703 refreshCurrent(); 702 refreshCurrent();
704} 703}
705 704
706/** 705/**
707 * MH Account stuff 706 * MH Account stuff
708 */ 707 */
709 708/* MH is a little bit different - the top folder can contains messages other than in IMAP and
709 POP3 and MBOX */
710MHviewItem::MHviewItem( const QString&aPath, AccountView *parent ) 710MHviewItem::MHviewItem( const QString&aPath, AccountView *parent )
711 : AccountViewItem( parent ) 711 : AccountViewItem( parent )
712{ 712{
713 m_Path = aPath; 713 m_Path = aPath;
714 /* be carefull - the space within settext is wanted - thats why the string twice */ 714 /* be carefull - the space within settext is wanted - thats why the string twice */
715 wrapper = AbstractMail::getWrapper( m_Path,"Local Folders"); 715 wrapper = AbstractMail::getWrapper( m_Path,"Local Folders");
716 setPixmap( 0, PIXMAP_LOCALFOLDER ); 716 setPixmap( 0, PIXMAP_LOCALFOLDER );
717 setText( 0, " Local Folders" ); 717 setText( 0, " Local Folders" );
718 setOpen( true ); 718 setOpen( true );
719 folder = 0;
719} 720}
720 721
721MHviewItem::~MHviewItem() 722MHviewItem::~MHviewItem()
722{ 723{
723 delete wrapper; 724 delete wrapper;
725 if (folder) delete folder;
724} 726}
725 727
726AbstractMail *MHviewItem::getWrapper() 728AbstractMail *MHviewItem::getWrapper()
727{ 729{
728 return wrapper; 730 return wrapper;
729} 731}
730 732
731void MHviewItem::refresh( QList<RecMail> & ) 733void MHviewItem::refresh( QList<RecMail> & target)
732{ 734{
733 refresh(false); 735 refresh(false);
736 getWrapper()->listMessages( "",target );
734} 737}
735 738
736void MHviewItem::refresh(bool force) 739void MHviewItem::removeChilds()
737{ 740{
738 if (childCount()>0 && force==false) return;
739 QList<Folder> *folders = wrapper->listFolders();
740 QListViewItem *child = firstChild(); 741 QListViewItem *child = firstChild();
741 while ( child ) { 742 while ( child ) {
742 QListViewItem *tmp = child; 743 QListViewItem *tmp = child;
743 child = child->nextSibling(); 744 child = child->nextSibling();
744 delete tmp; 745 delete tmp;
745 } 746 }
747}
748
749void MHviewItem::refresh(bool force)
750{
751 if (childCount()>0 && force==false) return;
752 removeChilds();
753 QList<Folder> *folders = wrapper->listFolders();
746 Folder *it; 754 Folder *it;
747 QListViewItem*item = 0; 755 MHfolderItem*item = 0;
756 MHfolderItem*pmaster = 0;
757 QString fname = "";
748 for ( it = folders->first(); it; it = folders->next() ) { 758 for ( it = folders->first(); it; it = folders->next() ) {
749 item = new MHfolderItem( it, this , item ); 759 fname = it->getDisplayName();
760 /* this folder itself */
761 if (fname=="/") {
762 folder = it;
763 continue;
764 }
765 if (pmaster) {
766 item = new MHfolderItem( it, pmaster, item, this );
767 } else {
768 item = new MHfolderItem( it, this , item );
769 }
750 item->setSelectable(it->may_select()); 770 item->setSelectable(it->may_select());
751 } 771 }
752 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 772 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
753 folders->setAutoDelete(false); 773 folders->setAutoDelete(false);
754 delete folders; 774 delete folders;
755} 775}
@@ -763,12 +783,14 @@ RecBody MHviewItem::fetchBody( const RecMail &mail )
763QPopupMenu * MHviewItem::getContextMenu() 783QPopupMenu * MHviewItem::getContextMenu()
764{ 784{
765 QPopupMenu *m = new QPopupMenu(0); 785 QPopupMenu *m = new QPopupMenu(0);
766 if (m) { 786 if (m) {
767 m->insertItem(QObject::tr("Refresh folder list",contextName),0); 787 m->insertItem(QObject::tr("Refresh folder list",contextName),0);
768 m->insertItem(QObject::tr("Create new folder",contextName),1); 788 m->insertItem(QObject::tr("Create new folder",contextName),1);
789 m->insertItem(QObject::tr("Delete all mails",contextName),2);
790 m->insertItem(QObject::tr("Move/Copie all mails",contextName),3);
769 } 791 }
770 return m; 792 return m;
771} 793}
772 794
773void MHviewItem::createFolder() 795void MHviewItem::createFolder()
774{ 796{
@@ -779,16 +801,24 @@ void MHviewItem::createFolder()
779 if (wrapper->createMbox(ndir)) { 801 if (wrapper->createMbox(ndir)) {
780 refresh(true); 802 refresh(true);
781 } 803 }
782 } 804 }
783} 805}
784 806
807void MHviewItem::downloadMails()
808{
809 AccountView*bl = accountView();
810 if (!bl) return;
811 bl->downloadMails(folder,getWrapper());
812}
813
785QStringList MHviewItem::subFolders() 814QStringList MHviewItem::subFolders()
786{ 815{
787 QStringList result; 816 QStringList result;
788 QListViewItem *child = firstChild(); 817 QListViewItem *child = firstChild();
818 result.append("/");
789 while ( child ) { 819 while ( child ) {
790 MHfolderItem *tmp = (MHfolderItem*)child; 820 MHfolderItem *tmp = (MHfolderItem*)child;
791 child = child->nextSibling(); 821 child = child->nextSibling();
792 result.append(tmp->getFolder()->getDisplayName()); 822 result.append(tmp->getFolder()->getDisplayName());
793 } 823 }
794 qDebug("Size of result: %i",result.count()); 824 qDebug("Size of result: %i",result.count());
@@ -801,12 +831,18 @@ void MHviewItem::contextMenuSelected(int which)
801 case 0: 831 case 0:
802 refresh(true); 832 refresh(true);
803 break; 833 break;
804 case 1: 834 case 1:
805 createFolder(); 835 createFolder();
806 break; 836 break;
837 case 2:
838 deleteAllMail(getWrapper(),folder);
839 break;
840 case 3:
841 downloadMails();
842 break;
807 default: 843 default:
808 break; 844 break;
809 } 845 }
810} 846}
811 847
812MHfolderItem::~MHfolderItem() 848MHfolderItem::~MHfolderItem()
@@ -816,20 +852,37 @@ MHfolderItem::~MHfolderItem()
816 852
817MHfolderItem::MHfolderItem( Folder *folderInit, MHviewItem *parent , QListViewItem*after ) 853MHfolderItem::MHfolderItem( Folder *folderInit, MHviewItem *parent , QListViewItem*after )
818 : AccountViewItem( parent,after ) 854 : AccountViewItem( parent,after )
819{ 855{
820 folder = folderInit; 856 folder = folderInit;
821 mbox = parent; 857 mbox = parent;
822 if (folder->getDisplayName().lower() == "outgoing") { 858 initName();
859}
860
861MHfolderItem::MHfolderItem( Folder *folderInit, MHfolderItem *parent, QListViewItem*after, MHviewItem*master)
862 : AccountViewItem( parent,after )
863{
864 folder = folderInit;
865 mbox = master;
866 initName();
867}
868
869void MHfolderItem::initName()
870{
871 QString bName = folder->getDisplayName();
872 if (bName.startsWith("/")&&bName.length()>1) {
873 bName.replace(0,1,"");
874 }
875 if (bName.lower() == "outgoing") {
823 setPixmap( 0, PIXMAP_OUTBOXFOLDER ); 876 setPixmap( 0, PIXMAP_OUTBOXFOLDER );
824 } else if (folder->getDisplayName().lower() == "inbox") { 877 } else if (bName.lower() == "inbox") {
825 setPixmap( 0, PIXMAP_INBOXFOLDER); 878 setPixmap( 0, PIXMAP_INBOXFOLDER);
826 } else { 879 } else {
827 setPixmap( 0, PIXMAP_MBOXFOLDER ); 880 setPixmap( 0, PIXMAP_MBOXFOLDER );
828 } 881 }
829 setText( 0, folder->getDisplayName() ); 882 setText( 0, bName );
830} 883}
831 884
832Folder*MHfolderItem::getFolder() 885Folder*MHfolderItem::getFolder()
833{ 886{
834 return folder; 887 return folder;
835} 888}
@@ -870,12 +923,13 @@ QPopupMenu * MHfolderItem::getContextMenu()
870{ 923{
871 QPopupMenu *m = new QPopupMenu(0); 924 QPopupMenu *m = new QPopupMenu(0);
872 if (m) { 925 if (m) {
873 m->insertItem(QObject::tr("Delete all mails",contextName),0); 926 m->insertItem(QObject::tr("Delete all mails",contextName),0);
874 m->insertItem(QObject::tr("Delete folder",contextName),1); 927 m->insertItem(QObject::tr("Delete folder",contextName),1);
875 m->insertItem(QObject::tr("Move/Copie all mails",contextName),2); 928 m->insertItem(QObject::tr("Move/Copie all mails",contextName),2);
929 m->insertItem(QObject::tr("Create new folder",contextName),3);
876 } 930 }
877 return m; 931 return m;
878} 932}
879 933
880void MHfolderItem::downloadMails() 934void MHfolderItem::downloadMails()
881{ 935{
@@ -897,6 +951,7 @@ void MHfolderItem::contextMenuSelected(int which)
897 downloadMails(); 951 downloadMails();
898 break; 952 break;
899 default: 953 default:
900 break; 954 break;
901 } 955 }
902} 956}
957
diff --git a/noncore/net/mail/accountview.h b/noncore/net/mail/accountview.h
index f5a2973..60e2b4b 100644
--- a/noncore/net/mail/accountview.h
+++ b/noncore/net/mail/accountview.h
@@ -131,33 +131,37 @@ public:
131 virtual QPopupMenu * getContextMenu(); 131 virtual QPopupMenu * getContextMenu();
132 virtual void contextMenuSelected(int); 132 virtual void contextMenuSelected(int);
133 QStringList subFolders(); 133 QStringList subFolders();
134 virtual void refresh(bool force=false); 134 virtual void refresh(bool force=false);
135 135
136protected: 136protected:
137 void downloadMails();
138 void removeChilds();
137 virtual void createFolder(); 139 virtual void createFolder();
138 QString m_Path; 140 QString m_Path;
139 AbstractMail *wrapper; 141 AbstractMail *wrapper;
140 142 Folder *folder;
141}; 143};
142 144
143class MHfolderItem : public AccountViewItem 145class MHfolderItem : public AccountViewItem
144{ 146{
145 147
146public: 148public:
147 MHfolderItem( Folder *folder, MHviewItem *parent , QListViewItem*after ); 149 MHfolderItem( Folder *folder, MHviewItem *parent , QListViewItem*after );
150 MHfolderItem( Folder *folder, MHfolderItem *parent, QListViewItem*after, MHviewItem*master);
148 virtual ~MHfolderItem(); 151 virtual ~MHfolderItem();
149 virtual void refresh(QList<RecMail>&); 152 virtual void refresh(QList<RecMail>&);
150 virtual RecBody fetchBody(const RecMail&); 153 virtual RecBody fetchBody(const RecMail&);
151 virtual QPopupMenu * getContextMenu(); 154 virtual QPopupMenu * getContextMenu();
152 virtual void contextMenuSelected(int); 155 virtual void contextMenuSelected(int);
153 virtual Folder*getFolder(); 156 virtual Folder*getFolder();
154 157
155protected: 158protected:
156 void downloadMails(); 159 void downloadMails();
157 virtual void deleteFolder(); 160 virtual void deleteFolder();
161 void initName();
158 Folder *folder; 162 Folder *folder;
159 MHviewItem *mbox; 163 MHviewItem *mbox;
160}; 164};
161 165
162class AccountView : public QListView 166class AccountView : public QListView
163{ 167{
diff --git a/noncore/net/mail/libmailwrapper/mhwrapper.cpp b/noncore/net/mail/libmailwrapper/mhwrapper.cpp
index 5adba55..512f778 100644
--- a/noncore/net/mail/libmailwrapper/mhwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/mhwrapper.cpp
@@ -328,6 +328,74 @@ const QString&MHwrapper::getType()const
328} 328}
329 329
330const QString&MHwrapper::getName()const 330const QString&MHwrapper::getName()const
331{ 331{
332 return MHName; 332 return MHName;
333} 333}
334void MHwrapper::mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
335{
336 init_storage();
337 if (!m_storage) {
338 return;
339 }
340 if (targetWrapper != this) {
341 qDebug("Using generic");
342 Genericwrapper::mvcpMail(mail,targetFolder,targetWrapper,moveit);
343 return;
344 }
345 qDebug("Using internal routines for move/copy");
346 QString tf = buildPath(targetFolder);
347 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail.getMbox().latin1());
348 if (r != MAIL_NO_ERROR) {
349 qDebug("Error selecting source mailbox");
350 return;
351 }
352 if (moveit) {
353 r = mailsession_move_message(m_storage->sto_session,mail.getNumber(),(char*)tf.latin1());
354 } else {
355 r = mailsession_copy_message(m_storage->sto_session,mail.getNumber(),(char*)tf.latin1());
356 }
357 if (r != MAIL_NO_ERROR) {
358 qDebug("Error copy/moving mail internal (%i)",r);
359 }
360}
361
362void MHwrapper::mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
363{
364 init_storage();
365 if (!m_storage) {
366 return;
367 }
368 if (targetWrapper != this) {
369 qDebug("Using generic");
370 Genericwrapper::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit);
371 return;
372 }
373 if (!fromFolder) return;
374 int r = mailsession_select_folder(m_storage->sto_session,(char*)fromFolder->getName().latin1());
375 if (r!=MAIL_NO_ERROR) {
376 qDebug("error selecting source folder!");
377 return;
378 }
379 QString tf = buildPath(targetFolder);
380 mailmessage_list*l=0;
381 r = mailsession_get_messages_list(m_storage->sto_session,&l);
382 if (r != MAIL_NO_ERROR) {
383 qDebug("Error message list");
384 }
385 unsigned j = 0;
386 for(unsigned int i = 0 ; l!= 0 && i < carray_count(l->msg_tab) ; ++i) {
387 mailmessage * msg;
388 msg = (mailmessage*)carray_get(l->msg_tab, i);
389 j = msg->msg_index;
390 if (moveit) {
391 r = mailsession_move_message(m_storage->sto_session,j,(char*)tf.latin1());
392 } else {
393 r = mailsession_copy_message(m_storage->sto_session,j,(char*)tf.latin1());
394 }
395 if (r != MAIL_NO_ERROR) {
396 qDebug("Error copy/moving mail internal (%i)",r);
397 break;
398 }
399 }
400 if (l) mailmessage_list_free(l);
401}
diff --git a/noncore/net/mail/libmailwrapper/mhwrapper.h b/noncore/net/mail/libmailwrapper/mhwrapper.h
index 7f028b4..79dec30 100644
--- a/noncore/net/mail/libmailwrapper/mhwrapper.h
+++ b/noncore/net/mail/libmailwrapper/mhwrapper.h
@@ -19,12 +19,14 @@ public:
19 virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); 19 virtual void listMessages(const QString & mailbox, QList<RecMail> &target );
20 virtual QList<Folder>* listFolders(); 20 virtual QList<Folder>* listFolders();
21 virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); 21 virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX");
22 22
23 virtual void deleteMail(const RecMail&mail); 23 virtual void deleteMail(const RecMail&mail);
24 virtual void answeredMail(const RecMail&mail); 24 virtual void answeredMail(const RecMail&mail);
25 virtual void mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit);
26 virtual void mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit);
25 27
26 virtual int createMbox(const QString&folder,const Folder*f=0,const QString&d="",bool s=false); 28 virtual int createMbox(const QString&folder,const Folder*f=0,const QString&d="",bool s=false);
27 virtual int deleteMbox(const Folder*); 29 virtual int deleteMbox(const Folder*);
28 30
29 virtual void storeMessage(const char*msg,size_t length, const QString&folder); 31 virtual void storeMessage(const char*msg,size_t length, const QString&folder);
30 32
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
index f5eca4a..14c2059 100644
--- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
@@ -11,13 +11,12 @@
11#define HARD_MSG_SIZE_LIMIT 5242880 11#define HARD_MSG_SIZE_LIMIT 5242880
12 12
13POP3wrapper::POP3wrapper( POP3account *a ) 13POP3wrapper::POP3wrapper( POP3account *a )
14: Genericwrapper() { 14: Genericwrapper() {
15 account = a; 15 account = a;
16 m_pop3 = NULL; 16 m_pop3 = NULL;
17 m_folder = NULL;
18 msgTempName = a->getFileName()+"_msg_cache"; 17 msgTempName = a->getFileName()+"_msg_cache";
19 last_msg_id = 0; 18 last_msg_id = 0;
20} 19}
21 20
22POP3wrapper::~POP3wrapper() { 21POP3wrapper::~POP3wrapper() {
23 logout(); 22 logout();
@@ -55,13 +54,13 @@ RecBody POP3wrapper::fetchBody( const RecMail &mail ) {
55 if (mail.getNumber()!=last_msg_id) { 54 if (mail.getNumber()!=last_msg_id) {
56 if (msg_cache.exists()) { 55 if (msg_cache.exists()) {
57 msg_cache.remove(); 56 msg_cache.remove();
58 } 57 }
59 msg_cache.open(IO_ReadWrite|IO_Truncate); 58 msg_cache.open(IO_ReadWrite|IO_Truncate);
60 last_msg_id = mail.getNumber(); 59 last_msg_id = mail.getNumber();
61 err = mailsession_get_message(m_folder->fld_session, mail.getNumber(), &mailmsg); 60 err = mailsession_get_message(m_pop3->sto_session, mail.getNumber(), &mailmsg);
62 err = mailmessage_fetch(mailmsg,&message,&length); 61 err = mailmessage_fetch(mailmsg,&message,&length);
63 msg_cache.writeBlock(message,length); 62 msg_cache.writeBlock(message,length);
64 } else { 63 } else {
65 QString msg=""; 64 QString msg="";
66 msg_cache.open(IO_ReadOnly); 65 msg_cache.open(IO_ReadOnly);
67 message = new char[4096]; 66 message = new char[4096];
@@ -91,23 +90,25 @@ RecBody POP3wrapper::fetchBody( const RecMail &mail ) {
91 if (message) 90 if (message)
92 free(message); 91 free(message);
93 92
94 return body; 93 return body;
95} 94}
96 95
97void POP3wrapper::listMessages(const QString &, QList<RecMail> &target ) { 96void POP3wrapper::listMessages(const QString &, QList<RecMail> &target )
97{
98 login(); 98 login();
99 if (!m_pop3) 99 if (!m_pop3)
100 return; 100 return;
101 uint32_t res_messages,res_recent,res_unseen; 101 uint32_t res_messages,res_recent,res_unseen;
102 mailsession_status_folder(m_folder->fld_session,"INBOX",&res_messages,&res_recent,&res_unseen); 102 mailsession_status_folder(m_pop3->sto_session,"INBOX",&res_messages,&res_recent,&res_unseen);
103 parseList(target,m_folder->fld_session,"INBOX"); 103 parseList(target,m_pop3->sto_session,"INBOX");
104 Global::statusMessage( tr("Mailbox contains %1 mail(s)").arg(res_messages)); 104 Global::statusMessage( tr("Mailbox contains %1 mail(s)").arg(res_messages));
105} 105}
106 106
107void POP3wrapper::login() { 107void POP3wrapper::login()
108{
108 if (account->getOffline()) 109 if (account->getOffline())
109 return; 110 return;
110 /* we'll hold the line */ 111 /* we'll hold the line */
111 if ( m_pop3 != NULL ) 112 if ( m_pop3 != NULL )
112 return; 113 return;
113 114
@@ -154,38 +155,26 @@ void POP3wrapper::login() {
154 //(ssl?CONNECTION_TYPE_TLS:CONNECTION_TYPE_PLAIN); 155 //(ssl?CONNECTION_TYPE_TLS:CONNECTION_TYPE_PLAIN);
155 156
156 pop3_mailstorage_init(m_pop3,(char*)server, port, NULL, conntype, POP3_AUTH_TYPE_PLAIN, 157 pop3_mailstorage_init(m_pop3,(char*)server, port, NULL, conntype, POP3_AUTH_TYPE_PLAIN,
157 (char*)user,(char*)pass,0,0,0); 158 (char*)user,(char*)pass,0,0,0);
158 159
159 160
160 161 err = mailstorage_connect(m_pop3);
161 m_folder = mailfolder_new(m_pop3, NULL, NULL);
162
163 if (m_folder==0) {
164 Global::statusMessage(tr("Error initializing folder"));
165 mailstorage_free(m_pop3);
166 m_pop3 = NULL;
167 return;
168 }
169 err = mailfolder_connect(m_folder);
170 if (err != MAIL_NO_ERROR) { 162 if (err != MAIL_NO_ERROR) {
171 qDebug( QString( "FEHLERNUMMER %1" ).arg( err ) ); 163 qDebug( QString( "FEHLERNUMMER %1" ).arg( err ) );
172 Global::statusMessage(tr("Error initializing folder")); 164 Global::statusMessage(tr("Error initializing folder"));
173 mailfolder_free(m_folder);
174 m_folder = 0;
175 mailstorage_free(m_pop3); 165 mailstorage_free(m_pop3);
176 m_pop3 = 0; 166 m_pop3 = 0;
177 } 167 }
178} 168}
179 169
180void POP3wrapper::logout() { 170void POP3wrapper::logout()
171{
181 int err = MAILPOP3_NO_ERROR; 172 int err = MAILPOP3_NO_ERROR;
182 if ( m_pop3 == NULL ) 173 if ( m_pop3 == NULL )
183 return; 174 return;
184 mailfolder_free(m_folder);
185 m_folder = 0;
186 mailstorage_free(m_pop3); 175 mailstorage_free(m_pop3);
187 m_pop3 = 0; 176 m_pop3 = 0;
188} 177}
189 178
190 179
191QList<Folder>* POP3wrapper::listFolders() { 180QList<Folder>* POP3wrapper::listFolders() {
@@ -197,13 +186,13 @@ QList<Folder>* POP3wrapper::listFolders() {
197} 186}
198 187
199void POP3wrapper::deleteMail(const RecMail&mail) { 188void POP3wrapper::deleteMail(const RecMail&mail) {
200 login(); 189 login();
201 if (!m_pop3) 190 if (!m_pop3)
202 return; 191 return;
203 int err = mailsession_remove_message(m_folder->fld_session,mail.getNumber()); 192 int err = mailsession_remove_message(m_pop3->sto_session,mail.getNumber());
204 if (err != MAIL_NO_ERROR) { 193 if (err != MAIL_NO_ERROR) {
205 Global::statusMessage(tr("error deleting mail")); 194 Global::statusMessage(tr("error deleting mail"));
206 } 195 }
207} 196}
208 197
209void POP3wrapper::answeredMail(const RecMail&) {} 198void POP3wrapper::answeredMail(const RecMail&) {}
@@ -212,19 +201,19 @@ int POP3wrapper::deleteAllMail(const Folder*) {
212 login(); 201 login();
213 if (!m_pop3) 202 if (!m_pop3)
214 return 0; 203 return 0;
215 int res = 1; 204 int res = 1;
216 205
217 uint32_t result = 0; 206 uint32_t result = 0;
218 int err = mailsession_messages_number(m_folder->fld_session,NULL,&result); 207 int err = mailsession_messages_number(m_pop3->sto_session,NULL,&result);
219 if (err != MAIL_NO_ERROR) { 208 if (err != MAIL_NO_ERROR) {
220 Global::statusMessage(tr("Error getting folder info")); 209 Global::statusMessage(tr("Error getting folder info"));
221 return 0; 210 return 0;
222 } 211 }
223 for (unsigned int i = 0; i < result; ++i) { 212 for (unsigned int i = 0; i < result; ++i) {
224 err = mailsession_remove_message(m_folder->fld_session,i+1); 213 err = mailsession_remove_message(m_pop3->sto_session,i+1);
225 if (err != MAIL_NO_ERROR) { 214 if (err != MAIL_NO_ERROR) {
226 Global::statusMessage(tr("Error deleting mail %1").arg(i+1)); 215 Global::statusMessage(tr("Error deleting mail %1").arg(i+1));
227 res=0; 216 res=0;
228 } 217 }
229 break; 218 break;
230 } 219 }
@@ -235,22 +224,22 @@ void POP3wrapper::statusFolder(folderStat&target_stat,const QString&) {
235 login(); 224 login();
236 target_stat.message_count = 0; 225 target_stat.message_count = 0;
237 target_stat.message_unseen = 0; 226 target_stat.message_unseen = 0;
238 target_stat.message_recent = 0; 227 target_stat.message_recent = 0;
239 if (!m_pop3) 228 if (!m_pop3)
240 return; 229 return;
241 int r = mailsession_status_folder(m_folder->fld_session,0,&target_stat.message_count, 230 int r = mailsession_status_folder(m_pop3->sto_session,0,&target_stat.message_count,
242 &target_stat.message_recent,&target_stat.message_unseen); 231 &target_stat.message_recent,&target_stat.message_unseen);
243} 232}
244 233
245encodedString* POP3wrapper::fetchRawBody(const RecMail&mail) { 234encodedString* POP3wrapper::fetchRawBody(const RecMail&mail) {
246 char*target=0; 235 char*target=0;
247 size_t length=0; 236 size_t length=0;
248 encodedString*res = 0; 237 encodedString*res = 0;
249 mailmessage * mailmsg = 0; 238 mailmessage * mailmsg = 0;
250 int err = mailsession_get_message(m_folder->fld_session, mail.getNumber(), &mailmsg); 239 int err = mailsession_get_message(m_pop3->sto_session, mail.getNumber(), &mailmsg);
251 err = mailmessage_fetch(mailmsg,&target,&length); 240 err = mailmessage_fetch(mailmsg,&target,&length);
252 if (mailmsg) 241 if (mailmsg)
253 mailmessage_free(mailmsg); 242 mailmessage_free(mailmsg);
254 if (target) { 243 if (target) {
255 res = new encodedString(target,length); 244 res = new encodedString(target,length);
256 } 245 }
@@ -258,9 +247,9 @@ encodedString* POP3wrapper::fetchRawBody(const RecMail&mail) {
258} 247}
259 248
260const QString&POP3wrapper::getType()const { 249const QString&POP3wrapper::getType()const {
261 return account->getType(); 250 return account->getType();
262} 251}
263 252
264const QString&POP3wrapper::getName()const { 253const QString&POP3wrapper::getName()const{
265 return account->getAccountName(); 254 return account->getAccountName();
266} 255}
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.h b/noncore/net/mail/libmailwrapper/pop3wrapper.h
index d2b708d..a24b9cf 100644
--- a/noncore/net/mail/libmailwrapper/pop3wrapper.h
+++ b/noncore/net/mail/libmailwrapper/pop3wrapper.h
@@ -34,10 +34,9 @@ public:
34 static void pop3_progress( size_t current, size_t maximum ); 34 static void pop3_progress( size_t current, size_t maximum );
35 35
36protected: 36protected:
37 void login(); 37 void login();
38 POP3account *account; 38 POP3account *account;
39 mailstorage*m_pop3; 39 mailstorage*m_pop3;
40 mailfolder*m_folder;
41}; 40};
42 41
43#endif 42#endif