diff --git a/RelayNext/config.py b/RelayNext/config.py index f4a1563..d87125f 100644 --- a/RelayNext/config.py +++ b/RelayNext/config.py @@ -36,7 +36,8 @@ try: except: # Placeholder that allows to run the plugin on a bot # without the i18n module - _ = lambda x:x + _ = lambda x: x + def configure(advanced): # This will be called by supybot to configure this module. advanced is @@ -48,9 +49,17 @@ def configure(advanced): RelayNext = conf.registerPlugin('RelayNext') -# This is where your configuration variables (if any) should go. For example: -# conf.registerGlobalValue(RelayNext, 'someConfigVariableName', -# registry.Boolean(False, _("""Help for someConfigVariableName."""))) + +conf.registerChannelValue(RelayNext, 'color', + registry.Boolean(True, _("""Determines whether the bot will color relayed + PRIVMSGs so as to make the messages easier to read."""))) +conf.registerChannelValue(RelayNext, 'hostmasks', + registry.Boolean(True, _("""Determines whether the bot will relay the + hostmask of the person joining or parting the channel when he or she joins + or parts."""))) +conf.registerChannelValue(RelayNext, 'noHighlight', + registry.Boolean(False, _("""Determines whether the bot should prefix nicks + with a hyphen (-) to prevent excess highlights (in PRIVMSGs and actions)."""))) # vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: diff --git a/RelayNext/plugin.py b/RelayNext/plugin.py index 39e791a..25a6c1d 100644 --- a/RelayNext/plugin.py +++ b/RelayNext/plugin.py @@ -46,7 +46,8 @@ try: except ImportError: # Placeholder that allows to run the plugin on a bot # without the i18n module - _ = lambda x:x + _ = lambda x: x + filename = conf.supybot.directories.data.dirize("RelayNext.db") @@ -69,7 +70,8 @@ class RelayNext(callbacks.Plugin): with open(filename, 'wb') as f: pickle.dump(self.db, f, 2) except Exception as e: - self.log.warning('RelayNext: Unable to write pickled database: %s', e) + self.log.warning('RelayNext: Unable to write pickled database: %s', + e) def __init__(self, irc): self.__parent = super(RelayNext, self) @@ -145,10 +147,10 @@ class RelayNext(callbacks.Plugin): s = '' nick = msg.nick userhost = '' - noHighlight = True - useHostmask = True - color = True channel = msg.args[0] + noHighlight = self.registryValue('noHighlight', channel) + useHostmask = self.registryValue('hostmasks', channel) + color = self.registryValue('color', channel) netname = irc.network.lower() if color: