[evolution-data-server] IMAPX: Add camel_imapx_server_ref_output_stream().



commit 2440c25c0d5c85fee55648c1673b286fcda25c9a
Author: Matthew Barnes <mbarnes redhat com>
Date:   Thu Jan 23 06:56:28 2014 -0500

    IMAPX: Add camel_imapx_server_ref_output_stream().
    
    Returns the GOutputStream for a CamelIMAPXServer, which is owned by
    either a GTcpConnection or a GSubprocess.
    
    The function doesn't actually return anything yet; just roughing in
    the API.  Will make it work in subsequent commits.

 camel/providers/imapx/camel-imapx-server.c |   34 ++++++++++++++++++++++++++++
 camel/providers/imapx/camel-imapx-server.h |    2 +
 docs/reference/camel/camel-sections.txt    |    1 +
 3 files changed, 37 insertions(+), 0 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index 97a5c7b..74c207b 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -336,6 +336,7 @@ struct _CamelIMAPXServerPrivate {
        /* The 'stream_lock' also guards the GSubprocess. */
        CamelIMAPXStream *stream;
        GInputStream *input_stream;
+       GOutputStream *output_stream;
 #if GLIB_CHECK_VERSION(2,39,0)
        GSubprocess *subprocess;
 #endif
@@ -8054,6 +8055,38 @@ camel_imapx_server_ref_input_stream (CamelIMAPXServer *is)
 }
 
 /**
+ * camel_imapx_server_ref_output_stream:
+ * @is: a #CamelIMAPXServer
+ *
+ * Returns the #GOutputStream for @is, which is owned by either a
+ * #GTcpConnection or a #GSubprocess.  If the #CamelIMAPXServer is not
+ * yet connected or has lost its connection, the function returns %NULL.
+ *
+ * The returned #GOutputStream is referenced for thread-safety and must
+ * be unreferenced with g_object_unref() when finished with it.
+ *
+ * Returns: a #GOutputStream, or %NULL
+ *
+ * Since: 3.12
+ **/
+GOutputStream *
+camel_imapx_server_ref_output_stream (CamelIMAPXServer *is)
+{
+       GOutputStream *output_stream = NULL;
+
+       g_return_val_if_fail (CAMEL_IS_IMAPX_SERVER (is), NULL);
+
+       g_mutex_lock (&is->priv->stream_lock);
+
+       if (is->priv->output_stream != NULL)
+               output_stream = g_object_ref (is->priv->output_stream);
+
+       g_mutex_unlock (&is->priv->stream_lock);
+
+       return output_stream;
+}
+
+/**
  * camel_imapx_server_ref_namespaces:
  * @is: a #CamelIMAPXServer
  *
@@ -8217,6 +8250,7 @@ imapx_disconnect (CamelIMAPXServer *is)
        }
 
        g_clear_object (&is->priv->input_stream);
+       g_clear_object (&is->priv->output_stream);
 
        g_mutex_unlock (&is->priv->stream_lock);
 
diff --git a/camel/providers/imapx/camel-imapx-server.h b/camel/providers/imapx/camel-imapx-server.h
index 33eb522..abddad8 100644
--- a/camel/providers/imapx/camel-imapx-server.h
+++ b/camel/providers/imapx/camel-imapx-server.h
@@ -147,6 +147,8 @@ CamelIMAPXStream *
                camel_imapx_server_ref_stream   (CamelIMAPXServer *is);
 GInputStream * camel_imapx_server_ref_input_stream
                                                (CamelIMAPXServer *is);
+GOutputStream *        camel_imapx_server_ref_output_stream
+                                               (CamelIMAPXServer *is);
 CamelIMAPXNamespaceResponse *
                camel_imapx_server_ref_namespaces
                                                (CamelIMAPXServer *is);
diff --git a/docs/reference/camel/camel-sections.txt b/docs/reference/camel/camel-sections.txt
index 055ebdb..7e665e1 100644
--- a/docs/reference/camel/camel-sections.txt
+++ b/docs/reference/camel/camel-sections.txt
@@ -3571,6 +3571,7 @@ camel_imapx_server_ref_store
 camel_imapx_server_ref_settings
 camel_imapx_server_ref_stream
 camel_imapx_server_ref_input_stream
+camel_imapx_server_ref_output_stream
 camel_imapx_server_ref_namespaces
 camel_imapx_server_ref_mailbox
 camel_imapx_server_ref_selected


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