summaryrefslogtreecommitdiff
path: root/degesch.c
diff options
context:
space:
mode:
Diffstat (limited to 'degesch.c')
-rw-r--r--degesch.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/degesch.c b/degesch.c
index fe9469b..c48d43a 100644
--- a/degesch.c
+++ b/degesch.c
@@ -2670,6 +2670,15 @@ irc_make_user (struct server *s, char *nickname)
return user;
}
+struct user *
+irc_get_or_make_user (struct server *s, const char *nickname)
+{
+ struct user *user = str_map_find (&s->irc_users, nickname);
+ if (user)
+ return user_ref (user);
+ return irc_make_user (s, xstrdup (nickname));
+}
+
static struct buffer *
irc_get_or_make_user_buffer (struct server *s, const char *nickname)
{
@@ -2677,11 +2686,7 @@ irc_get_or_make_user_buffer (struct server *s, const char *nickname)
if (buffer)
return buffer;
- struct user *user = str_map_find (&s->irc_users, nickname);
- if (!user)
- user = irc_make_user (s, xstrdup (nickname));
- else
- user = user_ref (user);
+ struct user *user = irc_get_or_make_user (s, nickname);
// Open a new buffer for the user
buffer = buffer_new ();