X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=src%2FIRCParser.c;h=bcb9f026897a838cc34cc392d903b4bba8820a2a;hb=d5df2d4f914907b38bc20e7c99712eff9b8be69b;hp=bf7755142b7f9f7049a4a77fba4ce41b950dc7dd;hpb=c471de147786a8324172b593b87f2965b67fed8d;p=NeonServV5.git diff --git a/src/IRCParser.c b/src/IRCParser.c index bf77551..bcb9f02 100644 --- a/src/IRCParser.c +++ b/src/IRCParser.c @@ -30,6 +30,7 @@ #include "bots.h" #include "timeq.h" #include "ConfigParser.h" +#include "statistics.h" struct irc_cmd *irc_commands = NULL; //static struct UserNode *registering_users = NULL; @@ -334,6 +335,10 @@ static IRC_CMD(raw_join) { event_registered(user, from); user->flags &= ~USERFLAG_WAS_REGISTERING; + if(user->last_who > REWHO_TIMEOUT) + user->last_who -= REWHO_TIMEOUT; + + event_join(chanuser); } else if(!(chan->flags & CHANFLAG_RECEIVED_USERLIST)) { if(client->user != user) { //bots are allowed to add themselves DESYNCHRONIZE(cache_sync); @@ -404,11 +409,24 @@ static IRC_CMD(raw_part) { decrease_viscount_butone(chan, chanuser); chan->botcount--; } + if(chanuser->flags & CHANUSERFLAG_PARTING) + chanuser->old_visCount--; chanuser->visCount--; if(chanuser->visCount == 0) { delChanUser(chanuser, 0); //not free, yet! event_part(chanuser, 0, (argc > 1 ? argv[1] : NULL)); freeChanUser(chanuser); + } else if(!(chanuser->flags & CHANUSERFLAG_PARTING)) { + chanuser->flags |= CHANUSERFLAG_PARTING; + chanuser->old_visCount = chanuser->visCount; + } else if(chanuser->old_visCount == 0) { + int visCount = chanuser->visCount; + delChanUser(chanuser, 0); //not free, yet! + event_part(chanuser, 0, (argc > 1 ? argv[1] : NULL)); + freeChanUser(chanuser); + chanuser = addChanUser(chan, user); + chanuser->visCount = visCount; + event_join(chanuser); } //check if channel is still present @@ -628,8 +646,7 @@ static IRC_CMD(raw_privmsg) { if(argv[0][0] == '#') { //Channel message struct ChanNode *chan = getChanByName(argv[0]); if(chan && client == get_first_prefered_bot_in_channel(chan)) { - if(statistics_enabled) - statistics_privmsg++; + statistics_privmsg++; if(argv[1][0] == '\001') { char *cmd = &argv[1][1]; char *text = strstr(cmd, " ");