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
This commit is contained in:
peavey 2009-10-13 14:16:16 +00:00
parent d1ddbd62f9
commit 2d043de488
7 changed files with 17 additions and 34 deletions

View File

@ -273,12 +273,10 @@ bool InspIRCd::DaemonSeed()
this->Logs->Log("STARTUP",DEFAULT,"Failed to getrlimit()!"); this->Logs->Log("STARTUP",DEFAULT,"Failed to getrlimit()!");
return false; return false;
} }
else rl.rlim_cur = rl.rlim_max;
{
rl.rlim_cur = rl.rlim_max; if (setrlimit(RLIMIT_CORE, &rl) == -1)
if (setrlimit(RLIMIT_CORE, &rl) == -1)
this->Logs->Log("STARTUP",DEFAULT,"setrlimit() failed, cannot increase coredump size."); this->Logs->Log("STARTUP",DEFAULT,"setrlimit() failed, cannot increase coredump size.");
}
return true; return true;
#endif #endif

View File

@ -24,13 +24,14 @@ class CommandChghost : public Command
public: public:
CommandChghost(Module* Creator, char* hmap) : Command(Creator,"CHGHOST", 2), hostmap(hmap) CommandChghost(Module* Creator, char* hmap) : Command(Creator,"CHGHOST", 2), hostmap(hmap)
{ {
flags_needed = 'o'; syntax = "<nick> <newhost>"; flags_needed = 'o';
syntax = "<nick> <newhost>";
TRANSLATE3(TR_NICK, TR_TEXT, TR_END); TRANSLATE3(TR_NICK, TR_TEXT, TR_END);
} }
CmdResult Handle(const std::vector<std::string> &parameters, User *user) CmdResult Handle(const std::vector<std::string> &parameters, User *user)
{ {
const char * x = parameters[1].c_str(); const char* x = parameters[1].c_str();
for (; *x; x++) for (; *x; x++)
{ {
@ -40,11 +41,6 @@ class CommandChghost : public Command
return CMD_FAILURE; 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) if ((parameters[1].c_str() - x) > 63)
{ {

View File

@ -22,7 +22,8 @@ class CommandChgident : public Command
public: public:
CommandChgident(Module* Creator) : Command(Creator,"CHGIDENT", 2) CommandChgident(Module* Creator) : Command(Creator,"CHGIDENT", 2)
{ {
flags_needed = 'o'; syntax = "<nick> <newident>"; flags_needed = 'o';
syntax = "<nick> <newident>";
TRANSLATE3(TR_NICK, TR_TEXT, TR_END); TRANSLATE3(TR_NICK, TR_TEXT, TR_END);
} }
@ -36,12 +37,6 @@ class CommandChgident : public Command
return CMD_FAILURE; 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) if (parameters[1].length() > ServerInstance->Config->Limits.IdentMax)
{ {
user->WriteServ("NOTICE %s :*** CHGIDENT: Ident is too long", user->nick.c_str()); user->WriteServ("NOTICE %s :*** CHGIDENT: Ident is too long", user->nick.c_str());

View File

@ -22,7 +22,8 @@ class CommandChgname : public Command
public: public:
CommandChgname(Module* Creator) : Command(Creator,"CHGNAME", 2, 2) CommandChgname(Module* Creator) : Command(Creator,"CHGNAME", 2, 2)
{ {
flags_needed = 'o'; syntax = "<nick> <newname>"; flags_needed = 'o';
syntax = "<nick> <newname>";
TRANSLATE3(TR_NICK, TR_TEXT, TR_END); TRANSLATE3(TR_NICK, TR_TEXT, TR_END);
} }
@ -36,12 +37,6 @@ class CommandChgname : public Command
return CMD_FAILURE; 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) if (parameters[1].length() > ServerInstance->Config->Limits.MaxGecos)
{ {
user->WriteServ("NOTICE %s :*** GECOS too long", user->nick.c_str()); user->WriteServ("NOTICE %s :*** GECOS too long", user->nick.c_str());

View File

@ -17,9 +17,9 @@
class ModuleGecosBan : public Module class ModuleGecosBan : public Module
{ {
private:
public: public:
ModuleGecosBan() { ModuleGecosBan()
{
Implementation eventlist[] = { I_OnCheckBan, I_On005Numeric }; Implementation eventlist[] = { I_OnCheckBan, I_On005Numeric };
ServerInstance->Modules->Attach(eventlist, this, 2); ServerInstance->Modules->Attach(eventlist, this, 2);
} }
@ -49,6 +49,4 @@ class ModuleGecosBan : public Module
} }
}; };
MODULE_INIT(ModuleGecosBan) MODULE_INIT(ModuleGecosBan)

View File

@ -20,9 +20,9 @@ class ModuleMapHide : public Module
std::string url; std::string url;
public: public:
ModuleMapHide() ModuleMapHide()
{ {
ServerInstance->Modules->Attach(I_OnPreCommand, this); Implementation eventlist[] = { I_OnPreCommand, I_OnRehash };
ServerInstance->Modules->Attach(I_OnRehash, this); ServerInstance->Modules->Attach(eventlist, this, 2);
OnRehash(NULL); OnRehash(NULL);
} }

View File

@ -19,7 +19,8 @@ class ModulePartMsgBan : public Module
{ {
private: private:
public: public:
ModulePartMsgBan() { ModulePartMsgBan()
{
Implementation eventlist[] = { I_OnUserPart, I_On005Numeric }; Implementation eventlist[] = { I_OnUserPart, I_On005Numeric };
ServerInstance->Modules->Attach(eventlist, this, 2); ServerInstance->Modules->Attach(eventlist, this, 2);
} }