X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_svshold.cpp;h=05a8d09b107c7cee5b622c523b729fc3a353dcf5;hb=551d687ec6d7ce44be35fae0dd7345fe73c4f63a;hp=37288a32299433549be19abf525b44f443ee5491;hpb=b1dedaba2400b7ce7acfa98b9a63fd54ae674a41;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_svshold.cpp b/src/modules/m_svshold.cpp index 37288a322..05a8d09b1 100644 --- a/src/modules/m_svshold.cpp +++ b/src/modules/m_svshold.cpp @@ -38,10 +38,6 @@ public: this->nickname = nick.c_str(); } - ~SVSHold() - { - } - bool Matches(User *u) { if (u->nick == nickname) @@ -56,12 +52,6 @@ public: return false; } - void DisplayExpiry() - { - ServerInstance->SNO->WriteToSnoMask('x',"Removing expired SVSHOLD %s (set by %s %ld seconds ago)", - this->nickname.c_str(), this->source.c_str(), (long int)(ServerInstance->Time() - this->set_time)); - } - const char* Displayable() { return nickname.c_str(); @@ -123,8 +113,10 @@ class CommandSvshold : public Command } else { - // Adding - XXX todo make this respect tag perhaps.. - long duration = ServerInstance->Duration(parameters[1]); + if (parameters.size() < 3) + return CMD_FAILURE; + + unsigned long duration = InspIRCd::Duration(parameters[1]); SVSHold* r = new SVSHold(ServerInstance->Time(), duration, user->nick.c_str(), parameters[2].c_str(), parameters[0].c_str()); if (ServerInstance->XLines->AddLine(r, user)) @@ -136,7 +128,8 @@ class CommandSvshold : public Command else { time_t c_requires_crap = duration + ServerInstance->Time(); - ServerInstance->SNO->WriteGlobalSno('x', "%s added timed SVSHOLD for %s, expires on %s: %s", user->nick.c_str(), parameters[0].c_str(), ServerInstance->TimeString(c_requires_crap).c_str(), parameters[2].c_str()); + std::string timestr = ServerInstance->TimeString(c_requires_crap); + ServerInstance->SNO->WriteGlobalSno('x', "%s added timed SVSHOLD for %s, expires on %s: %s", user->nick.c_str(), parameters[0].c_str(), timestr.c_str(), parameters[2].c_str()); } } else @@ -151,7 +144,7 @@ class CommandSvshold : public Command RouteDescriptor GetRouting(User* user, const std::vector& parameters) { - return ROUTE_LOCALONLY; + return ROUTE_BROADCAST; } }; @@ -163,14 +156,17 @@ class ModuleSVSHold : public Module public: ModuleSVSHold() : cmd(this) + { + } + + void init() { ServerInstance->XLines->RegisterFactory(&s); - ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(cmd); Implementation eventlist[] = { I_OnUserPreNick, I_OnStats }; - ServerInstance->Modules->Attach(eventlist, this, 2); + ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } - virtual ModResult OnStats(char symbol, User* user, string_list &out) { if(symbol != 'S')