From 2d043de488ea65807b51b35a4436bbbf570ca29c Mon Sep 17 00:00:00 2001 From: peavey Date: Tue, 13 Oct 2009 14:16:16 +0000 Subject: removes unnecessary checks in modules, removes a superfluous else statement, fixes some formatting. Patch by dKingston. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11867 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_chghost.cpp | 10 +++------- src/modules/m_chgident.cpp | 9 ++------- src/modules/m_chgname.cpp | 9 ++------- src/modules/m_gecosban.cpp | 6 ++---- src/modules/m_maphide.cpp | 6 +++--- src/modules/m_nopartmsg.cpp | 3 ++- 6 files changed, 14 insertions(+), 29 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp index fdec5d6d0..7901fad7f 100644 --- a/src/modules/m_chghost.cpp +++ b/src/modules/m_chghost.cpp @@ -24,13 +24,14 @@ class CommandChghost : public Command public: CommandChghost(Module* Creator, char* hmap) : Command(Creator,"CHGHOST", 2), hostmap(hmap) { - flags_needed = 'o'; syntax = " "; + flags_needed = 'o'; + syntax = " "; TRANSLATE3(TR_NICK, TR_TEXT, TR_END); } CmdResult Handle(const std::vector ¶meters, User *user) { - const char * x = parameters[1].c_str(); + const char* x = parameters[1].c_str(); for (; *x; x++) { @@ -40,11 +41,6 @@ class CommandChghost : public Command return CMD_FAILURE; } } - if (parameters[1].empty()) - { - user->WriteServ("NOTICE %s :*** CHGHOST: Host must be specified", user->nick.c_str()); - return CMD_FAILURE; - } if ((parameters[1].c_str() - x) > 63) { diff --git a/src/modules/m_chgident.cpp b/src/modules/m_chgident.cpp index 135b26446..f352c1c2b 100644 --- a/src/modules/m_chgident.cpp +++ b/src/modules/m_chgident.cpp @@ -22,7 +22,8 @@ class CommandChgident : public Command public: CommandChgident(Module* Creator) : Command(Creator,"CHGIDENT", 2) { - flags_needed = 'o'; syntax = " "; + flags_needed = 'o'; + syntax = " "; TRANSLATE3(TR_NICK, TR_TEXT, TR_END); } @@ -36,12 +37,6 @@ class CommandChgident : public Command return CMD_FAILURE; } - if (parameters[1].empty()) - { - user->WriteServ("NOTICE %s :*** CHGIDENT: Ident must be specified", user->nick.c_str()); - return CMD_FAILURE; - } - if (parameters[1].length() > ServerInstance->Config->Limits.IdentMax) { user->WriteServ("NOTICE %s :*** CHGIDENT: Ident is too long", user->nick.c_str()); diff --git a/src/modules/m_chgname.cpp b/src/modules/m_chgname.cpp index 17ad9dc48..0fac2bdad 100644 --- a/src/modules/m_chgname.cpp +++ b/src/modules/m_chgname.cpp @@ -22,7 +22,8 @@ class CommandChgname : public Command public: CommandChgname(Module* Creator) : Command(Creator,"CHGNAME", 2, 2) { - flags_needed = 'o'; syntax = " "; + flags_needed = 'o'; + syntax = " "; TRANSLATE3(TR_NICK, TR_TEXT, TR_END); } @@ -36,12 +37,6 @@ class CommandChgname : public Command return CMD_FAILURE; } - if (parameters[1].empty()) - { - user->WriteServ("NOTICE %s :*** GECOS must be specified", user->nick.c_str()); - return CMD_FAILURE; - } - if (parameters[1].length() > ServerInstance->Config->Limits.MaxGecos) { user->WriteServ("NOTICE %s :*** GECOS too long", user->nick.c_str()); diff --git a/src/modules/m_gecosban.cpp b/src/modules/m_gecosban.cpp index 9d1550b38..42830c660 100644 --- a/src/modules/m_gecosban.cpp +++ b/src/modules/m_gecosban.cpp @@ -17,9 +17,9 @@ class ModuleGecosBan : public Module { - private: public: - ModuleGecosBan() { + ModuleGecosBan() + { Implementation eventlist[] = { I_OnCheckBan, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, 2); } @@ -49,6 +49,4 @@ class ModuleGecosBan : public Module } }; - MODULE_INIT(ModuleGecosBan) - diff --git a/src/modules/m_maphide.cpp b/src/modules/m_maphide.cpp index 4c9d0591f..d05200164 100644 --- a/src/modules/m_maphide.cpp +++ b/src/modules/m_maphide.cpp @@ -20,9 +20,9 @@ class ModuleMapHide : public Module std::string url; public: ModuleMapHide() - { - ServerInstance->Modules->Attach(I_OnPreCommand, this); - ServerInstance->Modules->Attach(I_OnRehash, this); + { + Implementation eventlist[] = { I_OnPreCommand, I_OnRehash }; + ServerInstance->Modules->Attach(eventlist, this, 2); OnRehash(NULL); } diff --git a/src/modules/m_nopartmsg.cpp b/src/modules/m_nopartmsg.cpp index 270159147..cdd65417f 100644 --- a/src/modules/m_nopartmsg.cpp +++ b/src/modules/m_nopartmsg.cpp @@ -19,7 +19,8 @@ class ModulePartMsgBan : public Module { private: public: - ModulePartMsgBan() { + ModulePartMsgBan() + { Implementation eventlist[] = { I_OnUserPart, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, 2); } -- cgit v1.2.3