From a306d7c1dca70ffab28fa1ffa7c6a521a753d607 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Wed, 31 Oct 2012 15:13:20 -0700 Subject: [PATCH] Add better #startvote error responses. Add error responses for the three #startvote error states. 1. Person running #startvote is not the meeting chair. 2. A vote is already in progress. 3. The vote topic and options were not understood. Change-Id: I9d86671179ceea1067f0641213eb5398d933d405 --- .gitignore | 1 + ircmeeting/meeting.py | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0d20b64 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.pyc diff --git a/ircmeeting/meeting.py b/ircmeeting/meeting.py index ae4aa84..d647a59 100644 --- a/ircmeeting/meeting.py +++ b/ircmeeting/meeting.py @@ -462,9 +462,16 @@ class MeetingCommands(object): Format of command is #startvote $TOPIC $Options. eg #startvote What color should we use? blue, red, green""" - if not self.isChair(nick) or self._voteTopic is not None: return voteDetails = self.config.startvote_RE.match(line) - if voteDetails is None: return + if not self.isChair(nick): + self.reply("Only the meeting chair may start a vote.") + return + elif self._voteTopic is not None: + self.reply("Already voting on '%s'" % self._voteTopic) + return + elif voteDetails is None: + self.reply("Unable to parse vote topic and options.") + return self._voteTopic = voteDetails.group("question") voteOptions = voteDetails.group("choices") if voteOptions == "":