added cmd_staff
[NeonServV5.git] / src / UserNode.c
index 7be5ebdac2115a29ec6eeb6df69af88776680901..e4d73cac70bc8e33817c34f3657053aa61c209bf 100644 (file)
@@ -159,6 +159,20 @@ struct UserNode* getAllUsers(struct UserNode *last) {
         return last->next;
 }
 
+struct UserNode* getUsersWithAuth(const char *auth, struct UserNode *last) {
+    int cindex = (last ? get_nicklist_entry(last->nick[0]) : 0);
+    struct UserNode *cuser = last;
+    while(cindex <= VALID_NICK_CHARS_FIRST_LEN) {
+        for(cuser = (cuser ? cuser->next : userList[cindex]); cuser; cuser = cuser->next) {
+            if((cuser->flags & USERFLAG_ISAUTHED) && !strcmp(cuser->auth, auth))
+                return cuser;
+        }
+        cindex++;
+        cuser = NULL;
+    }
+    return NULL;
+}
+
 int getUserCount() {
     int i, count = 0;
     struct UserNode *user;