sendbuf(client);
return 0;
}
+ if (!strcmp(args[1], "+w")) {
+ if (trie_findfirst(&f, &chan->listwo) == 1)
+ do {
+ copy_strf(&databuf, ":%s 910 %s %s o:%s\n", hostname, client->nick, chan->name, f->key);
+ sendbuf(client);
+ } while(trie_findnext(&f) == 1);
+ if (trie_findfirst(&f, &chan->listwv) == 1)
+ do {
+ copy_strf(&databuf, ":%s 910 %s %s v:%s\n", hostname, client->nick, chan->name, f->key);
+ sendbuf(client);
+ } while(trie_findnext(&f) == 1);
+ copy_strf(&databuf, ":%s 911 %s %s :End of channel access list\n", hostname, client->nick, chan->name);
+ sendbuf(client);
+ return 0;
+ }
}
int is_plus;
char *p = args[1];
case 'q':
list = &chan->listq;
goto set_list;
+ case 'w':
+ if (!*argp) // TODO: error msg
+ break;
+ if (args[0][0] == 'o')
+ list = &chan->listwo;
+ else if (args[0][0] == 'v')
+ list = &chan->listwv;
+ else
+ break; // TODO: error msg
+ if (args[0][1] != ':')
+ break; // TODO: error msg
+ args[0] += 2;
+ goto set_list;
set_list: {
- if(!*argp)
+ if(!*argp) // TODO: error msg
break;
char *mask = *argp++;
if (strchr(mask, ' '))
if (newchan)
chanlog_time(chan->creation);
sendbuf_chan(chan);
+ // TODO: send channel modes to the joining client
+ // apply +w modes
+ if (match_list(client, &chan->listwo)) {
+ if (trie_set(&chan->o, client->key, client, NULL) == -1)
+ abort();
+ copy_strf(&databuf, ":cia!cia@cia.gov MODE %s +o %s\r\n", chan->name, client->nick);
+ sendbuf_chan(chan);
+ }
+ if (match_list(client, &chan->listwv)) {
+ if (trie_set(&chan->v, client->key, client, NULL) == -1)
+ abort();
+ copy_strf(&databuf, ":cia!cia@cia.gov MODE %s +v %s\r\n", chan->name, client->nick);
+ sendbuf_chan(chan);
+ }
// send topic
channel_sendtopic(client, chan, 1);
// send names
trie_free(&chan->liste);
trie_free(&chan->listI);
trie_free(&chan->listq);
+ trie_free(&chan->listwo);
+ trie_free(&chan->listwv);
free(chan->chankey);
free(chan);
}
}
void rpl_myinfo(struct client_data *client) // 004
{
- copy_strf(&databuf, ":%s 004 %s PatchyIRCD 0.0.1 iworZ beIqklPimnst\n", hostname, client->nick);
+ copy_strf(&databuf, ":%s 004 %s PatchyIRCD 0.0.1 iworZ beIqwklPimnst\n", hostname, client->nick);
}
void rpl_isupport(struct client_data *client) // 005
{
- copy_strf(&databuf, ":%s 005 %s CASEMAPPING=ascii NICKLEN=%u EXCEPTS=e INVEX=I MAXTARGETS=1 CHANMODES=beIq,k,l,Pimnst CHANTYPES=#& PREFIX=(ov)@+ STATUSMSG=@+ :are supported by this server\n", hostname, client->nick, MAX_NICKLEN-1);
+ copy_strf(&databuf, ":%s 005 %s CASEMAPPING=ascii NICKLEN=%u EXCEPTS=e INVEX=I MAXTARGETS=1 CHANMODES=beIqw,k,l,Pimnst CHANTYPES=#& PREFIX=(ov)@+ STATUSMSG=@+ :are supported by this server\n", hostname, client->nick, MAX_NICKLEN-1);
}
#if 0