Add a extended response handler for unhandled imapx tokens to be handled
authorChenthill Palanisamy <pchenthill@novell.com>
Tue, 8 May 2012 09:29:48 +0000 (14:59 +0530)
committerChenthill Palanisamy <pchenthill@novell.com>
Tue, 8 May 2012 09:29:48 +0000 (14:59 +0530)
by the derived providers.

camel/camel-imapx-server.c
camel/camel-imapx-server.h

index 2d9e598..10d5184 100644 (file)
@@ -1586,6 +1586,10 @@ imapx_untagged (CamelIMAPXServer *is,
                imapx_free_status (sinfo);
                return TRUE;
        default:
+               /* If there is a extended untagged response handler registered, call it */
+               if (is->untagged_handler_func)
+                       return is->untagged_handler_func (is, cancellable, error);
+
                /* unknown response, just ignore it */
                c(is->tagprefix, "unknown token: %s\n", token);
        }
@@ -6478,3 +6482,12 @@ camel_imapx_server_get_job_queue_info (CamelIMAPXServer *is)
 
        return jinfo;
 }
+
+void           
+camel_imapx_server_set_extended_token_handler  (CamelIMAPXServer *is,
+                                                IMAPXExtUntaggedResponseHander handler_func)
+{
+       g_return_if_fail (is != NULL);
+
+       is->untagged_handler_func = handler_func;
+}
index d442a17..680dfea 100644 (file)
@@ -62,6 +62,11 @@ typedef struct _CamelIMAPXServerClass CamelIMAPXServerClass;
 typedef struct _CamelIMAPXIdle CamelIMAPXIdle;
 struct _IMAPXJobQueueInfo;
 
+typedef gboolean (*IMAPXExtUntaggedResponseHander)
+                                       (CamelIMAPXServer *server, 
+                                        GCancellable *cancellable, 
+                                        GError **error);
+
 struct _CamelIMAPXServer {
        CamelObject parent;
 
@@ -75,6 +80,8 @@ struct _CamelIMAPXServer {
 
        CamelIMAPXNamespaceList *nsl;
 
+       IMAPXExtUntaggedResponseHander untagged_handler_func;
+
        /* incoming jobs */
        GQueue jobs;
 
@@ -234,6 +241,11 @@ struct _IMAPXJobQueueInfo *
                camel_imapx_server_get_job_queue_info
                                                (CamelIMAPXServer *is);
 
+void           camel_imapx_server_set_extended_token_handler 
+                                               (CamelIMAPXServer *is,
+                                                IMAPXExtUntaggedResponseHander handler_func);
+
+
 G_END_DECLS
 
 #endif /* CAMEL_IMAPX_SERVER_H */