Merge pull request #1228 from GLolol/ircutils-1

ircutils: add $network to standard substitutions
This commit is contained in:
Valentin Lorentz 2016-03-15 17:14:08 +01:00
commit e91b3e70f8
3 changed files with 7 additions and 0 deletions

View File

@ -824,6 +824,7 @@ def standardSubstitute(irc, msg, text, env=None):
if irc:
vars.update({
'botnick': irc.nick,
'network': irc.network,
})
if msg:

View File

@ -219,6 +219,8 @@ class FunctionsTestCase(SupyTestCase):
msg = ircmsgs.IrcMsg(':%s PRIVMSG #channel :stuff' % self.hostmask)
class Irc(object):
nick = 'bob'
network = 'testnet'
irc = Irc()
f = ircutils.standardSubstitute

View File

@ -41,6 +41,7 @@ class FunctionsTestCase(SupyTestCase):
class state:
channels = {'#foo': holder()}
nick = 'foobar'
network = 'testnet'
@retry()
def testStandardSubstitute(self):
@ -82,6 +83,9 @@ class FunctionsTestCase(SupyTestCase):
c = f(self.irc, msg, '$channel')
self.assertEqual(c, msg.args[0])
net = f(self.irc, msg, '$network')
self.assertEqual(net, self.irc.network)