From 45c7615f4a4f863092676cf0c889564f0c6e09ad Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Fri, 16 Jul 2021 19:53:25 +0200 Subject: [PATCH] irclib: Properly populate nickToHostmasks on RPL_NAMREPLY It used to set the nick instead of the hostmask as values... --- src/irclib.py | 2 +- test/test_irclib.py | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/irclib.py b/src/irclib.py index ccec3e420..180979204 100644 --- a/src/irclib.py +++ b/src/irclib.py @@ -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 diff --git a/test/test_irclib.py b/test/test_irclib.py index 0f1ef9b7a..18792e551 100644 --- a/test/test_irclib.py +++ b/test/test_irclib.py @@ -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):