mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-03-30 20:36:51 +02: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.
|
## adding new ones.
|
||||||
|
|
||||||
@internationalizeDocstring
|
@internationalizeDocstring
|
||||||
def tell(self, irc, msg, args, nick, text):
|
def tell(self, irc, msg, args, nicks, text):
|
||||||
"""<nick> <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
|
contain wildcard characters, and the first matching nick will be
|
||||||
given the note.
|
given the note.
|
||||||
"""
|
"""
|
||||||
self._deleteExpired()
|
self._deleteExpired()
|
||||||
|
validnicks = []
|
||||||
|
for nick in nicks:
|
||||||
if ircutils.strEqual(nick, irc.nick):
|
if ircutils.strEqual(nick, irc.nick):
|
||||||
irc.error(_('I can\'t send notes to myself.'))
|
irc.error(_('I can\'t send notes to myself.'))
|
||||||
return
|
return
|
||||||
validnick = self._validateNick(irc, nick)
|
validnick = self._validateNick(irc, nick)
|
||||||
if validnick is False:
|
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
|
return
|
||||||
|
validnicks.append(validnick)
|
||||||
|
full_queues = []
|
||||||
|
for validnick in validnicks:
|
||||||
try:
|
try:
|
||||||
self._addNote(validnick, msg.nick, text)
|
self._addNote(validnick, msg.nick, text)
|
||||||
irc.replySuccess()
|
|
||||||
except ValueError:
|
except ValueError:
|
||||||
irc.error(_('That person\'s message queue is already full.'))
|
full_queues.append(validnick)
|
||||||
tell = wrap(tell, ['something', 'text'])
|
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
|
@internationalizeDocstring
|
||||||
def notes(self, irc, msg, args, nick):
|
def notes(self, irc, msg, args, nick):
|
||||||
|
@ -72,7 +72,7 @@ class LaterTestCase(ChannelPluginTestCase):
|
|||||||
|
|
||||||
def testNoteSend(self):
|
def testNoteSend(self):
|
||||||
self.assertNotError('later tell foo stuff')
|
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')
|
self.assertRegexp('later notes', 'bar.*foo')
|
||||||
testPrefix = 'foo!bar@baz'
|
testPrefix = 'foo!bar@baz'
|
||||||
self.irc.feedMsg(ircmsgs.privmsg(self.channel, 'something',
|
self.irc.feedMsg(ircmsgs.privmsg(self.channel, 'something',
|
||||||
@ -83,6 +83,12 @@ class LaterTestCase(ChannelPluginTestCase):
|
|||||||
self.assertNotRegexp('later notes', 'foo')
|
self.assertNotRegexp('later notes', 'foo')
|
||||||
self.assertRegexp('later notes', 'bar')
|
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
|
real_time = time.time
|
||||||
def fake_time():
|
def fake_time():
|
||||||
return real_time() + 62
|
return real_time() + 62
|
||||||
|
Loading…
x
Reference in New Issue
Block a user