* @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;
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);
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__ */
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);
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);
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,