diff --git a/plugins/Later/plugin.py b/plugins/Later/plugin.py index 375765042..babfe845e 100644 --- a/plugins/Later/plugin.py +++ b/plugins/Later/plugin.py @@ -147,27 +147,38 @@ class Later(callbacks.Plugin): ## adding new ones. @internationalizeDocstring - def tell(self, irc, msg, args, nick, text): - """ + def tell(self, irc, msg, args, nicks, text): + """ - Tells the next time is seen. can + Tells each the next time is seen. can contain wildcard characters, and the first matching nick will be given the note. """ self._deleteExpired() - if ircutils.strEqual(nick, irc.nick): - irc.error(_('I can\'t send notes to myself.')) - return - validnick = self._validateNick(irc, nick) - if validnick is False: - irc.error('That is an invalid IRC nick. Please check your input.') - return - try: - self._addNote(validnick, msg.nick, text) + validnicks = [] + for nick in nicks: + if ircutils.strEqual(nick, irc.nick): + irc.error(_('I can\'t send notes to myself.')) + return + validnick = self._validateNick(irc, nick) + if validnick is False: + irc.error(_('%s is an invalid IRC nick. Please check your ' + 'input.' % nick)) + return + validnicks.append(validnick) + full_queues = [] + for validnick in validnicks: + try: + self._addNote(validnick, msg.nick, text) + except ValueError: + full_queues.append(validnick) + if full_queues: + irc.error(format( + _('These recipients\' message queue are already full: %L'), + full_queues)) + else: irc.replySuccess() - except ValueError: - irc.error(_('That person\'s message queue is already full.')) - tell = wrap(tell, ['something', 'text']) + tell = wrap(tell, [commalist('somethingWithoutSpaces'), 'text']) @internationalizeDocstring def notes(self, irc, msg, args, nick): diff --git a/plugins/Later/test.py b/plugins/Later/test.py index 2e36978c4..24699f613 100644 --- a/plugins/Later/test.py +++ b/plugins/Later/test.py @@ -72,7 +72,7 @@ class LaterTestCase(ChannelPluginTestCase): def testNoteSend(self): self.assertNotError('later tell foo stuff') - self.assertNotError('later tell bar more stuff') + self.assertNotError('later tell bar,baz more stuff') self.assertRegexp('later notes', 'bar.*foo') testPrefix = 'foo!bar@baz' self.irc.feedMsg(ircmsgs.privmsg(self.channel, 'something', @@ -83,6 +83,12 @@ class LaterTestCase(ChannelPluginTestCase): self.assertNotRegexp('later notes', 'foo') self.assertRegexp('later notes', 'bar') + self.irc.feedMsg(ircmsgs.privmsg(self.channel, 'something', + prefix='baz!baz@qux')) + m = self.getMsg(' ') + self.assertEqual(str(m).strip(), + 'PRIVMSG #test :baz: Sent just now: more stuff') + real_time = time.time def fake_time(): return real_time() + 62