diff options
Diffstat (limited to 'state.c')
-rw-r--r-- | state.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/state.c b/state.c index b1f84ad..f51a09b 100644 --- a/state.c +++ b/state.c @@ -259,7 +259,16 @@ static bool originSelf(const char *origin) { static void handleNick(struct Message *msg) { require(msg, true, 1); - if (originSelf(msg->origin)) set(&self.nick, msg->params[0]); + if (!originSelf(msg->origin)) return; + set(&self.nick, msg->params[0]); + + char *rest = strchr(self.origin, '!'); + assert(rest); + size_t size = strlen(self.nick) + strlen(rest) + 1; + char *origin = malloc(size); + if (!origin) err(EX_OSERR, "malloc"); + snprintf(origin, size, "%s%s", self.nick, rest); + set(&self.origin, origin); } static void handleJoin(struct Message *msg) { |