added get_userlist function to WHOHandler.c and wrote some test code
[NeonServV5.git] / ClientSocket.c
index 1d5e2f1fb60610548deb73d0a99138f36c56346c..2f80c71bbeee31e9bff8f7dfdd7672a26cf319ae 100644 (file)
@@ -189,3 +189,12 @@ putsock(struct ClientSocket *client, const char *text, ...)
     write_socket(client, sendBuf, pos+1);
 }
 
+struct ClientSocket* getBots(int flags, struct ClientSocket* last_bot) {
+    struct ClientSocket *sock = (last_bot ? last_bot->next : sockets->data);
+    if(sock == NULL) return NULL;
+    for (; sock; sock = sock->next) {
+        if((sock->flags & flags) == flags)
+            return sock;
+    }
+    return NULL;
+}