diff options
author | C. McEnroe | 2020-03-31 14:30:42 -0400 |
---|---|---|
committer | C. McEnroe | 2020-03-31 14:30:42 -0400 |
commit | 25f419465f019feedb7266cb68232d1b32a66957 (patch) | |
tree | 67dffcc716ad457967f884cb25f448de27634f64 /command.c | |
parent | fcb6e2909f5211c24778741a2404b763914f9f99 (diff) |
Add /ignore message filtering patterns
Diffstat (limited to 'command.c')
-rw-r--r-- | command.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/command.c b/command.c index 8782ee6..5872bdc 100644 --- a/command.c +++ b/command.c @@ -348,6 +348,35 @@ static void commandCopy(uint id, char *params) { urlCopyMatch(id, params); } +static void commandIgnore(uint id, char *params) { + if (params) { + const char *pattern = ignoreAdd(params); + uiFormat( + id, Cold, NULL, "Ignoring \3%02d%s\3", + Brown, pattern + ); + } else { + for (size_t i = 0; i < ignore.len; ++i) { + uiFormat( + Network, Warm, NULL, "Ignoring \3%02d%s\3", + Brown, ignore.patterns[i] + ); + } + } +} + +static void commandUnignore(uint id, char *params) { + if (!params) return; + if (ignoreRemove(params)) { + uiFormat( + id, Cold, NULL, "No longer ignoring \3%02d%s\3", + Brown, params + ); + } else { + uiFormat(id, Cold, NULL, "Not ignoring \3%02d%s\3", Brown, params); + } +} + static void commandExec(uint id, char *params) { execID = id; @@ -404,6 +433,7 @@ static const struct Handler { { "/except", commandExcept, 0 }, { "/exec", commandExec, Multiline | Restricted }, { "/help", commandHelp, 0 }, + { "/ignore", commandIgnore, 0 }, { "/invex", commandInvex, 0 }, { "/invite", commandInvite, 0 }, { "/join", commandJoin, Restricted }, @@ -428,6 +458,7 @@ static const struct Handler { { "/topic", commandTopic, 0 }, { "/unban", commandUnban, 0 }, { "/unexcept", commandUnexcept, 0 }, + { "/unignore", commandUnignore, 0 }, { "/uninvex", commandUninvex, 0 }, { "/voice", commandVoice, 0 }, { "/whois", commandWhois, 0 }, |