LinkRelay: Make relays management case-insentive.
This commit is contained in:
parent
00f0941b4d
commit
66bbb34dea
@ -394,20 +394,20 @@ class LinkRelay(callbacks.Plugin):
|
|||||||
s = ' | '.join(args)
|
s = ' | '.join(args)
|
||||||
|
|
||||||
currentConfig = self.registryValue('relays')
|
currentConfig = self.registryValue('relays')
|
||||||
|
config = list(map(ircutils.IrcString, currentConfig.split(' || ')))
|
||||||
if add == True:
|
if add == True:
|
||||||
if s in currentConfig.split(' || '):
|
if s in config:
|
||||||
return False
|
return False
|
||||||
if currentConfig == '':
|
if currentConfig == '':
|
||||||
self.setRegistryValue('relays', value=s)
|
self.setRegistryValue('relays', value=s)
|
||||||
else:
|
else:
|
||||||
self.setRegistryValue('relays',
|
self.setRegistryValue('relays',
|
||||||
value=' || '.join((currentConfig,s)))
|
value=' || '.join((currentConfig, s)))
|
||||||
else:
|
else:
|
||||||
newConfig = currentConfig.split(' || ')
|
if s not in config:
|
||||||
if s not in newConfig:
|
|
||||||
return False
|
return False
|
||||||
newConfig.remove(s)
|
config.remove(s)
|
||||||
self.setRegistryValue('relays', value=' || '.join(newConfig))
|
self.setRegistryValue('relays', value=' || '.join(config))
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _parseOptlist(self, irc, msg, tupleOptlist):
|
def _parseOptlist(self, irc, msg, tupleOptlist):
|
||||||
|
@ -56,6 +56,9 @@ class LinkRelayTestCase(ChannelPluginTestCase):
|
|||||||
self.assertResponse('config supybot.plugins.LinkRelay.relays',
|
self.assertResponse('config supybot.plugins.LinkRelay.relays',
|
||||||
'#test | test | #foo | bar | ')
|
'#test | test | #foo | bar | ')
|
||||||
|
|
||||||
|
self.assertRegexp('linkrelay add --to #foo@bar', 'already exists')
|
||||||
|
self.assertRegexp('linkrelay add --to #FOO@bar', 'already exists')
|
||||||
|
|
||||||
def testRemove(self):
|
def testRemove(self):
|
||||||
self.assertNotError('config supybot.plugins.LinkRelay.relays '
|
self.assertNotError('config supybot.plugins.LinkRelay.relays '
|
||||||
'"#foo | bar | #baz | bam | "')
|
'"#foo | bar | #baz | bam | "')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user