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