From: Egor Date: Sun, 8 May 2022 09:22:02 +0000 (+0300) Subject: add MODE +o +v X-Git-Url: https://git.patchysicp.xyz/?a=commitdiff_plain;h=ec16ff98be417de5391e29c923942890fec52040;p=patchyircd.git add MODE +o +v --- diff --git a/irc.c b/irc.c index f0b9b04..9aa92f2 100644 --- 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; } diff --git a/ircfmt.c b/ircfmt.c index 07290d3..8aec38e 100644 --- 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);