[evolution-data-server] Add camel_imapx_command_queue_ref_by_tag().



commit c7e9b695fb289c6b5b55af181c24bd4b06e9cba6
Author: Matthew Barnes <mbarnes redhat com>
Date:   Mon Aug 12 09:43:56 2013 -0400

    Add camel_imapx_command_queue_ref_by_tag().
    
    Returns a new reference to the CamelIMAPXCommand in the queue with a
    matching tag, or NULL if no match is found.

 camel/camel-imapx-command.c             |   36 +++++++++++++++++++++++++++++++
 camel/camel-imapx-command.h             |    4 +++
 docs/reference/camel/camel-sections.txt |    1 +
 3 files changed, 41 insertions(+), 0 deletions(-)
---
diff --git a/camel/camel-imapx-command.c b/camel/camel-imapx-command.c
index 11338f6..10ffad2 100644
--- a/camel/camel-imapx-command.c
+++ b/camel/camel-imapx-command.c
@@ -777,3 +777,39 @@ camel_imapx_command_queue_delete_link (CamelIMAPXCommandQueue *queue,
        g_queue_delete_link ((GQueue *) queue, link);
 }
 
+/**
+ * camel_imapx_command_queue_ref_by_tag:
+ * @queue: a #CamelIMAPXCommandQueue
+ * @tag: a #CamelIMAPXCommand tag
+ *
+ * Returns the #CamelIMAPXCommand in @queue with a matching @tag, or %NULL
+ * if no match is found.
+ *
+ * The returned #CamelIMAPXCommand is referenced for thread-safety and should
+ * be unreferenced with camel_imapx_command_unref() when finished with it.
+ *
+ * Since: 3.10
+ **/
+CamelIMAPXCommand *
+camel_imapx_command_queue_ref_by_tag (CamelIMAPXCommandQueue *queue,
+                                      guint32 tag)
+{
+       CamelIMAPXCommand *match = NULL;
+       GList *head, *link;
+
+       g_return_val_if_fail (queue != NULL, NULL);
+
+       head = camel_imapx_command_queue_peek_head_link (queue);
+
+       for (link = head; link != NULL; link = g_list_next (link)) {
+               CamelIMAPXCommand *command = link->data;
+
+               if (command->tag == tag) {
+                       match = camel_imapx_command_ref (command);
+                       break;
+               }
+       }
+
+       return match;
+}
+
diff --git a/camel/camel-imapx-command.h b/camel/camel-imapx-command.h
index ecaa8ea..5da7c32 100644
--- a/camel/camel-imapx-command.h
+++ b/camel/camel-imapx-command.h
@@ -159,6 +159,10 @@ gboolean   camel_imapx_command_queue_remove
 void           camel_imapx_command_queue_delete_link
                                                (CamelIMAPXCommandQueue *queue,
                                                 GList *link);
+CamelIMAPXCommand *
+               camel_imapx_command_queue_ref_by_tag
+                                               (CamelIMAPXCommandQueue *queue,
+                                                guint32 tag);
 
 G_END_DECLS
 
diff --git a/docs/reference/camel/camel-sections.txt b/docs/reference/camel/camel-sections.txt
index 6b9d327..82881be 100644
--- a/docs/reference/camel/camel-sections.txt
+++ b/docs/reference/camel/camel-sections.txt
@@ -768,6 +768,7 @@ camel_imapx_command_queue_peek_head
 camel_imapx_command_queue_peek_head_link
 camel_imapx_command_queue_remove
 camel_imapx_command_queue_delete_link
+camel_imapx_command_queue_ref_by_tag
 </SECTION>
 
 <SECTION>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]