X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=src%2FWHOHandler.c;h=61f2ed2afec8f894ad4353eba8eea3e976cb4ad7;hb=727b8a503f88131d92025bc43e3803d4a7c2aa00;hp=b0b8ddc51771f22fa5c349f255f31fd01147c2dc;hpb=65bb4d5c6fcb396b29c93ef65075664e7b4123d7;p=NeonServV5.git diff --git a/src/WHOHandler.c b/src/WHOHandler.c index b0b8ddc..61f2ed2 100644 --- a/src/WHOHandler.c +++ b/src/WHOHandler.c @@ -21,6 +21,7 @@ #include "ChanUser.h" #include "ModeNode.h" #include "ClientSocket.h" +#include "IPNode.h" #define WHOQUEUETYPE_ISONQUEUE 0x01 #define WHOQUEUETYPE_USERLIST 0x02 @@ -107,7 +108,7 @@ void get_userlist(struct ChanNode *chan, userlist_callback_t callback, void *dat entry->data[0] = data; for(i = 1; i < MAXCALLBACKS; i++) entry->data[i] = NULL; - putsock(bot, "WHO %s,%d %%tuhnaf,%d", chan->name, entry->type, entry->type); + putsock(bot, "WHO %s,%d %%tuihnaf,%d", chan->name, entry->type, entry->type); } else callback(bot, chan, data); } @@ -142,7 +143,7 @@ void _get_userlist_with_invisible(struct ChanNode *chan, userlist_callback_t cal entry->data[0] = data; for(i = 1; i < MAXCALLBACKS; i++) entry->data[i] = NULL; - putsock(bot, "WHO %s,%d d%%tuhnaf,%d", chan->name, entry->type, entry->type); + putsock(bot, "WHO %s,%d d%%tuihnaf,%d", chan->name, entry->type, entry->type); } else callback(bot, chan, data); } @@ -170,6 +171,10 @@ void get_userauth(struct UserNode *user, userauth_callback_t callback, void *dat bot = whobot; if(bot == NULL) bot = getBots(SOCKET_FLAG_READY, NULL); //check if we really need to who the user + if(!is_valid_nick(user->nick)) { + callback(bot, user->nick, NULL, data); + return; + } if((user->flags & (USERFLAG_ISAUTHED | USERFLAG_ISIRCOP | USERFLAG_ISBOT | USERFLAG_ISSERVER)) || (time(0) - user->last_who) <= REWHO_TIMEOUT) { callback(bot, user->nick, user, data); return; @@ -205,8 +210,8 @@ void recv_whohandler_354(struct ClientSocket *client, char **argv, unsigned int //parse flags int userflags = 0; int chanuserflags = 0; - for(i = 0; i < strlen(argv[5]); i++) { - switch (argv[5][i]) { + for(i = 0; i < strlen(argv[6]); i++) { + switch (argv[6][i]) { case '@': chanuserflags |= CHANUSERFLAG_OPPED; break; @@ -227,17 +232,17 @@ void recv_whohandler_354(struct ClientSocket *client, char **argv, unsigned int } } - struct UserNode *user = getUserByNick(argv[4]); + struct UserNode *user = getUserByNick(argv[5]); struct ChanUser *chanuser; if((chanuserflags & CHANUSERFLAG_INVISIBLE) && (!user || !isBot(user))) { - user = createTempUser(argv[4]); + user = createTempUser(argv[5]); user->flags |= USERFLAG_ISTMPUSER; chan->flags |= CHANFLAG_HAVE_INVISIBLES; chanuser = addInvisibleChanUser(chan, user); chanuser->flags = (chanuser->flags & ~CHANUSERFLAG_OPPED_OR_VOICED) | chanuserflags; } else { if(user == NULL) { - user = addUser(argv[4]); + user = addUser(argv[5]); } if(!(chanuser = getChanUser(user, chan))) { chanuser = addChanUser(chan, user); @@ -248,13 +253,15 @@ void recv_whohandler_354(struct ClientSocket *client, char **argv, unsigned int user->last_who = time(0); if(!*user->ident) strcpy(user->ident, argv[2]); + if(!user->ip) + user->ip = createIPNode(argv[3]); if(!*user->host) - strcpy(user->host, argv[3]); - if(!(user->flags & USERFLAG_ISAUTHED) && strcmp(argv[6], "0")) { - strcpy(user->auth, argv[6]); + strcpy(user->host, argv[4]); + if(!(user->flags & USERFLAG_ISAUTHED) && strcmp(argv[7], "0")) { + strcpy(user->auth, argv[7]); user->flags |= USERFLAG_ISAUTHED; } - } else if(type & WHOQUEUETYPE_USERAUTH) { + } else if((type & WHOQUEUETYPE_USERAUTH) && !(entry->type & WHOQUEUETYPE_FOUND)) { //:OGN2.OnlineGamesNet.net 354 Skynet 1 pk910 2001:41d0:2:1d3b::babe Skynet pk910 entry->type |= WHOQUEUETYPE_FOUND; entry->user->last_who = time(0);