added cmd_staff
[NeonServV5.git] / src / UserNode.c
index 452d17dd0ae027699415bdb6a45f3eb12c40a2a5..e4d73cac70bc8e33817c34f3657053aa61c209bf 100644 (file)
@@ -1,4 +1,4 @@
-/* UserNode.c - NeonServ v5.1
+/* UserNode.c - NeonServ v5.2
  * Copyright (C) 2011  Philipp Kreil (pk910)
  * 
  * This program is free software: you can redistribute it and/or modify
@@ -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;