mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 11:42:52 +01:00
Later: Allow multiple targets. Closes GH-1169.
This commit is contained in:
parent
82332ff87c
commit
1002ec5d30
@ -147,27 +147,38 @@ class Later(callbacks.Plugin):
|
||||
## adding new ones.
|
||||
|
||||
@internationalizeDocstring
|
||||
def tell(self, irc, msg, args, nick, text):
|
||||
"""<nick> <text>
|
||||
def tell(self, irc, msg, args, nicks, text):
|
||||
"""<nick1[,nick2[,...]]> <text>
|
||||
|
||||
Tells <nick> <text> the next time <nick> is seen. <nick> can
|
||||
Tells each <nickX> <text> the next time <nickX> is seen. <nickX> can
|
||||
contain wildcard characters, and the first matching nick will be
|
||||
given the note.
|
||||
"""
|
||||
self._deleteExpired()
|
||||
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('That is an invalid IRC nick. Please check your input.')
|
||||
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)
|
||||
irc.replySuccess()
|
||||
except ValueError:
|
||||
irc.error(_('That person\'s message queue is already full.'))
|
||||
tell = wrap(tell, ['something', 'text'])
|
||||
full_queues.append(validnick)
|
||||
if full_queues:
|
||||
irc.error(format(
|
||||
_('These recipients\' message queue are already full: %L'),
|
||||
full_queues))
|
||||
else:
|
||||
irc.replySuccess()
|
||||
tell = wrap(tell, [commalist('somethingWithoutSpaces'), 'text'])
|
||||
|
||||
@internationalizeDocstring
|
||||
def notes(self, irc, msg, args, nick):
|
||||
|
@ -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: <test> more stuff')
|
||||
|
||||
real_time = time.time
|
||||
def fake_time():
|
||||
return real_time() + 62
|
||||
|
Loading…
Reference in New Issue
Block a user