lightmelody

changeset 736:28da2358458b objectify

Removing dead code
author Arc Riley <arcriley@gmail.com>
date Wed, 15 Oct 2014 10:35:23 +0000
parents eb010d7b06c8
children 418935456927
files src/lm-debug.c src/lm-debug.h src/lm-old-socket.c src/lm-old-socket.h src/lm-simple-io.c src/lm-simple-io.h src/lm-xmpp-writer.c src/lm-xmpp-writer.h
diffstat 8 files changed, 0 insertions(+), 1695 deletions(-) [+]
line diff
     1.1 --- a/src/lm-debug.c	Sat Oct 11 15:57:20 2014 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,106 +0,0 @@
     1.4 -/*
     1.5 - *  Copyright (C) 2012,2013,2014 Copyleft Games Group
     1.6 - *  Copyright (C) 2003 Imendio AB
     1.7 - *
     1.8 - *  This program is free software; you can redistribute it and/or modify
     1.9 - *  it under the terms of the GNU Affero General Public License as published
    1.10 - *  by the Free Software Foundation, either version 3 of the License, or
    1.11 - *  (at your option) any later version.
    1.12 - *
    1.13 - *  This program is distributed in the hope that it will be useful,
    1.14 - *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.15 - *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.16 - *  GNU Affero General Public License for more details.
    1.17 - *
    1.18 - *  You should have received a copy of the GNU Affero General Public License
    1.19 - *  along with this program; if not, see http://www.gnu.org/licenses
    1.20 - *
    1.21 - */
    1.22 -
    1.23 -#include "lm-debug.h"
    1.24 -
    1.25 -#ifndef LM_NO_DEBUG
    1.26 -
    1.27 -static LmLogLevelFlags debug_flags = 0;
    1.28 -static gboolean initialized = FALSE;
    1.29 -
    1.30 -static const GDebugKey debug_keys[] = {
    1.31 -    {"VERBOSE",      LM_LOG_LEVEL_VERBOSE},
    1.32 -    {"NET",          LM_LOG_LEVEL_NET},
    1.33 -    {"PARSER",       LM_LOG_LEVEL_PARSER},
    1.34 -    {"SSL",          LM_LOG_LEVEL_SSL},
    1.35 -    {"SASL",         LM_LOG_LEVEL_SASL},
    1.36 -    {"ALL",          LM_LOG_LEVEL_ALL}
    1.37 -};
    1.38 -
    1.39 -#define NUM_DEBUG_KEYS (sizeof (debug_keys) / sizeof (GDebugKey))
    1.40 -
    1.41 -static void
    1.42 -debug_log_handler (const gchar    *log_domain,
    1.43 -                   GLogLevelFlags  log_level,
    1.44 -                   const gchar    *message,
    1.45 -                   gpointer        user_data)
    1.46 -{
    1.47 -    if (debug_flags & log_level) {
    1.48 -        if (log_level & LM_LOG_LEVEL_VERBOSE) {
    1.49 -            g_print ("*** ");
    1.50 -        }
    1.51 -        else if (log_level & LM_LOG_LEVEL_PARSER) {
    1.52 -            g_print ("LM-PARSER: ");
    1.53 -        }
    1.54 -        else if (log_level & LM_LOG_LEVEL_SASL) {
    1.55 -            g_print ("LM-SASL: ");
    1.56 -        }
    1.57 -        else if (log_level & LM_LOG_LEVEL_SSL) {
    1.58 -            g_print ("LM-SSL: ");
    1.59 -        }
    1.60 -
    1.61 -        g_print ("%s", message);
    1.62 -    }
    1.63 -}
    1.64 -
    1.65 -/**
    1.66 - * lm_debug_init
    1.67 - *
    1.68 - * Initialized the debug system.
    1.69 - **/
    1.70 -void
    1.71 -lm_debug_init (void)
    1.72 -{
    1.73 -    const gchar *env_lm_debug;
    1.74 -
    1.75 -    if (initialized) {
    1.76 -        return;
    1.77 -    }
    1.78 -
    1.79 -    env_lm_debug = g_getenv ("LM_DEBUG");
    1.80 -    if (env_lm_debug) {
    1.81 -        debug_flags = g_parse_debug_string (env_lm_debug, debug_keys,
    1.82 -                                            NUM_DEBUG_KEYS);
    1.83 -    }
    1.84 -
    1.85 -    g_log_set_handler (LM_LOG_DOMAIN, LM_LOG_LEVEL_ALL,
    1.86 -                       debug_log_handler, NULL);
    1.87 -
    1.88 -    initialized = TRUE;
    1.89 -}
    1.90 -
    1.91 -#else  /* LM_NO_DEBUG */
    1.92 -
    1.93 -static void
    1.94 -do_nothing_log_handler (const gchar    *log_domain,
    1.95 -                        GLogLevelFlags  log_level,
    1.96 -                        const gchar    *message,
    1.97 -                        gpointer        user_data)
    1.98 -{
    1.99 -}
   1.100 -
   1.101 -void
   1.102 -lm_debug_init (void)
   1.103 -{
   1.104 -    g_log_set_handler (LM_LOG_DOMAIN, LM_LOG_LEVEL_ALL,
   1.105 -                       do_nothing_log_handler, NULL);
   1.106 -}
   1.107 -
   1.108 -#endif /* LM_NO_DEBUG */
   1.109 -
     2.1 --- a/src/lm-debug.h	Sat Oct 11 15:57:20 2014 +0000
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,74 +0,0 @@
     2.4 -/*
     2.5 - *  Copyright (C) 2012,2013,2014 Copyleft Games Group
     2.6 - *  Copyright (C) 2003 Imendio AB
     2.7 - *
     2.8 - *  This program is free software; you can redistribute it and/or modify
     2.9 - *  it under the terms of the GNU Affero General Public License as published
    2.10 - *  by the Free Software Foundation, either version 3 of the License, or
    2.11 - *  (at your option) any later version.
    2.12 - *
    2.13 - *  This program is distributed in the hope that it will be useful,
    2.14 - *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    2.15 - *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2.16 - *  GNU Affero General Public License for more details.
    2.17 - *
    2.18 - *  You should have received a copy of the GNU Affero General Public License
    2.19 - *  along with this program; if not, see http://www.gnu.org/licenses
    2.20 - *
    2.21 - */
    2.22 -
    2.23 -#ifndef __LM_DEBUG_H__
    2.24 -#define __LM_DEBUG_H__
    2.25 -
    2.26 -#include <glib.h>
    2.27 -
    2.28 -typedef enum {
    2.29 -    LM_LOG_LEVEL_VERBOSE = 1 << (G_LOG_LEVEL_USER_SHIFT),
    2.30 -    LM_LOG_LEVEL_NET     = 1 << (G_LOG_LEVEL_USER_SHIFT + 1),
    2.31 -    LM_LOG_LEVEL_PARSER  = 1 << (G_LOG_LEVEL_USER_SHIFT + 2),
    2.32 -    LM_LOG_LEVEL_SSL     = 1 << (G_LOG_LEVEL_USER_SHIFT + 3),
    2.33 -    LM_LOG_LEVEL_SASL    = 1 << (G_LOG_LEVEL_USER_SHIFT + 4),
    2.34 -    LM_LOG_LEVEL_ALL     = (LM_LOG_LEVEL_NET |
    2.35 -                            LM_LOG_LEVEL_VERBOSE |
    2.36 -                            LM_LOG_LEVEL_PARSER |
    2.37 -                            LM_LOG_LEVEL_SSL |
    2.38 -                            LM_LOG_LEVEL_SASL)
    2.39 -} LmLogLevelFlags;
    2.40 -
    2.41 -#ifndef LM_LOG_DOMAIN
    2.42 -#  define LM_LOG_DOMAIN "LM"
    2.43 -#endif
    2.44 -
    2.45 -#ifdef G_HAVE_ISO_VARARGS
    2.46 -#  ifdef LM_NO_DEBUG
    2.47 -#    define lm_verbose(...)
    2.48 -#  else
    2.49 -#    define lm_verbose(...) \
    2.50 -       g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_VERBOSE, __VA_ARGS__)
    2.51 -#  endif
    2.52 -#elif defined(G_HAVE_GNUC_VARARGS)
    2.53 -#  if LM_NO_DEBUG
    2.54 -#    define lm_verbose(fmt...)
    2.55 -#  else
    2.56 -#    define lm_verbose(fmt...) \
    2.57 -       g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_VERBOSE, fmt)
    2.58 -#  endif
    2.59 -#else
    2.60 -#  if LM_NO_DEBUG
    2.61 -#    define lm_verbose(const gchar *format, ...) {};
    2.62 -#  else
    2.63 -static void
    2.64 -lm_verbose (const gchar *format, ...)
    2.65 -{
    2.66 -    va_list args;
    2.67 -    va_start (args, format);
    2.68 -    g_logv (LM_LOG_DOMAIN, LM_LOG_LEVEL_VERBOSE, format, args);
    2.69 -    va_end (args);
    2.70 -}
    2.71 -#  endif
    2.72 -#endif
    2.73 -
    2.74 -void lm_debug_init (void);
    2.75 -
    2.76 -#endif /* __LM_DEBUG_H__ */
    2.77 -
     3.1 --- a/src/lm-old-socket.c	Sat Oct 11 15:57:20 2014 +0000
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,1088 +0,0 @@
     3.4 -/*
     3.5 - *  Copyright (C) 2012,2013,2014 Copyleft Games Group
     3.6 - *  Copyright (C) 2006-2008 Imendio AB
     3.7 - *  Copyright (C) 2007 Collabora Ltd.
     3.8 - *  Copyright (C) 2006 Nokia Corporation
     3.9 - *
    3.10 - *  This program is free software; you can redistribute it and/or modify
    3.11 - *  it under the terms of the GNU Affero General Public License as published
    3.12 - *  by the Free Software Foundation, either version 3 of the License, or
    3.13 - *  (at your option) any later version.
    3.14 - *
    3.15 - *  This program is distributed in the hope that it will be useful,
    3.16 - *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    3.17 - *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3.18 - *  GNU Affero General Public License for more details.
    3.19 - *
    3.20 - *  You should have received a copy of the GNU Affero General Public License
    3.21 - *  along with this program; if not, see http://www.gnu.org/licenses
    3.22 - *
    3.23 - */
    3.24 -
    3.25 -#include <config.h>
    3.26 -
    3.27 -#include <string.h>
    3.28 -#include <sys/types.h>
    3.29 -
    3.30 -/* Needed on Mac OS X */
    3.31 -#if HAVE_NETINET_IN_H
    3.32 -#include <netinet/in.h>
    3.33 -#endif
    3.34 -
    3.35 -/* Needed on Mac OS X */
    3.36 -#if HAVE_ARPA_NAMESER_COMPAT_H
    3.37 -#include <arpa/nameser_compat.h>
    3.38 -#endif
    3.39 -
    3.40 -#include <arpa/inet.h>
    3.41 -#include <arpa/nameser.h>
    3.42 -#include <resolv.h>
    3.43 -
    3.44 -#include "lm-debug.h"
    3.45 -#include "lm-internals.h"
    3.46 -#include "lm-misc.h"
    3.47 -#include <lightmelody.h>
    3.48 -#include "lm-resolver.h"
    3.49 -#include <loudmouth/lm-ssl.h>
    3.50 -#include "lm-ssl-internals.h"
    3.51 -#include "lm-sock.h"
    3.52 -#include "lm-old-socket.h"
    3.53 -
    3.54 -#define IN_BUFFER_SIZE 1024
    3.55 -#define SRV_LEN 8192
    3.56 -
    3.57 -struct _LmOldSocket {
    3.58 -    LmConnection      *connection;
    3.59 -    GMainContext      *context;
    3.60 -
    3.61 -    gchar             *domain;
    3.62 -    gchar             *server;
    3.63 -    guint              port;
    3.64 -
    3.65 -    LmSSL             *ssl;
    3.66 -    gboolean           ssl_started;
    3.67 -    LmProxy           *proxy;
    3.68 -
    3.69 -    GIOChannel        *io_channel;
    3.70 -    GSource           *watch_in;
    3.71 -    GSource           *watch_err;
    3.72 -    GSource           *watch_hup;
    3.73 -
    3.74 -    LmOldSocketT       fd;
    3.75 -
    3.76 -    GSource           *watch_connect;
    3.77 -
    3.78 -    gboolean           cancel_open;
    3.79 -
    3.80 -    GSource           *watch_out;
    3.81 -    GString           *out_buf;
    3.82 -
    3.83 -    LmConnectData     *connect_data;
    3.84 -
    3.85 -    IncomingDataFunc   data_func;
    3.86 -    SocketClosedFunc   closed_func;
    3.87 -    ConnectResultFunc  connect_func;
    3.88 -    gpointer           user_data;
    3.89 -
    3.90 -    guint              ref_count;
    3.91 -
    3.92 -    LmResolver        *resolver;
    3.93 -};
    3.94 -
    3.95 -static void         socket_free                    (LmOldSocket    *socket);
    3.96 -static gboolean     socket_do_connect              (LmConnectData  *connect_data);
    3.97 -static gboolean     socket_connect_cb              (GIOChannel     *source,
    3.98 -                                                    GIOCondition    condition,
    3.99 -                                                    LmConnectData  *connect_data);
   3.100 -static gboolean     socket_in_event                (GIOChannel     *source,
   3.101 -                                                    GIOCondition    condition,
   3.102 -                                                    LmOldSocket    *socket);
   3.103 -static gboolean     socket_hup_event               (GIOChannel     *source,
   3.104 -                                                    GIOCondition    condition,
   3.105 -                                                    LmOldSocket    *socket);
   3.106 -static gboolean     socket_error_event             (GIOChannel     *source,
   3.107 -                                                    GIOCondition    condition,
   3.108 -                                                    LmOldSocket    *socket);
   3.109 -static gboolean     socket_buffered_write_cb       (GIOChannel     *source,
   3.110 -                                                    GIOCondition    condition,
   3.111 -                                                    LmOldSocket    *socket);
   3.112 -static void         socket_close_io_channel        (GIOChannel     *io_channel);
   3.113 -static gboolean     old_socket_output_is_buffered  (LmOldSocket    *socket,
   3.114 -                                                    const gchar    *buffer,
   3.115 -                                                    gint            len);
   3.116 -static void         old_socket_setup_output_buffer (LmOldSocket    *socket,
   3.117 -                                                    const gchar    *buffer,
   3.118 -                                                    gint            len);
   3.119 -
   3.120 -static void
   3.121 -socket_free (LmOldSocket *socket)
   3.122 -{
   3.123 -    g_free (socket->server);
   3.124 -    g_free (socket->domain);
   3.125 -
   3.126 -    if (socket->ssl) {
   3.127 -        lm_ssl_unref (socket->ssl);
   3.128 -    }
   3.129 -
   3.130 -    if (socket->proxy) {
   3.131 -        lm_proxy_unref (socket->proxy);
   3.132 -    }
   3.133 -
   3.134 -    if (socket->out_buf) {
   3.135 -        g_string_free (socket->out_buf, TRUE);
   3.136 -    }
   3.137 -
   3.138 -    if (socket->resolver) {
   3.139 -        g_object_unref (socket->resolver);
   3.140 -    }
   3.141 -
   3.142 -    g_free (socket);
   3.143 -}
   3.144 -
   3.145 -static gint
   3.146 -old_socket_do_write (LmOldSocket *socket, const gchar *buf, guint len)
   3.147 -{
   3.148 -    gint b_written;
   3.149 -
   3.150 -    if (socket->ssl_started) {
   3.151 -        b_written = _lm_ssl_send (socket->ssl, buf, len);
   3.152 -    } else {
   3.153 -        GIOStatus io_status = G_IO_STATUS_AGAIN;
   3.154 -        gsize     bytes_written;
   3.155 -
   3.156 -        while (io_status == G_IO_STATUS_AGAIN) {
   3.157 -            io_status = g_io_channel_write_chars (socket->io_channel,
   3.158 -                                                  buf, len,
   3.159 -                                                  &bytes_written,
   3.160 -                                                  NULL);
   3.161 -        }
   3.162 -
   3.163 -        b_written = bytes_written;
   3.164 -
   3.165 -        if (io_status != G_IO_STATUS_NORMAL) {
   3.166 -            b_written = -1;
   3.167 -        }
   3.168 -    }
   3.169 -
   3.170 -    return b_written;
   3.171 -}
   3.172 -
   3.173 -gint
   3.174 -lm_old_socket_write (LmOldSocket *socket, const gchar *buf, gint len)
   3.175 -{
   3.176 -    gint b_written;
   3.177 -
   3.178 -    if (old_socket_output_is_buffered (socket, buf, len)) {
   3.179 -        return len;
   3.180 -    }
   3.181 -
   3.182 -    b_written = old_socket_do_write (socket, buf, len);
   3.183 -
   3.184 -    if (b_written < len && b_written != -1) {
   3.185 -        old_socket_setup_output_buffer (socket,
   3.186 -                                        buf + b_written,
   3.187 -                                        len - b_written);
   3.188 -        return len;
   3.189 -    }
   3.190 -
   3.191 -    return b_written;
   3.192 -}
   3.193 -
   3.194 -static gboolean
   3.195 -socket_read_incoming (LmOldSocket *socket,
   3.196 -                      gchar    *buf,
   3.197 -                      gsize     buf_size,
   3.198 -                      gsize    *bytes_read,
   3.199 -                      gboolean *hangup,
   3.200 -                      gint     *reason)
   3.201 -{
   3.202 -    GIOStatus status;
   3.203 -
   3.204 -    *hangup = FALSE;
   3.205 -
   3.206 -    if (socket->ssl_started) {
   3.207 -        status = _lm_ssl_read (socket->ssl,
   3.208 -                               buf, buf_size - 1, bytes_read);
   3.209 -    } else {
   3.210 -        status = g_io_channel_read_chars (socket->io_channel,
   3.211 -                                          buf, buf_size - 1,
   3.212 -                                          bytes_read,
   3.213 -                                          NULL);
   3.214 -    }
   3.215 -
   3.216 -    if (status != G_IO_STATUS_NORMAL || *bytes_read < 0) {
   3.217 -        switch (status) {
   3.218 -        case G_IO_STATUS_EOF:
   3.219 -            *reason = LM_DISCONNECT_REASON_HUP;
   3.220 -            break;
   3.221 -        case G_IO_STATUS_AGAIN:
   3.222 -            /* No data readable but we didn't hangup */
   3.223 -            return FALSE;
   3.224 -            break;
   3.225 -        case G_IO_STATUS_ERROR:
   3.226 -            *reason = LM_DISCONNECT_REASON_ERROR;
   3.227 -            break;
   3.228 -        default:
   3.229 -            *reason = LM_DISCONNECT_REASON_UNKNOWN;
   3.230 -        }
   3.231 -
   3.232 -        /* Notify connection_in_event that we hangup the connection */
   3.233 -        *hangup = TRUE;
   3.234 -
   3.235 -        return FALSE;
   3.236 -    }
   3.237 -
   3.238 -    buf[*bytes_read] = '\0';
   3.239 -
   3.240 -    /* There is more data to be read */
   3.241 -    return TRUE;
   3.242 -}
   3.243 -
   3.244 -static gboolean
   3.245 -socket_in_event (GIOChannel   *source,
   3.246 -                 GIOCondition  condition,
   3.247 -                 LmOldSocket     *socket)
   3.248 -{
   3.249 -    gchar    buf[IN_BUFFER_SIZE];
   3.250 -    gsize    bytes_read = 0;
   3.251 -    gboolean read_anything = FALSE;
   3.252 -    gboolean hangup = 0;
   3.253 -    gint     reason = 0;
   3.254 -
   3.255 -    if (!socket->io_channel) {
   3.256 -        return FALSE;
   3.257 -    }
   3.258 -
   3.259 -    while (socket_read_incoming (socket, buf, IN_BUFFER_SIZE,
   3.260 -                                 &bytes_read, &hangup, &reason)) {
   3.261 -
   3.262 -        g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_NET, "\nRECV [%d]:\n",
   3.263 -               (int)bytes_read);
   3.264 -        g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_NET,
   3.265 -               "-----------------------------------\n");
   3.266 -        g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_NET, "'%s'\n", buf);
   3.267 -        g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_NET,
   3.268 -               "-----------------------------------\n");
   3.269 -
   3.270 -        lm_verbose ("Read: %d chars\n", (int)bytes_read);
   3.271 -
   3.272 -        (socket->data_func) (socket, buf, socket->user_data);
   3.273 -
   3.274 -        read_anything = TRUE;
   3.275 -    }
   3.276 -
   3.277 -    /* If we have read something, delay the hangup so that the data can be
   3.278 -     * processed. */
   3.279 -    if (hangup && !read_anything) {
   3.280 -        (socket->closed_func) (socket, reason, socket->user_data);
   3.281 -        return FALSE;
   3.282 -    }
   3.283 -
   3.284 -    return TRUE;
   3.285 -}
   3.286 -
   3.287 -static const char *
   3.288 -socket_io_condition_to_str  (GIOCondition condition)
   3.289 -{
   3.290 -    static char buf[256];
   3.291 -
   3.292 -    buf[0] = '\0';
   3.293 -
   3.294 -    if(condition & G_IO_ERR)
   3.295 -        strcat(buf, "G_IO_ERR ");
   3.296 -    if(condition & G_IO_HUP)
   3.297 -        strcat(buf, "G_IO_HUP ");
   3.298 -    if(condition & G_IO_NVAL)
   3.299 -        strcat(buf, "G_IO_NVAL ");
   3.300 -    if(condition & G_IO_IN)
   3.301 -        strcat(buf, "G_IO_IN ");
   3.302 -    if(condition & G_IO_OUT)
   3.303 -        strcat(buf, "G_IO_OUT ");
   3.304 -
   3.305 -    return buf;
   3.306 -}
   3.307 -
   3.308 -static gboolean
   3.309 -socket_hup_event (GIOChannel   *source,
   3.310 -                  GIOCondition  condition,
   3.311 -                  LmOldSocket     *socket)
   3.312 -{
   3.313 -    lm_verbose ("HUP event: %d->'%s'\n",
   3.314 -                condition, socket_io_condition_to_str (condition));
   3.315 -
   3.316 -    if (!socket->io_channel) {
   3.317 -        return FALSE;
   3.318 -    }
   3.319 -
   3.320 -    (socket->closed_func) (socket, LM_DISCONNECT_REASON_HUP,
   3.321 -                           socket->user_data);
   3.322 -
   3.323 -    return TRUE;
   3.324 -}
   3.325 -
   3.326 -static gboolean
   3.327 -socket_error_event (GIOChannel   *source,
   3.328 -                    GIOCondition  condition,
   3.329 -                    LmOldSocket     *socket)
   3.330 -{
   3.331 -    lm_verbose ("ERROR event: %d->'%s'\n",
   3.332 -                condition, socket_io_condition_to_str (condition));
   3.333 -
   3.334 -    if (!socket->io_channel) {
   3.335 -        return FALSE;
   3.336 -    }
   3.337 -
   3.338 -    (socket->closed_func) (socket, LM_DISCONNECT_REASON_ERROR,
   3.339 -                           socket->user_data);
   3.340 -
   3.341 -    return TRUE;
   3.342 -}
   3.343 -
   3.344 -static gboolean
   3.345 -_lm_old_socket_ssl_init (LmOldSocket *socket, gboolean delayed)
   3.346 -{
   3.347 -    GError *error = NULL;
   3.348 -    const gchar *ssl_verify_domain = NULL;
   3.349 -
   3.350 -    lm_verbose ("Setting up SSL...\n");
   3.351 -
   3.352 -    _lm_ssl_initialize (socket->ssl);
   3.353 -
   3.354 -#ifdef HAVE_GNUTLS
   3.355 -    /* GNU TLS requires the socket to be blocking */
   3.356 -    _lm_sock_set_blocking (socket->fd, TRUE);
   3.357 -#endif
   3.358 -
   3.359 -    /* If we're using StartTLS, the correct thing is to verify against
   3.360 -     * the domain. If we're using old SSL, we should verify against the
   3.361 -     * hostname. */
   3.362 -    if (delayed)
   3.363 -        ssl_verify_domain = socket->domain;
   3.364 -    else
   3.365 -        ssl_verify_domain = socket->server;
   3.366 -
   3.367 -    if (!_lm_ssl_begin (socket->ssl, socket->fd, ssl_verify_domain, &error)) {
   3.368 -        lm_verbose ("Could not begin SSL\n");
   3.369 -
   3.370 -        if (error) {
   3.371 -            g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_NET,
   3.372 -                   "%s\n", error->message);
   3.373 -            g_error_free (error);
   3.374 -        }
   3.375 -
   3.376 -        _lm_sock_shutdown (socket->fd);
   3.377 -        _lm_sock_close (socket->fd);
   3.378 -
   3.379 -        if (!delayed && socket->connect_func) {
   3.380 -            (socket->connect_func) (socket, FALSE, socket->user_data);
   3.381 -        }
   3.382 -
   3.383 -        return FALSE;
   3.384 -    }
   3.385 -
   3.386 -#ifdef HAVE_GNUTLS
   3.387 -    _lm_sock_set_blocking (socket->fd, FALSE);
   3.388 -#endif
   3.389 -
   3.390 -    socket->ssl_started = TRUE;
   3.391 -
   3.392 -    return TRUE;
   3.393 -}
   3.394 -
   3.395 -gboolean
   3.396 -lm_old_socket_starttls (LmOldSocket *socket)
   3.397 -{
   3.398 -    g_return_val_if_fail (lm_ssl_get_use_starttls (socket->ssl) == TRUE, FALSE);
   3.399 -
   3.400 -    return _lm_old_socket_ssl_init (socket, TRUE);
   3.401 -}
   3.402 -
   3.403 -
   3.404 -
   3.405 -void
   3.406 -_lm_old_socket_succeeded (LmConnectData *connect_data)
   3.407 -{
   3.408 -    LmOldSocket *socket;
   3.409 -
   3.410 -    socket = connect_data->socket;
   3.411 -
   3.412 -    if (socket->watch_connect) {
   3.413 -        g_source_destroy (socket->watch_connect);
   3.414 -        socket->watch_connect = NULL;
   3.415 -    }
   3.416 -
   3.417 -    /* Need some way to report error/success */
   3.418 -    if (socket->cancel_open) {
   3.419 -        lm_verbose ("Cancelling connection...\n");
   3.420 -        if (socket->connect_func) {
   3.421 -            (socket->connect_func) (socket, FALSE, socket->user_data);
   3.422 -        }
   3.423 -        return;
   3.424 -    }
   3.425 -
   3.426 -    socket->fd = connect_data->fd;
   3.427 -    socket->io_channel = connect_data->io_channel;
   3.428 -
   3.429 -    g_object_unref (socket->resolver);
   3.430 -    socket->resolver = NULL;
   3.431 -
   3.432 -    socket->connect_data = NULL;
   3.433 -    g_free (connect_data);
   3.434 -
   3.435 -    /* old-style ssl should be started immediately */
   3.436 -    if (socket->ssl && (lm_ssl_get_use_starttls (socket->ssl) == FALSE)) {
   3.437 -        if (!_lm_old_socket_ssl_init (socket, FALSE)) {
   3.438 -            return;
   3.439 -        }
   3.440 -    }
   3.441 -
   3.442 -    socket->watch_in =
   3.443 -        lm_misc_add_io_watch (socket->context,
   3.444 -                              socket->io_channel,
   3.445 -                              G_IO_IN,
   3.446 -                              (GIOFunc) socket_in_event,
   3.447 -                              socket);
   3.448 -
   3.449 -    /* FIXME: if we add these, we don't get ANY
   3.450 -     * response from the server, this is to do with the way that
   3.451 -     * windows handles watches, see bug #331214.
   3.452 -     */
   3.453 -#ifndef G_OS_WIN32
   3.454 -    socket->watch_err =
   3.455 -        lm_misc_add_io_watch (socket->context,
   3.456 -                              socket->io_channel,
   3.457 -                              G_IO_ERR,
   3.458 -                              (GIOFunc) socket_error_event,
   3.459 -                              socket);
   3.460 -
   3.461 -    socket->watch_hup =
   3.462 -        lm_misc_add_io_watch (socket->context,
   3.463 -                              socket->io_channel,
   3.464 -                              G_IO_HUP,
   3.465 -                              (GIOFunc) socket_hup_event,
   3.466 -                              socket);
   3.467 -#endif
   3.468 -
   3.469 -    if (socket->connect_func) {
   3.470 -        (socket->connect_func) (socket, TRUE, socket->user_data);
   3.471 -    }
   3.472 -}
   3.473 -
   3.474 -gboolean
   3.475 -_lm_old_socket_failed_with_error (LmConnectData *connect_data, int error)
   3.476 -{
   3.477 -    LmOldSocket *socket;
   3.478 -
   3.479 -    g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_NET,
   3.480 -           "Connection failed: %s (error %d)\n",
   3.481 -           _lm_sock_get_error_str (error), error);
   3.482 -
   3.483 -    socket = lm_old_socket_ref (connect_data->socket);
   3.484 -
   3.485 -    connect_data->current_addr = lm_resolver_results_get_next (socket->resolver);
   3.486 -
   3.487 -    if (socket->watch_connect) {
   3.488 -        g_source_destroy (socket->watch_connect);
   3.489 -        socket->watch_connect = NULL;
   3.490 -    }
   3.491 -
   3.492 -    if (connect_data->io_channel != NULL) {
   3.493 -        socket_close_io_channel (connect_data->io_channel);
   3.494 -        connect_data->io_channel = NULL;
   3.495 -    }
   3.496 -
   3.497 -    if (connect_data->current_addr == NULL) { /*Ran Out Of Addresses*/
   3.498 -        if (socket->connect_func) {
   3.499 -            (socket->connect_func) (socket, FALSE, socket->user_data);
   3.500 -        }
   3.501 -
   3.502 -        /* if the user callback called connection_close(), this is already freed */
   3.503 -        if (socket->connect_data != NULL) {
   3.504 -            if (socket->resolver) {
   3.505 -                g_object_unref (socket->resolver);
   3.506 -            }
   3.507 -
   3.508 -            socket->connect_data = NULL;
   3.509 -            g_free (connect_data);
   3.510 -        }
   3.511 -    } else {
   3.512 -        /* try to connect to the next host */
   3.513 -        return socket_do_connect (connect_data);
   3.514 -    }
   3.515 -
   3.516 -    lm_old_socket_unref (socket);
   3.517 -
   3.518 -    return FALSE;
   3.519 -}
   3.520 -
   3.521 -gboolean
   3.522 -_lm_old_socket_failed (LmConnectData *connect_data)
   3.523 -{
   3.524 -    return _lm_old_socket_failed_with_error (connect_data,
   3.525 -                                             _lm_sock_get_last_error());
   3.526 -}
   3.527 -
   3.528 -static gboolean
   3.529 -socket_connect_cb (GIOChannel   *source,
   3.530 -                   GIOCondition  condition,
   3.531 -                   LmConnectData *connect_data)
   3.532 -{
   3.533 -    LmOldSocket     *socket;
   3.534 -    /* struct addrinfo *addr; */
   3.535 -    int              err;
   3.536 -    socklen_t        len;
   3.537 -    LmOldSocketT     fd;
   3.538 -    gboolean         result = FALSE;
   3.539 -
   3.540 -    socket = lm_old_socket_ref (connect_data->socket);
   3.541 -    /* addr = connect_data->current_addr; */
   3.542 -    fd = g_io_channel_unix_get_fd (source);
   3.543 -
   3.544 -    if (condition == G_IO_ERR) {
   3.545 -        len = sizeof (err);
   3.546 -        _lm_sock_get_error (fd, &err, &len);
   3.547 -        if (!_lm_sock_is_blocking_error (err)) {
   3.548 -            g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_VERBOSE,
   3.549 -                   "Connection failed.\n");
   3.550 -
   3.551 -            /* error condition, but might be possible to recover
   3.552 -             * from it (by connecting to the next host) */
   3.553 -            if (!_lm_old_socket_failed_with_error (connect_data, err)) {
   3.554 -                socket->watch_connect = NULL;
   3.555 -                goto out;
   3.556 -            }
   3.557 -        }
   3.558 -    }
   3.559 -
   3.560 -#if 0
   3.561 -    if (_lm_connection_async_connect_waiting (socket->connection)) {
   3.562 -        gint res;
   3.563 -
   3.564 -        fd = g_io_channel_unix_get_fd (source);
   3.565 -
   3.566 -        res = _lm_sock_connect (fd, addr->ai_addr, (int)addr->ai_addrlen);
   3.567 -        if (res < 0) {
   3.568 -            err = _lm_sock_get_last_error ();
   3.569 -            if (_lm_sock_is_blocking_success (err)) {
   3.570 -                _lm_connection_set_async_connect_waiting (socket->connection, FALSE);
   3.571 -
   3.572 -                g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_NET,
   3.573 -                       "Connection success (1).\n");
   3.574 -
   3.575 -                _lm_old_socket_succeeded (connect_data);
   3.576 -            }
   3.577 -
   3.578 -            if (_lm_connection_async_connect_waiting (socket->connection) &&
   3.579 -                !_lm_sock_is_blocking_error (err)) {
   3.580 -                g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_NET,
   3.581 -                       "Connection failed.\n");
   3.582 -
   3.583 -                _lm_sock_close (connect_data->fd);
   3.584 -                _lm_old_socket_failed_with_error (connect_data, err);
   3.585 -
   3.586 -                socket->watch_connect = NULL;
   3.587 -                goto out;
   3.588 -            }
   3.589 -        }
   3.590 -    } else {
   3.591 -#endif
   3.592 -    {
   3.593 -        /* for blocking sockets, G_IO_OUT means we are connected */
   3.594 -        g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_VERBOSE,
   3.595 -               "Connection success (2).\n");
   3.596 -
   3.597 -        _lm_old_socket_succeeded (connect_data);
   3.598 -    }
   3.599 -
   3.600 -    result = TRUE;
   3.601 -
   3.602 - out:
   3.603 -    lm_old_socket_unref(socket);
   3.604 -
   3.605 -    return result;
   3.606 -}
   3.607 -
   3.608 -static gboolean
   3.609 -socket_do_connect (LmConnectData *connect_data)
   3.610 -{
   3.611 -    LmOldSocket     *socket;
   3.612 -    LmOldSocketT     fd;
   3.613 -    int              res, err;
   3.614 -    int              port;
   3.615 -    char             name[NI_MAXHOST];
   3.616 -    char             portname[NI_MAXSERV];
   3.617 -    struct addrinfo *addr;
   3.618 -
   3.619 -    socket = connect_data->socket;
   3.620 -    addr = connect_data->current_addr;
   3.621 -
   3.622 -    if (socket->port == 0) {
   3.623 -        socket->port = 5222;
   3.624 -    }
   3.625 -
   3.626 -    if (socket->proxy) {
   3.627 -        port = htons (lm_proxy_get_port (socket->proxy));
   3.628 -    } else {
   3.629 -        port = htons (socket->port);
   3.630 -    }
   3.631 -
   3.632 -    ((struct sockaddr_in *) addr->ai_addr)->sin_port = port;
   3.633 -
   3.634 -    res = getnameinfo (addr->ai_addr,
   3.635 -                       (socklen_t)addr->ai_addrlen,
   3.636 -                       name,     sizeof (name),
   3.637 -                       portname, sizeof (portname),
   3.638 -                       NI_NUMERICHOST | NI_NUMERICSERV);
   3.639 -
   3.640 -    if (res < 0) {
   3.641 -        return _lm_old_socket_failed (connect_data);
   3.642 -    }
   3.643 -
   3.644 -    g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_NET,
   3.645 -           "Trying %s port %s...\n", name, portname);
   3.646 -
   3.647 -    fd = _lm_sock_makesocket (addr->ai_family,
   3.648 -                              addr->ai_socktype,
   3.649 -                              addr->ai_protocol);
   3.650 -
   3.651 -    if (!_LM_SOCK_VALID (fd)) {
   3.652 -        g_print("invalid fd\n");
   3.653 -        g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_NET,
   3.654 -               "Failed making socket, error:%d...\n",
   3.655 -               _lm_sock_get_last_error ());
   3.656 -
   3.657 -        return _lm_old_socket_failed (connect_data);
   3.658 -    }
   3.659 -
   3.660 -    /* Even though it says _unix_new(), it is supported by glib on
   3.661 -     * win32 because glib does some cool stuff to find out if it
   3.662 -     * can treat it as a FD or a windows SOCKET.
   3.663 -     */
   3.664 -    connect_data->fd = fd;
   3.665 -    connect_data->io_channel = g_io_channel_unix_new (fd);
   3.666 -
   3.667 -    g_io_channel_set_encoding (connect_data->io_channel, NULL, NULL);
   3.668 -    g_io_channel_set_buffered (connect_data->io_channel, FALSE);
   3.669 -
   3.670 -    _lm_sock_set_blocking (connect_data->fd, FALSE);
   3.671 -
   3.672 -    if (socket->proxy) {
   3.673 -    /*
   3.674 -
   3.675 -        socket->watch_connect =
   3.676 -            lm_misc_add_io_watch (socket->context,
   3.677 -                                  connect_data->io_channel,
   3.678 -                                  G_IO_OUT|G_IO_ERR,
   3.679 -                                  (GIOFunc) _lm_proxy_connect_cb,
   3.680 -                                  connect_data);
   3.681 -    */
   3.682 -    } else {
   3.683 -        socket->watch_connect =
   3.684 -            lm_misc_add_io_watch (socket->context,
   3.685 -                                  connect_data->io_channel,
   3.686 -                                  G_IO_OUT|G_IO_ERR,
   3.687 -                                  (GIOFunc) socket_connect_cb,
   3.688 -                                  connect_data);
   3.689 -    }
   3.690 -
   3.691 -    res = _lm_sock_connect (connect_data->fd,
   3.692 -                            addr->ai_addr, (int)addr->ai_addrlen);
   3.693 -    if (res < 0) {
   3.694 -        err = _lm_sock_get_last_error ();
   3.695 -        if (!_lm_sock_is_blocking_error (err)) {
   3.696 -            _lm_sock_close (connect_data->fd);
   3.697 -            g_print("unable to connect\n");
   3.698 -            return _lm_old_socket_failed_with_error (connect_data, err);
   3.699 -        }
   3.700 -    }
   3.701 -
   3.702 -    return TRUE;
   3.703 -}
   3.704 -
   3.705 -static gboolean
   3.706 -old_socket_output_is_buffered (LmOldSocket     *socket,
   3.707 -                               const gchar  *buffer,
   3.708 -                               gint          len)
   3.709 -{
   3.710 -    if (socket->out_buf) {
   3.711 -        lm_verbose ("Appending %d bytes to output buffer\n", len);
   3.712 -        g_string_append_len (socket->out_buf, buffer, len);
   3.713 -        return TRUE;
   3.714 -    }
   3.715 -
   3.716 -    return FALSE;
   3.717 -}
   3.718 -
   3.719 -static void
   3.720 -old_socket_setup_output_buffer (LmOldSocket *socket, const gchar *buffer, gint len)
   3.721 -{
   3.722 -    lm_verbose ("OUTPUT BUFFER ENABLED\n");
   3.723 -
   3.724 -    socket->out_buf = g_string_new_len (buffer, len);
   3.725 -
   3.726 -    socket->watch_out =
   3.727 -        lm_misc_add_io_watch (socket->context,
   3.728 -                              socket->io_channel,
   3.729 -                              G_IO_OUT,
   3.730 -                              (GIOFunc) socket_buffered_write_cb,
   3.731 -                              socket);
   3.732 -}
   3.733 -
   3.734 -static gboolean
   3.735 -socket_buffered_write_cb (GIOChannel   *source,
   3.736 -                          GIOCondition  condition,
   3.737 -                          LmOldSocket     *socket)
   3.738 -{
   3.739 -    gint     b_written;
   3.740 -    GString *out_buf;
   3.741 -
   3.742 -    out_buf = socket->out_buf;
   3.743 -    if (!out_buf) {
   3.744 -        /* Should not be possible */
   3.745 -        return FALSE;
   3.746 -    }
   3.747 -
   3.748 -    b_written = old_socket_do_write (socket, out_buf->str, out_buf->len);
   3.749 -
   3.750 -    if (b_written < 0) {
   3.751 -        (socket->closed_func) (socket, LM_DISCONNECT_REASON_ERROR,
   3.752 -                               socket->user_data);
   3.753 -        return FALSE;
   3.754 -    }
   3.755 -
   3.756 -    g_string_erase (out_buf, 0, (gsize) b_written);
   3.757 -    if (out_buf->len == 0) {
   3.758 -        lm_verbose ("Output buffer is empty, going back to normal output\n");
   3.759 -
   3.760 -        if (socket->watch_out) {
   3.761 -            g_source_destroy (socket->watch_out);
   3.762 -            socket->watch_out = NULL;
   3.763 -        }
   3.764 -
   3.765 -        g_string_free (out_buf, TRUE);
   3.766 -        socket->out_buf = NULL;
   3.767 -        return FALSE;
   3.768 -    }
   3.769 -
   3.770 -    return TRUE;
   3.771 -}
   3.772 -
   3.773 -static void
   3.774 -socket_close_io_channel (GIOChannel *io_channel)
   3.775 -{
   3.776 -    gint fd;
   3.777 -
   3.778 -    g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_NET,
   3.779 -           "Freeing up IOChannel and file descriptor\n");
   3.780 -
   3.781 -    fd = g_io_channel_unix_get_fd (io_channel);
   3.782 -
   3.783 -    g_io_channel_unref (io_channel);
   3.784 -
   3.785 -    _lm_sock_close (fd);
   3.786 -}
   3.787 -
   3.788 -static void
   3.789 -old_socket_resolver_host_cb (LmResolver       *resolver,
   3.790 -                             LmResolverResult  result,
   3.791 -                             gpointer          user_data)
   3.792 -{
   3.793 -    LmOldSocket *socket = (LmOldSocket *) user_data;
   3.794 -    char dispbuf[128];
   3.795 -    struct sockaddr_in *addr; /* FIXME:IPv6 */
   3.796 -    const char *converr;
   3.797 -
   3.798 -    lm_verbose ("LmOldSocket::host_cb (result=%d)\n", result);
   3.799 -
   3.800 -    if (result != LM_RESOLVER_RESULT_OK) {
   3.801 -        lm_verbose ("error while resolving, bailing out\n");
   3.802 -        if (socket->connect_func) {
   3.803 -            (socket->connect_func) (socket, FALSE, socket->user_data);
   3.804 -        }
   3.805 -        /*FIXME: Leaking Resolvers Until Clean Up Can Be Properly Handled
   3.806 -        g_object_unref (socket->resolver);
   3.807 -        socket->resolver = NULL;*/
   3.808 -        g_free (socket->connect_data);
   3.809 -        socket->connect_data = NULL;
   3.810 -
   3.811 -        return;
   3.812 -    }
   3.813 -
   3.814 -    socket->connect_data->current_addr =
   3.815 -        lm_resolver_results_get_next (resolver);
   3.816 -
   3.817 -    if (socket->connect_data->current_addr) { /* FIXME:IPv6 */
   3.818 -        addr = (struct sockaddr_in *) (socket->connect_data->current_addr->ai_addr);
   3.819 -        converr = inet_ntop(AF_INET,&(addr->sin_addr),dispbuf,sizeof(dispbuf));
   3.820 -        if (converr) {
   3.821 -            g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_VERBOSE,
   3.822 -                   "Attempting Connection to %s\n",dispbuf);
   3.823 -        } else {
   3.824 -            g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_VERBOSE,
   3.825 -                   "Attempting Connection (unable to convert address to presentable format)\n");
   3.826 -        };
   3.827 -        socket_do_connect (socket->connect_data);
   3.828 -    } else { /* FIXME: IPv6 Support? */
   3.829 -        g_log (LM_LOG_DOMAIN,G_LOG_LEVEL_ERROR,
   3.830 -               "Unable to locate server available over IPv4.\n");
   3.831 -    };
   3.832 -
   3.833 -    /* FIXME: What do we do here?  How to make the mainloop exit with an
   3.834 -       error, while having no ref to said mainloop */
   3.835 -}
   3.836 -
   3.837 -/* FIXME: Need to have a way to only get srv reply and then decide if the
   3.838 - *        resolver should continue to look the host up.
   3.839 - *
   3.840 - *        This is needed for the case when we do a SRV lookup to lookup the
   3.841 - *        real host of the service and then connect to it through a proxy.
   3.842 - */
   3.843 -static void
   3.844 -old_socket_resolver_srv_cb (LmResolver       *resolver,
   3.845 -                            LmResolverResult  result,
   3.846 -                            gpointer          user_data)
   3.847 -{
   3.848 -    LmOldSocket *socket = (LmOldSocket *) user_data;
   3.849 -    const gchar *remote_addr;
   3.850 -
   3.851 -    lm_verbose ("LmOldSocket::srv_cb (result=%d)\n", result);
   3.852 -
   3.853 -    if (result != LM_RESOLVER_RESULT_OK) {
   3.854 -        lm_verbose ("SRV lookup failed, trying jid domain\n");
   3.855 -        socket->server = g_strdup (socket->domain);
   3.856 -    } else {
   3.857 -        g_object_get (resolver, "host", &socket->server, NULL);
   3.858 -        g_object_get (resolver, "port", &socket->port, NULL);
   3.859 -    }
   3.860 -
   3.861 -    if (socket->proxy) {
   3.862 -        remote_addr = lm_proxy_get_server (socket->proxy);
   3.863 -    } else if (socket->server) {
   3.864 -        remote_addr = socket->server;
   3.865 -    }
   3.866 -    else {
   3.867 -        remote_addr = socket->domain;
   3.868 -    }
   3.869 -
   3.870 -    g_object_unref (socket->resolver);
   3.871 -
   3.872 -    socket->resolver =
   3.873 -            lm_resolver_new_for_host (remote_addr,
   3.874 -                                      old_socket_resolver_host_cb,
   3.875 -                                      socket);
   3.876 -
   3.877 -    lm_resolver_lookup (socket->resolver);
   3.878 -}
   3.879 -
   3.880 -LmOldSocket *
   3.881 -lm_old_socket_create (GMainContext      *context,
   3.882 -                      IncomingDataFunc   data_func,
   3.883 -                      SocketClosedFunc   closed_func,
   3.884 -                      ConnectResultFunc  connect_func,
   3.885 -                      gpointer           user_data,
   3.886 -                      LmConnection      *connection,
   3.887 -                      const gchar       *server,
   3.888 -                      const gchar       *domain,
   3.889 -                      guint              port,
   3.890 -                      LmSSL             *ssl,
   3.891 -                      LmProxy           *proxy,
   3.892 -                      GError           **error)
   3.893 -{
   3.894 -    LmOldSocket   *socket;
   3.895 -    LmConnectData *data;
   3.896 -
   3.897 -    g_return_val_if_fail (domain != NULL, NULL);
   3.898 -    g_return_val_if_fail ((port >= LM_MIN_PORT && port <= LM_MAX_PORT), NULL);
   3.899 -    g_return_val_if_fail (data_func != NULL, NULL);
   3.900 -    g_return_val_if_fail (closed_func != NULL, NULL);
   3.901 -    g_return_val_if_fail (connect_func != NULL, NULL);
   3.902 -
   3.903 -    socket = g_new0 (LmOldSocket, 1);
   3.904 -
   3.905 -    socket->ref_count = 1;
   3.906 -
   3.907 -    socket->connection = connection;
   3.908 -    socket->domain = g_strdup (domain);
   3.909 -    socket->server = g_strdup (server);
   3.910 -    socket->port = port;
   3.911 -    socket->cancel_open = FALSE;
   3.912 -    socket->ssl = ssl;
   3.913 -    socket->ssl_started = FALSE;
   3.914 -    socket->proxy = NULL;
   3.915 -
   3.916 -    if (context) {
   3.917 -        socket->context = g_main_context_ref (context);
   3.918 -    }
   3.919 -
   3.920 -    if (proxy) {
   3.921 -        socket->proxy = lm_proxy_ref (proxy);
   3.922 -    }
   3.923 -
   3.924 -    data = g_new0 (LmConnectData, 1);
   3.925 -    data->socket = socket;
   3.926 -    data->connection = socket->connection;
   3.927 -    data->fd = -1;
   3.928 -    socket->connect_data = data;
   3.929 -
   3.930 -    if (!server) {
   3.931 -        socket->resolver = lm_resolver_new_for_service (socket->domain,
   3.932 -                                                        "xmpp-client",
   3.933 -                                                        "tcp",
   3.934 -                                                        old_socket_resolver_srv_cb,
   3.935 -                                                        socket);
   3.936 -    } else {
   3.937 -        socket->resolver =
   3.938 -            lm_resolver_new_for_host (socket->server ? socket->server : socket->domain,
   3.939 -                                      old_socket_resolver_host_cb,
   3.940 -                                      socket);
   3.941 -    }
   3.942 -
   3.943 -    if (socket->context) {
   3.944 -        g_object_set (socket->resolver, "context", context, NULL);
   3.945 -    }
   3.946 -
   3.947 -    socket->data_func = data_func;
   3.948 -    socket->closed_func = closed_func;
   3.949 -    socket->connect_func = connect_func;
   3.950 -    socket->user_data = user_data;
   3.951 -
   3.952 -    lm_resolver_lookup (socket->resolver);
   3.953 -
   3.954 -    return socket;
   3.955 -}
   3.956 -
   3.957 -void
   3.958 -lm_old_socket_flush (LmOldSocket *socket)
   3.959 -{
   3.960 -    g_return_if_fail (socket != NULL);
   3.961 -    g_return_if_fail (socket->io_channel != NULL);
   3.962 -
   3.963 -    g_io_channel_flush (socket->io_channel, NULL);
   3.964 -}
   3.965 -
   3.966 -void
   3.967 -lm_old_socket_close (LmOldSocket *socket)
   3.968 -{
   3.969 -    LmConnectData *data;
   3.970 -
   3.971 -    g_return_if_fail (socket != NULL);
   3.972 -
   3.973 -    if (socket->watch_connect) {
   3.974 -        g_source_destroy (socket->watch_connect);
   3.975 -        socket->watch_connect = NULL;
   3.976 -    }
   3.977 -
   3.978 -    data = socket->connect_data;
   3.979 -    if (data) {
   3.980 -        if (data->io_channel) {
   3.981 -	    socket_close_io_channel (data->io_channel);
   3.982 -        }
   3.983 -        socket->connect_data = NULL;
   3.984 -        g_free (data);
   3.985 -    }
   3.986 -
   3.987 -    /* FIXME: Leaking Resolvers Until Clean Up Can Be Corrected
   3.988 -    if (socket->resolver) {
   3.989 -        g_object_unref (socket->resolver);
   3.990 -        socket->resolver = NULL;
   3.991 -    } */
   3.992 -
   3.993 -    if (socket->io_channel) {
   3.994 -        if (socket->watch_in) {
   3.995 -            g_source_destroy (socket->watch_in);
   3.996 -            socket->watch_in = NULL;
   3.997 -        }
   3.998 -
   3.999 -        if (socket->watch_err) {
  3.1000 -            g_source_destroy (socket->watch_err);
  3.1001 -            socket->watch_err = NULL;
  3.1002 -        }
  3.1003 -
  3.1004 -        if (socket->watch_hup) {
  3.1005 -            g_source_destroy (socket->watch_hup);
  3.1006 -            socket->watch_hup = NULL;
  3.1007 -        }
  3.1008 -
  3.1009 -        if (socket->watch_out) {
  3.1010 -            g_source_destroy (socket->watch_out);
  3.1011 -            socket->watch_out = NULL;
  3.1012 -        }
  3.1013 -
  3.1014 -        socket_close_io_channel (socket->io_channel);
  3.1015 -
  3.1016 -        socket->io_channel = NULL;
  3.1017 -        socket->fd = -1;
  3.1018 -    }
  3.1019 -
  3.1020 -    if (socket->ssl) {
  3.1021 -        _lm_ssl_close (socket->ssl);
  3.1022 -    }
  3.1023 -}
  3.1024 -
  3.1025 -gchar *
  3.1026 -lm_old_socket_get_local_host (LmOldSocket *socket)
  3.1027 -{
  3.1028 -    return _lm_sock_get_local_host (socket->fd);
  3.1029 -}
  3.1030 -
  3.1031 -LmOldSocket *
  3.1032 -lm_old_socket_ref (LmOldSocket *socket)
  3.1033 -{
  3.1034 -    g_return_val_if_fail (socket != NULL, NULL);
  3.1035 -
  3.1036 -    socket->ref_count++;
  3.1037 -
  3.1038 -    return socket;
  3.1039 -}
  3.1040 -
  3.1041 -void
  3.1042 -lm_old_socket_unref (LmOldSocket *socket)
  3.1043 -{
  3.1044 -    g_return_if_fail (socket != NULL);
  3.1045 -
  3.1046 -    socket->ref_count--;
  3.1047 -
  3.1048 -    if (socket->ref_count <= 0) {
  3.1049 -        socket_free (socket);
  3.1050 -    }
  3.1051 -}
  3.1052 -
  3.1053 -gboolean
  3.1054 -lm_old_socket_set_keepalive (LmOldSocket *socket, int delay)
  3.1055 -{
  3.1056 -#ifdef USE_TCP_KEEPALIVES
  3.1057 -    return _lm_sock_set_keepalive (socket->fd, delay);
  3.1058 -#else
  3.1059 -    return FALSE;
  3.1060 -#endif /* USE_TCP_KEEPALIVES */
  3.1061 -}
  3.1062 -
  3.1063 -void
  3.1064 -lm_old_socket_asyncns_cancel (LmOldSocket *socket)
  3.1065 -{
  3.1066 -    if (!socket->resolver) {
  3.1067 -        return;
  3.1068 -    }
  3.1069 -
  3.1070 -    lm_resolver_cancel (socket->resolver);
  3.1071 -}
  3.1072 -
  3.1073 -gboolean
  3.1074 -lm_old_socket_get_use_starttls (LmOldSocket *socket)
  3.1075 -{
  3.1076 -    if (!socket->ssl) {
  3.1077 -        return FALSE;
  3.1078 -    }
  3.1079 -
  3.1080 -    return lm_ssl_get_use_starttls (socket->ssl);
  3.1081 -}
  3.1082 -
  3.1083 -gboolean
  3.1084 -lm_old_socket_get_require_starttls (LmOldSocket *socket)
  3.1085 -{
  3.1086 -    if (!socket->ssl) {
  3.1087 -        return FALSE;
  3.1088 -    }
  3.1089 -
  3.1090 -    return lm_ssl_get_require_starttls (socket->ssl);
  3.1091 -}
     4.1 --- a/src/lm-old-socket.h	Sat Oct 11 15:57:20 2014 +0000
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,70 +0,0 @@
     4.4 -/*
     4.5 - *  Copyright (C) 2012,2013,2014 Copyleft Games Group
     4.6 - *  Copyright (C) 2006 Imendio AB
     4.7 - *
     4.8 - *  This program is free software; you can redistribute it and/or modify
     4.9 - *  it under the terms of the GNU Affero General Public License as published
    4.10 - *  by the Free Software Foundation, either version 3 of the License, or
    4.11 - *  (at your option) any later version.
    4.12 - *
    4.13 - *  This program is distributed in the hope that it will be useful,
    4.14 - *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    4.15 - *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4.16 - *  GNU Affero General Public License for more details.
    4.17 - *
    4.18 - *  You should have received a copy of the GNU Affero General Public License
    4.19 - *  along with this program; if not, see http://www.gnu.org/licenses
    4.20 - *
    4.21 - */
    4.22 -
    4.23 -#ifndef __LM_OLD_SOCKET_H__
    4.24 -#define __LM_OLD_SOCKET_H__
    4.25 -
    4.26 -#include <glib.h>
    4.27 -
    4.28 -#include "lm-internals.h"
    4.29 -
    4.30 -typedef struct _LmOldSocket LmOldSocket;
    4.31 -
    4.32 -typedef void    (* IncomingDataFunc)  (LmOldSocket         *socket,
    4.33 -                                       const gchar         *buf,
    4.34 -                                       gpointer             user_data);
    4.35 -
    4.36 -typedef void    (* SocketClosedFunc)  (LmOldSocket         *socket,
    4.37 -                                       LmDisconnectReason   reason,
    4.38 -                                       gpointer             user_data);
    4.39 -
    4.40 -typedef void    (* ConnectResultFunc) (LmOldSocket         *socket,
    4.41 -                                       gboolean             result,
    4.42 -                                       gpointer             user_data);
    4.43 -
    4.44 -LmOldSocket * lm_old_socket_create          (GMainContext       *context,
    4.45 -                                             IncomingDataFunc    data_func,
    4.46 -                                             SocketClosedFunc    closed_func,
    4.47 -                                             ConnectResultFunc   connect_func,
    4.48 -                                             gpointer            user_data,
    4.49 -                                             LmConnection       *connection,
    4.50 -                                             const gchar        *server,
    4.51 -                                             const gchar        *domain,
    4.52 -                                             guint               port,
    4.53 -                                             LmSSL              *ssl,
    4.54 -                                             LmProxy            *proxy,
    4.55 -                                             GError           **error);
    4.56 -gint           lm_old_socket_write          (LmOldSocket       *socket,
    4.57 -                                             const gchar       *buf,
    4.58 -                                             gint               len);
    4.59 -void           lm_old_socket_flush          (LmOldSocket        *socket);
    4.60 -void           lm_old_socket_close          (LmOldSocket        *socket);
    4.61 -LmOldSocket *  lm_old_socket_ref            (LmOldSocket        *socket);
    4.62 -void           lm_old_socket_unref          (LmOldSocket        *socket);
    4.63 -gboolean       lm_old_socket_starttls       (LmOldSocket        *socket);
    4.64 -gboolean       lm_old_socket_set_keepalive  (LmOldSocket        *socket,
    4.65 -                                             int                 delay);
    4.66 -gchar *        lm_old_socket_get_local_host (LmOldSocket        *socket);
    4.67 -void           lm_old_socket_asyncns_cancel (LmOldSocket        *socket);
    4.68 -
    4.69 -gboolean       lm_old_socket_get_use_starttls (LmOldSocket      *socket);
    4.70 -gboolean       lm_old_socket_get_require_starttls (LmOldSocket  *socket);
    4.71 -
    4.72 -#endif /* __LM_OLD_SOCKET_H__ */
    4.73 -
     5.1 --- a/src/lm-simple-io.c	Sat Oct 11 15:57:20 2014 +0000
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,150 +0,0 @@
     5.4 -/*
     5.5 - *  Copyright (C) 2012,2013,2014 Copyleft Games Group
     5.6 - *  Copyright (C) 2008 Imendio AB
     5.7 - *
     5.8 - *  This program is free software; you can redistribute it and/or modify
     5.9 - *  it under the terms of the GNU Affero General Public License as published
    5.10 - *  by the Free Software Foundation, either version 3 of the License, or
    5.11 - *  (at your option) any later version.
    5.12 - *
    5.13 - *  This program is distributed in the hope that it will be useful,
    5.14 - *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    5.15 - *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5.16 - *  GNU Affero General Public License for more details.
    5.17 - *
    5.18 - *  You should have received a copy of the GNU Affero General Public License
    5.19 - *  along with this program; if not, see http://www.gnu.org/licenses
    5.20 - *
    5.21 - */
    5.22 -
    5.23 -#include <config.h>
    5.24 -
    5.25 -#include "lm-marshal.h"
    5.26 -#include "lm-xmpp-writer.h"
    5.27 -#include "lm-simple-io.h"
    5.28 -
    5.29 -#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), LM_TYPE_SIMPLE_IO, LmSimpleIOPriv))
    5.30 -
    5.31 -typedef struct LmSimpleIOPriv LmSimpleIOPriv;
    5.32 -struct LmSimpleIOPriv {
    5.33 -    gint my_prop;
    5.34 -};
    5.35 -
    5.36 -static void     simple_io_finalize            (GObject           *object);
    5.37 -static void     simple_io_writer_iface_init   (LmXmppWriterIface *iface);
    5.38 -static void     simple_io_get_property        (GObject           *object,
    5.39 -                                               guint              param_id,
    5.40 -                                               GValue            *value,
    5.41 -                                               GParamSpec        *pspec);
    5.42 -static void     simple_io_set_property        (GObject           *object,
    5.43 -                                               guint              param_id,
    5.44 -                                               const GValue      *value,
    5.45 -                                               GParamSpec        *pspec);
    5.46 -static void     simple_io_send_message        (LmXmppWriter      *writer,
    5.47 -                                               LmMessage         *message);
    5.48 -static void     simple_io_send_text           (LmXmppWriter      *writer,
    5.49 -                                               const gchar       *buf,
    5.50 -                                               gsize              len);
    5.51 -
    5.52 -G_DEFINE_TYPE_WITH_CODE (LmSimpleIO, lm_simple_io, G_TYPE_OBJECT,
    5.53 -                         G_IMPLEMENT_INTERFACE (LM_TYPE_XMPP_WRITER,
    5.54 -                                                simple_io_writer_iface_init))
    5.55 -
    5.56 -enum {
    5.57 -    PROP_0,
    5.58 -    PROP_MY_PROP
    5.59 -};
    5.60 -
    5.61 -static void
    5.62 -lm_simple_io_class_init (LmSimpleIOClass *class)
    5.63 -{
    5.64 -    GObjectClass *object_class = G_OBJECT_CLASS (class);
    5.65 -
    5.66 -    object_class->finalize     = simple_io_finalize;
    5.67 -    object_class->get_property = simple_io_get_property;
    5.68 -    object_class->set_property = simple_io_set_property;
    5.69 -
    5.70 -    g_object_class_install_property (object_class,
    5.71 -                                     PROP_MY_PROP,
    5.72 -                                     g_param_spec_string ("my-prop",
    5.73 -                                                          "My Prop",
    5.74 -                                                          "My Property",
    5.75 -                                                          NULL,
    5.76 -                                                          G_PARAM_READWRITE));
    5.77 -
    5.78 -    g_type_class_add_private (object_class, sizeof (LmSimpleIOPriv));
    5.79 -}
    5.80 -
    5.81 -static void
    5.82 -lm_simple_io_init (LmSimpleIO *simple_io)
    5.83 -{
    5.84 -    (void) GET_PRIV (simple_io);
    5.85 -}
    5.86 -
    5.87 -static void
    5.88 -simple_io_finalize (GObject *object)
    5.89 -{
    5.90 -    (void) GET_PRIV (object);
    5.91 -
    5.92 -    (G_OBJECT_CLASS (lm_simple_io_parent_class)->finalize) (object);
    5.93 -}
    5.94 -
    5.95 -static void
    5.96 -simple_io_writer_iface_init (LmXmppWriterIface *iface)
    5.97 -{
    5.98 -    iface->send_message = simple_io_send_message;
    5.99 -    iface->send_text    = simple_io_send_text;
   5.100 -}
   5.101 -
   5.102 -static void
   5.103 -simple_io_get_property (GObject    *object,
   5.104 -                        guint       param_id,
   5.105 -                        GValue     *value,
   5.106 -                        GParamSpec *pspec)
   5.107 -{
   5.108 -    LmSimpleIOPriv *priv;
   5.109 -
   5.110 -    priv = GET_PRIV (object);
   5.111 -
   5.112 -    switch (param_id) {
   5.113 -    case PROP_MY_PROP:
   5.114 -        g_value_set_int (value, priv->my_prop);
   5.115 -        break;
   5.116 -    default:
   5.117 -        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
   5.118 -        break;
   5.119 -    };
   5.120 -}
   5.121 -
   5.122 -static void
   5.123 -simple_io_set_property (GObject      *object,
   5.124 -                        guint         param_id,
   5.125 -                        const GValue *value,
   5.126 -                        GParamSpec   *pspec)
   5.127 -{
   5.128 -    LmSimpleIOPriv *priv;
   5.129 -
   5.130 -    priv = GET_PRIV (object);
   5.131 -
   5.132 -    switch (param_id) {
   5.133 -    case PROP_MY_PROP:
   5.134 -        priv->my_prop = g_value_get_int (value);
   5.135 -        break;
   5.136 -    default:
   5.137 -        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
   5.138 -        break;
   5.139 -    };
   5.140 -}
   5.141 -
   5.142 -static void
   5.143 -simple_io_send_message (LmXmppWriter *writer, LmMessage *message)
   5.144 -{
   5.145 -}
   5.146 -
   5.147 -static void
   5.148 -simple_io_send_text (LmXmppWriter *writer,
   5.149 -                     const gchar  *buf,
   5.150 -                     gsize         len)
   5.151 -{
   5.152 -}
   5.153 -
     6.1 --- a/src/lm-simple-io.h	Sat Oct 11 15:57:20 2014 +0000
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,50 +0,0 @@
     6.4 -/*
     6.5 - *  Copyright (C) 2012,2013,2014 Copyleft Games Group
     6.6 - *  Copyright (C) 2008 Imendio AB
     6.7 - *
     6.8 - *  This program is free software; you can redistribute it and/or modify
     6.9 - *  it under the terms of the GNU Affero General Public License as published
    6.10 - *  by the Free Software Foundation, either version 3 of the License, or
    6.11 - *  (at your option) any later version.
    6.12 - *
    6.13 - *  This program is distributed in the hope that it will be useful,
    6.14 - *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    6.15 - *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6.16 - *  GNU Affero General Public License for more details.
    6.17 - *
    6.18 - *  You should have received a copy of the GNU Affero General Public License
    6.19 - *  along with this program; if not, see http://www.gnu.org/licenses
    6.20 - *
    6.21 - */
    6.22 -
    6.23 -#ifndef __LM_SIMPLE_IO_H__
    6.24 -#define __LM_SIMPLE_IO_H__
    6.25 -
    6.26 -#include <glib-object.h>
    6.27 -
    6.28 -G_BEGIN_DECLS
    6.29 -
    6.30 -#define LM_TYPE_SIMPLE_IO            (lm_simple_io_get_type ())
    6.31 -#define LM_SIMPLE_IO(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), LM_TYPE_SIMPLE_IO, LmSimpleIO))
    6.32 -#define LM_SIMPLE_IO_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), LM_TYPE_SIMPLE_IO, LmSimpleIOClass))
    6.33 -#define LM_IS_SIMPLE_IO(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LM_TYPE_SIMPLE_IO))
    6.34 -#define LM_IS_SIMPLE_IO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LM_TYPE_SIMPLE_IO))
    6.35 -#define LM_SIMPLE_IO_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), LM_TYPE_SIMPLE_IO, LmSimpleIOClass))
    6.36 -
    6.37 -typedef struct LmSimpleIO      LmSimpleIO;
    6.38 -typedef struct LmSimpleIOClass LmSimpleIOClass;
    6.39 -
    6.40 -struct LmSimpleIO {
    6.41 -    GObject parent;
    6.42 -};
    6.43 -
    6.44 -struct LmSimpleIOClass {
    6.45 -    GObjectClass parent_class;
    6.46 -};
    6.47 -
    6.48 -GType   lm_simple_io_get_type  (void);
    6.49 -
    6.50 -G_END_DECLS
    6.51 -
    6.52 -#endif /* __LM_SIMPLE_IO_H__ */
    6.53 -
     7.1 --- a/src/lm-xmpp-writer.c	Sat Oct 11 15:57:20 2014 +0000
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,91 +0,0 @@
     7.4 -/*
     7.5 - *  Copyright (C) 2012,2013,2014 Copyleft Games Group
     7.6 - *  Copyright (C) 2008 Imendio AB
     7.7 - *
     7.8 - *  This program is free software; you can redistribute it and/or modify
     7.9 - *  it under the terms of the GNU Affero General Public License as published
    7.10 - *  by the Free Software Foundation, either version 3 of the License, or
    7.11 - *  (at your option) any later version.
    7.12 - *
    7.13 - *  This program is distributed in the hope that it will be useful,
    7.14 - *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    7.15 - *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7.16 - *  GNU Affero General Public License for more details.
    7.17 - *
    7.18 - *  You should have received a copy of the GNU Affero General Public License
    7.19 - *  along with this program; if not, see http://www.gnu.org/licenses
    7.20 - *
    7.21 - */
    7.22 -
    7.23 -#include <config.h>
    7.24 -
    7.25 -#include "lm-xmpp-writer.h"
    7.26 -
    7.27 -static void    xmpp_writer_base_init (LmXmppWriterIface *iface);
    7.28 -
    7.29 -GType
    7.30 -lm_xmpp_writer_get_type (void)
    7.31 -{
    7.32 -    static GType iface_type = 0;
    7.33 -
    7.34 -    if (!iface_type) {
    7.35 -        static const GTypeInfo iface_info = {
    7.36 -            sizeof (LmXmppWriterIface),
    7.37 -            (GBaseInitFunc)     xmpp_writer_base_init,
    7.38 -            (GBaseFinalizeFunc) NULL,
    7.39 -        };
    7.40 -
    7.41 -        iface_type = g_type_register_static (G_TYPE_INTERFACE,
    7.42 -                                             "LmXmppWriterIface",
    7.43 -                                             &iface_info,
    7.44 -                                             0);
    7.45 -
    7.46 -        g_type_interface_add_prerequisite (iface_type, G_TYPE_OBJECT);
    7.47 -    }
    7.48 -
    7.49 -    return iface_type;
    7.50 -}
    7.51 -
    7.52 -static void
    7.53 -xmpp_writer_base_init (LmXmppWriterIface *iface)
    7.54 -{
    7.55 -    static gboolean initialized = FALSE;
    7.56 -
    7.57 -    if (!initialized) {
    7.58 -        /* create interface signals here. */
    7.59 -        initialized = TRUE;
    7.60 -    }
    7.61 -}
    7.62 -
    7.63 -void
    7.64 -lm_xmpp_writer_send_message (LmXmppWriter *writer, LmMessage *message)
    7.65 -{
    7.66 -    if (!LM_XMPP_WRITER_GET_IFACE(writer)->send_message) {
    7.67 -        g_assert_not_reached ();
    7.68 -    }
    7.69 -
    7.70 -    LM_XMPP_WRITER_GET_IFACE(writer)->send_message (writer, message);
    7.71 -}
    7.72 -
    7.73 -void
    7.74 -lm_xmpp_writer_send_text (LmXmppWriter *writer,
    7.75 -                          const gchar  *buf,
    7.76 -                          gsize         len)
    7.77 -{
    7.78 -    if (!LM_XMPP_WRITER_GET_IFACE(writer)->send_text) {
    7.79 -        g_assert_not_reached ();
    7.80 -    }
    7.81 -
    7.82 -    LM_XMPP_WRITER_GET_IFACE(writer)->send_text (writer, buf, len);
    7.83 -}
    7.84 -
    7.85 -void
    7.86 -lm_xmpp_writer_flush (LmXmppWriter *writer)
    7.87 -{
    7.88 -    if (!LM_XMPP_WRITER_GET_IFACE(writer)->flush) {
    7.89 -        g_assert_not_reached ();
    7.90 -    }
    7.91 -
    7.92 -    LM_XMPP_WRITER_GET_IFACE(writer)->flush (writer);
    7.93 -}
    7.94 -
     8.1 --- a/src/lm-xmpp-writer.h	Sat Oct 11 15:57:20 2014 +0000
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,66 +0,0 @@
     8.4 -/*
     8.5 - *  Copyright (C) 2012,2013,2014 Copyleft Games Group
     8.6 - *  Copyright (C) 2008 Imendio AB
     8.7 - *
     8.8 - *  This program is free software; you can redistribute it and/or modify
     8.9 - *  it under the terms of the GNU Affero General Public License as published
    8.10 - *  by the Free Software Foundation, either version 3 of the License, or
    8.11 - *  (at your option) any later version.
    8.12 - *
    8.13 - *  This program is distributed in the hope that it will be useful,
    8.14 - *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    8.15 - *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8.16 - *  GNU Affero General Public License for more details.
    8.17 - *
    8.18 - *  You should have received a copy of the GNU Affero General Public License
    8.19 - *  along with this program; if not, see http://www.gnu.org/licenses
    8.20 - *
    8.21 - */
    8.22 -
    8.23 -#ifndef __LM_XMPP_WRITER_H__
    8.24 -#define __LM_XMPP_WRITER_H__
    8.25 -
    8.26 -#include <glib-object.h>
    8.27 -
    8.28 -#include <loudmouth/lm-message.h>
    8.29 -#include "lm-internals.h"
    8.30 -
    8.31 -G_BEGIN_DECLS
    8.32 -
    8.33 -#define LM_TYPE_XMPP_WRITER             (lm_xmpp_writer_get_type())
    8.34 -#define LM_XMPP_WRITER(o)               (G_TYPE_CHECK_INSTANCE_CAST((o), LM_TYPE_XMPP_WRITER, LmXmppWriter))
    8.35 -#define LM_IS_XMPP_WRITER(o)            (G_TYPE_CHECK_INSTANCE_TYPE((o), LM_TYPE_XMPP_WRITER))
    8.36 -#define LM_XMPP_WRITER_GET_IFACE(o)     (G_TYPE_INSTANCE_GET_INTERFACE((o), LM_TYPE_XMPP_WRITER, LmXmppWriterIface))
    8.37 -
    8.38 -typedef struct _LmXmppWriter      LmXmppWriter;
    8.39 -typedef struct _LmXmppWriterIface LmXmppWriterIface;
    8.40 -
    8.41 -struct _LmXmppWriterIface {
    8.42 -    GTypeInterface parent;
    8.43 -
    8.44 -    /* <vtable> */
    8.45 -    void (*send_message) (LmXmppWriter *writer,
    8.46 -                          LmMessage    *message);
    8.47 -    void (*send_text)    (LmXmppWriter *writer,
    8.48 -                          const gchar  *buf,
    8.49 -                          gsize         len);
    8.50 -
    8.51 -    /* Needed? */
    8.52 -    void (*flush)        (LmXmppWriter   *writer);
    8.53 -};
    8.54 -
    8.55 -GType          lm_xmpp_writer_get_type      (void);
    8.56 -
    8.57 -LmXmppWriter * lm_xmpp_writer_new           (LmOldSocket       *socket);
    8.58 -
    8.59 -void           lm_xmpp_writer_send_message  (LmXmppWriter   *writer,
    8.60 -                                             LmMessage      *message);
    8.61 -void           lm_xmpp_writer_send_text     (LmXmppWriter   *writer,
    8.62 -                                             const gchar    *buf,
    8.63 -                                             gsize           len);
    8.64 -void           lm_xmpp_writer_flush         (LmXmppWriter   *writer);
    8.65 -
    8.66 -G_END_DECLS
    8.67 -
    8.68 -#endif /* __LM_XMPP_WRITER_H__ */
    8.69 -