X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_dccallow.cpp;h=0cea96154d4d8d5e1af49a57314d4e6d48d1c373;hb=b5b17f22e98ce06bc639edede60784bb1988a9e5;hp=8c2a5f73e3e3e68c1167b33960631d39c8c8a83c;hpb=90875afded8d80cc6c61d9f7804c1ba7a74e70a7;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp index 8c2a5f73e..0cea96154 100644 --- a/src/modules/m_dccallow.cpp +++ b/src/modules/m_dccallow.cpp @@ -102,7 +102,7 @@ class CommandDccallow : public Command std::string nick = parameters[0].substr(1); User *target = ServerInstance->FindNickOnly(nick); - if (target) + if ((target) && (!IS_SERVER(target)) && (!target->quitting) && (target->registered == REG_ALL)) { if (action == '-') @@ -257,7 +257,7 @@ class ModuleDCCAllow : public Module ServerInstance->Extensions.Register(ext); ServerInstance->AddCommand(&cmd); ReadFileConf(); - Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice, I_OnUserQuit, I_OnUserPreNick, I_OnRehash }; + Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice, I_OnUserQuit, I_OnUserPostNick, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, 5); } @@ -274,7 +274,9 @@ class ModuleDCCAllow : public Module // remove their DCCALLOW list if they have one if (udl) { - RemoveFromUserlist(user); + userlist::iterator it = std::find(ul.begin(), ul.end(), user); + if (it != ul.end()) + ul.erase(it); } // remove them from any DCCALLOW lists @@ -282,10 +284,9 @@ class ModuleDCCAllow : public Module RemoveNick(user); } - virtual ModResult OnUserPreNick(User* user, const std::string &newnick) + virtual void OnUserPostNick(User* user, const std::string &oldnick) { RemoveNick(user); - return MOD_RES_PASSTHRU; } virtual ModResult OnUserPreMessage(User* user, void* dest, int target_type, std::string &text, char status, CUList &exempt_list) @@ -381,7 +382,7 @@ class ModuleDCCAllow : public Module void Expire() { - for (userlist::iterator iter = ul.begin(); iter != ul.end(); ++iter) + for (userlist::iterator iter = ul.begin(); iter != ul.end();) { User* u = (User*)(*iter); dl = ext->get(u); @@ -403,10 +404,11 @@ class ModuleDCCAllow : public Module } } } + ++iter; } else { - RemoveFromUserlist(u); + iter = ul.erase(iter); } } } @@ -414,7 +416,7 @@ class ModuleDCCAllow : public Module void RemoveNick(User* user) { /* Iterate through all DCCALLOW lists and remove user */ - for (userlist::iterator iter = ul.begin(); iter != ul.end(); ++iter) + for (userlist::iterator iter = ul.begin(); iter != ul.end();) { User *u = (User*)(*iter); dl = ext->get(u); @@ -434,10 +436,11 @@ class ModuleDCCAllow : public Module } } } + ++iter; } else { - RemoveFromUserlist(u); + iter = ul.erase(iter); } } }