return err_notregistered(client), sendbuf(client), 0;
if (argc == 0)
return err_needmoreparams(client, command), sendbuf(client), 0;
- // TODO: masks
if (strchr("#&", args[0][0])) {
struct channel *chan = findChannel(args[0]);
// TODO: handle chanmode +s, umode +i
map_foreach(&chan->members, 0, &cl)
(args[1] ? rpl_whospcrpl(client, cl, chan, args[1]) : rpl_whoreply(client, cl, chan)), sendbuf(client);
}
- } else {
+ } else if (!strchr(args[0], '*')) {
+ // TODO: this probably needs better +i mode handling
struct client_data *cl = findClient(args[0]);
if (cl)
(args[1] ? rpl_whospcrpl(client, cl, 0, args[1]) : rpl_whoreply(client, cl, 0)), sendbuf(client);
+ } else {
+ struct client_data *cl;
+ map_foreach(&client_map, 0, &cl) {
+ if (!irc_glob(cl->nuh, args[0]))
+ continue;
+ int visible = client->umode & UMODE_OPER || !(cl->umode & UMODE_INVISIBLE) || client == cl;
+ if (!visible) {
+ struct channel *chan;
+ map_foreach(&cl->channels, 0, &chan) {
+ if (map_get(&client->channels, chan->key)) {
+ visible = 1;
+ break;
+ }
+ }
+ }
+ if (visible)
+ (args[1] ? rpl_whospcrpl(client, cl, 0, args[1]) : rpl_whoreply(client, cl, 0)), sendbuf(client);
+ }
}
rpl_endofwho(client, args[0]), sendbuf(client);
} else if(strcmp(command, "WHOIS") == 0) {