]> PatchyGit - patchyircd.git/commitdiff
add +0 chanmode for viewing all lists
authorEgor <egor@patchysicp.xyz>
Fri, 27 May 2022 20:49:41 +0000 (23:49 +0300)
committerEgor <egor@patchysicp.xyz>
Fri, 27 May 2022 21:01:00 +0000 (00:01 +0300)
irc.c

diff --git a/irc.c b/irc.c
index f1a1b88..3f01dde 100644 (file)
--- a/irc.c
+++ b/irc.c
@@ -618,35 +618,40 @@ int processPacket(struct client_data *client, char *source, char *command, int a
                                        return 0; // TODO: error
                                if (argc == 2) { // Type A channel modes
                                        struct trie_find *f = NULL;
-                                       if (!strcmp(args[1], "+b") || !strcmp(args[1], "b")) {
+                                       int all = !strcmp(args[1], "+0");
+                                       if (all) {
+                                               rpl_channelmodeis(client, chan), sendbuf(client);
+                                               rpl_creationtime(client, chan), sendbuf(client);
+                                       }
+                                       if (all || !strcmp(args[1], "+b") || !strcmp(args[1], "b")) {
                                                if (trie_findfirst(&f, &chan->listb) == 1)
                                                        do {
                                                                rpl_banlist(client, chan, f->key), sendbuf(client);
                                                        } while(trie_findnext(&f) == 1);
                                                return rpl_endofbanlist(client, chan), sendbuf(client), 0;
                                        }
-                                       if (!strcmp(args[1], "+e") || !strcmp(args[1], "e")) {
+                                       if (all || !strcmp(args[1], "+e") || !strcmp(args[1], "e")) {
                                                if (trie_findfirst(&f, &chan->liste) == 1)
                                                        do {
                                                                rpl_exceptlist(client, chan, f->key), sendbuf(client);
                                                        } while(trie_findnext(&f) == 1);
                                                return rpl_endofexceptlist(client, chan), sendbuf(client), 0;
                                        }
-                                       if (!strcmp(args[1], "+I") || !strcmp(args[1], "I")) {
+                                       if (all || !strcmp(args[1], "+I") || !strcmp(args[1], "I")) {
                                                if (trie_findfirst(&f, &chan->listI) == 1)
                                                        do {
                                                                rpl_invexlist(client, chan, f->key), sendbuf(client);
                                                        } while(trie_findnext(&f) == 1);
                                                return rpl_endofinvexlist(client, chan), sendbuf(client), 0;
                                        }
-                                       if (!strcmp(args[1], "+q") || !strcmp(args[1], "q")) {
+                                       if (all || !strcmp(args[1], "+q") || !strcmp(args[1], "q")) {
                                                if (trie_findfirst(&f, &chan->listq) == 1)
                                                        do {
                                                                rpl_quietlist(client, chan, f->key), sendbuf(client);
                                                        } while(trie_findnext(&f) == 1);
                                                return rpl_endofquietlist(client, chan), sendbuf(client), 0;
                                        }
-                                       if (!strcmp(args[1], "+w") || !strcmp(args[1], "w")) {
+                                       if (all || !strcmp(args[1], "+w") || !strcmp(args[1], "w")) {
                                                if (trie_findfirst(&f, &chan->listwo) == 1)
                                                        do {
                                                                rpl_accesslist(client, chan, 'o', f->key), sendbuf(client);