[evolution-data-server] Add a function to get the job queue info
- From: Chenthill Palanisamy <pchen src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Add a function to get the job queue info
- Date: Tue, 6 Jul 2010 02:34:17 +0000 (UTC)
commit bb7329a80d768b2b2cf7c2ffb558b552912191f5
Author: Chenthill Palanisamy <pchenthill novell com>
Date: Mon Jul 5 14:30:27 2010 +0530
Add a function to get the job queue info
camel/providers/imapx/camel-imapx-server.c | 26 ++++++++++++++++++++++++++
camel/providers/imapx/camel-imapx-server.h | 5 +++++
camel/providers/imapx/camel-imapx-utils.c | 7 +++++++
camel/providers/imapx/camel-imapx-utils.h | 10 ++++++++++
4 files changed, 48 insertions(+), 0 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index 31945d5..6865452 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -5374,3 +5374,29 @@ camel_imapx_server_rename_folder (CamelIMAPXServer *is, const gchar *old_name, c
g_free (job);
}
+
+IMAPXJobQueueInfo *
+camel_imapx_server_get_job_queue_info (CamelIMAPXServer *is)
+{
+ IMAPXJobQueueInfo *jinfo = g_new0 (IMAPXJobQueueInfo, 1);
+ CamelDListNode *node;
+ CamelIMAPXJob *job = NULL;
+
+ QUEUE_LOCK(is);
+
+ jinfo->queue_len = camel_dlist_length (&is->jobs);
+ jinfo->folders = g_hash_table_new_full (g_int_hash, g_int_equal, (GDestroyNotify) g_free, NULL);
+
+ for (node = is->jobs.head;node->next;node = job->msg.ln.next) {
+ job = (CamelIMAPXJob *) node;
+
+ if (job->folder) {
+ const gchar *full_name = camel_folder_get_full_name (job->folder);
+ g_hash_table_insert (jinfo->folders, g_strdup (full_name), GINT_TO_POINTER (1));
+ }
+ }
+
+ QUEUE_UNLOCK(is);
+
+ return jinfo;
+}
diff --git a/camel/providers/imapx/camel-imapx-server.h b/camel/providers/imapx/camel-imapx-server.h
index 4bf851a..24393a6 100644
--- a/camel/providers/imapx/camel-imapx-server.h
+++ b/camel/providers/imapx/camel-imapx-server.h
@@ -57,6 +57,7 @@ typedef struct _CamelIMAPXServerClass CamelIMAPXServerClass;
typedef struct _CamelIMAPXCommand CamelIMAPXCommand;
typedef struct _CamelIMAPXIdle CamelIMAPXIdle;
+struct _IMAPXJobQueueInfo;
struct _CamelIMAPXServer {
CamelObject parent;
@@ -135,6 +136,7 @@ struct _CamelIMAPXServerClass {
gchar tagprefix;
};
+
GType camel_imapx_server_get_type (void);
CamelIMAPXServer *
camel_imapx_server_new (CamelStore *store,
@@ -195,6 +197,9 @@ void camel_imapx_server_rename_folder(CamelIMAPXServer *is,
const gchar *old_name,
const gchar *new_name,
CamelException *ex);
+struct _IMAPXJobQueueInfo *
+ camel_imapx_server_get_job_queue_info
+ (CamelIMAPXServer *is);
G_END_DECLS
diff --git a/camel/providers/imapx/camel-imapx-utils.c b/camel/providers/imapx/camel-imapx-utils.c
index dc9c2e8..3c43cfb 100644
--- a/camel/providers/imapx/camel-imapx-utils.c
+++ b/camel/providers/imapx/camel-imapx-utils.c
@@ -2106,3 +2106,10 @@ imapx_get_temp_uid (void)
return res;
}
+
+void
+camel_imapx_server_destroy_job_queue_info (IMAPXJobQueueInfo *jinfo)
+{
+ g_hash_table_destroy (jinfo->folders);
+ g_free (jinfo);
+}
diff --git a/camel/providers/imapx/camel-imapx-utils.h b/camel/providers/imapx/camel-imapx-utils.h
index 77d8979..ad1c278 100644
--- a/camel/providers/imapx/camel-imapx-utils.h
+++ b/camel/providers/imapx/camel-imapx-utils.h
@@ -210,6 +210,16 @@ gchar *imapx_list_get_path(struct _list_info *li);
void imapx_free_list(struct _list_info *linfo);
/* ********************************************************************** */
+typedef struct _IMAPXJobQueueInfo {
+ guint queue_len;
+
+ /* list of folders for which jobs are in the queue */
+ GHashTable *folders;
+} IMAPXJobQueueInfo;
+
+void camel_imapx_server_destroy_job_queue_info (IMAPXJobQueueInfo *jinfo);
+
+/* ********************************************************************** */
extern guchar imapx_specials[256];
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]