diff options
author | June McEnroe <june@causal.agency> | 2022-09-11 17:34:41 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2022-09-11 17:34:41 -0400 |
commit | fcbe7af1e2ac2abb71251a51f5384d22cad9a87a (patch) | |
tree | e5583b434defc629f35cf286f69413a1787a610e /command.c | |
parent | Set pointer to Entry in Cursor (diff) | |
download | catgirl-fcbe7af1e2ac2abb71251a51f5384d22cad9a87a.tar.gz catgirl-fcbe7af1e2ac2abb71251a51f5384d22cad9a87a.zip |
Generate /ops from cache
Diffstat (limited to '')
-rw-r--r-- | command.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/command.c b/command.c index 3acbe76..4fb58da 100644 --- a/command.c +++ b/command.c @@ -219,8 +219,31 @@ static void commandNames(uint id, char *params) { static void commandOps(uint id, char *params) { (void)params; - ircFormat("WHO %s\r\n", idNames[id]); - replies[ReplyWho]++; + char buf[1024]; + char *ptr = buf, *end = &buf[sizeof(buf)]; + ptr = seprintf( + ptr, end, "The council of \3%02d%s\3 are ", + idColors[id], idNames[id] + ); + bool first = true; + struct Cursor curs = {0}; + for (const char *nick; (nick = cacheNextKey(&curs, id));) { + char prefix = bitPrefix(curs.entry->prefixBits); + if (!prefix || prefix == '+') continue; + ptr = seprintf( + ptr, end, "%s\3%02d%c%s\3", + (first ? "" : ", "), curs.entry->color, prefix, nick + ); + first = false; + } + if (first) { + uiFormat( + id, Warm, NULL, "\3%02d%s\3 is a lawless wasteland", + idColors[id], idNames[id] + ); + } else { + uiWrite(id, Warm, NULL, buf); + } } static void commandInvite(uint id, char *params) { |