diff --git a/ChangeLog b/ChangeLog index a13bd85b8..9251c51ba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ + * Fixed bug in RSS.configure; no aliases could be added. + + * Changed Alias.freeze to Alias.lock. + * Fixed sorting in Status' uptime database. * Updated the Gameknot tests for expired games. diff --git a/plugins/Alias.py b/plugins/Alias.py index 7e15bc889..5a5c66e9f 100644 --- a/plugins/Alias.py +++ b/plugins/Alias.py @@ -160,23 +160,23 @@ class Alias(callbacks.Privmsg): def __init__(self): callbacks.Privmsg.__init__(self) filename = os.path.join(conf.dataDir, 'Aliases.db') - # Schema: {name: [alias, frozen]} + # Schema: {name: [alias, locked]} self.aliases = structures.PersistentDictionary(filename) def __call__(self, irc, msg): # Adding the aliases requires an Irc. So the first time we get called # with an Irc, we add our aliases and then delete ourselves :) - for (name, (alias, frozen)) in self.aliases.iteritems(): - self.addAlias(irc, name, alias, frozen) + for (name, (alias, locked)) in self.aliases.iteritems(): + self.addAlias(irc, name, alias, locked) del self.__class__.__call__ def die(self): self.aliases.close() - def freeze(self, irc, msg, args): + def lock(self, irc, msg, args): """ - 'Freezes' an alias so that no one else can change it. + Locks an alias so that no one else can change it. """ name = privmsgs.getArgs(args) name = callbacks.canonicalName(name) @@ -185,12 +185,12 @@ class Alias(callbacks.Privmsg): irc.reply(msg, conf.replySuccess) else: irc.error(msg, 'There is no such alias.') - freeze = privmsgs.checkCapability(freeze, 'admin') + lock = privmsgs.checkCapability(lock, 'admin') - def unfreeze(self, irc, msg, args): + def unlock(self, irc, msg, args): """ - 'Unfreezes' an alias so that people can define new aliases over it. + Unlocks an alias so that people can define new aliases over it. """ name = privmsgs.getArgs(args) name = callbacks.canonicalName(name) @@ -199,10 +199,10 @@ class Alias(callbacks.Privmsg): irc.reply(msg, conf.replySuccess) else: irc.error(msg, 'There is no such alias.') - unfreeze = privmsgs.checkCapability(unfreeze, 'admin') + unlock = privmsgs.checkCapability(unlock, 'admin') _invalidCharsRe = re.compile(r'[\[\]\s]') - def addAlias(self, irc, name, alias, freeze=False): + def addAlias(self, irc, name, alias, lock=False): if self._invalidCharsRe.search(name): raise AliasError, 'Names cannot contain spaces or square brackets.' if conf.enablePipeSyntax and '|' in name: @@ -217,24 +217,24 @@ class Alias(callbacks.Privmsg): s = 'A command with the name %r already exists.' % name raise AliasError, s if name in self.aliases: - (currentAlias, frozen) = self.aliases[name] - if frozen and currentAlias != alias: - raise AliasError, 'Alias %r is frozen.' % name + (currentAlias, locked) = self.aliases[name] + if locked and currentAlias != alias: + raise AliasError, 'Alias %r is locked.' % name try: f = makeNewAlias(name, alias) except RecursiveAlias: raise AliasError, 'You can\'t define a recursive alias.' setattr(self.__class__, name, f) - self.aliases[name] = [alias, freeze] + self.aliases[name] = [alias, lock] - def removeAlias(self, name, evenIfFrozen=False): + def removeAlias(self, name, evenIfLocked=False): name = callbacks.canonicalName(name) if hasattr(self, name) and self.isCommand(name): - if evenIfFrozen or not self.aliases[name][1]: + if evenIfLocked or not self.aliases[name][1]: delattr(self.__class__, name) del self.aliases[name] else: - raise AliasError, 'That alias is frozen.' + raise AliasError, 'That alias is locked.' else: raise AliasError, 'There is no such alias.' @@ -259,7 +259,7 @@ class Alias(callbacks.Privmsg): def remove(self, irc, msg, args): """ - Removes the given alias, if unfrozen. + Removes the given alias, if unlocked. """ name = privmsgs.getArgs(args) try: diff --git a/plugins/Lookup.py b/plugins/Lookup.py index e421a9c80..0aac16117 100644 --- a/plugins/Lookup.py +++ b/plugins/Lookup.py @@ -106,7 +106,7 @@ class Lookup(callbacks.Privmsg): db.commit() cb = irc.getCallback('Alias') if cb is not None: - cb.removeAlias(name, evenIfFrozen=True) + cb.removeAlias(name, evenIfLocked=True) irc.reply(msg, conf.replySuccess) except sqlite.DatabaseError: irc.error(msg, 'No such lookup exists.') @@ -128,7 +128,7 @@ class Lookup(callbacks.Privmsg): cb = irc.getCallback('Alias') if cb is not None: try: - cb.addAlias(irc, name, 'lookup %s @1' % name, freeze=True) + cb.addAlias(irc, name, 'lookup %s @1' % name, lock=True) except sys.modules[cb.__module__].AliasError, e: pass irc.reply(msg, conf.replySuccess) @@ -158,7 +158,7 @@ class Lookup(callbacks.Privmsg): cb = irc.getCallback('Alias') if cb is not None: try: - cb.addAlias(irc, name, 'lookup %s @1' % name, freeze=True) + cb.addAlias(irc, name, 'lookup %s @1' % name, lock=True) except sys.modules[cb.__module__].AliasError, e: irc.error(msg, str(e)) return diff --git a/plugins/RSS.py b/plugins/RSS.py index 31f3de6b1..d0546a728 100644 --- a/plugins/RSS.py +++ b/plugins/RSS.py @@ -64,8 +64,8 @@ def configure(onStart, afterConnect, advanced): prompt = 'Would you like to add another RSS feed?' name = something('What\'s the name of the website?') url = something('What\'s the URL of the RSS feed?') - onStart.append('alias %s "rss %s"' % (name, url)) - onStart.append('freeze %s' % name) + onStart.append('alias add %s "rss %s"' % (name, url)) + onStart.append('alias lock %s' % name) class RSS(callbacks.Privmsg): threaded = True diff --git a/test/test_Alias.py b/test/test_Alias.py index 268f1da6b..ae5ce1c55 100644 --- a/test/test_Alias.py +++ b/test/test_Alias.py @@ -122,10 +122,10 @@ class AliasTestCase(ChannelPluginTestCase, PluginDocumentation): def testAddRemoveAlias(self): cb = self.irc.getCallback('Alias') - cb.addAlias(self.irc, 'foobar', 'echo sbbone', freeze=True) + cb.addAlias(self.irc, 'foobar', 'echo sbbone', lock=True) self.assertResponse('foobar', 'sbbone') self.assertRaises(Alias.AliasError, cb.removeAlias, 'foobar') - cb.removeAlias('foobar', evenIfFrozen=True) + cb.removeAlias('foobar', evenIfLocked=True) self.failIf('foobar' in cb.aliases) self.assertNoResponse('foobar', 2)