-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 | |||
@@ -176,10 +176,7 @@ QString MHwrapper::buildPath(const QString&p) | |||
176 | 176 | ||
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) { |
185 | // toplevel folder | 182 | // toplevel folder |
@@ -189,10 +186,19 @@ int MHwrapper::createMbox(const QString&folder,const FolderP&pfolder,const QStri | |||
189 | f+="/"; | 186 | f+="/"; |
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 | } |
198 | return 1; | 204 | return 1; |
@@ -207,12 +213,13 @@ void MHwrapper::storeMessage(const char*msg,size_t length, const QString&Folder) | |||
207 | QString f = buildPath(Folder); | 213 | QString f = buildPath(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; |
218 | } | 225 | } |