diff options
author | C. McEnroe | 2020-09-30 17:52:39 -0400 |
---|---|---|
committer | C. McEnroe | 2020-09-30 17:52:39 -0400 |
commit | 3e67bf6557861a58d75f62c562a3a2b43f226435 (patch) | |
tree | aada4c6bc2a93a0479b02009ec5c8cf3163eb0a4 /handle.c | |
parent | dce6c11cf683cad51bc602b682e84c366c60c689 (diff) |
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.
Diffstat (limited to 'handle.c')
-rw-r--r-- | handle.c | 14 |
1 files changed, 10 insertions, 4 deletions
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) { |