X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_shun.cpp;h=cbaa6840991d3dda1163352cf94de001b0987c7b;hb=551d687ec6d7ce44be35fae0dd7345fe73c4f63a;hp=096d2f9eee97799e15ead02d952a043c68573ba8;hpb=a4db7bf9af00b32d4f5c1922997d02b0b8be59e5;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp index 096d2f9ee..cbaa68409 100644 --- a/src/modules/m_shun.cpp +++ b/src/modules/m_shun.cpp @@ -36,14 +36,11 @@ public: this->matchtext = shunmask; } - ~Shun() - { - } - bool Matches(User *u) { // E: overrides shun - if (u->exempt) + LocalUser* lu = IS_LOCAL(u); + if (lu && lu->exempt) return false; if (InspIRCd::Match(u->GetFullHost(), matchtext) || InspIRCd::Match(u->GetFullRealHost(), matchtext) || InspIRCd::Match(u->nick+"!"+u->ident+"@"+u->GetIPString(), matchtext)) @@ -59,12 +56,6 @@ public: return false; } - void DisplayExpiry() - { - ServerInstance->SNO->WriteToSnoMask('x',"Removing expired shun %s (set by %s %ld seconds ago)", - this->matchtext.c_str(), this->source.c_str(), (long int)(ServerInstance->Time() - this->set_time)); - } - const char* Displayable() { return matchtext.c_str(); @@ -107,9 +98,9 @@ class CommandShun : public Command /* 'time' is a human-readable timestring, like 2d3h2s. */ std::string target = parameters[0]; - - User *find = ServerInstance->FindNick(target.c_str()); - if (find) + + User *find = ServerInstance->FindNick(target); + if ((find) && (find->registered == REG_ALL)) target = std::string("*!*@") + find->GetIPString(); if (parameters.size() == 1) @@ -127,11 +118,11 @@ class CommandShun : public Command else { // Adding - XXX todo make this respect tag perhaps.. - long duration; + unsigned long duration; std::string expr; if (parameters.size() > 2) { - duration = ServerInstance->Duration(parameters[1]); + duration = InspIRCd::Duration(parameters[1]); expr = parameters[2]; } else @@ -168,6 +159,9 @@ class CommandShun : public Command RouteDescriptor GetRouting(User* user, const std::vector& parameters) { + if (IS_LOCAL(user)) + return ROUTE_LOCALONLY; // spanningtree will send ADDLINE + return ROUTE_BROADCAST; } }; @@ -182,12 +176,16 @@ class ModuleShun : public Module public: ModuleShun() : cmd(this) + { + } + + void init() { ServerInstance->XLines->RegisterFactory(&f); - ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(cmd); Implementation eventlist[] = { I_OnStats, I_OnPreCommand, I_OnRehash }; - ServerInstance->Modules->Attach(eventlist, this, 3); + ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); OnRehash(NULL); } @@ -246,7 +244,7 @@ class ModuleShun : public Module return MOD_RES_PASSTHRU; } - if (!affectopers && IS_OPER(user)) + if (!affectopers && user->IsOper()) { /* Don't do anything if the user is an operator and affectopers isn't set */ return MOD_RES_PASSTHRU; @@ -283,4 +281,3 @@ class ModuleShun : public Module }; MODULE_INIT(ModuleShun) -