summaryrefslogtreecommitdiffabout
path: root/kmicromail/libmailwrapper
Side-by-side diff
Diffstat (limited to 'kmicromail/libmailwrapper') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/mhwrapper.cpp23
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
@@ -173,29 +173,35 @@ QString MHwrapper::buildPath(const QString&p)
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)
@@ -204,18 +210,19 @@ void MHwrapper::storeMessage(const char*msg,size_t length, const QString&Folder)
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)
{