Added registry.split.

This commit is contained in:
Jeremy Fincher 2004-07-25 11:06:00 +00:00
parent d868a17bf9
commit 282846fd59

View File

@ -820,7 +820,7 @@ class Privmsg(irclib.IrcCallback):
def registryValue(self, name, channel=None): def registryValue(self, name, channel=None):
plugin = self.name() plugin = self.name()
group = conf.supybot.plugins.get(plugin) group = conf.supybot.plugins.get(plugin)
names = name.split('.') names = registry.split(name)
for name in names: for name in names:
group = group.get(name) group = group.get(name)
if channel is None: if channel is None:
@ -828,6 +828,17 @@ class Privmsg(irclib.IrcCallback):
else: else:
return group.get(channel)() return group.get(channel)()
def setRegistryValue(self, name, value, channel=None):
plugin = self.name()
group = conf.supybot.plugins.get(plugin)
names = registry.split(name)
for name in names:
group = group.get(name)
if channel is None:
group.setValue(value)
else:
group.get(channel).setValue(value)
def userValue(self, name, prefixOrName, default=None): def userValue(self, name, prefixOrName, default=None):
try: try:
id = str(ircdb.users.getUserId(prefixOrName)) id = str(ircdb.users.getUserId(prefixOrName))
@ -835,7 +846,7 @@ class Privmsg(irclib.IrcCallback):
return None return None
plugin = self.name() plugin = self.name()
group = conf.users.plugins.get(plugin) group = conf.users.plugins.get(plugin)
names = name.split('.') names = registry.split(name)
for name in names: for name in names:
group = group.get(name) group = group.get(name)
return group.get(id)() return group.get(id)()
@ -851,7 +862,7 @@ class Privmsg(irclib.IrcCallback):
raise raise
plugin = self.name() plugin = self.name()
group = conf.users.plugins.get(plugin) group = conf.users.plugins.get(plugin)
names = name.split('.') names = registry.split(name)
for name in names: for name in names:
group = group.get(name) group = group.get(name)
group = group.get(id) group = group.get(id)