Advertisement
Atheuz

Untitled

Jun 5th, 2011
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.77 KB | None | 0 0
  1. diff --git a/core/config.py b/core/config.py
  2. index 1b2cacb..f99d024 100644
  3. --- a/core/config.py
  4. +++ b/core/config.py
  5. @@ -21,6 +21,8 @@ if not os.path.exists('config'):
  6.            },
  7.            "disabled_plugins": [],
  8.            "disabled_commands": [],
  9. +          "enabled_commands": [],
  10. +          "enabled_commands_propagate": 0,
  11.            "acls": {},
  12.            "api_keys": {},
  13.            "censored_strings":
  14. diff --git a/plugins/help.py b/plugins/help.py
  15. index 5ff9992..bf44565 100644
  16. --- a/plugins/help.py
  17. +++ b/plugins/help.py
  18. @@ -10,16 +10,27 @@ def help(inp, bot=None, pm=None):
  19.      funcs = {}
  20.      disabled = bot.config.get('disabled_plugins', [])
  21.      disabled_comm = bot.config.get('disabled_commands', [])
  22. +    enabled_commands = bot.config.get('enabled_commands', [])
  23. +    enabled_commands_propagate = bot.config.get('enabled_commands_propagate')
  24.      for command, (func, args) in bot.commands.iteritems():
  25.          fn = re.match(r'^plugins.(.+).py$', func._filename)
  26.          if fn.group(1).lower() not in disabled:
  27.              if command not in disabled_comm:
  28. -                if func.__doc__ is not None:
  29. -                    if func in funcs:
  30. -                        if len(funcs[func]) < len(command):
  31. -                            funcs[func] = command
  32. -                    else:
  33. -                        funcs[func] = command
  34. +                if enabled_commands_propagate:
  35. +                    if command in enabled_commands:
  36. +                        if func.__doc__ is not None:
  37. +                            if func in funcs:
  38. +                                if len(funcs[func]) < len(command):
  39. +                                    funcs[func] = command
  40. +                            else:
  41. +                                funcs[func] = command
  42. +                else:
  43. +                    if func.__doc__ is not None:
  44. +                            if func in funcs:
  45. +                                if len(funcs[func]) < len(command):
  46. +                                    funcs[func] = command
  47. +                            else:
  48. +                                funcs[func] = command
  49.  
  50.      commands = dict((value, key) for key, value in funcs.iteritems())
  51.  
  52. diff --git a/plugins/sieve.py b/plugins/sieve.py
  53. index 108390e..46824b6 100644
  54. --- a/plugins/sieve.py
  55. +++ b/plugins/sieve.py
  56. @@ -12,6 +12,9 @@ def sieve_suite(bot, input, func, kind, args):
  57.      if kind == "command":
  58.          if input.trigger in bot.config.get('disabled_commands', []):
  59.              return None
  60. +        if bot.config.get('enabled_commands_propagate'):
  61. +            if input.trigger not in bot.config.get('enabled_commands', []):
  62. +                return None
  63.  
  64.          ignored = bot.config.get('ignored', [])
  65.          if input.host in ignored or input.nick in ignored:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement