mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-25 12:12:54 +01:00
Alias: add hard-coded check that alias names are valid registry names
This commit is contained in:
parent
4507771ce7
commit
f5c66afe4f
@ -319,10 +319,17 @@ class Alias(callbacks.Plugin):
|
|||||||
group.unregister(name)
|
group.unregister(name)
|
||||||
|
|
||||||
|
|
||||||
def setLocked(name, value):
|
def setLocked(self, name, value):
|
||||||
self.aliases[name][1] = value
|
self.aliases[name][1] = value
|
||||||
self.aliasRegistryNode(name).locked.setValue(value)
|
self.aliasRegistryNode(name).locked.setValue(value)
|
||||||
|
|
||||||
|
def isValidName(self, name):
|
||||||
|
if not re.search(self.registryValue('validName'), name):
|
||||||
|
return False
|
||||||
|
if not registry.isValidRegistryName(name):
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
@internationalizeDocstring
|
@internationalizeDocstring
|
||||||
def lock(self, irc, msg, args, name):
|
def lock(self, irc, msg, args, name):
|
||||||
"""<alias>
|
"""<alias>
|
||||||
@ -350,7 +357,7 @@ class Alias(callbacks.Plugin):
|
|||||||
unlock = wrap(unlock, [('checkCapability', 'admin'), 'commandName'])
|
unlock = wrap(unlock, [('checkCapability', 'admin'), 'commandName'])
|
||||||
|
|
||||||
def addAlias(self, irc, name, alias, lock=False):
|
def addAlias(self, irc, name, alias, lock=False):
|
||||||
if not re.search(self.registryValue('validName'), name):
|
if not self.isValidName(name):
|
||||||
raise AliasError('Invalid alias name.')
|
raise AliasError('Invalid alias name.')
|
||||||
realName = callbacks.canonicalName(name)
|
realName = callbacks.canonicalName(name)
|
||||||
if name != realName:
|
if name != realName:
|
||||||
|
Loading…
Reference in New Issue
Block a user