From da821350b78948d8b85cb27d7c07cb04e003b4b9 Mon Sep 17 00:00:00 2001 From: dgw Date: Tue, 23 Aug 2022 20:20:27 -0500 Subject: [PATCH] coretasks: `.blocks hostmask` -> `.blocks host` These are not, and AFAICT never have been, actual host*masks*. Having the subcommand name and code variables refer to them as (host)masks has been a point of confusion for, literally, years. This is just the first step toward making the ignore/block system work more intuitively, but you know what they say about journeys of a thousand miles... For full context, thought processes, tentative future plans, and so on: See #1355. --- sopel/coretasks.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/sopel/coretasks.py b/sopel/coretasks.py index 42e06b439a..4fdc79dcac 100644 --- a/sopel/coretasks.py +++ b/sopel/coretasks.py @@ -1272,26 +1272,26 @@ def blocks(bot, trigger): "success_del": "Successfully deleted block: %s", "success_add": "Successfully added block: %s", "no_nick": "No matching nick block found for: %s", - "no_host": "No matching hostmask block found for: %s", - "invalid": "Invalid format for %s a block. Try: .blocks add (nick|hostmask) sopel", + "no_host": "No matching host block found for: %s", + "invalid": "Invalid format for %s a block. Try: .blocks add (nick|host) sopel", "invalid_display": "Invalid input for displaying blocks.", "nonelisted": "No %s listed in the blocklist.", 'huh': "I could not figure out what you wanted to do.", } - masks = set(s for s in bot.config.core.host_blocks if s != '') + hosts = set(s for s in bot.config.core.host_blocks if s != '') nicks = set(bot.make_identifier(nick) for nick in bot.config.core.nick_blocks if nick != '') text = trigger.group().split() if len(text) == 3 and text[1] == "list": - if text[2] == "hostmask": - if len(masks) > 0: - blocked = ', '.join(str(mask) for mask in masks) - bot.say("Blocked hostmasks: {}".format(blocked)) + if text[2] == "host": + if len(hosts) > 0: + blocked = ', '.join(str(host) for host in hosts) + bot.say("Blocked hosts: {}".format(blocked)) else: - bot.reply(STRINGS['nonelisted'] % ('hostmasks')) + bot.reply(STRINGS['nonelisted'] % ('hosts')) elif text[2] == "nick": if len(nicks) > 0: blocked = ', '.join(str(nick) for nick in nicks) @@ -1306,9 +1306,9 @@ def blocks(bot, trigger): nicks.add(text[3]) bot.config.core.nick_blocks = nicks bot.config.save() - elif text[2] == "hostmask": - masks.add(text[3].lower()) - bot.config.core.host_blocks = list(masks) + elif text[2] == "host": + hosts.add(text[3].lower()) + bot.config.core.host_blocks = list(hosts) else: bot.reply(STRINGS['invalid'] % ("adding")) return @@ -1325,13 +1325,13 @@ def blocks(bot, trigger): bot.config.core.nick_blocks = [str(n) for n in nicks] bot.config.save() bot.reply(STRINGS['success_del'] % (text[3])) - elif text[2] == "hostmask": - mask = text[3].lower() - if mask not in masks: + elif text[2] == "host": + host = text[3].lower() + if host not in hosts: bot.reply(STRINGS['no_host'] % (text[3])) return - masks.remove(mask) - bot.config.core.host_blocks = [str(m) for m in masks] + hosts.remove(host) + bot.config.core.host_blocks = [str(m) for m in hosts] bot.config.save() bot.reply(STRINGS['success_del'] % (text[3])) else: