From cd0f9f262867abe7594a2b53111c9a654d196fbc Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Sun, 31 Jul 2022 09:04:27 +0200 Subject: [PATCH] Polls: Make nick matching case-insensitive This prevents the same nick from voting twice by changing the capitalization --- plugins/Poll/plugin.py | 5 ++++- plugins/Poll/test.py | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/Poll/plugin.py b/plugins/Poll/plugin.py index e1b83747f..680a884d2 100644 --- a/plugins/Poll/plugin.py +++ b/plugins/Poll/plugin.py @@ -149,7 +149,10 @@ class Poll_(callbacks.Plugin): ) self._polls[(irc.network, channel)][poll_id] = Poll( - question=question, answers=dict(answers), votes={}, open=True + question=question, + answers=dict(answers), + votes=ircutils.IrcDict(), + open=True, ) irc.replySuccess(_("Poll # %d created.") % poll_id) diff --git a/plugins/Poll/test.py b/plugins/Poll/test.py index 73c05f3fa..b891fd862 100644 --- a/plugins/Poll/test.py +++ b/plugins/Poll/test.py @@ -73,6 +73,11 @@ class PollTestCase(ChannelPluginTestCase): "voter1: Error: You already voted on this poll.", frm="voter1!foo@bar", ) + self.assertResponse( + "vote 1 Yes", + "VOTER1: Error: You already voted on this poll.", + frm="VOTER1!foo@bar", + ) self.assertRegexp( "results 1",