Diffstat (limited to 'noncore/net/mail/libmailwrapper') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/mail/libmailwrapper/abstractmail.cpp | 19 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/abstractmail.h | 2 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.cpp | 31 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.h | 1 |
4 files changed, 53 insertions, 0 deletions
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.cpp b/noncore/net/mail/libmailwrapper/abstractmail.cpp index 3dd2fce..4b4c728 100644 --- a/noncore/net/mail/libmailwrapper/abstractmail.cpp +++ b/noncore/net/mail/libmailwrapper/abstractmail.cpp | |||
@@ -104,3 +104,22 @@ QString AbstractMail::defaultLocalfolder() | |||
104 | void AbstractMail::deleteMails(const QString &,QList<RecMail> &) | 104 | void AbstractMail::deleteMails(const QString &,QList<RecMail> &) |
105 | { | 105 | { |
106 | } | 106 | } |
107 | |||
108 | void AbstractMail::mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) | ||
109 | { | ||
110 | QList<RecMail> t; | ||
111 | listMessages(fromFolder->getName(),t); | ||
112 | encodedString*st = 0; | ||
113 | while (t.count()>0) { | ||
114 | RecMail*r = t.at(0); | ||
115 | st = fetchRawBody(*r); | ||
116 | if (st) { | ||
117 | targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder); | ||
118 | delete st; | ||
119 | } | ||
120 | t.removeFirst(); | ||
121 | } | ||
122 | if (moveit) { | ||
123 | deleteAllMail(fromFolder); | ||
124 | } | ||
125 | } | ||
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.h b/noncore/net/mail/libmailwrapper/abstractmail.h index 15d83cb..8debaae 100644 --- a/noncore/net/mail/libmailwrapper/abstractmail.h +++ b/noncore/net/mail/libmailwrapper/abstractmail.h | |||
@@ -35,6 +35,8 @@ public: | |||
35 | virtual int deleteMbox(const Folder*)=0; | 35 | virtual int deleteMbox(const Folder*)=0; |
36 | virtual void storeMessage(const char*msg,size_t length, const QString&folder)=0; | 36 | virtual void storeMessage(const char*msg,size_t length, const QString&folder)=0; |
37 | 37 | ||
38 | virtual void mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); | ||
39 | |||
38 | virtual void cleanMimeCache(){}; | 40 | virtual void cleanMimeCache(){}; |
39 | /* mail box methods */ | 41 | /* mail box methods */ |
40 | /* parameter is the box to create. | 42 | /* parameter is the box to create. |
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp index bb74de9..23c678b 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp | |||
@@ -1009,6 +1009,7 @@ const QString&IMAPwrapper::getType()const | |||
1009 | 1009 | ||
1010 | const QString&IMAPwrapper::getName()const | 1010 | const QString&IMAPwrapper::getName()const |
1011 | { | 1011 | { |
1012 | qDebug("Get name: %s",account->getAccountName().latin1()); | ||
1012 | return account->getAccountName(); | 1013 | return account->getAccountName(); |
1013 | } | 1014 | } |
1014 | 1015 | ||
@@ -1018,3 +1019,33 @@ encodedString* IMAPwrapper::fetchRawBody(const RecMail&mail) | |||
1018 | QValueList<int> path; | 1019 | QValueList<int> path; |
1019 | return fetchRawPart(mail,path,false); | 1020 | return fetchRawPart(mail,path,false); |
1020 | } | 1021 | } |
1022 | |||
1023 | void IMAPwrapper::mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) | ||
1024 | { | ||
1025 | qDebug("mvcp mail imap"); | ||
1026 | if (targetWrapper != this) { | ||
1027 | AbstractMail::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit); | ||
1028 | qDebug("Using generic"); | ||
1029 | return; | ||
1030 | } | ||
1031 | qDebug("Using internal"); | ||
1032 | mailimap_set *set = 0; | ||
1033 | |||
1034 | int err = mailimap_select( m_imap, fromFolder->getName().latin1()); | ||
1035 | if ( err != MAILIMAP_NO_ERROR ) { | ||
1036 | Global::statusMessage(tr("error selecting mailbox: %1").arg(m_imap->imap_response)); | ||
1037 | return; | ||
1038 | } | ||
1039 | |||
1040 | int last = m_imap->imap_selection_info->sel_exists; | ||
1041 | set = mailimap_set_new_interval( 1, last ); | ||
1042 | err = mailimap_copy(m_imap,set,targetFolder.latin1()); | ||
1043 | if ( err != MAILIMAP_NO_ERROR ) { | ||
1044 | Global::statusMessage(tr("error copy mails: %1").arg(m_imap->imap_response)); | ||
1045 | return; | ||
1046 | } | ||
1047 | mailimap_set_free( set ); | ||
1048 | if (moveit) { | ||
1049 | deleteAllMail(fromFolder); | ||
1050 | } | ||
1051 | } | ||
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.h b/noncore/net/mail/libmailwrapper/imapwrapper.h index b2bd7e9..07c6210 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.h +++ b/noncore/net/mail/libmailwrapper/imapwrapper.h | |||
@@ -31,6 +31,7 @@ public: | |||
31 | virtual void answeredMail(const RecMail&mail); | 31 | virtual void answeredMail(const RecMail&mail); |
32 | virtual int deleteAllMail(const Folder*folder); | 32 | virtual int deleteAllMail(const Folder*folder); |
33 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); | 33 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); |
34 | virtual void mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); | ||
34 | 35 | ||
35 | virtual RecBody fetchBody(const RecMail&mail); | 36 | virtual RecBody fetchBody(const RecMail&mail); |
36 | virtual QString fetchTextPart(const RecMail&mail,const RecPart&part); | 37 | virtual QString fetchTextPart(const RecMail&mail,const RecPart&part); |