irclib: Properly populate nickToHostmasks on RPL_NAMREPLY

It used to set the nick instead of the hostmask as values...
This commit is contained in:
Valentin Lorentz 2021-07-16 19:53:25 +02:00
parent d308329461
commit 45c7615f4a
2 changed files with 7 additions and 7 deletions

View File

@ -978,7 +978,7 @@ class IrcState(IrcCommandDispatcher, log.Firewalled):
item_prefix = item[0:-len(stripped_item)]
if ircutils.isUserHostmask(stripped_item):
nick = ircutils.nickFromHostmask(stripped_item)
self.nicksToHostmasks[nick] = nick
self.nicksToHostmasks[nick] = stripped_item
name = item_prefix + nick
else:
name = item

View File

@ -548,9 +548,9 @@ class IrcStateTestCase(SupyTestCase):
chan_st = st.channels['#chan']
self.assertEqual(chan_st.users, ircutils.IrcSet(['nick1', 'nick2', 'nick3']))
self.assertEqual(chan_st.ops, ircutils.IrcSet(['nick2', 'nick3']))
self.assertEqual(st.nicksToHostmasks['nick1'], 'nick1')
self.assertEqual(st.nicksToHostmasks['nick2'], 'nick2')
self.assertEqual(st.nicksToHostmasks['nick3'], 'nick3')
self.assertEqual(st.nicksToHostmasks['nick1'], 'nick1!u1@h1')
self.assertEqual(st.nicksToHostmasks['nick2'], 'nick2!u2@h2')
self.assertEqual(st.nicksToHostmasks['nick3'], 'nick3!u3@h3')
# Prefixed with chars not in ISUPPORT PREFIX
st = irclib.IrcState()
@ -560,9 +560,9 @@ class IrcStateTestCase(SupyTestCase):
chan_st = st.channels['#chan']
self.assertEqual(chan_st.users, ircutils.IrcSet(['nick1', 'nick2', '~@nick3']))
self.assertEqual(chan_st.ops, ircutils.IrcSet(['nick2']))
self.assertEqual(st.nicksToHostmasks['nick1'], 'nick1')
self.assertEqual(st.nicksToHostmasks['nick2'], 'nick2')
self.assertEqual(st.nicksToHostmasks['~@nick3'], '~@nick3')
self.assertEqual(st.nicksToHostmasks['nick1'], 'nick1!u1@h1')
self.assertEqual(st.nicksToHostmasks['nick2'], 'nick2!u2@h2')
self.assertEqual(st.nicksToHostmasks['~@nick3'], '~@nick3!u3@h3')
class IrcCapsTestCase(SupyTestCase, CapNegMixin):