mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 11:42:52 +01:00
Limit statusmsg prefix stripping to PRIVMSG and NOTICE.
This commit is contained in:
parent
7a7cdb9f05
commit
5b40b5136d
@ -882,10 +882,11 @@ class Irc(IrcCommandDispatcher, log.Firewalled):
|
||||
msg.tag('receivedOn', self.network)
|
||||
msg.tag('receivedAt', time.time())
|
||||
|
||||
# Check if the message is addressed to a channel
|
||||
# Check if the message is sent to a channel
|
||||
if msg.args:
|
||||
channel = msg.args[0]
|
||||
if not conf.supybot.protocols.irc.strictRfc():
|
||||
if msg.command in ('NOTICE', 'PRIVMSG') and \
|
||||
not conf.supybot.protocols.irc.strictRfc():
|
||||
statusmsg_chars = self.state.supported.get('statusmsg', '')
|
||||
channel = channel.lstrip(statusmsg_chars)
|
||||
if not self.isChannel(channel):
|
||||
|
@ -497,6 +497,15 @@ class IrcTestCase(SupyTestCase):
|
||||
self.irc.feedMsg(ircmsgs.IrcMsg('PRIVMSG +#linux3 :foo bar baz!'))
|
||||
self.assertEqual(self.irc.state.history[-1].channel, None)
|
||||
|
||||
# Test msg.channel is set only for PRIVMSG and NOTICE
|
||||
self.irc.state.supported['statusmsg'] = '+@'
|
||||
self.irc.feedMsg(ircmsgs.IrcMsg('NOTICE @#linux :foo bar baz!'))
|
||||
self.assertEqual(self.irc.state.history[-1].channel, '#linux')
|
||||
self.irc.feedMsg(ircmsgs.IrcMsg('NOTICE @#linux2 :foo bar baz!'))
|
||||
self.assertEqual(self.irc.state.history[-1].channel, '#linux2')
|
||||
self.irc.feedMsg(ircmsgs.IrcMsg('MODE @#linux3 +v foo'))
|
||||
self.assertEqual(self.irc.state.history[-1].channel, None)
|
||||
|
||||
def testQuit(self):
|
||||
self.irc.reset()
|
||||
self.irc.feedMsg(ircmsgs.IrcMsg(':someuser JOIN #foo'))
|
||||
|
Loading…
Reference in New Issue
Block a user