aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar libec <libor.huspenina@gmail.com>2015-11-07 21:02:04 +0100
committerGravatar libec <libor.huspenina@gmail.com>2015-11-07 21:02:04 +0100
commit703a580f1fe599f2dde7fec6c6e9a51ca47da34d (patch)
tree9689aad3943a884922ab4c50b2ca92a5c73fcc50 /src
parente8e41511e27e9b9f5d757bf2ac33871edd676ec4 (diff)
Adds error code to IMAPSession::customCommand. Renames sendCustomCommand to customCommand.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/async/imap/MCIMAPAsyncSession.cpp2
-rwxr-xr-xsrc/async/imap/MCIMAPAsyncSession.h2
-rw-r--r--src/async/imap/MCIMAPCustomCommandOperation.cpp4
-rwxr-xr-xsrc/core/imap/MCIMAPSession.cpp11
-rwxr-xr-xsrc/core/imap/MCIMAPSession.h2
-rwxr-xr-xsrc/objc/imap/MCOIMAPSession.mm2
6 files changed, 16 insertions, 7 deletions
diff --git a/src/async/imap/MCIMAPAsyncSession.cpp b/src/async/imap/MCIMAPAsyncSession.cpp
index 15d546d5..a8cccea5 100755
--- a/src/async/imap/MCIMAPAsyncSession.cpp
+++ b/src/async/imap/MCIMAPAsyncSession.cpp
@@ -537,7 +537,7 @@ IMAPFetchContentOperation * IMAPAsyncSession::fetchMessageByNumberOperation(Stri
return op;
}
-IMAPCustomCommandOperation * IMAPAsyncSession::sendCustomCommand(String *command, bool urgent)
+IMAPCustomCommandOperation * IMAPAsyncSession::customCommand(String *command, bool urgent)
{
IMAPCustomCommandOperation *op = new IMAPCustomCommandOperation();
diff --git a/src/async/imap/MCIMAPAsyncSession.h b/src/async/imap/MCIMAPAsyncSession.h
index 42fedcfb..62577a6e 100755
--- a/src/async/imap/MCIMAPAsyncSession.h
+++ b/src/async/imap/MCIMAPAsyncSession.h
@@ -136,7 +136,7 @@ namespace mailcore {
Encoding encoding, bool urgent = false);
virtual IMAPFetchContentOperation * fetchMessageByNumberOperation(String * folder, uint32_t number, bool urgent = false);
- virtual IMAPCustomCommandOperation * sendCustomCommand(String *command, bool urgent);
+ virtual IMAPCustomCommandOperation * customCommand(String *command, bool urgent);
virtual IMAPFetchContentOperation * fetchMessageAttachmentByNumberOperation(String * folder, uint32_t number, String * partID,
Encoding encoding, bool urgent = false);
diff --git a/src/async/imap/MCIMAPCustomCommandOperation.cpp b/src/async/imap/MCIMAPCustomCommandOperation.cpp
index 61e0e655..3995d6aa 100644
--- a/src/async/imap/MCIMAPCustomCommandOperation.cpp
+++ b/src/async/imap/MCIMAPCustomCommandOperation.cpp
@@ -37,6 +37,8 @@ String * IMAPCustomCommandOperation::response()
void IMAPCustomCommandOperation::main()
{
- mResponse = session()->session()->sendCustomCommand(mCustomCommand);
+ ErrorCode error;
+ mResponse = session()->session()->customCommand(mCustomCommand, &error);
MC_SAFE_RETAIN(mResponse);
+ setError(error);
}
diff --git a/src/core/imap/MCIMAPSession.cpp b/src/core/imap/MCIMAPSession.cpp
index 69d80cc7..cbd94a2b 100755
--- a/src/core/imap/MCIMAPSession.cpp
+++ b/src/core/imap/MCIMAPSession.cpp
@@ -996,9 +996,16 @@ static uint64_t get_mod_sequence_value(mailimap * session)
return mod_sequence_value;
}
-String * IMAPSession::sendCustomCommand(String * command)
+String * IMAPSession::customCommand(String * command, ErrorCode * pError)
{
- mailimap_custom_command(mImap, MCUTF8(command));
+ int r;
+
+ r = mailimap_custom_command(mImap, MCUTF8(command));
+ if (r == MAILIMAP_ERROR_CUSTOM_COMMAND) {
+ * pError = ErrorCustomCommand;
+ return NULL;
+ }
+
String *response = String::stringWithUTF8Characters(mImap->imap_response);
return response;
}
diff --git a/src/core/imap/MCIMAPSession.h b/src/core/imap/MCIMAPSession.h
index 8b1db9cb..5ee6bc1c 100755
--- a/src/core/imap/MCIMAPSession.h
+++ b/src/core/imap/MCIMAPSession.h
@@ -107,7 +107,7 @@ namespace mailcore {
IndexSet * numbers,
IMAPProgressCallback * progressCallback,
Array * extraHeaders, ErrorCode * pError);
- virtual String * sendCustomCommand(String * command);
+ virtual String * customCommand(String * command, ErrorCode * pError);
virtual Data * fetchMessageByUID(String * folder, uint32_t uid,
IMAPProgressCallback * progressCallback, ErrorCode * pError);
diff --git a/src/objc/imap/MCOIMAPSession.mm b/src/objc/imap/MCOIMAPSession.mm
index 07e140b5..362227f6 100755
--- a/src/objc/imap/MCOIMAPSession.mm
+++ b/src/objc/imap/MCOIMAPSession.mm
@@ -436,7 +436,7 @@ MCO_OBJC_SYNTHESIZE_SCALAR(dispatch_queue_t, dispatch_queue_t, setDispatchQueue,
}
- (MCOIMAPCustomCommandOperation *) customCommandOperation:(NSString *)command {
- IMAPCustomCommandOperation *customOp = MCO_NATIVE_INSTANCE->sendCustomCommand([command mco_mcString], false);
+ IMAPCustomCommandOperation *customOp = MCO_NATIVE_INSTANCE->customCommand([command mco_mcString], false);
return MCO_TO_OBJC_OP(customOp);
}