mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-24 02:54:05 +01:00
Config: Add command '@config network'.
This commit is contained in:
parent
2f4644f7b3
commit
c07086d7dc
@ -291,6 +291,30 @@ class Config(callbacks.Plugin):
|
||||
'channels', 'settableConfigVar',
|
||||
additional('text')])
|
||||
|
||||
def network(self, irc, msg, args, network, group, value):
|
||||
"""[<network>] <name> [<value>]
|
||||
|
||||
If <value> is given, sets the network configuration variable for <name>
|
||||
to <value> for <network>.
|
||||
Otherwise, returns the current network configuration value of <name>.
|
||||
<network> defaults to the current network."""
|
||||
if not group._networkValue:
|
||||
irc.error(_('That configuration variable is not a network-specific '
|
||||
'configuration variable.'))
|
||||
return
|
||||
if value is not None:
|
||||
self._setValue(irc, msg, group.get(':' + network.network), value)
|
||||
|
||||
irc.replySuccess()
|
||||
else:
|
||||
values = []
|
||||
private = None
|
||||
(value, private) = \
|
||||
self._getValue(irc, msg, group, network)
|
||||
irc.reply(value, private=private)
|
||||
network = wrap(network, ['networkIrc', 'settableConfigVar',
|
||||
additional('text')])
|
||||
|
||||
@internationalizeDocstring
|
||||
def config(self, irc, msg, args, group, value):
|
||||
"""<name> [<value>]
|
||||
|
@ -181,6 +181,25 @@ class ConfigTestCase(ChannelPluginTestCase):
|
||||
self.assertResponse('config channel #testchan1 reply.whenAddressedBy.strings', '.')
|
||||
self.assertResponse('config channel #testchan2 reply.whenAddressedBy.strings', '.')
|
||||
|
||||
def testNetwork(self):
|
||||
getTestIrc('testnet1')
|
||||
getTestIrc('testnet2')
|
||||
self.assertResponse('config reply.whenAddressedBy.strings ^',
|
||||
'The operation succeeded.')
|
||||
self.assertResponse('config network reply.whenAddressedBy.strings @',
|
||||
'The operation succeeded.')
|
||||
self.assertResponse('config network reply.whenAddressedBy.strings', '@')
|
||||
self.assertNotError('config network reply.whenAddressedBy.strings $')
|
||||
self.assertResponse('config network testnet1 reply.whenAddressedBy.strings', '^')
|
||||
self.assertResponse('config network testnet2 reply.whenAddressedBy.strings', '^')
|
||||
self.assertResponse('config network reply.whenAddressedBy.strings', '$')
|
||||
self.assertResponse('config network testnet1 reply.whenAddressedBy.strings', '^')
|
||||
self.assertResponse('config network testnet2 reply.whenAddressedBy.strings', '^')
|
||||
|
||||
self.assertNotError('config network testnet1 reply.whenAddressedBy.strings =')
|
||||
self.assertResponse('config network testnet1 reply.whenAddressedBy.strings', '=')
|
||||
self.assertResponse('config network testnet2 reply.whenAddressedBy.strings', '^')
|
||||
|
||||
def testChannelNetwork(self):
|
||||
irc = self.irc
|
||||
irc1 = getTestIrc('testnet1')
|
||||
|
Loading…
Reference in New Issue
Block a user