pass NULL to the get_userauth callback if the user doesn't exist
authorpk910 <philipp@zoelle1.de>
Wed, 17 Aug 2011 05:02:31 +0000 (07:02 +0200)
committerpk910 <philipp@zoelle1.de>
Wed, 17 Aug 2011 05:02:31 +0000 (07:02 +0200)
WHOHandler.c
bot_NeonServ.c

index 3e07192ea24025c8c82f35ff12c299b5e8e2a137..f3da915702ead4f66634790982391896eab614d9 100644 (file)
@@ -8,6 +8,8 @@
 #define WHOQUEUETYPE_ISONQUEUE 0x01
 #define WHOQUEUETYPE_USERLIST  0x02
 #define WHOQUEUETYPE_USERAUTH  0x04
+#define WHOQUEUETYPE_CHECKTYPE 0x07
+#define WHOQUEUETYPE_FOUND     0x08
 
 struct WHOQueueEntry {
     char type;
@@ -98,7 +100,7 @@ void recv_whohandler_354(struct ClientSocket *client, char **argv, unsigned int
     int type = atoi(argv[1]);
     if(!(type & WHOQUEUETYPE_ISONQUEUE)) return;
     struct WHOQueueEntry* entry = getNextWHOQueueEntry(client, 0);
-    if(entry == NULL || entry->type != type) return;
+    if(entry == NULL || (entry->type & WHOQUEUETYPE_CHECKTYPE) != (type & WHOQUEUETYPE_CHECKTYPE)) return;
     if(type & WHOQUEUETYPE_USERLIST) {
         if(argc < 7) return;
         //:OGN2.OnlineGamesNet.net 354 skynet 1 pk910 2001:41d0:2:1d3b::babe skynet H@ pk910
@@ -141,6 +143,7 @@ void recv_whohandler_354(struct ClientSocket *client, char **argv, unsigned int
         }
     } else if(type & WHOQUEUETYPE_USERAUTH) {
         //:OGN2.OnlineGamesNet.net 354 Skynet 1 pk910 2001:41d0:2:1d3b::babe Skynet pk910
+        entry->flags |= WHOQUEUETYPE_FOUND;
         if(!strcmp(argv[5], "0") && !(entry->user->flags & USERFLAG_ISAUTHED)) {
             strcpy(entry->user->auth, argv[5]);
             entry->user->flags |= USERFLAG_ISAUTHED;
@@ -156,12 +159,17 @@ void recv_whohandler_315(struct ClientSocket *client, char **argv, unsigned int
     int type = atoi(typestr);
     if(!(type & WHOQUEUETYPE_ISONQUEUE)) return;
     struct WHOQueueEntry* entry = getNextWHOQueueEntry(client, 1);
-    if(entry == NULL || entry->type != type) return;
+    if(entry == NULL || (entry->type & WHOQUEUETYPE_CHECKTYPE) != (type & WHOQUEUETYPE_CHECKTYPE)) return;
     if(type & WHOQUEUETYPE_USERLIST) {
         //:OGN2.OnlineGamesNet.net 315 skynet #pk910,1 :End of /WHO list.
         entry->chan->flags |= CHANFLAG_RECEIVED_USERLIST;
         userlist_callback_t *callback = entry->callback;
         callback(client, entry->chan, entry->data);
+    } else if(type & WHOQUEUETYPE_USERAUTH) {
+        if(!(entry->flags & WHOQUEUETYPE_FOUND)) {
+            userauth_callback_t *callback = entry->callback;
+            callback(client, NULL, entry->data);
+        }
     }
     free(entry);
 }
index 1263b4bab5f5714653d1e8d79f29787dedbd4e01..2b165fa6bc976d902be340992cf869e105a345f6 100644 (file)
@@ -8,6 +8,7 @@
 #include "ClientSocket.h"
 #include "mysqlConn.h"
 #include "lang.h"
+#include "HandleInfoHandle.h"
 
 #define BOTID 1
 #define CLASSNAME "NeonServ"