mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-17 06:00:42 +01:00
Fixed bug in IrcObjectProxy{Regexp} where actions weren't targetted correctly based on the to/private arguments.
This commit is contained in:
parent
70ce38a979
commit
2747baf48a
@ -550,12 +550,11 @@ class IrcObjectProxy(RichReplyMethods):
|
|||||||
self.irc.queueMsg(reply(msg, s, self.prefixName,
|
self.irc.queueMsg(reply(msg, s, self.prefixName,
|
||||||
self.private, self.notice, self.to))
|
self.private, self.notice, self.to))
|
||||||
elif self.action:
|
elif self.action:
|
||||||
if self.private:
|
target = ircutils.replyTo(msg)
|
||||||
target = msg.nick
|
|
||||||
else:
|
|
||||||
target = msg.args[0]
|
|
||||||
if self.to:
|
if self.to:
|
||||||
target = self.to
|
target = self.to
|
||||||
|
elif self.private:
|
||||||
|
target = msg.nick
|
||||||
self.irc.queueMsg(ircmsgs.action(target, s))
|
self.irc.queueMsg(ircmsgs.action(target, s))
|
||||||
else:
|
else:
|
||||||
s = ircutils.safeArgument(s)
|
s = ircutils.safeArgument(s)
|
||||||
@ -789,13 +788,18 @@ class IrcObjectProxyRegexp(RichReplyMethods):
|
|||||||
def error(self, s, **kwargs):
|
def error(self, s, **kwargs):
|
||||||
self.reply('Error: ' + s, **kwargs)
|
self.reply('Error: ' + s, **kwargs)
|
||||||
|
|
||||||
def reply(self, s, action=False, **kwargs):
|
def reply(self, s, action=False, to=None, private=False, **kwargs):
|
||||||
assert not isinstance(s, ircmsgs.IrcMsg), \
|
assert not isinstance(s, ircmsgs.IrcMsg), \
|
||||||
'Old code alert: there is no longer a "msg" argument to reply.'
|
'Old code alert: there is no longer a "msg" argument to reply.'
|
||||||
if action:
|
if action:
|
||||||
self.irc.queueMsg(ircmsgs.action(ircutils.replyTo(self.msg), s))
|
target = ircutils.replyTo(self.msg)
|
||||||
|
if to:
|
||||||
|
target = to
|
||||||
|
elif private:
|
||||||
|
target = msg.nick
|
||||||
|
self.irc.queueMsg(ircmsgs.action(target, s))
|
||||||
else:
|
else:
|
||||||
self.irc.queueMsg(reply(self.msg, s, **kwargs))
|
self.irc.queueMsg(reply(self.msg,s,to=to,private=private,**kwargs))
|
||||||
|
|
||||||
def __getattr__(self, attr):
|
def __getattr__(self, attr):
|
||||||
return getattr(self.irc, attr)
|
return getattr(self.irc, attr)
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
from testsupport import *
|
from testsupport import *
|
||||||
|
|
||||||
class MiscTestCase(ChannelPluginTestCase, PluginDocumentation):
|
class MiscTestCase(ChannelPluginTestCase):
|
||||||
plugins = ('Misc', 'Utilities', 'Gameknot', 'Ctcp', 'Dict', 'User')
|
plugins = ('Misc', 'Utilities', 'Gameknot', 'Ctcp', 'Dict', 'User')
|
||||||
def testAction(self):
|
def testAction(self):
|
||||||
self.assertAction('action moos', 'moos')
|
self.assertAction('action moos', 'moos')
|
||||||
@ -218,6 +218,13 @@ class MiscTestCase(ChannelPluginTestCase, PluginDocumentation):
|
|||||||
self.assertResponse('seconds 1w 1s', '604801')
|
self.assertResponse('seconds 1w 1s', '604801')
|
||||||
|
|
||||||
|
|
||||||
|
class MiscNonChannelTestCase(PluginTestCase):
|
||||||
|
plugins = ('Misc',)
|
||||||
|
def testAction(self):
|
||||||
|
self.prefix = 'something!else@somewhere.else'
|
||||||
|
self.nick = 'something'
|
||||||
|
m = self.assertAction('action foo', 'foo')
|
||||||
|
self.failIf(m.args[0] == self.irc.nick)
|
||||||
|
|
||||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user