Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coretasks: make URL handling respect per-channel config #1812

Closed
dgw opened this issue Jan 25, 2020 · 1 comment
Closed

coretasks: make URL handling respect per-channel config #1812

dgw opened this issue Jan 25, 2020 · 1 comment
Labels
Bug Things to squish; generally used for issues High Priority
Milestone

Comments

@dgw
Copy link
Member

dgw commented Jan 25, 2020

We removed the unblockable status from handle_url_callbacks() in #1806, so it will respect the ignored status of users matching entries in the block list (.blocks command set). We should further enhance this function so certain URL handlers (plugins or specific callables) can be disabled using the per-channel settings introduced by #1235.

URL callable handling directly invokes the matching function:

sopel/sopel/coretasks.py

Lines 1009 to 1012 in c5cffdb

for function, match in bot.search_url_callbacks(url):
# trigger callback defined by the `@url` decorator
if hasattr(function, 'url_regex'):
function(bot, trigger, match=match)

Normal callable handling goes through bot.call(), which enforces per-channel restrictions:

sopel/sopel/bot.py

Lines 565 to 585 in c5cffdb

# if channel has its own config section, check for excluded plugins/plugin methods
if trigger.sender in self.config:
channel_config = self.config[trigger.sender]
# disable listed plugins completely on provided channel
if 'disable_plugins' in channel_config:
disabled_plugins = channel_config.disable_plugins.split(',')
# if "*" is used, we are disabling all plugins on provided channel
if '*' in disabled_plugins:
return
if func.__module__ in disabled_plugins:
return
# disable chosen methods from plugins
if 'disable_commands' in channel_config:
disabled_commands = literal_eval(channel_config.disable_commands)
if func.__module__ in disabled_commands:
if func.__name__ in disabled_commands[func.__module__]:
return

@dgw dgw added this to the 7.1.0 milestone Jan 25, 2020
@dgw dgw added Bug Things to squish; generally used for issues High Priority and removed Feature Medium Priority labels Apr 14, 2020
@dgw dgw modified the milestones: 7.1.0, 7.0.2 Apr 14, 2020
@dgw
Copy link
Member Author

dgw commented Apr 15, 2020

Closing as fixed by #1845.

@dgw dgw closed this as completed Apr 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Things to squish; generally used for issues High Priority
Projects
None yet
Development

No branches or pull requests

1 participant