]> PatchyGit - patchyircd.git/commitdiff
add MODE +o +v
authorEgor <egor@patchysicp.xyz>
Sun, 8 May 2022 09:22:02 +0000 (12:22 +0300)
committerEgor <egor@patchysicp.xyz>
Sun, 8 May 2022 09:22:02 +0000 (12:22 +0300)
irc.c
ircfmt.c

diff --git a/irc.c b/irc.c
index f0b9b04..9aa92f2 100644 (file)
--- a/irc.c
+++ b/irc.c
@@ -565,6 +565,28 @@ int processPacket(struct client_data *client, char *source, char *command, int a
                                        case 'b':
                                        case 'e':
                                        case 'I':
+                                               break;
+                                       case 'v':
+                                       case 'o':
+                                               if(!*argp)
+                                                       continue;
+                                               const char *nick = *argp++;
+                                               char which[2] = {*p, 0};
+                                               struct client_data *cl = findClient(nick);
+                                               if (!cl) {
+                                                       err_nosuchnick(client, nick), sendbuf(client);
+                                                       continue;
+                                               }
+                                               if (!trie_get(&chan->members, cl->key)) {
+                                                       err_usernotinchannel(client, cl->nick, chan), sendbuf(client);
+                                                       continue;
+                                               }
+                                               trie_set(*p == 'o' ? &chan->o : &chan->v, cl->key, is_plus ? cl : NULL, NULL);
+                                               copy_strf(&databuf, ":%s!%s@%s MODE %s %s%s %s\r\n",
+                                                               client->nick, client->username, client->hostname,
+                                                               chan->name, is_plus?"+":"-", which, cl->nick);
+                                               sendbuf_chan(chan);
+                                               break;
                                        default:
                                                goto unknown;
                                        }
index 07290d3..8aec38e 100644 (file)
--- a/ircfmt.c
+++ b/ircfmt.c
@@ -276,11 +276,11 @@ void err_nicknameinuse(struct client_data *client, const char *nick) // 433
 {
        copy_strf(&databuf, ":%s 433 %s %s :Nickname is already in use\r\n", hostname, client->nick, nick);
 }
-#if 0
 void err_usernotinchannel(struct client_data *client, const char *nick, struct channel *chan) // 441
 {
        copy_strf(&databuf, ":%s 441 %s %s %s :They aren't on that channel\r\n", hostname, client->nick, nick, chan->name);
 }
+#if 0
 void err_notonchannel(struct client_data *client, struct channel *chan) // 442
 {
        copy_strf(&databuf, ":%s 442 %s %s :is already on channel\r\n", hostname, client->nick, chan->name);