diff options
-rw-r--r-- | catgirl.1 | 4 | ||||
-rw-r--r-- | chat.h | 1 | ||||
-rw-r--r-- | command.c | 7 | ||||
-rw-r--r-- | handle.c | 14 |
4 files changed, 21 insertions, 5 deletions
diff --git a/catgirl.1 b/catgirl.1 index ad2b3a2..6a45722 100644 --- a/catgirl.1 +++ b/catgirl.1 @@ -1,4 +1,4 @@ -.Dd September 6, 2020 +.Dd September 30, 2020 .Dt CATGIRL 1 .Os . @@ -292,6 +292,8 @@ Change nicknames. Send a notice. .It Ic /ns Ar command Send a command to NickServ. +.It Ic /ops +List channel operators. .It Ic /part Op Ar message Leave the channel. .It Ic /query Ar nick diff --git a/chat.h b/chat.h index 6cf34b3..43df641 100644 --- a/chat.h +++ b/chat.h @@ -246,6 +246,7 @@ extern struct Replies { uint list; uint mode; uint names; + uint ops; uint topic; uint whois; } replies; diff --git a/command.c b/command.c index 0d988cd..efc095c 100644 --- a/command.c +++ b/command.c @@ -174,6 +174,12 @@ static void commandNames(uint id, char *params) { replies.names++; } +static void commandOps(uint id, char *params) { + (void)params; + ircFormat("NAMES %s\r\n", idNames[id]); + replies.ops++; +} + static void commandInvite(uint id, char *params) { if (!params) return; char *nick = strsep(¶ms, " "); @@ -468,6 +474,7 @@ static const struct Handler { { "/o", commandOpen, Restricted }, { "/op", commandOp, 0 }, { "/open", commandOpen, Restricted }, + { "/ops", commandOps, 0 }, { "/part", commandPart, 0 }, { "/query", commandQuery, Restricted }, { "/quit", commandQuit, 0 }, 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) { |