-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 | |||
@@ -177,8 +177,5 @@ QString MHwrapper::buildPath(const QString&p) | |||
177 | int MHwrapper::createMbox(const QString&folder,const FolderP&pfolder,const QString&,bool ) | 177 | int MHwrapper::createMbox(const QString&folder,const FolderP&pfolder,const QString&,bool ) |
178 | { | 178 | { |
179 | init_storage(); | 179 | |
180 | if (!m_storage) { | ||
181 | return 0; | ||
182 | } | ||
183 | QString f; | 180 | QString f; |
184 | if (!pfolder) { | 181 | if (!pfolder) { |
@@ -190,8 +187,17 @@ int MHwrapper::createMbox(const QString&folder,const FolderP&pfolder,const QStri | |||
190 | f+=folder; | 187 | f+=folder; |
191 | } | 188 | } |
192 | 189 | QFileInfo fi ( f ); | |
190 | if ( fi. exists () ) { | ||
191 | qDebug("folder exists "); | ||
192 | return 1; | ||
193 | } | ||
194 | qDebug("creating folder ---%s--- ",f.latin1() ); | ||
195 | init_storage(); | ||
196 | if (!m_storage) { | ||
197 | return 0; | ||
198 | } | ||
193 | int r = mailsession_create_folder(m_storage->sto_session,(char*)f.latin1()); | 199 | int r = mailsession_create_folder(m_storage->sto_session,(char*)f.latin1()); |
194 | if (r != MAIL_NO_ERROR) { | 200 | if (r != MAIL_NO_ERROR) { |
195 | qDebug("error creating folder "); | 201 | qDebug("error %d creating folder %s", r, f.latin1()); |
196 | return 0; | 202 | return 0; |
197 | } | 203 | } |
@@ -208,10 +214,11 @@ void MHwrapper::storeMessage(const char*msg,size_t length, const QString&Folder) | |||
208 | int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); | 214 | int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); |
209 | if (r!=MAIL_NO_ERROR) { | 215 | if (r!=MAIL_NO_ERROR) { |
210 | qDebug("error selecting folder! "); | 216 | qDebug("error selecting folder %d", r); |
211 | return; | 217 | return; |
212 | } | 218 | } |
213 | r = mailsession_append_message(m_storage->sto_session,(char*)msg,length); | 219 | r = mailsession_append_message(m_storage->sto_session,(char*)msg,length); |
214 | if (r!=MAIL_NO_ERROR) { | 220 | if (r!=MAIL_NO_ERROR) { |
215 | qDebug("error storing mail "); | 221 | if ( r != MAIL_ERROR_APPEND ) |
222 | qDebug("error storing mail %d", r); | ||
216 | } | 223 | } |
217 | return; | 224 | return; |