X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Finspircd.cpp;h=87da59b5736edbc7b11387692932c217cd14df7d;hb=dada179fb63917ced15976da5e83c7c6ddc65f2f;hp=2f64e621d1edba4a79a629f02c2902f4541a85e1;hpb=6216ca471818d39fd92fe17587d4b94173cd8d08;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 2f64e621d..87da59b57 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -144,7 +144,7 @@ userrec* fd_ref_table[65536]; int statsAccept = 0, statsRefused = 0, statsUnknown = 0, statsCollisions = 0, statsDns = 0, statsDnsGood = 0, statsDnsBad = 0, statsConnects = 0, statsSent= 0, statsRecv = 0; - +Server* MyServer = new Server; FILE *log_file; @@ -571,10 +571,13 @@ chanrec* add_channel(userrec *user, const char* cn, const char* key, bool overri if (!FindChan(cname)) { - MOD_RESULT = 0; - FOREACH_RESULT(OnUserPreJoin(user,NULL,cname)); - if (MOD_RESULT == 1) { - return NULL; + if (!strcasecmp(ServerName,user->server)) + { + MOD_RESULT = 0; + FOREACH_RESULT(OnUserPreJoin(user,NULL,cname)); + if (MOD_RESULT == 1) { + return NULL; + } } /* create a new one */ @@ -604,9 +607,9 @@ chanrec* add_channel(userrec *user, const char* cn, const char* key, bool overri { log(DEBUG,"add_channel: joining to: %s",Ptr->name); - // the override flag allows us to bypass channel modes + // remote users are allowed us to bypass channel modes // and bans (used by servers) - if ((!override) || (!strcasecmp(user->server,ServerName))) + if (!strcasecmp(ServerName,user->server)) { log(DEBUG,"Not overriding..."); MOD_RESULT = 0; @@ -856,12 +859,12 @@ void kick_channel(userrec *src,userrec *user, chanrec *Ptr, char* reason) int MOD_RESULT = 0; FOREACH_RESULT(OnAccessCheck(src,user,Ptr,AC_KICK)); - if (MOD_RESULT == ACR_DENY) + if ((MOD_RESULT == ACR_DENY) && (!is_uline(src->server))) return; - if (MOD_RESULT == ACR_DEFAULT) + if ((MOD_RESULT == ACR_DEFAULT) || (!is_uline(src->server))) { - if (((cstatus(src,Ptr) < STATUS_HOP) || (cstatus(src,Ptr) < cstatus(user,Ptr))) && (!is_uline(src->server))) + if ((cstatus(src,Ptr) < STATUS_HOP) || (cstatus(src,Ptr) < cstatus(user,Ptr))) { if (cstatus(src,Ptr) == STATUS_HOP) { @@ -876,10 +879,13 @@ void kick_channel(userrec *src,userrec *user, chanrec *Ptr, char* reason) } } - MOD_RESULT = 0; - FOREACH_RESULT(OnUserPreKick(src,user,Ptr,reason)); - if (MOD_RESULT) - return; + if (!is_uline(src->server)) + { + MOD_RESULT = 0; + FOREACH_RESULT(OnUserPreKick(src,user,Ptr,reason)); + if (MOD_RESULT) + return; + } FOREACH_MOD OnUserKick(src,user,Ptr,reason); @@ -1551,8 +1557,6 @@ void FullConnectUser(userrec* user) } } - // fix by brain: move this below the xline checks to prevent spurious quits going onto the net that dont belong - user->registered = 7; WriteServ(user->fd,"NOTICE Auth :Welcome to \002%s\002!",Network); WriteServ(user->fd,"001 %s :Welcome to the %s IRC Network %s!%s@%s",user->nick,Network,user->nick,user->ident,user->host); @@ -1587,9 +1591,11 @@ void FullConnectUser(userrec* user) } ShowMOTD(user); - // fix by brain: these should be AFTER the N token, so other servers know what the HELL we're on about... :) + // fix 3 by brain, move registered = 7 below these so that spurious modes and host changes dont go out + // onto the network and produce 'fake direction' FOREACH_MOD OnUserConnect(user); FOREACH_MOD OnGlobalConnect(user); + user->registered = 7; WriteOpers("*** Client connecting on port %lu: %s!%s@%s [%s]",(unsigned long)user->port,user->nick,user->ident,user->host,user->ip); } @@ -2178,6 +2184,15 @@ bool UnloadModule(const char* filename) snprintf(MODERR,MAXBUF,"Module not unloadable (marked static)"); return false; } + /* Give the module a chance to tidy out all its metadata */ + for (chan_hash::iterator c = chanlist.begin(); c != chanlist.end(); c++) + { + modules[j]->OnCleanup(TYPE_CHANNEL,c->second); + } + for (user_hash::iterator u = clientlist.begin(); u != clientlist.end(); u++) + { + modules[j]->OnCleanup(TYPE_USER,u->second); + } FOREACH_MOD OnUnloadModule(modules[j],module_names[j]); // found the module log(DEBUG,"Deleting module..."); @@ -2238,7 +2253,7 @@ bool LoadModule(const char* filename) } if (factory[MODCOUNT+1]->factory) { - Module* m = factory[MODCOUNT+1]->factory->CreateModule(); + Module* m = factory[MODCOUNT+1]->factory->CreateModule(MyServer); modules[MODCOUNT+1] = m; /* save the module and the module's classfactory, if * this isnt done, random crashes can occur :/ */