made commands op, deop, opall, deopall, voice, devoice, voiceall, devoiceall a little...
[NeonServV5.git] / src / modcmd.c
index 18483ed63887f77cc09cebe55dfc735940c2b1ab..ea8b416486f66b89d95a1cf28cd23d7071c6d146 100644 (file)
@@ -456,6 +456,7 @@ static void handle_command_async(struct ClientSocket *client, struct UserNode *u
             str_b = cbind->channel_access;
         access_list[0] = '\0';
         if(str_b) {
+            struct ChanUser *chanuser = getChanUser(user, chan);
             str_c = strdup(str_b);
             str_b = str_c;
             while((str_a = str_b)) {
@@ -464,6 +465,15 @@ static void handle_command_async(struct ClientSocket *client, struct UserNode *u
                     *str_b = '\0';
                     str_b++;
                 }
+                if(*str_a == '@' || *str_a == '+') {
+                    //privs can override this access requirement
+                    int priv = 0;
+                    if(*str_a == '@') priv = CHANUSERFLAG_OPPED;
+                    else if(*str_a == '%') priv = CHANUSERFLAG_HALFOPPED;
+                    else if(*str_a == '+') priv = CHANUSERFLAG_VOICED;
+                    if(chanuser && (chanuser->flags & priv)) continue;
+                    str_a++;
+                }
                 if(*str_a == '#') {
                     str_a++;
                     access_pos += sprintf(access_list+access_pos, ", `%s`", str_a);