mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-24 02:54:05 +01:00
Merge pull request #1228 from GLolol/ircutils-1
ircutils: add $network to standard substitutions
This commit is contained in:
commit
e91b3e70f8
@ -824,6 +824,7 @@ def standardSubstitute(irc, msg, text, env=None):
|
|||||||
if irc:
|
if irc:
|
||||||
vars.update({
|
vars.update({
|
||||||
'botnick': irc.nick,
|
'botnick': irc.nick,
|
||||||
|
'network': irc.network,
|
||||||
})
|
})
|
||||||
|
|
||||||
if msg:
|
if msg:
|
||||||
|
@ -219,6 +219,8 @@ class FunctionsTestCase(SupyTestCase):
|
|||||||
msg = ircmsgs.IrcMsg(':%s PRIVMSG #channel :stuff' % self.hostmask)
|
msg = ircmsgs.IrcMsg(':%s PRIVMSG #channel :stuff' % self.hostmask)
|
||||||
class Irc(object):
|
class Irc(object):
|
||||||
nick = 'bob'
|
nick = 'bob'
|
||||||
|
network = 'testnet'
|
||||||
|
|
||||||
irc = Irc()
|
irc = Irc()
|
||||||
|
|
||||||
f = ircutils.standardSubstitute
|
f = ircutils.standardSubstitute
|
||||||
|
@ -41,6 +41,7 @@ class FunctionsTestCase(SupyTestCase):
|
|||||||
class state:
|
class state:
|
||||||
channels = {'#foo': holder()}
|
channels = {'#foo': holder()}
|
||||||
nick = 'foobar'
|
nick = 'foobar'
|
||||||
|
network = 'testnet'
|
||||||
|
|
||||||
@retry()
|
@retry()
|
||||||
def testStandardSubstitute(self):
|
def testStandardSubstitute(self):
|
||||||
@ -82,6 +83,9 @@ class FunctionsTestCase(SupyTestCase):
|
|||||||
c = f(self.irc, msg, '$channel')
|
c = f(self.irc, msg, '$channel')
|
||||||
self.assertEqual(c, msg.args[0])
|
self.assertEqual(c, msg.args[0])
|
||||||
|
|
||||||
|
net = f(self.irc, msg, '$network')
|
||||||
|
self.assertEqual(net, self.irc.network)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user