Use global state again for now in one spot, fixes regression.
authorJelmer Vernooij <jelmer@samba.org>
Sun, 16 Dec 2007 19:30:03 +0000 (20:30 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Sun, 16 Dec 2007 19:30:03 +0000 (20:30 +0100)
lib/client.c
lib/client.h
src/client.c
src/linestack_file.c

index 7bb314636cee6dbae303fd37e2101332f96d903b..023e95a082e25b7e3675d42daa879b7d9e2e87ef 100644 (file)
@@ -609,7 +609,7 @@ static gboolean client_ping(struct client *client)
  * @param c Channel to talk over
  * @param desc Description of the client
  */
-struct client *irc_client_new(GIOChannel *c, const char *desc, gboolean (*process_from_client) (struct client *, const struct line *))
+struct client *irc_client_new(GIOChannel *c, const char *desc, gboolean (*process_from_client) (struct client *, const struct line *), struct network *n)
 {
        struct client *client;
 
@@ -617,8 +617,9 @@ struct client *irc_client_new(GIOChannel *c, const char *desc, gboolean (*proces
        g_assert(desc != NULL);
 
        client = g_new0(struct client, 1);
+       g_assert(client != NULL);
        client->references = 1;
-       g_assert(client);
+       client->network = network_ref(n);
 
        g_io_channel_set_flags(c, G_IO_FLAG_NONBLOCK, NULL);
        g_io_channel_set_close_on_unref(c, TRUE);
index b03ddf9d3f277313414817cc813cdab31bc2306a..3e75b2011b327bfa70a7de198a14099e7a55ad97 100644 (file)
@@ -77,6 +77,6 @@ G_MODULE_EXPORT const char *client_get_own_hostmask(struct client *c);
 
 G_MODULE_EXPORT struct client *client_ref(struct client *c);
 G_MODULE_EXPORT void client_unref(struct client *c);
-G_MODULE_EXPORT struct client *irc_client_new(GIOChannel *c, const char *desc, gboolean (*process_from_client) (struct client *, const struct line *));
+G_MODULE_EXPORT struct client *irc_client_new(GIOChannel *c, const char *desc, gboolean (*process_from_client) (struct client *, const struct line *), struct irc_network *n);
 
 #endif /* __CTRLPROXY_CLIENT_H__ */
index 03881fefcb8ee129c4d2429d4c6da1f9b14515d1..28f48d26acb3fb7f281a9e56fc99542adf898e59 100644 (file)
@@ -111,9 +111,8 @@ static gboolean process_from_client(struct client *c, const struct line *_l)
 
 struct client *client_init(struct irc_network *n, GIOChannel *c, const char *desc)
 {
-       struct client *client = irc_client_new(c, desc, process_from_client);
+       struct client *client = irc_client_new(c, desc, process_from_client, n);
 
-       client->network = network_ref(n);
        if (n != NULL && n->global != NULL)
                client_set_charset(client, n->global->config->client_charset);
 
index 51bd44329b72df579d705fab0f0851696604e2f4..181c770bb800a9aeaaa6462ba3741bd859660ba6 100644 (file)
@@ -520,7 +520,6 @@ static void file_insert_state(struct linestack_context *ctx,
                nd->state_dumps = g_realloc(nd->state_dumps, nd->num_state_dumps_alloc * sizeof(*nd->state_dumps));
        }
 
-
        nd->state_dumps[nd->num_state_dumps].line_offset = g_io_channel_tell_position(nd->line_file);
        nd->state_dumps[nd->num_state_dumps].state_offset = g_io_channel_tell_position(nd->state_file);
 
@@ -529,7 +528,7 @@ static void file_insert_state(struct linestack_context *ctx,
        marshall_network_state(MARSHALL_PUSH, nd->state_file, (struct network_state *)state);
 
        status = g_io_channel_flush(nd->state_file, &error);
-       g_assert(status);
+       g_assert(status == G_IO_STATUS_NORMAL);
 }
 
 static gboolean file_insert_line(struct linestack_context *ctx,