X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_silence.cpp;h=9361b9a67f1c032df15fd7853f9c10a1d798ffdc;hb=ccd95e668a3bcbd26c4cd2984cdd8809347f9815;hp=1bea10b70885936bae8000876c2f0d4f3089c9a9;hpb=694e307c09334c21aaf1a6c3f0b7b6d95440dd3e;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp index 1bea10b70..9361b9a67 100644 --- a/src/modules/m_silence.cpp +++ b/src/modules/m_silence.cpp @@ -2,7 +2,7 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * InspIRCd: (C) 2002-2007 InspIRCd Development Team + * InspIRCd: (C) 2002-2008 InspIRCd Development Team * See: http://www.inspircd.org/wiki/index.php/Credits * * This program is free but copyrighted software; see @@ -21,18 +21,18 @@ // have one of these structures associated with their user record. typedef std::map silencelist; -class cmd_silence : public Command +class CommandSilence : public Command { unsigned int& maxsilence; public: - cmd_silence (InspIRCd* Instance, unsigned int &max) : Command(Instance,"SILENCE", 0, 0), maxsilence(max) + CommandSilence (InspIRCd* Instance, unsigned int &max) : Command(Instance,"SILENCE", 0, 0), maxsilence(max) { this->source = "m_silence.so"; syntax = "{[+|-]}"; TRANSLATE2(TR_TEXT, TR_END); } - CmdResult Handle (const char** parameters, int pcnt, userrec *user) + CmdResult Handle (const char* const* parameters, int pcnt, User *user) { if (!pcnt) { @@ -83,7 +83,7 @@ class cmd_silence : public Command { // tidy up -- if a user's list is empty, theres no use having it // hanging around in the user record. - DELETE(sl); + delete sl; user->Shrink("silence_list"); } } @@ -125,7 +125,7 @@ class cmd_silence : public Command class ModuleSilence : public Module { - cmd_silence* mycommand; + CommandSilence* mycommand; unsigned int maxsilence; public: @@ -133,16 +133,14 @@ class ModuleSilence : public Module : Module(Me), maxsilence(32) { OnRehash(NULL, ""); - mycommand = new cmd_silence(ServerInstance, maxsilence); + mycommand = new CommandSilence(ServerInstance, maxsilence); ServerInstance->AddCommand(mycommand); + Implementation eventlist[] = { I_OnRehash, I_OnUserQuit, I_On005Numeric, I_OnUserPreNotice, I_OnUserPreMessage }; + ServerInstance->Modules->Attach(eventlist, this, 5); } - void Implements(char* List) - { - List[I_OnRehash] = List[I_OnUserQuit] = List[I_On005Numeric] = List[I_OnUserPreNotice] = List[I_OnUserPreMessage] = 1; - } - virtual void OnRehash(userrec* user, const std::string ¶meter) + virtual void OnRehash(User* user, const std::string ¶meter) { ConfigReader Conf(ServerInstance); maxsilence = Conf.ReadInteger("silence", "maxentries", 0, true); @@ -150,7 +148,7 @@ class ModuleSilence : public Module maxsilence = 32; } - virtual void OnUserQuit(userrec* user, const std::string &reason, const std::string &oper_message) + virtual void OnUserQuit(User* user, const std::string &reason, const std::string &oper_message) { // when the user quits tidy up any silence list they might have just to keep things tidy // and to prevent a HONKING BIG MEMORY LEAK! @@ -158,7 +156,7 @@ class ModuleSilence : public Module user->GetExt("silence_list", sl); if (sl) { - DELETE(sl); + delete sl; user->Shrink("silence_list"); } } @@ -169,7 +167,7 @@ class ModuleSilence : public Module output = output + " SILENCE=" + ConvToStr(maxsilence); } - virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list) + virtual int OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list) { // im not sure how unreal's silence operates but ours is sensible. It blocks notices and // privmsgs from people on the silence list, directed privately at the user. @@ -177,7 +175,7 @@ class ModuleSilence : public Module // a channel when you've set an ignore on the two most talkative people?) if ((target_type == TYPE_USER) && (IS_LOCAL(user))) { - userrec* u = (userrec*)dest; + User* u = (User*)dest; silencelist* sl; u->GetExt("silence_list", sl); if (sl) @@ -194,7 +192,7 @@ class ModuleSilence : public Module return 0; } - virtual int OnUserPreMessage(userrec* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list) + virtual int OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list) { return OnUserPreNotice(user,dest,target_type,text,status,exempt_list); }