diff options
Diffstat (limited to 'degesch.c')
-rw-r--r-- | degesch.c | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -1287,9 +1287,10 @@ struct user_channel }; static struct user_channel * -user_channel_new (void) +user_channel_new (struct channel *channel) { struct user_channel *self = xcalloc (1, sizeof *self); + self->channel = channel; return self; } @@ -1325,10 +1326,11 @@ static struct ispect_field g_user_ispect[] = }; static struct user * -user_new (void) +user_new (char *nickname) { struct user *self = xcalloc (1, sizeof *self); self->ref_count = 1; + self->nickname = nickname; return self; } @@ -1405,10 +1407,12 @@ static struct ispect_field g_channel_ispect[] = }; static struct channel * -channel_new (void) +channel_new (char *name, char *topic) { struct channel *self = xcalloc (1, sizeof *self); self->ref_count = 1; + self->name = name; + self->topic = topic; self->no_param_modes = str_make (); self->param_modes = str_map_make (free); self->names_buf = strv_make (); @@ -4376,9 +4380,8 @@ irc_make_user (struct server *s, char *nickname) { hard_assert (!str_map_find (&s->irc_users, nickname)); - struct user *user = user_new (); + struct user *user = user_new (nickname); (void) user_weak_ref (user, irc_user_on_destroy, s); - user->nickname = nickname; str_map_set (&s->irc_users, user->nickname, user); return user; } @@ -4435,8 +4438,7 @@ static void irc_channel_link_user (struct channel *channel, struct user *user, const char *prefixes) { - struct user_channel *user_channel = user_channel_new (); - user_channel->channel = channel; + struct user_channel *user_channel = user_channel_new (channel); LIST_PREPEND (user->channels, user_channel); struct channel_user *channel_user = channel_user_new (user, prefixes); @@ -4479,10 +4481,8 @@ irc_make_channel (struct server *s, char *name) { hard_assert (!str_map_find (&s->irc_channels, name)); - struct channel *channel = channel_new (); + struct channel *channel = channel_new (name, NULL); (void) channel_weak_ref (channel, irc_channel_on_destroy, s); - channel->name = name; - channel->topic = NULL; str_map_set (&s->irc_channels, channel->name, channel); return channel; } |