added some code & compiler information to cmd_netinfo
[NeonServV5.git] / cmd_neonserv_voiceall.c
1
2 /*
3 * argv[0]    (optional) nick mask
4 */
5
6 static CMD_BIND(neonserv_cmd_voiceall) {
7     int done_users = 0;
8     char *nickmask = NULL;
9     struct ChanUser *chanuser;
10     struct ModeBuffer *modeBuf;
11     check_mysql();
12     if(!checkChannelAccess(user, chan, "channel_canvoice", 1, 0)) {
13         reply(getTextBot(), user, "NS_ACCESS_DENIED");
14         return;
15     }
16     if(argc > 0)
17         nickmask = argv[0];
18     modeBuf = initModeBuffer(client, chan);
19     for(chanuser = getChannelUsers(chan, NULL); chanuser; chanuser = getChannelUsers(chan, chanuser)) {
20         if(nickmask && match(nickmask, chanuser->user->nick)) continue;
21         if(chanuser->flags & CHANUSERFLAG_VOICED) continue;
22         modeBufferVoice(modeBuf, chanuser->user->nick);
23         done_users++;
24     }
25     freeModeBuffer(modeBuf);
26     reply(getTextBot(), user, "NS_VOICEALL_DONE", done_users, chan->name);
27 }