author | alwin <alwin> | 2004-03-08 03:03:12 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-03-08 03:03:12 (UTC) |
commit | 9553bf83fd98812781b5d15aad9b69daaadec3f5 (patch) (unidiff) | |
tree | 8495eaf7fae291b498114bd70d532f1aecba1fd9 | |
parent | eddc5184f5be6a067b077d18e240a1fe982bbcf4 (diff) | |
download | opie-9553bf83fd98812781b5d15aad9b69daaadec3f5.zip opie-9553bf83fd98812781b5d15aad9b69daaadec3f5.tar.gz opie-9553bf83fd98812781b5d15aad9b69daaadec3f5.tar.bz2 |
obsolete variables removed
-rw-r--r-- | noncore/net/mail/libmailwrapper/mboxwrapper.cpp | 4 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mboxwrapper.h | 1 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mhwrapper.cpp | 4 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mhwrapper.h | 1 |
4 files changed, 2 insertions, 8 deletions
diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp index 11ffd92..abe4bb6 100644 --- a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp | |||
@@ -1,58 +1,56 @@ | |||
1 | #include "mboxwrapper.h" | 1 | #include "mboxwrapper.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 <stdlib.h> | 6 | #include <stdlib.h> |
7 | #include <qpe/global.h> | 7 | #include <qpe/global.h> |
8 | 8 | ||
9 | const MAILLIB::ATYPE MBOXwrapper::wrapperType=MAILLIB::MBOX; | ||
10 | |||
11 | MBOXwrapper::MBOXwrapper(const QString & mbox_dir,const QString&mbox_name) | 9 | MBOXwrapper::MBOXwrapper(const QString & mbox_dir,const QString&mbox_name) |
12 | : Genericwrapper(),MBOXPath(mbox_dir),MBOXName(mbox_name) | 10 | : Genericwrapper(),MBOXPath(mbox_dir),MBOXName(mbox_name) |
13 | { | 11 | { |
14 | QDir dir(MBOXPath); | 12 | QDir dir(MBOXPath); |
15 | if (!dir.exists()) { | 13 | if (!dir.exists()) { |
16 | dir.mkdir(MBOXPath); | 14 | dir.mkdir(MBOXPath); |
17 | } | 15 | } |
18 | } | 16 | } |
19 | 17 | ||
20 | MBOXwrapper::~MBOXwrapper() | 18 | MBOXwrapper::~MBOXwrapper() |
21 | { | 19 | { |
22 | } | 20 | } |
23 | 21 | ||
24 | void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) | 22 | void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) |
25 | { | 23 | { |
26 | mailstorage*storage = mailstorage_new(NULL); | 24 | mailstorage*storage = mailstorage_new(NULL); |
27 | QString p = MBOXPath+"/"; | 25 | QString p = MBOXPath+"/"; |
28 | p+=mailbox; | 26 | p+=mailbox; |
29 | 27 | ||
30 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); | 28 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); |
31 | mailfolder*folder; | 29 | mailfolder*folder; |
32 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); | 30 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); |
33 | r = mailfolder_connect(folder); | 31 | r = mailfolder_connect(folder); |
34 | if (r != MAIL_NO_ERROR) { | 32 | if (r != MAIL_NO_ERROR) { |
35 | qDebug("Error initializing mbox"); | 33 | qDebug("Error initializing mbox"); |
36 | mailfolder_free(folder); | 34 | mailfolder_free(folder); |
37 | mailstorage_free(storage); | 35 | mailstorage_free(storage); |
38 | return; | 36 | return; |
39 | } | 37 | } |
40 | 38 | ||
41 | parseList(target,folder->fld_session,mailbox); | 39 | parseList(target,folder->fld_session,mailbox); |
42 | 40 | ||
43 | mailfolder_disconnect(folder); | 41 | mailfolder_disconnect(folder); |
44 | mailfolder_free(folder); | 42 | mailfolder_free(folder); |
45 | mailstorage_free(storage); | 43 | mailstorage_free(storage); |
46 | Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count())); | 44 | Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count())); |
47 | } | 45 | } |
48 | 46 | ||
49 | QList<Folder>* MBOXwrapper::listFolders() | 47 | QList<Folder>* MBOXwrapper::listFolders() |
50 | { | 48 | { |
51 | QList<Folder> * folders = new QList<Folder>(); | 49 | QList<Folder> * folders = new QList<Folder>(); |
52 | folders->setAutoDelete( false ); | 50 | folders->setAutoDelete( false ); |
53 | QDir dir(MBOXPath); | 51 | QDir dir(MBOXPath); |
54 | if (!dir.exists()) return folders; | 52 | if (!dir.exists()) return folders; |
55 | dir.setFilter(QDir::Files|QDir::Writable|QDir::Readable); | 53 | dir.setFilter(QDir::Files|QDir::Writable|QDir::Readable); |
56 | QStringList entries = dir.entryList(); | 54 | QStringList entries = dir.entryList(); |
57 | QStringList::ConstIterator it = entries.begin(); | 55 | QStringList::ConstIterator it = entries.begin(); |
58 | for (;it!=entries.end();++it) { | 56 | for (;it!=entries.end();++it) { |
@@ -283,55 +281,55 @@ int MBOXwrapper::deleteAllMail(const Folder*tfolder) | |||
283 | } | 281 | } |
284 | } | 282 | } |
285 | if (l) mailmessage_list_free(l); | 283 | if (l) mailmessage_list_free(l); |
286 | if (folder) mailfolder_free(folder); | 284 | if (folder) mailfolder_free(folder); |
287 | if (storage) mailstorage_free(storage); | 285 | if (storage) mailstorage_free(storage); |
288 | return res; | 286 | return res; |
289 | } | 287 | } |
290 | 288 | ||
291 | int MBOXwrapper::deleteMbox(const Folder*tfolder) | 289 | int MBOXwrapper::deleteMbox(const Folder*tfolder) |
292 | { | 290 | { |
293 | if (!tfolder) return 0; | 291 | if (!tfolder) return 0; |
294 | QString p = MBOXPath+"/"+tfolder->getDisplayName(); | 292 | QString p = MBOXPath+"/"+tfolder->getDisplayName(); |
295 | QFile fi(p); | 293 | QFile fi(p); |
296 | if (!fi.exists()) { | 294 | if (!fi.exists()) { |
297 | Global::statusMessage(tr("Mailbox doesn't exist.")); | 295 | Global::statusMessage(tr("Mailbox doesn't exist.")); |
298 | return 0; | 296 | return 0; |
299 | } | 297 | } |
300 | if (!fi.remove()) { | 298 | if (!fi.remove()) { |
301 | Global::statusMessage(tr("Error deleting Mailbox.")); | 299 | Global::statusMessage(tr("Error deleting Mailbox.")); |
302 | return 0; | 300 | return 0; |
303 | } | 301 | } |
304 | return 1; | 302 | return 1; |
305 | } | 303 | } |
306 | 304 | ||
307 | void MBOXwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) | 305 | void MBOXwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) |
308 | { | 306 | { |
309 | mailfolder*folder = 0; | 307 | mailfolder*folder = 0; |
310 | mailstorage*storage = mailstorage_new(NULL); | 308 | mailstorage*storage = mailstorage_new(NULL); |
311 | target_stat.message_count = 0; | 309 | target_stat.message_count = 0; |
312 | target_stat.message_unseen = 0; | 310 | target_stat.message_unseen = 0; |
313 | target_stat.message_recent = 0; | 311 | target_stat.message_recent = 0; |
314 | QString p = MBOXPath+"/"+mailbox; | 312 | QString p = MBOXPath+"/"+mailbox; |
315 | QFile fi(p); | 313 | QFile fi(p); |
316 | if (!fi.exists()) { | 314 | if (!fi.exists()) { |
317 | Global::statusMessage(tr("Mailbox doesn't exist.")); | 315 | Global::statusMessage(tr("Mailbox doesn't exist.")); |
318 | return; | 316 | return; |
319 | } | 317 | } |
320 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); | 318 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); |
321 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); | 319 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); |
322 | r = mailfolder_connect(folder); | 320 | r = mailfolder_connect(folder); |
323 | r = mailsession_status_folder(folder->fld_session,(char*)mailbox.latin1(),&target_stat.message_count, | 321 | r = mailsession_status_folder(folder->fld_session,(char*)mailbox.latin1(),&target_stat.message_count, |
324 | &target_stat.message_recent,&target_stat.message_unseen); | 322 | &target_stat.message_recent,&target_stat.message_unseen); |
325 | if (folder) mailfolder_free(folder); | 323 | if (folder) mailfolder_free(folder); |
326 | if (storage) mailstorage_free(storage); | 324 | if (storage) mailstorage_free(storage); |
327 | } | 325 | } |
328 | 326 | ||
329 | MAILLIB::ATYPE MBOXwrapper::getType()const | 327 | MAILLIB::ATYPE MBOXwrapper::getType()const |
330 | { | 328 | { |
331 | return wrapperType; | 329 | return MAILLIB::A_MBOX; |
332 | } | 330 | } |
333 | 331 | ||
334 | const QString&MBOXwrapper::getName()const | 332 | const QString&MBOXwrapper::getName()const |
335 | { | 333 | { |
336 | return MBOXName; | 334 | return MBOXName; |
337 | } | 335 | } |
diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.h b/noncore/net/mail/libmailwrapper/mboxwrapper.h index a12a1dd..7e7f359 100644 --- a/noncore/net/mail/libmailwrapper/mboxwrapper.h +++ b/noncore/net/mail/libmailwrapper/mboxwrapper.h | |||
@@ -1,48 +1,47 @@ | |||
1 | #ifndef __MBOX_WRAPPER_H | 1 | #ifndef __MBOX_WRAPPER_H |
2 | #define __MBOX_WRAPPER_H | 2 | #define __MBOX_WRAPPER_H |
3 | 3 | ||
4 | #include "genericwrapper.h" | 4 | #include "genericwrapper.h" |
5 | #include <qstring.h> | 5 | #include <qstring.h> |
6 | 6 | ||
7 | class RecMail; | 7 | class RecMail; |
8 | class RecBody; | 8 | class RecBody; |
9 | class encodedString; | 9 | class encodedString; |
10 | struct mailmbox_folder; | 10 | struct mailmbox_folder; |
11 | 11 | ||
12 | class MBOXwrapper : public Genericwrapper | 12 | class MBOXwrapper : public Genericwrapper |
13 | { | 13 | { |
14 | Q_OBJECT | 14 | Q_OBJECT |
15 | 15 | ||
16 | public: | 16 | public: |
17 | MBOXwrapper(const QString & dir,const QString&name); | 17 | MBOXwrapper(const QString & dir,const QString&name); |
18 | virtual ~MBOXwrapper(); | 18 | virtual ~MBOXwrapper(); |
19 | 19 | ||
20 | virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); | 20 | virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); |
21 | virtual QList<Folder>* listFolders(); | 21 | virtual QList<Folder>* listFolders(); |
22 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); | 22 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); |
23 | 23 | ||
24 | virtual void deleteMail(const RecMail&mail); | 24 | virtual void deleteMail(const RecMail&mail); |
25 | virtual void answeredMail(const RecMail&mail); | 25 | virtual void answeredMail(const RecMail&mail); |
26 | 26 | ||
27 | virtual int createMbox(const QString&folder,const Folder*f=0,const QString&d="",bool s=false); | 27 | virtual int createMbox(const QString&folder,const Folder*f=0,const QString&d="",bool s=false); |
28 | virtual int deleteMbox(const Folder*); | 28 | virtual int deleteMbox(const Folder*); |
29 | 29 | ||
30 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); | 30 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); |
31 | 31 | ||
32 | virtual RecBody fetchBody( const RecMail &mail ); | 32 | virtual RecBody fetchBody( const RecMail &mail ); |
33 | static void mbox_progress( size_t current, size_t maximum ); | 33 | static void mbox_progress( size_t current, size_t maximum ); |
34 | 34 | ||
35 | virtual encodedString* fetchRawBody(const RecMail&mail); | 35 | virtual encodedString* fetchRawBody(const RecMail&mail); |
36 | virtual void deleteMails(const QString & FolderName,QList<RecMail> &target); | 36 | virtual void deleteMails(const QString & FolderName,QList<RecMail> &target); |
37 | virtual int deleteAllMail(const Folder*); | 37 | virtual int deleteAllMail(const Folder*); |
38 | virtual MAILLIB::ATYPE getType()const; | 38 | virtual MAILLIB::ATYPE getType()const; |
39 | virtual const QString&getName()const; | 39 | virtual const QString&getName()const; |
40 | 40 | ||
41 | protected: | 41 | protected: |
42 | static void deleteMails(mailmbox_folder*f,QList<RecMail> &target); | 42 | static void deleteMails(mailmbox_folder*f,QList<RecMail> &target); |
43 | QString MBOXPath; | 43 | QString MBOXPath; |
44 | QString MBOXName; | 44 | QString MBOXName; |
45 | static const MAILLIB::ATYPE wrapperType; | ||
46 | }; | 45 | }; |
47 | 46 | ||
48 | #endif | 47 | #endif |
diff --git a/noncore/net/mail/libmailwrapper/mhwrapper.cpp b/noncore/net/mail/libmailwrapper/mhwrapper.cpp index 179bd34..560eab0 100644 --- a/noncore/net/mail/libmailwrapper/mhwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mhwrapper.cpp | |||
@@ -1,60 +1,58 @@ | |||
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 | ||
11 | const MAILLIB::ATYPE MHwrapper::wrapperType=MAILLIB::A_MH; | ||
12 | |||
13 | MHwrapper::MHwrapper(const QString & mbox_dir,const QString&mbox_name) | 11 | MHwrapper::MHwrapper(const QString & mbox_dir,const QString&mbox_name) |
14 | : Genericwrapper(),MHPath(mbox_dir),MHName(mbox_name) | 12 | : Genericwrapper(),MHPath(mbox_dir),MHName(mbox_name) |
15 | { | 13 | { |
16 | if (MHPath.length()>0) { | 14 | if (MHPath.length()>0) { |
17 | if (MHPath[MHPath.length()-1]=='/') { | 15 | if (MHPath[MHPath.length()-1]=='/') { |
18 | MHPath=MHPath.left(MHPath.length()-1); | 16 | MHPath=MHPath.left(MHPath.length()-1); |
19 | } | 17 | } |
20 | qDebug(MHPath); | 18 | qDebug(MHPath); |
21 | QDir dir(MHPath); | 19 | QDir dir(MHPath); |
22 | if (!dir.exists()) { | 20 | if (!dir.exists()) { |
23 | dir.mkdir(MHPath); | 21 | dir.mkdir(MHPath); |
24 | } | 22 | } |
25 | init_storage(); | 23 | init_storage(); |
26 | } | 24 | } |
27 | } | 25 | } |
28 | 26 | ||
29 | void MHwrapper::init_storage() | 27 | void MHwrapper::init_storage() |
30 | { | 28 | { |
31 | int r; | 29 | int r; |
32 | QString pre = MHPath; | 30 | QString pre = MHPath; |
33 | if (!m_storage) { | 31 | if (!m_storage) { |
34 | m_storage = mailstorage_new(NULL); | 32 | m_storage = mailstorage_new(NULL); |
35 | r = mh_mailstorage_init(m_storage,(char*)pre.latin1(),0,0,0); | 33 | r = mh_mailstorage_init(m_storage,(char*)pre.latin1(),0,0,0); |
36 | if (r != MAIL_NO_ERROR) { | 34 | if (r != MAIL_NO_ERROR) { |
37 | qDebug("error initializing storage"); | 35 | qDebug("error initializing storage"); |
38 | mailstorage_free(m_storage); | 36 | mailstorage_free(m_storage); |
39 | m_storage = 0; | 37 | m_storage = 0; |
40 | return; | 38 | return; |
41 | } | 39 | } |
42 | } | 40 | } |
43 | r = mailstorage_connect(m_storage); | 41 | r = mailstorage_connect(m_storage); |
44 | if (r!=MAIL_NO_ERROR) { | 42 | if (r!=MAIL_NO_ERROR) { |
45 | qDebug("error connecting storage"); | 43 | qDebug("error connecting storage"); |
46 | mailstorage_free(m_storage); | 44 | mailstorage_free(m_storage); |
47 | m_storage = 0; | 45 | m_storage = 0; |
48 | } | 46 | } |
49 | } | 47 | } |
50 | 48 | ||
51 | void MHwrapper::clean_storage() | 49 | void MHwrapper::clean_storage() |
52 | { | 50 | { |
53 | if (m_storage) { | 51 | if (m_storage) { |
54 | mailstorage_disconnect(m_storage); | 52 | mailstorage_disconnect(m_storage); |
55 | mailstorage_free(m_storage); | 53 | mailstorage_free(m_storage); |
56 | m_storage = 0; | 54 | m_storage = 0; |
57 | } | 55 | } |
58 | } | 56 | } |
59 | 57 | ||
60 | MHwrapper::~MHwrapper() | 58 | MHwrapper::~MHwrapper() |
@@ -323,97 +321,97 @@ int MHwrapper::deleteMbox(const Folder*tfolder) | |||
323 | OProcess *process = new OProcess(); | 321 | OProcess *process = new OProcess(); |
324 | 322 | ||
325 | connect(process, SIGNAL(processExited(OProcess*)), | 323 | connect(process, SIGNAL(processExited(OProcess*)), |
326 | this, SLOT( processEnded(OProcess*))); | 324 | this, SLOT( processEnded(OProcess*))); |
327 | connect(process, SIGNAL( receivedStderr(OProcess*,char*,int)), | 325 | connect(process, SIGNAL( receivedStderr(OProcess*,char*,int)), |
328 | this, SLOT( oprocessStderr(OProcess*,char*,int))); | 326 | this, SLOT( oprocessStderr(OProcess*,char*,int))); |
329 | 327 | ||
330 | *process << command; | 328 | *process << command; |
331 | removeMboxfailed = false; | 329 | removeMboxfailed = false; |
332 | if(!process->start(OProcess::Block, OProcess::All) ) { | 330 | if(!process->start(OProcess::Block, OProcess::All) ) { |
333 | qDebug("could not start process"); | 331 | qDebug("could not start process"); |
334 | return 0; | 332 | return 0; |
335 | } | 333 | } |
336 | qDebug("mail box deleted"); | 334 | qDebug("mail box deleted"); |
337 | return 1; | 335 | return 1; |
338 | } | 336 | } |
339 | 337 | ||
340 | void MHwrapper::processEnded(OProcess *p) | 338 | void MHwrapper::processEnded(OProcess *p) |
341 | { | 339 | { |
342 | if (p) delete p; | 340 | if (p) delete p; |
343 | } | 341 | } |
344 | 342 | ||
345 | void MHwrapper::oprocessStderr(OProcess*, char *buffer, int ) | 343 | void MHwrapper::oprocessStderr(OProcess*, char *buffer, int ) |
346 | { | 344 | { |
347 | QString lineStr = buffer; | 345 | QString lineStr = buffer; |
348 | QMessageBox::warning( 0, tr("Error"), lineStr ,tr("Ok") ); | 346 | QMessageBox::warning( 0, tr("Error"), lineStr ,tr("Ok") ); |
349 | removeMboxfailed = true; | 347 | removeMboxfailed = true; |
350 | } | 348 | } |
351 | 349 | ||
352 | void MHwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) | 350 | void MHwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) |
353 | { | 351 | { |
354 | init_storage(); | 352 | init_storage(); |
355 | if (!m_storage) { | 353 | if (!m_storage) { |
356 | return; | 354 | return; |
357 | } | 355 | } |
358 | target_stat.message_count = 0; | 356 | target_stat.message_count = 0; |
359 | target_stat.message_unseen = 0; | 357 | target_stat.message_unseen = 0; |
360 | target_stat.message_recent = 0; | 358 | target_stat.message_recent = 0; |
361 | QString f = buildPath(mailbox); | 359 | QString f = buildPath(mailbox); |
362 | int r = mailsession_status_folder(m_storage->sto_session,(char*)f.latin1(),&target_stat.message_count, | 360 | int r = mailsession_status_folder(m_storage->sto_session,(char*)f.latin1(),&target_stat.message_count, |
363 | &target_stat.message_recent,&target_stat.message_unseen); | 361 | &target_stat.message_recent,&target_stat.message_unseen); |
364 | if (r != MAIL_NO_ERROR) { | 362 | if (r != MAIL_NO_ERROR) { |
365 | Global::statusMessage(tr("Error retrieving status")); | 363 | Global::statusMessage(tr("Error retrieving status")); |
366 | } | 364 | } |
367 | } | 365 | } |
368 | 366 | ||
369 | MAILLIB::ATYPE MHwrapper::getType()const | 367 | MAILLIB::ATYPE MHwrapper::getType()const |
370 | { | 368 | { |
371 | return wrapperType; | 369 | return MAILLIB::A_MH; |
372 | } | 370 | } |
373 | 371 | ||
374 | const QString&MHwrapper::getName()const | 372 | const QString&MHwrapper::getName()const |
375 | { | 373 | { |
376 | return MHName; | 374 | return MHName; |
377 | } | 375 | } |
378 | void MHwrapper::mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) | 376 | void MHwrapper::mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) |
379 | { | 377 | { |
380 | init_storage(); | 378 | init_storage(); |
381 | if (!m_storage) { | 379 | if (!m_storage) { |
382 | return; | 380 | return; |
383 | } | 381 | } |
384 | if (targetWrapper != this) { | 382 | if (targetWrapper != this) { |
385 | qDebug("Using generic"); | 383 | qDebug("Using generic"); |
386 | Genericwrapper::mvcpMail(mail,targetFolder,targetWrapper,moveit); | 384 | Genericwrapper::mvcpMail(mail,targetFolder,targetWrapper,moveit); |
387 | return; | 385 | return; |
388 | } | 386 | } |
389 | qDebug("Using internal routines for move/copy"); | 387 | qDebug("Using internal routines for move/copy"); |
390 | QString tf = buildPath(targetFolder); | 388 | QString tf = buildPath(targetFolder); |
391 | int r = mailsession_select_folder(m_storage->sto_session,(char*)mail.getMbox().latin1()); | 389 | int r = mailsession_select_folder(m_storage->sto_session,(char*)mail.getMbox().latin1()); |
392 | if (r != MAIL_NO_ERROR) { | 390 | if (r != MAIL_NO_ERROR) { |
393 | qDebug("Error selecting source mailbox"); | 391 | qDebug("Error selecting source mailbox"); |
394 | return; | 392 | return; |
395 | } | 393 | } |
396 | if (moveit) { | 394 | if (moveit) { |
397 | r = mailsession_move_message(m_storage->sto_session,mail.getNumber(),(char*)tf.latin1()); | 395 | r = mailsession_move_message(m_storage->sto_session,mail.getNumber(),(char*)tf.latin1()); |
398 | } else { | 396 | } else { |
399 | r = mailsession_copy_message(m_storage->sto_session,mail.getNumber(),(char*)tf.latin1()); | 397 | r = mailsession_copy_message(m_storage->sto_session,mail.getNumber(),(char*)tf.latin1()); |
400 | } | 398 | } |
401 | if (r != MAIL_NO_ERROR) { | 399 | if (r != MAIL_NO_ERROR) { |
402 | qDebug("Error copy/moving mail internal (%i)",r); | 400 | qDebug("Error copy/moving mail internal (%i)",r); |
403 | } | 401 | } |
404 | } | 402 | } |
405 | 403 | ||
406 | void MHwrapper::mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) | 404 | void MHwrapper::mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) |
407 | { | 405 | { |
408 | init_storage(); | 406 | init_storage(); |
409 | if (!m_storage) { | 407 | if (!m_storage) { |
410 | return; | 408 | return; |
411 | } | 409 | } |
412 | if (targetWrapper != this) { | 410 | if (targetWrapper != this) { |
413 | qDebug("Using generic"); | 411 | qDebug("Using generic"); |
414 | Genericwrapper::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit); | 412 | Genericwrapper::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit); |
415 | return; | 413 | return; |
416 | } | 414 | } |
417 | if (!fromFolder) return; | 415 | if (!fromFolder) return; |
418 | int r = mailsession_select_folder(m_storage->sto_session,(char*)fromFolder->getName().latin1()); | 416 | int r = mailsession_select_folder(m_storage->sto_session,(char*)fromFolder->getName().latin1()); |
419 | if (r!=MAIL_NO_ERROR) { | 417 | if (r!=MAIL_NO_ERROR) { |
diff --git a/noncore/net/mail/libmailwrapper/mhwrapper.h b/noncore/net/mail/libmailwrapper/mhwrapper.h index c1ba78d..b7c23af 100644 --- a/noncore/net/mail/libmailwrapper/mhwrapper.h +++ b/noncore/net/mail/libmailwrapper/mhwrapper.h | |||
@@ -5,57 +5,56 @@ | |||
5 | 5 | ||
6 | #include "genericwrapper.h" | 6 | #include "genericwrapper.h" |
7 | #include <qstring.h> | 7 | #include <qstring.h> |
8 | 8 | ||
9 | class RecMail; | 9 | class RecMail; |
10 | class RecBody; | 10 | class RecBody; |
11 | class encodedString; | 11 | class encodedString; |
12 | struct mailmbox_folder; | 12 | struct mailmbox_folder; |
13 | class OProcess; | 13 | class OProcess; |
14 | 14 | ||
15 | class MHwrapper : public Genericwrapper | 15 | class MHwrapper : public Genericwrapper |
16 | { | 16 | { |
17 | Q_OBJECT | 17 | Q_OBJECT |
18 | public: | 18 | public: |
19 | MHwrapper(const QString & dir,const QString&name); | 19 | MHwrapper(const QString & dir,const QString&name); |
20 | virtual ~MHwrapper(); | 20 | virtual ~MHwrapper(); |
21 | 21 | ||
22 | virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); | 22 | virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); |
23 | virtual QList<Folder>* listFolders(); | 23 | virtual QList<Folder>* listFolders(); |
24 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); | 24 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); |
25 | 25 | ||
26 | virtual void deleteMail(const RecMail&mail); | 26 | virtual void deleteMail(const RecMail&mail); |
27 | virtual void answeredMail(const RecMail&mail); | 27 | virtual void answeredMail(const RecMail&mail); |
28 | virtual void mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); | 28 | virtual void mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); |
29 | virtual void mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); | 29 | virtual void mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); |
30 | 30 | ||
31 | virtual int createMbox(const QString&folder,const Folder*f=0,const QString&d="",bool s=false); | 31 | virtual int createMbox(const QString&folder,const Folder*f=0,const QString&d="",bool s=false); |
32 | virtual int deleteMbox(const Folder*); | 32 | virtual int deleteMbox(const Folder*); |
33 | 33 | ||
34 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); | 34 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); |
35 | 35 | ||
36 | virtual RecBody fetchBody( const RecMail &mail ); | 36 | virtual RecBody fetchBody( const RecMail &mail ); |
37 | static void mbox_progress( size_t current, size_t maximum ); | 37 | static void mbox_progress( size_t current, size_t maximum ); |
38 | 38 | ||
39 | virtual encodedString* fetchRawBody(const RecMail&mail); | 39 | virtual encodedString* fetchRawBody(const RecMail&mail); |
40 | virtual void deleteMails(const QString & FolderName,QList<RecMail> &target); | 40 | virtual void deleteMails(const QString & FolderName,QList<RecMail> &target); |
41 | virtual int deleteAllMail(const Folder*); | 41 | virtual int deleteAllMail(const Folder*); |
42 | virtual MAILLIB::ATYPE getType()const; | 42 | virtual MAILLIB::ATYPE getType()const; |
43 | virtual const QString&getName()const; | 43 | virtual const QString&getName()const; |
44 | 44 | ||
45 | public slots: | 45 | public slots: |
46 | /* for deleting maildirs we are using a system call */ | 46 | /* for deleting maildirs we are using a system call */ |
47 | virtual void oprocessStderr(OProcess*, char *buffer, int ); | 47 | virtual void oprocessStderr(OProcess*, char *buffer, int ); |
48 | virtual void processEnded(OProcess *); | 48 | virtual void processEnded(OProcess *); |
49 | protected: | 49 | protected: |
50 | QString buildPath(const QString&p); | 50 | QString buildPath(const QString&p); |
51 | QString MHPath; | 51 | QString MHPath; |
52 | QString MHName; | 52 | QString MHName; |
53 | static const MAILLIB::ATYPE wrapperType; | ||
54 | 53 | ||
55 | void init_storage(); | 54 | void init_storage(); |
56 | void clean_storage(); | 55 | void clean_storage(); |
57 | 56 | ||
58 | bool removeMboxfailed; | 57 | bool removeMboxfailed; |
59 | }; | 58 | }; |
60 | 59 | ||
61 | #endif | 60 | #endif |