Skip to content

Commit

Permalink
Don't try to add users to a channel named "*"
Browse files Browse the repository at this point in the history
WHO and WHOX replies use * as a placeholder for the channel parameter if
we have no visibility into a channel for the specified user. Internally,
we also have a fake channel called * aliased to channels.Dummy for use
in testing. The combination meant that sometimes users got added to the
fake Dummy channel, which could break user tracking later on if they
quit. Fix WHO and WHOX reply handling to ignore channel parameters
containing * so this doesn't happen.
  • Loading branch information
skizzerz committed Dec 11, 2024
1 parent edb0866 commit 02ff145
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def who_reply(cli, bot_server, bot_nick, chan, ident, host, server, nick, status
if user is None:
user = users.add(cli, nick=nick, ident=ident, host=host)

ch = channels.get(chan, allow_none=True)
ch = channels.get(chan, allow_none=True) if chan != "*" else None
if ch is not None and ch not in user.channels:
user.channels[ch] = modes
ch.users.add(user)
Expand Down Expand Up @@ -125,7 +125,7 @@ def extended_who_reply(cli, bot_server, bot_nick, data, chan, ident, ip_address,
new_user = users.get(nick, ident, host, account, allow_bot=True)
Event("account_change", {}, old=user).dispatch(new_user, old_account)

ch = channels.get(chan, allow_none=True)
ch = channels.get(chan, allow_none=True) if chan != "*" else None
if ch is not None and ch not in user.channels:
user.channels[ch] = modes
ch.users.add(user)
Expand Down

0 comments on commit 02ff145

Please sign in to comment.