author | zautrix <zautrix> | 2005-03-18 21:38:19 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-18 21:38:19 (UTC) |
commit | f0232b7801f098b5842e3cd5a1fd804af98ab862 (patch) (side-by-side diff) | |
tree | 7537ad5f4b86a4c7e0965051ce0082bcb8d023fa /kmicromail/libmailwrapper/mhwrapper.cpp | |
parent | 246da4d3796f5e03a3ce5f2b2febe9e1c8dd7a7e (diff) | |
download | kdepimpi-f0232b7801f098b5842e3cd5a1fd804af98ab862.zip kdepimpi-f0232b7801f098b5842e3cd5a1fd804af98ab862.tar.gz kdepimpi-f0232b7801f098b5842e3cd5a1fd804af98ab862.tar.bz2 |
etpan fixes
Diffstat (limited to 'kmicromail/libmailwrapper/mhwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kmicromail/libmailwrapper/mhwrapper.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/kmicromail/libmailwrapper/mhwrapper.cpp b/kmicromail/libmailwrapper/mhwrapper.cpp index 982d7a6..787e85d 100644 --- a/kmicromail/libmailwrapper/mhwrapper.cpp +++ b/kmicromail/libmailwrapper/mhwrapper.cpp @@ -131,133 +131,140 @@ RecBodyP MHwrapper::fetchBody( const RecMailP &mail ) qDebug("MHwrapper::fetchBody "); RecBodyP body = new RecBody(); init_storage(); if (!m_storage) { return body; } mailmessage * msg; char*data=0; /* mail should hold the complete path! */ int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1()); if (r != MAIL_NO_ERROR) { return body; } r = mailsession_get_message(m_storage->sto_session, mail->getNumber(), &msg); if (r != MAIL_NO_ERROR) { qDebug("Error fetching mail "); return body; } body = parseMail(msg); mailmessage_fetch_result_free(msg,data); return body; } void MHwrapper::mbox_progress( size_t current, size_t maximum ) { qDebug("MBox Progress %d of %d",current,maximum ); //odebug << "MH " << current << " von " << maximum << "" << oendl; } QString MHwrapper::buildPath(const QString&p) { QString f=""; if (p.length()==0||p=="/") return MHPath; if (!p.startsWith(MHPath)) { f+=MHPath; } if (!p.startsWith("/")) { f+="/"; } f+=p; return f; } int MHwrapper::createMbox(const QString&folder,const FolderP&pfolder,const QString&,bool ) { - init_storage(); - if (!m_storage) { - return 0; - } + QString f; if (!pfolder) { // toplevel folder f = buildPath(folder); } else { f = pfolder->getName(); f+="/"; f+=folder; } - + QFileInfo fi ( f ); + if ( fi. exists () ) { + qDebug("folder exists "); + return 1; + } + qDebug("creating folder ---%s--- ",f.latin1() ); + init_storage(); + if (!m_storage) { + return 0; + } int r = mailsession_create_folder(m_storage->sto_session,(char*)f.latin1()); if (r != MAIL_NO_ERROR) { - qDebug("error creating folder "); + qDebug("error %d creating folder %s", r, f.latin1()); return 0; } return 1; } void MHwrapper::storeMessage(const char*msg,size_t length, const QString&Folder) { init_storage(); if (!m_storage) { return; } QString f = buildPath(Folder); int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); if (r!=MAIL_NO_ERROR) { - qDebug("error selecting folder! "); + qDebug("error selecting folder %d", r); return; } r = mailsession_append_message(m_storage->sto_session,(char*)msg,length); if (r!=MAIL_NO_ERROR) { - qDebug("error storing mail "); + if ( r != MAIL_ERROR_APPEND ) + qDebug("error storing mail %d", r); } return; } encodedString* MHwrapper::fetchRawBody(const RecMailP&mail) { encodedString*result = 0; init_storage(); if (!m_storage) { return result; } mailmessage * msg = 0; char*data=0; size_t size; int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1()); if (r!=MAIL_NO_ERROR) { qDebug("error selecting folder! "); return result; } r = mailsession_get_message(m_storage->sto_session, mail->getNumber(), &msg); if (r != MAIL_NO_ERROR) { Global::statusMessage(i18n("Error fetching mail %i").arg(mail->getNumber())); return 0; } r = mailmessage_fetch(msg,&data,&size); if (r != MAIL_NO_ERROR) { Global::statusMessage(i18n("Error fetching mail %i").arg(mail->getNumber())); if (msg) mailmessage_free(msg); return 0; } result = new encodedString(data,size); if (msg) mailmessage_free(msg); return result; } void MHwrapper::deleteMails(const QString & mailbox,const QValueList<RecMailP> &target) { QString f = buildPath(mailbox); int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); if (r!=MAIL_NO_ERROR) { qDebug("deleteMails: error selecting folder! "); return; } QValueList<RecMailP>::ConstIterator it; for (it=target.begin(); it!=target.end();++it) { r = mailsession_remove_message(m_storage->sto_session,(*it)->getNumber()); if (r != MAIL_NO_ERROR) { qDebug("error deleting mail "); |