From 3e67bf6557861a58d75f62c562a3a2b43f226435 Mon Sep 17 00:00:00 2001 From: C. McEnroe Date: Wed, 30 Sep 2020 17:52:39 -0400 Subject: Add /ops command It's pretty awkward with large channels since NAMES isn't sorted by prefixes or anything... But having it accumulate names across many replies would require more reworking. --- handle.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'handle.c') diff --git a/handle.c b/handle.c index cf3c977..e3efe47 100644 --- a/handle.c +++ b/handle.c @@ -499,20 +499,26 @@ static void handleReplyNames(struct Message *msg) { char *user = strsep(&name, "@"); enum Color color = (user ? hash(user) : Default); completeAdd(id, nick, color); - if (!replies.names) continue; + if (replies.ops && (prefixes == nick || prefixes[0] == '+')) continue; + if (!replies.ops && !replies.names) continue; catf(&cat, "%s\3%02d%s\3", (buf[0] ? ", " : ""), color, prefixes); } - if (!replies.names) return; + if (!cat.len) return; uiFormat( id, Cold, tagTime(msg), - "In \3%02d%s\3 are %s", + "%s \3%02d%s\3 are %s", + (replies.ops ? "The operators of" : "In"), hash(msg->params[2]), msg->params[2], buf ); } static void handleReplyEndOfNames(struct Message *msg) { (void)msg; - if (replies.names) replies.names--; + if (replies.ops) { + replies.ops--; + } else if (replies.names) { + replies.names--; + } } static void handleReplyNoTopic(struct Message *msg) { -- cgit 1.4.1-2-gfad0