[evolution-data-server] IMAPX: Populate the input and output streams.



commit 2fcf189bb893a10d951e32fe6b05ab5c9c9db954
Author: Matthew Barnes <mbarnes redhat com>
Date:   Thu Jan 23 07:27:52 2014 -0500

    IMAPX: Populate the input and output streams.
    
    Still not used yet, but they're set now.  Will need to wrapper the
    input stream in a custom GBufferedInputStream subclass for parsing.

 camel/providers/imapx/camel-imapx-server.c |   49 ++++++++++++++++++++++++++--
 1 files changed, 46 insertions(+), 3 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index 74c207b..5ec0be3 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -4325,20 +4325,29 @@ connect_to_server_process (CamelIMAPXServer *is,
        g_object_unref (launcher);
 
        if (subprocess != NULL) {
+               GInputStream *input_stream;
+               GOutputStream *output_stream;
+
                g_mutex_lock (&is->priv->stream_lock);
 
                g_warn_if_fail (is->priv->subprocess == NULL);
+               g_warn_if_fail (is->priv->input_stream == NULL);
+               g_warn_if_fail (is->priv->output_stream == NULL);
 
                is->priv->subprocess = g_object_ref (subprocess);
 
+               input_stream = g_subprocess_get_stdout_pipe (subprocess);
+               is->priv->input_stream = g_object_ref (input_stream);
+
+               output_stream = g_subprocess_get_stdin_pipe (subprocess);
+               is->priv->output_stream = g_object_ref (output_stream);
+
                g_mutex_unlock (&is->priv->stream_lock);
 
                g_object_unref (subprocess);
        }
 
-       /* FIXME Temporarily broken.  Need to port the rest of
-        *       IMAPX to use GInput/OutputStream directly. */
-       return FALSE;
+       return TRUE;
 
 #else /* GLIB_CHECK_VERSION(2,39,0) */
 
@@ -4407,6 +4416,22 @@ imapx_connect_to_server (CamelIMAPXServer *is,
                CAMEL_NETWORK_SERVICE (store), cancellable, error);
 
        if (base_stream != NULL) {
+               GInputStream *input_stream;
+               GOutputStream *output_stream;
+
+               g_mutex_lock (&is->priv->stream_lock);
+
+               g_warn_if_fail (is->priv->input_stream == NULL);
+               g_warn_if_fail (is->priv->output_stream == NULL);
+
+               input_stream = g_io_stream_get_input_stream (base_stream);
+               is->priv->input_stream = g_object_ref (input_stream);
+
+               output_stream = g_io_stream_get_output_stream (base_stream);
+               is->priv->output_stream = g_object_ref (output_stream);
+
+               g_mutex_unlock (&is->priv->stream_lock);
+
                stream = camel_stream_new (base_stream);
                g_object_unref (base_stream);
        } else {
@@ -4552,6 +4577,24 @@ imapx_connect_to_server (CamelIMAPXServer *is,
                g_object_unref (base_stream);
 
                if (tls_stream != NULL) {
+                       GInputStream *input_stream;
+                       GOutputStream *output_stream;
+
+                       g_mutex_lock (&is->priv->stream_lock);
+
+                       g_clear_object (&is->priv->input_stream);
+                       g_clear_object (&is->priv->output_stream);
+
+                       input_stream =
+                               g_io_stream_get_input_stream (tls_stream);
+                       is->priv->input_stream = g_object_ref (input_stream);
+
+                       output_stream =
+                               g_io_stream_get_output_stream (tls_stream);
+                       is->priv->output_stream = g_object_ref (output_stream);
+
+                       g_mutex_unlock (&is->priv->stream_lock);
+
                        camel_stream_set_base_stream (stream, tls_stream);
                        g_object_unref (tls_stream);
                } else {


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