added full half-op support
[NeonServV5.git] / src / cmd_neonserv_peek.c
index f32ce6cde4fec8b1b0daf0eb77c3beea2c38558c..51de508c12d535381a2d271bc359bd3f1e378bed 100644 (file)
@@ -53,10 +53,13 @@ static void neonserv_cmd_peek_async1(struct ClientSocket *client, struct ClientS
     getModeString(chan->modes, tmpStr);
     reply(textclient, user, "NS_PEEK_MODES", tmpStr);
     struct ChanUser *chanuser;
-    int op_count = 0, voice_count = 0, normal_count = 0, invi_count = 0;
+    int with_halfops = get_int_field("General.have_halfop");
+    int op_count = 0, halfop_count = 0, voice_count = 0, normal_count = 0, invi_count = 0;
     for(chanuser = getChannelUsers(chan, NULL); chanuser; chanuser = getChannelUsers(chan, chanuser)) {
         if(chanuser->flags & CHANUSERFLAG_OPPED)
             op_count++;
+        else if(with_halfops && (chanuser->flags & CHANUSERFLAG_HALFOPPED))
+            halfop_count++;
         else if(chanuser->flags & CHANUSERFLAG_VOICED)
             voice_count++;
         else if(chanuser->flags & CHANUSERFLAG_INVISIBLE)
@@ -64,7 +67,10 @@ static void neonserv_cmd_peek_async1(struct ClientSocket *client, struct ClientS
         else
             normal_count++;
     }
-    reply(textclient, user, "NS_PEEK_USERS", op_count+voice_count+invi_count+normal_count, op_count, voice_count, normal_count, invi_count);
+    if(with_halfops)
+        reply(textclient, user, "NS_PEEK_USERS_HALFOP", op_count+halfop_count+voice_count+invi_count+normal_count, op_count, halfop_count, voice_count, normal_count, invi_count);
+    else
+        reply(textclient, user, "NS_PEEK_USERS", op_count+voice_count+invi_count+normal_count, op_count, voice_count, normal_count, invi_count);
     int tmpStrPos = 0;
     int headerlen = 10 + strlen(user->nick);
     for(chanuser = getChannelUsers(chan, NULL); chanuser; chanuser = getChannelUsers(chan, chanuser)) {