mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-10 02:59:01 -04:00
Conversion of command handler params from "const char* const* parameters, int pcnt" to "const std::vector<std::string>& parameters". All of core is converted, but cant test it till the modules are converted.
IMPORTANT: The mode parser public calls have had to be tweaked a bit to also use the string vector. Note that this makes a LOT of our core a bit messy and paves the way to convert a lot of stuff from the mess of .c_str() calls to using std::string params directly. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9608 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
parent
1c0efd2f56
commit
ffbd1eebf0
@ -39,7 +39,7 @@ class CoreExport CommandParser : public classbase
|
||||
* @param parameters The input string
|
||||
* @return The number of parameters parsed into command_p
|
||||
*/
|
||||
int ProcessParameters(char **command_p,char *parameters);
|
||||
int ProcessParameters(std::vector<std::string>& command_p, char* parameters);
|
||||
|
||||
/** Process a command from a user.
|
||||
* @param user The user to parse the command for
|
||||
@ -84,7 +84,7 @@ class CoreExport CommandParser : public classbase
|
||||
* @return True if the command was reloaded, false if it could not be found
|
||||
* or another error occured
|
||||
*/
|
||||
bool ReloadCommand(const char* cmd, User* user);
|
||||
bool ReloadCommand(std::string cmd, User* user);
|
||||
|
||||
/** Default constructor.
|
||||
* @param Instance The creator of this class
|
||||
@ -102,7 +102,7 @@ class CoreExport CommandParser : public classbase
|
||||
* command simply did not exist at all or the wrong number of parameters were given, or the user
|
||||
* was not privilaged enough to execute the command.
|
||||
*/
|
||||
CmdResult CallHandler(const std::string &commandname,const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult CallHandler(const std::string &commandname, const std::vector<std::string>& parameters, User *user);
|
||||
|
||||
/** Get the handler function for a command.
|
||||
* @param commandname The command required. Always use uppercase for this parameter.
|
||||
@ -118,7 +118,7 @@ class CoreExport CommandParser : public classbase
|
||||
* equal to or greater than the minimum number of parameters to the given command, then this
|
||||
* function will return true, otherwise it will return false.
|
||||
*/
|
||||
bool IsValidCommand(const std::string &commandname, int pcnt, User * user);
|
||||
bool IsValidCommand(const std::string &commandname, unsigned int pcnt, User * user);
|
||||
|
||||
/** LoopCall is used to call a command classes handler repeatedly based on the contents of a comma seperated list.
|
||||
* There are two overriden versions of this method, one of which takes two potential lists and the other takes one.
|
||||
@ -141,7 +141,7 @@ class CoreExport CommandParser : public classbase
|
||||
* @return This function will return 1 when there are no more parameters to process. When this occurs, its
|
||||
* caller should return without doing anything, otherwise it should continue into its main section of code.
|
||||
*/
|
||||
int LoopCall(User* user, Command* CommandObj, const char* const* parameters, int pcnt, unsigned int splithere, unsigned int extra);
|
||||
int LoopCall(User* user, Command* CommandObj, const std::vector<std::string>& parameters, unsigned int splithere, unsigned int extra);
|
||||
|
||||
/** LoopCall is used to call a command classes handler repeatedly based on the contents of a comma seperated list.
|
||||
* There are two overriden versions of this method, one of which takes two potential lists and the other takes one.
|
||||
@ -164,7 +164,7 @@ class CoreExport CommandParser : public classbase
|
||||
* @return This function will return 1 when there are no more parameters to process. When this occurs, its
|
||||
* caller should return without doing anything, otherwise it should continue into its main section of code.
|
||||
*/
|
||||
int LoopCall(User* user, Command* CommandObj, const char* const* parameters, int pcnt, unsigned int splithere);
|
||||
int LoopCall(User* user, Command* CommandObj, const std::vector<std::string>& parameters, unsigned int splithere);
|
||||
|
||||
/** Take a raw input buffer from a recvq, and process it on behalf of a user.
|
||||
* @param buffer The buffer line to process
|
||||
@ -219,7 +219,7 @@ class cmd_reload : public Command
|
||||
cmd_reload (InspIRCd* Instance) : Command(Instance,"RELOAD","o",1) { syntax = "<core-command>"; }
|
||||
/** Handle RELOAD
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
/** A lookup table of values for multiplier characters used by
|
||||
|
@ -34,7 +34,7 @@ class CommandAdmin : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ class CommandAway : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -35,7 +35,7 @@ class CommandClearcache : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ class CommandCommands : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ class CommandConnect : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ class CommandDie : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ class CommandEline : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ class CommandGline : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ class CommandInfo : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ class CommandInvite : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ class CommandIson : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ class CommandJoin : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ class CommandKick : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ class CommandKill : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ class CommandKline : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ class CommandLinks : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ class CommandList : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ class CommandLoadmodule : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ class CommandLusers : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ class CommandMap : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -35,7 +35,7 @@ class CommandMode : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ class CommandModules : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -39,7 +39,7 @@ class CommandMotd : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ class CommandNames : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -37,7 +37,7 @@ class CommandNick : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
|
||||
/** Handle internal command
|
||||
* @param id Used to indicate if invalid nick changes are allowed.
|
||||
|
@ -36,7 +36,7 @@ class CommandNotice : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -38,7 +38,7 @@ class CommandOper : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ class CommandPart : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -39,7 +39,7 @@ class CommandPass : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ class CommandPing : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -37,7 +37,7 @@ class CommandPong : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ class CommandPrivmsg : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ class CommandQline : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ class CommandQuit : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ class CommandRehash : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ class CommandReloadmodule : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -39,7 +39,7 @@ class CommandRestart : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -39,7 +39,7 @@ class CommandRules : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ class CommandServer : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -39,7 +39,7 @@ class CommandSquit : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -39,7 +39,7 @@ class CommandStats : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ class CommandTime : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ class CommandTopic : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ class CommandTrace : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ class CommandUnloadmodule : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ class CommandUser : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ class CommandUserhost : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ class CommandVersion : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ class CommandWallops : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -49,7 +49,7 @@ class CommandWho : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
bool whomatch(User* user, const char* matchtext);
|
||||
};
|
||||
|
||||
|
@ -39,7 +39,7 @@ class CommandWhois : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -79,7 +79,7 @@ class CommandWhowas : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
/** Handle an internal request from another command, the core, or a module
|
||||
* @param Command ID
|
||||
* @param Zero or more parameters, whos form is specified by the command ID.
|
||||
|
@ -36,7 +36,7 @@ class CommandZline : public Command
|
||||
* @param user The user issuing the command
|
||||
* @return A value from CmdResult to indicate command success or failure.
|
||||
*/
|
||||
CmdResult Handle(const char* const* parameters, int pcnt, User *user);
|
||||
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -59,7 +59,7 @@ class CoreExport Command : public Extensible
|
||||
char flags_needed;
|
||||
/** Minimum number of parameters command takes
|
||||
*/
|
||||
int min_params;
|
||||
unsigned int min_params;
|
||||
/** used by /stats m
|
||||
*/
|
||||
long double use_count;
|
||||
@ -113,7 +113,7 @@ class CoreExport Command : public Extensible
|
||||
* If the command succeeds but should remain local to this server,
|
||||
* return CMD_LOCALONLY.
|
||||
*/
|
||||
virtual CmdResult Handle(const char* const* parameters, int pcnt, User* user) = 0;
|
||||
virtual CmdResult Handle(const std::vector<std::string>& parameters, User* user) = 0;
|
||||
|
||||
/** Handle an internal request from another command, the core, or a module
|
||||
* @param Command ID
|
||||
|
@ -679,7 +679,7 @@ class CoreExport InspIRCd : public classbase
|
||||
* @param pcnt The number of items you have given in the first parameter
|
||||
* @param user The user to send error messages to
|
||||
*/
|
||||
void SendMode(const char* const* parameters, int pcnt, User *user);
|
||||
void SendMode(const std::vector<std::string>& parameters, User *user);
|
||||
|
||||
/** Match two strings using pattern matching.
|
||||
* This operates identically to the global function match(),
|
||||
@ -697,7 +697,7 @@ class CoreExport InspIRCd : public classbase
|
||||
* @param user The user to execute the command as
|
||||
* @return True if the command handler was called successfully
|
||||
*/
|
||||
CmdResult CallCommandHandler(const std::string &commandname, const char* const* parameters, int pcnt, User* user);
|
||||
CmdResult CallCommandHandler(const std::string &commandname, const std::vector<std::string>& parameters, User* user);
|
||||
|
||||
/** Return true if the command is a module-implemented command and the given parameters are valid for it
|
||||
* @param parameters The mode parameters
|
||||
|
@ -502,7 +502,7 @@ class CoreExport ModeParser : public classbase
|
||||
* and *user->server == NULL.
|
||||
* @param servermode True if a server is setting the mode.
|
||||
*/
|
||||
void Process(const char* const* parameters, int pcnt, User *user, bool servermode);
|
||||
void Process(const std::vector<std::string>& parameters, User *user, bool servermode);
|
||||
|
||||
/** Find the mode handler for a given mode and type.
|
||||
* @param modeletter mode letter to search for
|
||||
|
@ -1037,7 +1037,7 @@ class CoreExport Module : public Extensible
|
||||
* @param original_line The entire original line as passed to the parser from the user
|
||||
* @return 1 to block the command, 0 to allow
|
||||
*/
|
||||
virtual int OnPreCommand(const std::string &command, const char* const* parameters, int pcnt, User *user, bool validated, const std::string &original_line);
|
||||
virtual int OnPreCommand(const std::string &command, const std::vector<std::string>& parameters, User *user, bool validated, const std::string &original_line);
|
||||
|
||||
/** Called after any command has been executed.
|
||||
* This event occurs for all registered commands, wether they are registered in the core,
|
||||
@ -1051,7 +1051,7 @@ class CoreExport Module : public Extensible
|
||||
* @param result The return code given by the command handler, one of CMD_SUCCESS or CMD_FAILURE
|
||||
* @param original_line The entire original line as passed to the parser from the user
|
||||
*/
|
||||
virtual void OnPostCommand(const std::string &command, const char* const* parameters, int pcnt, User *user, CmdResult result, const std::string &original_line);
|
||||
virtual void OnPostCommand(const std::string &command, const std::vector<std::string>& parameters, User *user, CmdResult result, const std::string &original_line);
|
||||
|
||||
/** Called to check if a user who is connecting can now be allowed to register
|
||||
* If any modules return false for this function, the user is held in the waiting
|
||||
|
@ -48,12 +48,12 @@ int InspIRCd::PassCompare(Extensible* ex, const char* data,const char* input, co
|
||||
* The second version is much simpler and just has the one stream to read, and is used in NAMES, WHOIS, PRIVMSG etc.
|
||||
* Both will only parse until they reach ServerInstance->Config->MaxTargets number of targets, to stop abuse via spam.
|
||||
*/
|
||||
int CommandParser::LoopCall(User* user, Command* CommandObj, const char* const* parameters, int pcnt, unsigned int splithere, unsigned int extra)
|
||||
int CommandParser::LoopCall(User* user, Command* CommandObj, const std::vector<std::string>& parameters, unsigned int splithere, unsigned int extra)
|
||||
{
|
||||
/* First check if we have more than one item in the list, if we don't we return zero here and the handler
|
||||
* which called us just carries on as it was.
|
||||
*/
|
||||
if (!strchr(parameters[splithere],','))
|
||||
if (parameters[splithere].find(',') == std::string::npos)
|
||||
return 0;
|
||||
|
||||
/** Some lame ircds will weed out dupes using some shitty O(n^2) algorithm.
|
||||
@ -78,10 +78,10 @@ int CommandParser::LoopCall(User* user, Command* CommandObj, const char* const*
|
||||
{
|
||||
if (dupes.find(item.c_str()) == dupes.end())
|
||||
{
|
||||
const char* new_parameters[MAXPARAMETERS];
|
||||
std::vector<std::string> new_parameters;
|
||||
|
||||
for (int t = 0; (t < pcnt) && (t < MAXPARAMETERS); t++)
|
||||
new_parameters[t] = parameters[t];
|
||||
for (unsigned int t = 0; (t < parameters.size()) && (t < MAXPARAMETERS); t++)
|
||||
new_parameters.push_back(parameters[t]);
|
||||
|
||||
if (!items2.GetToken(extrastuff))
|
||||
extrastuff = "";
|
||||
@ -89,7 +89,7 @@ int CommandParser::LoopCall(User* user, Command* CommandObj, const char* const*
|
||||
new_parameters[splithere] = item.c_str();
|
||||
new_parameters[extra] = extrastuff.c_str();
|
||||
|
||||
CommandObj->Handle(new_parameters,pcnt,user);
|
||||
CommandObj->Handle(new_parameters, user);
|
||||
|
||||
dupes[item.c_str()] = true;
|
||||
}
|
||||
@ -97,12 +97,12 @@ int CommandParser::LoopCall(User* user, Command* CommandObj, const char* const*
|
||||
return 1;
|
||||
}
|
||||
|
||||
int CommandParser::LoopCall(User* user, Command* CommandObj, const char* const* parameters, int pcnt, unsigned int splithere)
|
||||
int CommandParser::LoopCall(User* user, Command* CommandObj, const std::vector<std::string>& parameters, unsigned int splithere)
|
||||
{
|
||||
/* First check if we have more than one item in the list, if we don't we return zero here and the handler
|
||||
* which called us just carries on as it was.
|
||||
*/
|
||||
if (!strchr(parameters[splithere],','))
|
||||
if (parameters[splithere].find(',') == std::string::npos)
|
||||
return 0;
|
||||
|
||||
std::map<irc::string, bool> dupes;
|
||||
@ -120,10 +120,10 @@ int CommandParser::LoopCall(User* user, Command* CommandObj, const char* const*
|
||||
{
|
||||
if (dupes.find(item.c_str()) == dupes.end())
|
||||
{
|
||||
const char* new_parameters[MAXPARAMETERS];
|
||||
std::vector<std::string> new_parameters;
|
||||
|
||||
for (int t = 0; (t < pcnt) && (t < MAXPARAMETERS); t++)
|
||||
new_parameters[t] = parameters[t];
|
||||
for (unsigned int t = 0; (t < parameters.size()) && (t < MAXPARAMETERS); t++)
|
||||
new_parameters.push_back(parameters[t]);
|
||||
|
||||
new_parameters[splithere] = item.c_str();
|
||||
|
||||
@ -131,7 +131,7 @@ int CommandParser::LoopCall(User* user, Command* CommandObj, const char* const*
|
||||
* record out from under us (e.g. if we /kill a comma sep list, and we're
|
||||
* in that list ourselves) abort if we're gone.
|
||||
*/
|
||||
CommandObj->Handle(new_parameters,pcnt,user);
|
||||
CommandObj->Handle(new_parameters, user);
|
||||
|
||||
dupes[item.c_str()] = true;
|
||||
}
|
||||
@ -143,13 +143,13 @@ int CommandParser::LoopCall(User* user, Command* CommandObj, const char* const*
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool CommandParser::IsValidCommand(const std::string &commandname, int pcnt, User * user)
|
||||
bool CommandParser::IsValidCommand(const std::string &commandname, unsigned int pcnt, User * user)
|
||||
{
|
||||
Commandable::iterator n = cmdlist.find(commandname);
|
||||
|
||||
if (n != cmdlist.end())
|
||||
{
|
||||
if ((pcnt>=n->second->min_params) && (n->second->source != "<core>"))
|
||||
if ((pcnt >= n->second->min_params) && (n->second->source != "<core>"))
|
||||
{
|
||||
if (IS_LOCAL(user) && n->second->flags_needed)
|
||||
{
|
||||
@ -178,13 +178,13 @@ Command* CommandParser::GetHandler(const std::string &commandname)
|
||||
|
||||
// calls a handler function for a command
|
||||
|
||||
CmdResult CommandParser::CallHandler(const std::string &commandname,const char* const* parameters, int pcnt, User *user)
|
||||
CmdResult CommandParser::CallHandler(const std::string &commandname, const std::vector<std::string>& parameters, User *user)
|
||||
{
|
||||
Commandable::iterator n = cmdlist.find(commandname);
|
||||
|
||||
if (n != cmdlist.end())
|
||||
{
|
||||
if (pcnt >= n->second->min_params)
|
||||
if (parameters.size() >= n->second->min_params)
|
||||
{
|
||||
bool bOkay = false;
|
||||
|
||||
@ -207,7 +207,7 @@ CmdResult CommandParser::CallHandler(const std::string &commandname,const char*
|
||||
|
||||
if (bOkay)
|
||||
{
|
||||
return n->second->Handle(parameters,pcnt,user);
|
||||
return n->second->Handle(parameters,user);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -257,10 +257,9 @@ void CommandParser::DoLines(User* current, bool one_only)
|
||||
|
||||
bool CommandParser::ProcessCommand(User *user, std::string &cmd)
|
||||
{
|
||||
const char *command_p[MAXPARAMETERS];
|
||||
int items = 0;
|
||||
std::vector<std::string> command_p;
|
||||
irc::tokenstream tokens(cmd);
|
||||
std::string command;
|
||||
std::string command, token;
|
||||
tokens.GetToken(command);
|
||||
|
||||
/* A client sent a nick prefix on their command (ick)
|
||||
@ -271,16 +270,13 @@ bool CommandParser::ProcessCommand(User *user, std::string &cmd)
|
||||
if (*command.c_str() == ':')
|
||||
tokens.GetToken(command);
|
||||
|
||||
while (tokens.GetToken(para[items]) && (items < MAXPARAMETERS))
|
||||
{
|
||||
command_p[items] = para[items].c_str();
|
||||
items++;
|
||||
}
|
||||
while (tokens.GetToken(token) && (command_p.size() < MAXPARAMETERS))
|
||||
command_p.push_back(token);
|
||||
|
||||
std::transform(command.begin(), command.end(), command.begin(), ::toupper);
|
||||
|
||||
int MOD_RESULT = 0;
|
||||
FOREACH_RESULT(I_OnPreCommand,OnPreCommand(command,command_p,items,user,false,cmd));
|
||||
FOREACH_RESULT(I_OnPreCommand,OnPreCommand(command, command_p, user, false, cmd));
|
||||
if (MOD_RESULT == 1) {
|
||||
return true;
|
||||
}
|
||||
@ -333,7 +329,7 @@ bool CommandParser::ProcessCommand(User *user, std::string &cmd)
|
||||
command.c_str(), user->nick, user->ident, user->host);
|
||||
return do_more;
|
||||
}
|
||||
if (items < cm->second->min_params)
|
||||
if (command_p.size() < cm->second->min_params)
|
||||
{
|
||||
user->WriteNumeric(461, "%s %s :Not enough parameters.", user->nick, command.c_str());
|
||||
if ((ServerInstance->Config->SyntaxHints) && (user->registered == REG_ALL) && (cm->second->syntax.length()))
|
||||
@ -353,16 +349,16 @@ bool CommandParser::ProcessCommand(User *user, std::string &cmd)
|
||||
|
||||
/* module calls too */
|
||||
MOD_RESULT = 0;
|
||||
FOREACH_RESULT(I_OnPreCommand,OnPreCommand(command,command_p,items,user,true,cmd));
|
||||
FOREACH_RESULT(I_OnPreCommand,OnPreCommand(command, command_p, user, true, cmd));
|
||||
if (MOD_RESULT == 1)
|
||||
return do_more;
|
||||
|
||||
/*
|
||||
* WARNING: be careful, the user may be deleted soon
|
||||
*/
|
||||
CmdResult result = cm->second->Handle(command_p,items,user);
|
||||
CmdResult result = cm->second->Handle(command_p, user);
|
||||
|
||||
FOREACH_MOD(I_OnPostCommand,OnPostCommand(command, command_p, items, user, result,cmd));
|
||||
FOREACH_MOD(I_OnPostCommand,OnPostCommand(command, command_p, user, result,cmd));
|
||||
return do_more;
|
||||
}
|
||||
}
|
||||
@ -448,38 +444,29 @@ bool CommandParser::FindSym(void** v, void* h, const std::string &name)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CommandParser::ReloadCommand(const char* cmd, User* user)
|
||||
bool CommandParser::ReloadCommand(std::string cmd, User* user)
|
||||
{
|
||||
char filename[MAXBUF];
|
||||
char commandname[MAXBUF];
|
||||
int y = 0;
|
||||
std::transform(cmd.begin(), cmd.end(), cmd.begin(), ::toupper);
|
||||
|
||||
for (const char* x = cmd; *x; x++, y++)
|
||||
commandname[y] = toupper(*x);
|
||||
|
||||
commandname[y] = 0;
|
||||
|
||||
SharedObjectList::iterator command = RFCCommands.find(commandname);
|
||||
SharedObjectList::iterator command = RFCCommands.find(cmd);
|
||||
|
||||
if (command != RFCCommands.end())
|
||||
{
|
||||
Command* cmdptr = cmdlist.find(commandname)->second;
|
||||
cmdlist.erase(cmdlist.find(commandname));
|
||||
|
||||
for (char* x = commandname; *x; x++)
|
||||
*x = tolower(*x);
|
||||
|
||||
Command* cmdptr = cmdlist.find(cmd)->second;
|
||||
cmdlist.erase(cmdlist.find(cmd));
|
||||
|
||||
RFCCommands.erase(cmd);
|
||||
std::transform(cmd.begin(), cmd.end(), cmd.begin(), ::tolower);
|
||||
delete cmdptr;
|
||||
dlclose(command->second);
|
||||
RFCCommands.erase(command);
|
||||
|
||||
snprintf(filename, MAXBUF, "cmd_%s.so", commandname);
|
||||
snprintf(filename, MAXBUF, "cmd_%s.so", cmd.c_str());
|
||||
const char* err = this->LoadCommand(filename);
|
||||
if (err)
|
||||
{
|
||||
if (user)
|
||||
user->WriteServ("NOTICE %s :*** Error loading 'cmd_%s.so': %s", user->nick, cmd, err);
|
||||
user->WriteServ("NOTICE %s :*** Error loading 'cmd_%s.so': %s", user->nick, cmd.c_str(), err);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -489,18 +476,21 @@ bool CommandParser::ReloadCommand(const char* cmd, User* user)
|
||||
return false;
|
||||
}
|
||||
|
||||
CmdResult cmd_reload::Handle(const char* const* parameters, int /* pcnt */, User *user)
|
||||
CmdResult cmd_reload::Handle(const std::vector<std::string>& parameters, User *user)
|
||||
{
|
||||
user->WriteServ("NOTICE %s :*** Reloading command '%s'",user->nick, parameters[0]);
|
||||
if (parameters.size() < 1)
|
||||
return CMD_FAILURE;
|
||||
|
||||
user->WriteServ("NOTICE %s :*** Reloading command '%s'",user->nick, parameters[0].c_str());
|
||||
if (ServerInstance->Parser->ReloadCommand(parameters[0], user))
|
||||
{
|
||||
user->WriteServ("NOTICE %s :*** Successfully reloaded command '%s'", user->nick, parameters[0]);
|
||||
ServerInstance->SNO->WriteToSnoMask('A', "RELOAD: %s reloaded the '%s' command.", user->nick, parameters[0]);
|
||||
user->WriteServ("NOTICE %s :*** Successfully reloaded command '%s'", user->nick, parameters[0].c_str());
|
||||
ServerInstance->SNO->WriteToSnoMask('A', "RELOAD: %s reloaded the '%s' command.", user->nick, parameters[0].c_str());
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
user->WriteServ("NOTICE %s :*** Could not reload command '%s' -- fix this problem, then /REHASH as soon as possible!", user->nick, parameters[0]);
|
||||
user->WriteServ("NOTICE %s :*** Could not reload command '%s' -- fix this problem, then /REHASH as soon as possible!", user->nick, parameters[0].c_str());
|
||||
return CMD_FAILURE;
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
|
||||
|
||||
/** Handle /ADMIN
|
||||
*/
|
||||
CmdResult CommandAdmin::Handle (const char* const* parameters, int pcnt, User *user)
|
||||
CmdResult CommandAdmin::Handle (const std::vector<std::string>& parameters, User *user)
|
||||
{
|
||||
user->WriteNumeric(256, "%s :Administrative info for %s",user->nick,ServerInstance->Config->ServerName);
|
||||
if (*ServerInstance->Config->AdminName)
|
||||
|
@ -21,11 +21,11 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
|
||||
|
||||
/** Handle /AWAY
|
||||
*/
|
||||
CmdResult CommandAway::Handle (const char* const* parameters, int pcnt, User *user)
|
||||
CmdResult CommandAway::Handle (const std::vector<std::string>& parameters, User *user)
|
||||
{
|
||||
int MOD_RESULT = 0;
|
||||
|
||||
if ((pcnt) && (*parameters[0]))
|
||||
if ((parameters.size()) && (!parameters[0].empty()))
|
||||
{
|
||||
FOREACH_RESULT(I_OnSetAway, OnSetAway(user, parameters[0]));
|
||||
|
||||
@ -33,7 +33,8 @@ CmdResult CommandAway::Handle (const char* const* parameters, int pcnt, User *us
|
||||
return CMD_FAILURE;
|
||||
|
||||
user->awaytime = ServerInstance->Time();
|
||||
strlcpy(user->awaymsg,parameters[0],MAXAWAY);
|
||||
strlcpy(user->awaymsg, parameters[0].c_str(), MAXAWAY);
|
||||
|
||||
user->WriteNumeric(306, "%s :You have been marked as being away",user->nick);
|
||||
}
|
||||
else
|
||||
|
@ -21,7 +21,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
|
||||
|
||||
/** Handle /CLEARCACHE
|
||||
*/
|
||||
CmdResult CommandClearcache::Handle (const char* const* parameters, int pcnt, User *user)
|
||||
CmdResult CommandClearcache::Handle (const std::vector<std::string>& parameters, User *user)
|
||||
{
|
||||
int n = ServerInstance->Res->ClearCache();
|
||||
user->WriteServ("NOTICE %s :*** Cleared DNS cache of %d items.", user->nick, n);
|
||||
|
@ -21,7 +21,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
|
||||
return new CommandCommands(Instance);
|
||||
}
|
||||
|
||||
CmdResult CommandCommands::Handle (const char* const*, int, User *user)
|
||||
CmdResult CommandCommands::Handle (const std::vector<std::string>&, User *user)
|
||||
{
|
||||
for (Commandable::iterator i = ServerInstance->Parser->cmdlist.begin(); i != ServerInstance->Parser->cmdlist.end(); i++)
|
||||
{
|
||||
|
@ -25,7 +25,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
|
||||
|
||||
/** Handle /CONNECT
|
||||
*/
|
||||
CmdResult CommandConnect::Handle (const char* const*, int, User *user)
|
||||
CmdResult CommandConnect::Handle (const std::vector<std::string>&, User *user)
|
||||
{
|
||||
user->WriteServ( "NOTICE %s :Look into loading a linking module (like m_spanningtree) if you want this to do anything useful.", user->nick);
|
||||
return CMD_SUCCESS;
|
||||
|
@ -22,9 +22,9 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
|
||||
|
||||
/** Handle /DIE
|
||||
*/
|
||||
CmdResult CommandDie::Handle (const char* const* parameters, int pcnt, User *user)
|
||||
CmdResult CommandDie::Handle (const std::vector<std::string>& parameters, User *user)
|
||||
{
|
||||
if (!ServerInstance->PassCompare(user, ServerInstance->Config->diepass, parameters[0], ServerInstance->Config->powerhash))
|
||||
if (!ServerInstance->PassCompare(user, ServerInstance->Config->diepass, parameters[0].c_str(), ServerInstance->Config->powerhash))
|
||||
{
|
||||
{
|
||||
std::string diebuf = std::string("*** DIE command from ") + user->nick + "!" + user->ident + "@" + user->dhost + ". Terminating in " + ConvToStr(ServerInstance->Config->DieDelay) + " seconds.";
|
||||
|
@ -22,11 +22,11 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
|
||||
|
||||
/** Handle /ELINE
|
||||
*/
|
||||
CmdResult CommandEline::Handle (const char* const* parameters, int pcnt, User *user)
|
||||
CmdResult CommandEline::Handle (const std::vector<std::string>& parameters, User *user)
|
||||
{
|
||||
std::string target = parameters[0];
|
||||
|
||||
if (pcnt >= 3)
|
||||
if (parameters.size() >= 3)
|
||||
{
|
||||
IdentHostPair ih;
|
||||
User* find = ServerInstance->FindNick(target.c_str());
|
||||
@ -48,9 +48,9 @@ CmdResult CommandEline::Handle (const char* const* parameters, int pcnt, User *u
|
||||
if (ServerInstance->HostMatchesEveryone(ih.first+"@"+ih.second,user))
|
||||
return CMD_FAILURE;
|
||||
|
||||
long duration = ServerInstance->Duration(parameters[1]);
|
||||
long duration = ServerInstance->Duration(parameters[1].c_str());
|
||||
|
||||
ELine* el = new ELine(ServerInstance, ServerInstance->Time(), duration, user->nick, parameters[2], ih.first.c_str(), ih.second.c_str());
|
||||
ELine* el = new ELine(ServerInstance, ServerInstance->Time(), duration, user->nick, parameters[2].c_str(), ih.first.c_str(), ih.second.c_str());
|
||||
if (ServerInstance->XLines->AddLine(el, user))
|
||||
{
|
||||
if (!duration)
|
||||
|
@ -22,11 +22,11 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
|
||||
|
||||
/** Handle /GLINE
|
||||
*/
|
||||
CmdResult CommandGline::Handle (const char* const* parameters, int pcnt, User *user)
|
||||
CmdResult CommandGline::Handle (const std::vector<std::string>& parameters, User *user)
|
||||
{
|
||||
std::string target = parameters[0];
|
||||
|
||||
if (pcnt >= 3)
|
||||
if (parameters.size() >= 3)
|
||||
{
|
||||
IdentHostPair ih;
|
||||
User* find = ServerInstance->FindNick(target.c_str());
|
||||
@ -48,14 +48,14 @@ CmdResult CommandGline::Handle (const char* const* parameters, int pcnt, User *u
|
||||
if (ServerInstance->HostMatchesEveryone(ih.first+"@"+ih.second,user))
|
||||
return CMD_FAILURE;
|
||||
|
||||
else if (strchr(target.c_str(),'!'))
|
||||
else if (target.find('!') != std::string::npos)
|
||||
{
|
||||
user->WriteServ("NOTICE %s :*** G-Line cannot operate on nick!user@host masks",user->nick);
|
||||
return CMD_FAILURE;
|
||||
}
|
||||
|
||||
long duration = ServerInstance->Duration(parameters[1]);
|
||||
GLine* gl = new GLine(ServerInstance, ServerInstance->Time(), duration, user->nick, parameters[2], ih.first.c_str(), ih.second.c_str());
|
||||
long duration = ServerInstance->Duration(parameters[1].c_str());
|
||||
GLine* gl = new GLine(ServerInstance, ServerInstance->Time(), duration, user->nick, parameters[2].c_str(), ih.first.c_str(), ih.second.c_str());
|
||||
if (ServerInstance->XLines->AddLine(gl, user))
|
||||
{
|
||||
if (!duration)
|
||||
|
@ -21,7 +21,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
|
||||
|
||||
/** Handle /INFO
|
||||
*/
|
||||
CmdResult CommandInfo::Handle (const char* const*, int, User *user)
|
||||
CmdResult CommandInfo::Handle (const std::vector<std::string>&, User *user)
|
||||
{
|
||||
user->WriteServ( "371 %s : -/\\- \2InspIRCd\2 -\\/-", user->nick);
|
||||
user->WriteServ( "371 %s : November 2002 - Present", user->nick);
|
||||
|
@ -21,31 +21,23 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
|
||||
|
||||
/** Handle /INVITE
|
||||
*/
|
||||
CmdResult CommandInvite::Handle (const char* const* parameters, int pcnt, User *user)
|
||||
CmdResult CommandInvite::Handle (const std::vector<std::string>& parameters, User *user)
|
||||
{
|
||||
int MOD_RESULT = 0;
|
||||
|
||||
if (pcnt == 2 || pcnt == 3)
|
||||
if (parameters.size() == 2 || parameters.size() == 3)
|
||||
{
|
||||
User* u = ServerInstance->FindNick(parameters[0]);
|
||||
Channel* c = ServerInstance->FindChan(parameters[1]);
|
||||
time_t timeout = 0;
|
||||
if (pcnt == 3)
|
||||
if (parameters.size() == 3)
|
||||
{
|
||||
timeout = time(NULL) + ServerInstance->Duration(parameters[2]);
|
||||
}
|
||||
|
||||
if ((!c) || (!u))
|
||||
{
|
||||
if (!c)
|
||||
{
|
||||
user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, parameters[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, parameters[0]);
|
||||
}
|
||||
|
||||
user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, c ? parameters[0].c_str() : parameters[1].c_str());
|
||||
return CMD_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -21,13 +21,13 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
|
||||
|
||||
/** Handle /ISON
|
||||
*/
|
||||
CmdResult CommandIson::Handle (const char* const* parameters, int pcnt, User *user)
|
||||
CmdResult CommandIson::Handle (const std::vector<std::string>& parameters, User *user)
|
||||
{
|
||||
std::map<User*,User*> ison_already;
|
||||
User *u;
|
||||
std::string reply = std::string("303 ") + user->nick + " :";
|
||||
|
||||
for (int i = 0; i < pcnt; i++)
|
||||
for (unsigned int i = 0; i < parameters.size(); i++)
|
||||
{
|
||||
u = ServerInstance->FindNick(parameters[i]);
|
||||
if (ison_already.find(u) != ison_already.end())
|
||||
@ -48,7 +48,7 @@ CmdResult CommandIson::Handle (const char* const* parameters, int pcnt, User *us
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((i == pcnt-1) && (strchr(parameters[i],' ')))
|
||||
if ((i == parameters.size() - 1) && (parameters[i].find(' ') != std::string::npos))
|
||||
{
|
||||
/* Its a space seperated list of nicks (RFC1459 says to support this)
|
||||
*/
|
||||
|
@ -21,31 +21,31 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
|
||||
|
||||
/** Handle /JOIN
|
||||
*/
|
||||
CmdResult CommandJoin::Handle (const char* const* parameters, int pcnt, User *user)
|
||||
CmdResult CommandJoin::Handle (const std::vector<std::string>& parameters, User *user)
|
||||
{
|
||||
if (pcnt > 1)
|
||||
if (parameters.size() > 1)
|
||||
{
|
||||
if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0, 1))
|
||||
if (ServerInstance->Parser->LoopCall(user, this, parameters, 0, 1))
|
||||
return CMD_SUCCESS;
|
||||
|
||||
if (ServerInstance->IsChannel(parameters[0]))
|
||||
if (ServerInstance->IsChannel(parameters[0].c_str()))
|
||||
{
|
||||
Channel::JoinUser(ServerInstance, user, parameters[0], false, parameters[1], false);
|
||||
Channel::JoinUser(ServerInstance, user, parameters[0].c_str(), false, parameters[1].c_str(), false);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0))
|
||||
if (ServerInstance->Parser->LoopCall(user, this, parameters, 0))
|
||||
return CMD_SUCCESS;
|
||||
|
||||
if (ServerInstance->IsChannel(parameters[0]))
|
||||
if (ServerInstance->IsChannel(parameters[0].c_str()))
|
||||
{
|
||||
Channel::JoinUser(ServerInstance, user, parameters[0], false, "", false);
|
||||
Channel::JoinUser(ServerInstance, user, parameters[0].c_str(), false, "", false);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
user->WriteNumeric(403, "%s %s :Invalid channel name",user->nick, parameters[0]);
|
||||
user->WriteNumeric(403, "%s %s :Invalid channel name",user->nick, parameters[0].c_str());
|
||||
return CMD_FAILURE;
|
||||
}
|
||||
|
@ -21,30 +21,30 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
|
||||
|
||||
/** Handle /KICK
|
||||
*/
|
||||
CmdResult CommandKick::Handle (const char* const* parameters, int pcnt, User *user)
|
||||
CmdResult CommandKick::Handle (const std::vector<std::string>& parameters, User *user)
|
||||
{
|
||||
char reason[MAXKICK];
|
||||
Channel* c = ServerInstance->FindChan(parameters[0]);
|
||||
User* u = ServerInstance->FindNick(parameters[1]);
|
||||
|
||||
if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 1))
|
||||
if (ServerInstance->Parser->LoopCall(user, this, parameters, parameters.size(), 1))
|
||||
return CMD_SUCCESS;
|
||||
|
||||
if (!u || !c)
|
||||
{
|
||||
user->WriteServ( "401 %s %s :No such nick/channel", user->nick, u ? parameters[0] : parameters[1]);
|
||||
user->WriteServ( "401 %s %s :No such nick/channel", user->nick, u ? parameters[0].c_str() : parameters[1].c_str());
|
||||
return CMD_FAILURE;
|
||||
}
|
||||
|
||||
if ((IS_LOCAL(user)) && (!c->HasUser(user)) && (!ServerInstance->ULine(user->server)))
|
||||
{
|
||||
user->WriteServ( "442 %s %s :You're not on that channel!", user->nick, parameters[0]);
|
||||
user->WriteServ( "442 %s %s :You're not on that channel!", user->nick, parameters[0].c_str());
|
||||
return CMD_FAILURE;
|
||||
}
|
||||
|
||||
if (pcnt > 2)
|
||||
if (parameters.size() > 2)
|
||||
{
|
||||
strlcpy(reason, parameters[2], MAXKICK - 1);
|
||||
strlcpy(reason, parameters[2].c_str(), MAXKICK - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -21,10 +21,10 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
|
||||
|
||||
/** Handle /KILL
|
||||
*/
|
||||
CmdResult CommandKill::Handle (const char* const* parameters, int pcnt, User *user)
|
||||
CmdResult CommandKill::Handle (const std::vector<std::string>& parameters, User *user)
|
||||
{
|
||||
/* Allow comma seperated lists of users for /KILL (thanks w00t) */
|
||||
if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0))
|
||||
if (ServerInstance->Parser->LoopCall(user, this, parameters, parameters.size(), 0))
|
||||
return CMD_SUCCESS;
|
||||
|
||||
User *u = ServerInstance->FindNick(parameters[0]);
|
||||
@ -54,18 +54,18 @@ CmdResult CommandKill::Handle (const char* const* parameters, int pcnt, User *us
|
||||
if (*ServerInstance->Config->HideKillsServer)
|
||||
{
|
||||
// hidekills is on, use it
|
||||
snprintf(killreason, MAXQUIT, "Killed (%s (%s))", ServerInstance->Config->HideKillsServer, parameters[1]);
|
||||
snprintf(killreason, MAXQUIT, "Killed (%s (%s))", ServerInstance->Config->HideKillsServer, parameters[1].c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
// hidekills is off, do nothing
|
||||
snprintf(killreason, MAXQUIT, "Killed (%s (%s))", user->nick, parameters[1]);
|
||||
snprintf(killreason, MAXQUIT, "Killed (%s (%s))", user->nick, parameters[1].c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Leave it alone, remote server has already formatted it */
|
||||
snprintf(killreason, MAXQUIT, "%s", parameters[1]);
|
||||
strlcpy(killreason, parameters[1].c_str(), MAXQUIT);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -75,7 +75,7 @@ CmdResult CommandKill::Handle (const char* const* parameters, int pcnt, User *us
|
||||
if (!IS_LOCAL(u))
|
||||
{
|
||||
// remote kill
|
||||
ServerInstance->SNO->WriteToSnoMask('K', "Remote kill by %s: %s!%s@%s (%s)", user->nick, u->nick, u->ident, u->host, parameters[1]);
|
||||
ServerInstance->SNO->WriteToSnoMask('K', "Remote kill by %s: %s!%s@%s (%s)", user->nick, u->nick, u->ident, u->host, parameters[1].c_str());
|
||||
FOREACH_MOD(I_OnRemoteKill, OnRemoteKill(user, u, killreason, killreason));
|
||||
}
|
||||
else
|
||||
@ -85,8 +85,8 @@ CmdResult CommandKill::Handle (const char* const* parameters, int pcnt, User *us
|
||||
* XXX - this isn't entirely correct, servers A - B - C, oper on A, client on C. Oper kills client, A and B will get remote kill
|
||||
* snotices, C will get a local kill snotice. this isn't accurate, and needs fixing at some stage. -- w00t
|
||||
*/
|
||||
ServerInstance->SNO->WriteToSnoMask('k',"Local Kill by %s: %s!%s@%s (%s)", user->nick, u->nick, u->ident, u->host, parameters[1]);
|
||||
ServerInstance->Logs->Log("KILL",DEFAULT,"LOCAL KILL: %s :%s!%s!%s (%s)", u->nick, ServerInstance->Config->ServerName, user->dhost, user->nick, parameters[1]);
|
||||
ServerInstance->SNO->WriteToSnoMask('k',"Local Kill by %s: %s!%s@%s (%s)", user->nick, u->nick, u->ident, u->host, parameters[1].c_str());
|
||||
ServerInstance->Logs->Log("KILL",DEFAULT,"LOCAL KILL: %s :%s!%s!%s (%s)", u->nick, ServerInstance->Config->ServerName, user->dhost, user->nick, parameters[1].c_str());
|
||||
/* Bug #419, make sure this message can only occur once even in the case of multiple KILL messages crossing the network, and change to show
|
||||
* hidekillsserver as source if possible
|
||||
*/
|
||||
@ -97,7 +97,7 @@ CmdResult CommandKill::Handle (const char* const* parameters, int pcnt, User *us
|
||||
ServerInstance->Config->ServerName,
|
||||
user->dhost,
|
||||
*ServerInstance->Config->HideKillsServer ? ServerInstance->Config->HideKillsServer : user->nick,
|
||||
parameters[1]);
|
||||
parameters[1].c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,7 +106,7 @@ CmdResult CommandKill::Handle (const char* const* parameters, int pcnt, User *us
|
||||
}
|
||||
else
|
||||
{
|
||||
user->WriteServ( "401 %s %s :No such nick/channel", user->nick, parameters[0]);
|
||||
user->WriteServ( "401 %s %s :No such nick/channel", user->nick, parameters[0].c_str());
|
||||
return CMD_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -22,11 +22,11 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
|
||||
|
||||
/** Handle /KLINE
|
||||
*/
|
||||
CmdResult CommandKline::Handle (const char* const* parameters, int pcnt, User *user)
|
||||
CmdResult CommandKline::Handle (const std::vector<std::string>& parameters, User *user)
|
||||
{
|
||||
std::string target = parameters[0];
|
||||
|
||||
if (pcnt >= 3)
|
||||
if (parameters.size() >= 3)
|
||||
{
|
||||
IdentHostPair ih;
|
||||
User* find = ServerInstance->FindNick(target.c_str());
|
||||
@ -48,14 +48,14 @@ CmdResult CommandKline::Handle (const char* const* parameters, int pcnt, User *u
|
||||
if (ServerInstance->HostMatchesEveryone(ih.first+"@"+ih.second,user))
|
||||
return CMD_FAILURE;
|
||||
|
||||
if (strchr(target.c_str(),'!'))
|
||||
if (target.find('!') != std::string::npos)
|
||||
{
|
||||
user->WriteServ("NOTICE %s :*** K-Line cannot operate on nick!user@host masks",user->nick);
|
||||
return CMD_FAILURE;
|
||||
}
|
||||
|
||||
long duration = ServerInstance->Duration(parameters[1]);
|
||||
KLine* kl = new KLine(ServerInstance, ServerInstance->Time(), duration, user->nick, parameters[2], ih.first.c_str(), ih.second.c_str());
|
||||
long duration = ServerInstance->Duration(parameters[1].c_str());
|
||||
KLine* kl = new KLine(ServerInstance, ServerInstance->Time(), duration, user->nick, parameters[2].c_str(), ih.first.c_str(), ih.second.c_str());
|
||||
if (ServerInstance->XLines->AddLine(kl,user))
|
||||
{
|
||||
if (!duration)
|
||||
|
@ -21,7 +21,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
|
||||
|
||||
/** Handle /LINKS
|
||||
*/
|
||||
CmdResult CommandLinks::Handle (const char* const*, int, User *user)
|
||||
CmdResult CommandLinks::Handle (const std::vector<std::string>&, User *user)
|
||||
{
|
||||
user->WriteNumeric(364, "%s %s %s :0 %s",user->nick,ServerInstance->Config->ServerName,ServerInstance->Config->ServerName,ServerInstance->Config->ServerDesc);
|
||||
user->WriteNumeric(365, "%s * :End of /LINKS list.",user->nick);
|
||||
|
@ -22,24 +22,22 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
|
||||
return new CommandList(Instance);
|
||||
}
|
||||
|
||||
CmdResult CommandList::Handle (const char* const* parameters, int pcnt, User *user)
|
||||
CmdResult CommandList::Handle (const std::vector<std::string>& parameters, User *user)
|
||||
{
|
||||
int minusers = 0, maxusers = 0;
|
||||
|
||||
user->WriteNumeric(321, "%s Channel :Users Name",user->nick);
|
||||
|
||||
/* Work around mIRC suckyness. YOU SUCK, KHALED! */
|
||||
if (pcnt == 1)
|
||||
if (parameters.size() == 1)
|
||||
{
|
||||
if (*parameters[0] == '<')
|
||||
if (parameters[0][0] == '<')
|
||||
{
|
||||
maxusers = atoi(parameters[0]+1);
|
||||
pcnt = 0;
|
||||
maxusers = atoi((parameters[0].c_str())+1);
|
||||
}
|
||||
else if (*parameters[0] == '>')
|
||||
else if (parameters[0][0] == '>')
|
||||
{
|
||||
minusers = atoi(parameters[0]+1);
|
||||
pcnt = 0;
|
||||
minusers = atoi((parameters[0].c_str())+1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,9 +52,9 @@ CmdResult CommandList::Handle (const char* const* parameters, int pcnt, User *us
|
||||
if (too_many || too_few)
|
||||
continue;
|
||||
|
||||
if (pcnt)
|
||||
if (parameters.size() && parameters[0][0] != '<' && parameters[0][0] == '>')
|
||||
{
|
||||
if (!match(i->second->name, parameters[0]) && !match(i->second->topic, parameters[0]))
|
||||
if (!match(i->second->name, parameters[0].c_str()) && !match(i->second->topic, parameters[0].c_str()))
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -21,17 +21,17 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
|
||||
|
||||
/** Handle /LOADMODULE
|
||||
*/
|
||||
CmdResult CommandLoadmodule::Handle (const char* const* parameters, int, User *user)
|
||||
CmdResult CommandLoadmodule::Handle (const std::vector<std::string>& parameters, User *user)
|
||||
{
|
||||
if (ServerInstance->Modules->Load(parameters[0]))
|
||||
if (ServerInstance->Modules->Load(parameters[0].c_str()))
|
||||
{
|
||||
ServerInstance->SNO->WriteToSnoMask('A', "NEW MODULE: %s loaded %s",user->nick, parameters[0]);
|
||||
user->WriteNumeric(975, "%s %s :Module successfully loaded.",user->nick, parameters[0]);
|
||||
ServerInstance->SNO->WriteToSnoMask('A', "NEW MODULE: %s loaded %s",user->nick, parameters[0].c_str());
|
||||
user->WriteNumeric(975, "%s %s :Module successfully loaded.",user->nick, parameters[0].c_str());
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
user->WriteNumeric(974, "%s %s :%s",user->nick, parameters[0], ServerInstance->Modules->LastError().c_str());
|
||||
user->WriteNumeric(974, "%s %s :%s",user->nick, parameters[0].c_str(), ServerInstance->Modules->LastError().c_str());
|
||||
return CMD_FAILURE;
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
|
||||
|
||||
/** Handle /LUSERS
|
||||
*/
|
||||
CmdResult CommandLusers::Handle (const char* const*, int, User *user)
|
||||
CmdResult CommandLusers::Handle (const std::vector<std::string>&, User *user)
|
||||
{
|
||||
// this lusers command shows one server at all times because
|
||||
// a protocol module must override it to show those stats.
|
||||
|
@ -21,7 +21,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
|
||||
|
||||
/** Handle /MAP
|
||||
*/
|
||||
CmdResult CommandMap::Handle (const char* const*, int, User *user)
|
||||
CmdResult CommandMap::Handle (const std::vector<std::string>&, User *user)
|
||||
{
|
||||
// as with /LUSERS this does nothing without a linking
|
||||
// module to override its behaviour and display something
|
||||
|
@ -21,9 +21,9 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
|
||||
|
||||
/** Handle /MODE
|
||||
*/
|
||||
CmdResult CommandMode::Handle (const char* const* parameters, int pcnt, User *user)
|
||||
CmdResult CommandMode::Handle (const std::vector<std::string>& parameters, User *user)
|
||||
{
|
||||
ServerInstance->Modes->Process(parameters, pcnt, user, false);
|
||||
ServerInstance->Modes->Process(parameters, user, false);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
|
||||
|
||||
/** Handle /MODULES
|
||||
*/
|
||||
CmdResult CommandModules::Handle (const char* const*, int, User *user)
|
||||
CmdResult CommandModules::Handle (const std::vector<std::string>&, User *user)
|
||||
{
|
||||
std::vector<std::string> module_names = ServerInstance->Modules->GetAllModuleNames(0);
|
||||
|
||||
|
@ -21,7 +21,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
|
||||
|
||||
/** Handle /MOTD
|
||||
*/
|
||||
CmdResult CommandMotd::Handle (const char* const*, int, User *user)
|
||||
CmdResult CommandMotd::Handle (const std::vector<std::string>&, User *user)
|
||||
{
|
||||
user->ShowMOTD();
|
||||
return CMD_SUCCESS;
|
||||
|
@ -21,17 +21,17 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
|
||||
|
||||
/** Handle /NAMES
|
||||
*/
|
||||
CmdResult CommandNames::Handle (const char* const* parameters, int pcnt, User *user)
|
||||
CmdResult CommandNames::Handle (const std::vector<std::string>& parameters, User *user)
|
||||
{
|
||||
Channel* c;
|
||||
|
||||
if (!pcnt)
|
||||
if (!parameters.size())
|
||||
{
|
||||
user->WriteNumeric(366, "%s * :End of /NAMES list.",user->nick);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0))
|
||||
if (ServerInstance->Parser->LoopCall(user, this, parameters, 0))
|
||||
return CMD_SUCCESS;
|
||||
|
||||
c = ServerInstance->FindChan(parameters[0]);
|
||||
@ -46,7 +46,7 @@ CmdResult CommandNames::Handle (const char* const* parameters, int pcnt, User *u
|
||||
}
|
||||
else
|
||||
{
|
||||
user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, parameters[0]);
|
||||
user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, parameters[0].c_str());
|
||||
}
|
||||
|
||||
return CMD_SUCCESS;
|
||||
|
@ -25,21 +25,21 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
|
||||
* for the client introduction code in here, youre in the wrong place.
|
||||
* You need to look in the spanningtree module for this!
|
||||
*/
|
||||
CmdResult CommandNick::Handle (const char* const* parameters, int, User *user)
|
||||
CmdResult CommandNick::Handle (const std::vector<std::string>& parameters, User *user)
|
||||
{
|
||||
char oldnick[NICKMAX];
|
||||
|
||||
if (!*parameters[0] || !*user->nick)
|
||||
if (parameters[0].empty())
|
||||
{
|
||||
/* We cant put blanks in the parameters, so for this (extremely rare) issue we just put '*' here. */
|
||||
user->WriteNumeric(432, "%s * :Erroneous Nickname", *user->nick ? user->nick : "*");
|
||||
return CMD_FAILURE;
|
||||
}
|
||||
|
||||
if (irc::string(user->nick) == irc::string(parameters[0]))
|
||||
if (irc::string(user->nick) == assign(parameters[0]))
|
||||
{
|
||||
/* If its exactly the same, even case, dont do anything. */
|
||||
if (!strcmp(user->nick,parameters[0]))
|
||||
if (parameters[0] == user->nick)
|
||||
return CMD_SUCCESS;
|
||||
|
||||
/* Its a change of case. People insisted that they should be
|
||||
@ -48,12 +48,12 @@ CmdResult CommandNick::Handle (const char* const* parameters, int, User *user)
|
||||
*/
|
||||
strlcpy(oldnick, user->nick, NICKMAX - 1);
|
||||
int MOD_RESULT = 0;
|
||||
FOREACH_RESULT(I_OnUserPreNick,OnUserPreNick(user,parameters[0]));
|
||||
FOREACH_RESULT(I_OnUserPreNick,OnUserPreNick(user,parameters[0].c_str()));
|
||||
if (MOD_RESULT)
|
||||
return CMD_FAILURE;
|
||||
if (user->registered == REG_ALL)
|
||||
user->WriteCommon("NICK %s",parameters[0]);
|
||||
strlcpy(user->nick, parameters[0], NICKMAX - 1);
|
||||
user->WriteCommon("NICK %s",parameters[0].c_str());
|
||||
strlcpy(user->nick, parameters[0].c_str(), NICKMAX - 1);
|
||||
user->InvalidateCache();
|
||||
FOREACH_MOD(I_OnUserPostNick,OnUserPostNick(user,oldnick));
|
||||
return CMD_SUCCESS;
|
||||
@ -73,8 +73,8 @@ CmdResult CommandNick::Handle (const char* const* parameters, int, User *user)
|
||||
XLine* mq = ServerInstance->XLines->MatchesLine("Q",parameters[0]);
|
||||
if (mq)
|
||||
{
|
||||
ServerInstance->SNO->WriteToSnoMask('x', "Q-Lined nickname %s from %s!%s@%s: %s", parameters[0], user->nick, user->ident, user->host, mq->reason);
|
||||
user->WriteNumeric(432, "%s %s :Invalid nickname: %s",user->nick,parameters[0], mq->reason);
|
||||
ServerInstance->SNO->WriteToSnoMask('x', "Q-Lined nickname %s from %s!%s@%s: %s", parameters[0].c_str(), user->nick, user->ident, user->host, mq->reason);
|
||||
user->WriteNumeric(432, "%s %s :Invalid nickname: %s",user->nick, parameters[0].c_str(), mq->reason);
|
||||
return CMD_FAILURE;
|
||||
}
|
||||
}
|
||||
@ -89,7 +89,7 @@ CmdResult CommandNick::Handle (const char* const* parameters, int, User *user)
|
||||
* because the nick is already (rightfully) in use. -- w00t
|
||||
*/
|
||||
User* InUse = ServerInstance->FindNickOnly(parameters[0]);
|
||||
if (InUse && (InUse != user) && ((ServerInstance->IsNick(parameters[0]) || allowinvalid)))
|
||||
if (InUse && (InUse != user) && ((ServerInstance->IsNick(parameters[0].c_str()) || allowinvalid)))
|
||||
{
|
||||
if (InUse->registered != REG_ALL)
|
||||
{
|
||||
@ -104,33 +104,33 @@ CmdResult CommandNick::Handle (const char* const* parameters, int, User *user)
|
||||
else
|
||||
{
|
||||
/* No camping, tell the incoming user to stop trying to change nick ;p */
|
||||
user->WriteNumeric(433, "%s %s :Nickname is already in use.", user->registered >= REG_NICK ? user->nick : "*", parameters[0]);
|
||||
user->WriteNumeric(433, "%s %s :Nickname is already in use.", user->registered >= REG_NICK ? user->nick : "*", parameters[0].c_str());
|
||||
return CMD_FAILURE;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (((!ServerInstance->IsNick(parameters[0]))) && (IS_LOCAL(user)))
|
||||
if (((!ServerInstance->IsNick(parameters[0].c_str()))) && (IS_LOCAL(user)))
|
||||
{
|
||||
if (!allowinvalid)
|
||||
{
|
||||
user->WriteNumeric(432, "%s %s :Erroneous Nickname",user->nick,parameters[0]);
|
||||
user->WriteNumeric(432, "%s %s :Erroneous Nickname", user->nick,parameters[0].c_str());
|
||||
return CMD_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
int MOD_RESULT = 0;
|
||||
FOREACH_RESULT(I_OnUserPreNick,OnUserPreNick(user,parameters[0]));
|
||||
FOREACH_RESULT(I_OnUserPreNick,OnUserPreNick(user, parameters[0]));
|
||||
if (MOD_RESULT)
|
||||
// if a module returns true, the nick change is silently forbidden.
|
||||
return CMD_FAILURE;
|
||||
|
||||
if (user->registered == REG_ALL)
|
||||
user->WriteCommon("NICK %s",parameters[0]);
|
||||
user->WriteCommon("NICK %s", parameters[0].c_str());
|
||||
|
||||
strlcpy(oldnick, user->nick, NICKMAX - 1);
|
||||
|
||||
/* change the nick of the user in the users_hash */
|
||||
user = user->UpdateNickHash(parameters[0]);
|
||||
user = user->UpdateNickHash(parameters[0].c_str());
|
||||
|
||||
/* actually change the nick within the record */
|
||||
if (!user)
|
||||
@ -138,7 +138,7 @@ CmdResult CommandNick::Handle (const char* const* parameters, int, User *user)
|
||||
if (!*user->nick)
|
||||
return CMD_FAILURE;
|
||||
|
||||
strlcpy(user->nick, parameters[0], NICKMAX - 1);
|
||||
strlcpy(user->nick, parameters[0].c_str(), NICKMAX - 1);
|
||||
|
||||
user->InvalidateCache();
|
||||
|
||||
|
@ -20,7 +20,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
|
||||
return new CommandNotice(Instance);
|
||||
}
|
||||
|
||||
CmdResult CommandNotice::Handle (const char* const* parameters, int pcnt, User *user)
|
||||
CmdResult CommandNotice::Handle (const std::vector<std::string>& parameters, User *user)
|
||||
{
|
||||
User *dest;
|
||||
Channel *chan;
|
||||
@ -29,28 +29,29 @@ CmdResult CommandNotice::Handle (const char* const* parameters, int pcnt, User *
|
||||
|
||||
user->idle_lastmsg = ServerInstance->Time();
|
||||
|
||||
if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0))
|
||||
if (ServerInstance->Parser->LoopCall(user, this, parameters, parameters.size(), 0))
|
||||
return CMD_SUCCESS;
|
||||
if ((parameters[0][0] == '$') && (IS_OPER(user) || ServerInstance->ULine(user->server)))
|
||||
{
|
||||
int MOD_RESULT = 0;
|
||||
std::string temp = parameters[1];
|
||||
FOREACH_RESULT(I_OnUserPreNotice,OnUserPreNotice(user,(void*)parameters[0],TYPE_SERVER,temp,0,exempt_list));
|
||||
FOREACH_RESULT(I_OnUserPreNotice,OnUserPreNotice(user, (void*)parameters[0].c_str(), TYPE_SERVER, temp, 0, exempt_list));
|
||||
if (MOD_RESULT)
|
||||
return CMD_FAILURE;
|
||||
const char* text = temp.c_str();
|
||||
const char* servermask = parameters[0] + 1;
|
||||
const char* servermask = (parameters[0].c_str()) + 1;
|
||||
|
||||
FOREACH_MOD(I_OnText,OnText(user,(void*)parameters[0],TYPE_SERVER,text,0,exempt_list));
|
||||
FOREACH_MOD(I_OnText,OnText(user, (void*)parameters[0].c_str(), TYPE_SERVER, text, 0, exempt_list));
|
||||
if (match(ServerInstance->Config->ServerName,servermask))
|
||||
{
|
||||
user->SendAll("NOTICE", "%s", text);
|
||||
}
|
||||
FOREACH_MOD(I_OnUserNotice,OnUserNotice(user,(void*)parameters[0],TYPE_SERVER,text,0,exempt_list));
|
||||
FOREACH_MOD(I_OnUserNotice,OnUserNotice(user, (void*)parameters[0].c_str(), TYPE_SERVER, text, 0, exempt_list));
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
char status = 0;
|
||||
const char* target = parameters[0];
|
||||
const char* target = parameters[0].c_str();
|
||||
|
||||
if (ServerInstance->Modes->FindPrefix(*target))
|
||||
{
|
||||
status = *target;
|
||||
@ -121,7 +122,7 @@ CmdResult CommandNotice::Handle (const char* const* parameters, int pcnt, User *
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
const char* destnick = parameters[0];
|
||||
const char* destnick = parameters[0].c_str();
|
||||
|
||||
if (IS_LOCAL(user))
|
||||
{
|
||||
@ -135,7 +136,7 @@ CmdResult CommandNotice::Handle (const char* const* parameters, int pcnt, User *
|
||||
if (dest && strcasecmp(dest->server, targetserver + 1))
|
||||
{
|
||||
/* Incorrect server for user */
|
||||
user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, parameters[0]);
|
||||
user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, parameters[0].c_str());
|
||||
return CMD_FAILURE;
|
||||
}
|
||||
}
|
||||
@ -147,7 +148,7 @@ CmdResult CommandNotice::Handle (const char* const* parameters, int pcnt, User *
|
||||
|
||||
if (dest)
|
||||
{
|
||||
if (!*parameters[1])
|
||||
if (parameters[1].empty())
|
||||
{
|
||||
user->WriteNumeric(412, "%s :No text to send", user->nick);
|
||||
return CMD_FAILURE;
|
||||
@ -174,7 +175,7 @@ CmdResult CommandNotice::Handle (const char* const* parameters, int pcnt, User *
|
||||
else
|
||||
{
|
||||
/* no such nick/channel */
|
||||
user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, parameters[0]);
|
||||
user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, parameters[0].c_str());
|
||||
return CMD_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
|
||||
return new CommandOper(Instance);
|
||||
}
|
||||
|
||||
CmdResult CommandOper::Handle (const char* const* parameters, int, User *user)
|
||||
CmdResult CommandOper::Handle (const std::vector<std::string>& parameters, User *user)
|
||||
{
|
||||
char LoginName[MAXBUF];
|
||||
char Password[MAXBUF];
|
||||
@ -65,8 +65,8 @@ CmdResult CommandOper::Handle (const char* const* parameters, int, User *user)
|
||||
ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "oper", "host", i, HostName, MAXBUF);
|
||||
ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "oper", "hash", i, HashType, MAXBUF);
|
||||
|
||||
match_login = !strcmp(LoginName,parameters[0]);
|
||||
match_pass = !ServerInstance->PassCompare(user, Password,parameters[1], HashType);
|
||||
match_login = (LoginName == parameters[0]);
|
||||
match_pass = !ServerInstance->PassCompare(user, Password,parameters[1].c_str(), HashType);
|
||||
match_hosts = OneOfMatches(TheHost,TheIP,HostName);
|
||||
|
||||
if (match_login && match_pass && match_hosts)
|
||||
@ -107,7 +107,7 @@ CmdResult CommandOper::Handle (const char* const* parameters, int, User *user)
|
||||
if (found)
|
||||
{
|
||||
/* correct oper credentials */
|
||||
ServerInstance->SNO->WriteToSnoMask('o',"%s (%s@%s) is now an IRC operator of type %s (using oper '%s')",user->nick,user->ident,user->host,irc::Spacify(OperType),parameters[0]);
|
||||
ServerInstance->SNO->WriteToSnoMask('o',"%s (%s@%s) is now an IRC operator of type %s (using oper '%s')",user->nick,user->ident,user->host,irc::Spacify(OperType),parameters[0].c_str());
|
||||
user->WriteNumeric(381, "%s :You are now %s %s",user->nick, strchr("aeiouAEIOU", *OperType) ? "an" : "a", irc::Spacify(OperType));
|
||||
if (!user->IsModeSet('o'))
|
||||
user->Oper(OperType, LoginName);
|
||||
@ -133,21 +133,21 @@ CmdResult CommandOper::Handle (const char* const* parameters, int, User *user)
|
||||
user->WriteNumeric(491, "%s :Invalid oper credentials",user->nick);
|
||||
user->IncreasePenalty(10);
|
||||
|
||||
snprintf(broadcast, MAXBUF, "WARNING! Failed oper attempt by %s!%s@%s using login '%s': The following fields do not match: %s",user->nick,user->ident,user->host, parameters[0], fields.c_str());
|
||||
snprintf(broadcast, MAXBUF, "WARNING! Failed oper attempt by %s!%s@%s using login '%s': The following fields do not match: %s",user->nick,user->ident,user->host, parameters[0].c_str(), fields.c_str());
|
||||
ServerInstance->SNO->WriteToSnoMask('o',std::string(broadcast));
|
||||
|
||||
ServerInstance->Logs->Log("OPER",DEFAULT,"OPER: Failed oper attempt by %s!%s@%s using login '%s': The following fields did not match: %s",user->nick,user->ident,user->host,parameters[0],fields.c_str());
|
||||
ServerInstance->Logs->Log("OPER",DEFAULT,"OPER: Failed oper attempt by %s!%s@%s using login '%s': The following fields did not match: %s",user->nick,user->ident,user->host,parameters[0].c_str(),fields.c_str());
|
||||
return CMD_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
user->WriteNumeric(491, "%s :Your oper block does not have a valid opertype associated with it",user->nick);
|
||||
|
||||
snprintf(broadcast, MAXBUF, "CONFIGURATION ERROR! Oper block '%s': missing OperType %s",parameters[0],OperType);
|
||||
snprintf(broadcast, MAXBUF, "CONFIGURATION ERROR! Oper block '%s': missing OperType %s",parameters[0].c_str(),OperType);
|
||||
|
||||
ServerInstance->SNO->WriteToSnoMask('o', std::string(broadcast));
|
||||
|
||||
ServerInstance->Logs->Log("OPER",DEFAULT,"OPER: Failed oper attempt by %s!%s@%s using login '%s': credentials valid, but oper type nonexistent.",user->nick,user->ident,user->host,parameters[0]);
|
||||
ServerInstance->Logs->Log("OPER",DEFAULT,"OPER: Failed oper attempt by %s!%s@%s using login '%s': credentials valid, but oper type nonexistent.",user->nick,user->ident,user->host,parameters[0].c_str());
|
||||
return CMD_FAILURE;
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
|
||||
return new CommandPart(Instance);
|
||||
}
|
||||
|
||||
CmdResult CommandPart::Handle (const char* const* parameters, int pcnt, User *user)
|
||||
CmdResult CommandPart::Handle (const std::vector<std::string>& parameters, User *user)
|
||||
{
|
||||
std::string reason;
|
||||
|
||||
@ -29,7 +29,7 @@ CmdResult CommandPart::Handle (const char* const* parameters, int pcnt, User *us
|
||||
reason = ServerInstance->Config->FixedPart;
|
||||
else
|
||||
{
|
||||
if (pcnt > 1)
|
||||
if (parameters.size() > 1)
|
||||
reason = ServerInstance->Config->PrefixPart + std::string(parameters[1]) + ServerInstance->Config->SuffixPart;
|
||||
else
|
||||
reason = "";
|
||||
@ -37,10 +37,10 @@ CmdResult CommandPart::Handle (const char* const* parameters, int pcnt, User *us
|
||||
}
|
||||
else
|
||||
{
|
||||
reason = pcnt > 1 ? parameters[1] : "";
|
||||
reason = parameters.size() > 1 ? parameters[1] : "";
|
||||
}
|
||||
|
||||
if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0))
|
||||
if (ServerInstance->Parser->LoopCall(user, this, parameters, 0))
|
||||
return CMD_SUCCESS;
|
||||
|
||||
Channel* c = ServerInstance->FindChan(parameters[0]);
|
||||
@ -54,7 +54,7 @@ CmdResult CommandPart::Handle (const char* const* parameters, int pcnt, User *us
|
||||
}
|
||||
else
|
||||
{
|
||||
user->WriteServ( "401 %s %s :No such channel", user->nick, parameters[0]);
|
||||
user->WriteServ( "401 %s %s :No such channel", user->nick, parameters[0].c_str());
|
||||
return CMD_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
|
||||
return new CommandPass(Instance);
|
||||
}
|
||||
|
||||
CmdResult CommandPass::Handle (const char* const* parameters, int, User *user)
|
||||
CmdResult CommandPass::Handle (const std::vector<std::string>& parameters, User *user)
|
||||
{
|
||||
// Check to make sure they havnt registered -- Fix by FCS
|
||||
if (user->registered == REG_ALL)
|
||||
@ -31,11 +31,9 @@ CmdResult CommandPass::Handle (const char* const* parameters, int, User *user)
|
||||
if (!a)
|
||||
return CMD_FAILURE;
|
||||
|
||||
strlcpy(user->password,parameters[0],63);
|
||||
if (!ServerInstance->PassCompare(user, a->GetPass().c_str(), parameters[0], a->GetHash().c_str()))
|
||||
{
|
||||
strlcpy(user->password, parameters[0].c_str(), 63);
|
||||
if (!ServerInstance->PassCompare(user, a->GetPass().c_str(), parameters[0].c_str(), a->GetHash().c_str()))
|
||||
user->haspassed = true;
|
||||
}
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
@ -19,8 +19,8 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
|
||||
return new CommandPing(Instance);
|
||||
}
|
||||
|
||||
CmdResult CommandPing::Handle (const char* const* parameters, int, User *user)
|
||||
CmdResult CommandPing::Handle (const std::vector<std::string>& parameters, User *user)
|
||||
{
|
||||
user->WriteServ("PONG %s :%s",ServerInstance->Config->ServerName,parameters[0]);
|
||||
user->WriteServ("PONG %s :%s", ServerInstance->Config->ServerName, parameters[0].c_str());
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
|
||||
return new CommandPong(Instance);
|
||||
}
|
||||
|
||||
CmdResult CommandPong::Handle (const char* const*, int, User *user)
|
||||
CmdResult CommandPong::Handle (const std::vector<std::string>&, User *user)
|
||||
{
|
||||
// set the user as alive so they survive to next ping
|
||||
user->lastping = 1;
|
||||
|
@ -20,7 +20,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
|
||||
return new CommandPrivmsg(Instance);
|
||||
}
|
||||
|
||||
CmdResult CommandPrivmsg::Handle (const char* const* parameters, int pcnt, User *user)
|
||||
CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, User *user)
|
||||
{
|
||||
User *dest;
|
||||
Channel *chan;
|
||||
@ -28,28 +28,31 @@ CmdResult CommandPrivmsg::Handle (const char* const* parameters, int pcnt, User
|
||||
|
||||
user->idle_lastmsg = ServerInstance->Time();
|
||||
|
||||
if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0))
|
||||
if (ServerInstance->Parser->LoopCall(user, this, parameters, parameters.size(), 0))
|
||||
return CMD_SUCCESS;
|
||||
|
||||
if ((parameters[0][0] == '$') && (IS_OPER(user) || ServerInstance->ULine(user->server)))
|
||||
{
|
||||
int MOD_RESULT = 0;
|
||||
std::string temp = parameters[1];
|
||||
FOREACH_RESULT(I_OnUserPreMessage,OnUserPreMessage(user,(void*)parameters[0],TYPE_SERVER,temp,0,except_list));
|
||||
FOREACH_RESULT(I_OnUserPreMessage,OnUserPreMessage(user, (void*)parameters[0].c_str(), TYPE_SERVER, temp, 0, except_list));
|
||||
if (MOD_RESULT)
|
||||
return CMD_FAILURE;
|
||||
|
||||
const char* text = temp.c_str();
|
||||
const char* servermask = parameters[0] + 1;
|
||||
FOREACH_MOD(I_OnText,OnText(user,(void*)parameters[0],TYPE_SERVER,text,0,except_list));
|
||||
const char* servermask = (parameters[0].c_str()) + 1;
|
||||
|
||||
FOREACH_MOD(I_OnText,OnText(user, (void*)parameters[0].c_str(), TYPE_SERVER, text, 0, except_list));
|
||||
if (match(ServerInstance->Config->ServerName,servermask))
|
||||
{
|
||||
user->SendAll("PRIVMSG", "%s", text);
|
||||
}
|
||||
FOREACH_MOD(I_OnUserMessage,OnUserMessage(user,(void*)parameters[0],TYPE_SERVER,text,0,except_list));
|
||||
FOREACH_MOD(I_OnUserMessage,OnUserMessage(user, (void*)parameters[0].c_str(), TYPE_SERVER, text, 0, except_list));
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
char status = 0;
|
||||
const char* target = parameters[0];
|
||||
const char* target = parameters[0].c_str();
|
||||
|
||||
if (ServerInstance->Modes->FindPrefix(*target))
|
||||
{
|
||||
status = *target;
|
||||
@ -121,7 +124,7 @@ CmdResult CommandPrivmsg::Handle (const char* const* parameters, int pcnt, User
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
const char* destnick = parameters[0];
|
||||
const char* destnick = parameters[0].c_str();
|
||||
|
||||
if (IS_LOCAL(user))
|
||||
{
|
||||
@ -135,7 +138,7 @@ CmdResult CommandPrivmsg::Handle (const char* const* parameters, int pcnt, User
|
||||
if (dest && strcasecmp(dest->server, targetserver + 1))
|
||||
{
|
||||
/* Incorrect server for user */
|
||||
user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, parameters[0]);
|
||||
user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, parameters[0].c_str());
|
||||
return CMD_FAILURE;
|
||||
}
|
||||
}
|
||||
@ -147,7 +150,7 @@ CmdResult CommandPrivmsg::Handle (const char* const* parameters, int pcnt, User
|
||||
|
||||
if (dest)
|
||||
{
|
||||
if (!*parameters[1])
|
||||
if (parameters[1].empty())
|
||||
{
|
||||
user->WriteNumeric(412, "%s :No text to send", user->nick);
|
||||
return CMD_FAILURE;
|
||||
@ -162,13 +165,13 @@ CmdResult CommandPrivmsg::Handle (const char* const* parameters, int pcnt, User
|
||||
int MOD_RESULT = 0;
|
||||
|
||||
std::string temp = parameters[1];
|
||||
FOREACH_RESULT(I_OnUserPreMessage,OnUserPreMessage(user,dest,TYPE_USER,temp,0,except_list));
|
||||
FOREACH_RESULT(I_OnUserPreMessage,OnUserPreMessage(user, dest, TYPE_USER, temp, 0, except_list));
|
||||
if (MOD_RESULT) {
|
||||
return CMD_FAILURE;
|
||||
}
|
||||
const char* text = temp.c_str();
|
||||
|
||||
FOREACH_MOD(I_OnText,OnText(user,dest,TYPE_USER,text,0,except_list));
|
||||
FOREACH_MOD(I_OnText,OnText(user, dest, TYPE_USER, text, 0, except_list));
|
||||
|
||||
if (IS_LOCAL(dest))
|
||||
{
|
||||
@ -176,12 +179,12 @@ CmdResult CommandPrivmsg::Handle (const char* const* parameters, int pcnt, User
|
||||
user->WriteTo(dest, "PRIVMSG %s :%s", dest->nick, text);
|
||||
}
|
||||
|
||||
FOREACH_MOD(I_OnUserMessage,OnUserMessage(user,dest,TYPE_USER,text,0,except_list));
|
||||
FOREACH_MOD(I_OnUserMessage,OnUserMessage(user, dest, TYPE_USER, text, 0, except_list));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* no such nick/channel */
|
||||
user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, parameters[0]);
|
||||
user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, parameters[0].c_str());
|
||||
return CMD_FAILURE;
|
||||
}
|
||||
return CMD_SUCCESS;
|
||||
|
@ -22,31 +22,31 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
|
||||
return new CommandQline(Instance);
|
||||
}
|
||||
|
||||
CmdResult CommandQline::Handle (const char* const* parameters, int pcnt, User *user)
|
||||
CmdResult CommandQline::Handle (const std::vector<std::string>& parameters, User *user)
|
||||
{
|
||||
if (pcnt >= 3)
|
||||
if (parameters.size() >= 3)
|
||||
{
|
||||
if (ServerInstance->NickMatchesEveryone(parameters[0],user))
|
||||
return CMD_FAILURE;
|
||||
|
||||
if (strchr(parameters[0],'@') || strchr(parameters[0],'!') || strchr(parameters[0],'.'))
|
||||
if (parameters[0].find('@') != std::string::npos || parameters[0].find('!') != std::string::npos || parameters[0].find('.') != std::string::npos)
|
||||
{
|
||||
user->WriteServ("NOTICE %s :*** A Q-Line only bans a nick pattern, not a nick!user@host pattern.",user->nick);
|
||||
return CMD_FAILURE;
|
||||
}
|
||||
|
||||
long duration = ServerInstance->Duration(parameters[1]);
|
||||
QLine* ql = new QLine(ServerInstance, ServerInstance->Time(), duration, user->nick, parameters[2], parameters[0]);
|
||||
long duration = ServerInstance->Duration(parameters[1].c_str());
|
||||
QLine* ql = new QLine(ServerInstance, ServerInstance->Time(), duration, user->nick, parameters[2].c_str(), parameters[0].c_str());
|
||||
if (ServerInstance->XLines->AddLine(ql,user))
|
||||
{
|
||||
if (!duration)
|
||||
{
|
||||
ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent Q-line for %s.",user->nick,parameters[0]);
|
||||
ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent Q-line for %s.",user->nick,parameters[0].c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
time_t c_requires_crap = duration + ServerInstance->Time();
|
||||
ServerInstance->SNO->WriteToSnoMask('x',"%s added timed Q-line for %s, expires on %s",user->nick,parameters[0],
|
||||
ServerInstance->SNO->WriteToSnoMask('x',"%s added timed Q-line for %s, expires on %s",user->nick,parameters[0].c_str(),
|
||||
ServerInstance->TimeString(c_requires_crap).c_str());
|
||||
}
|
||||
ServerInstance->XLines->ApplyLines();
|
||||
@ -54,18 +54,18 @@ CmdResult CommandQline::Handle (const char* const* parameters, int pcnt, User *u
|
||||
else
|
||||
{
|
||||
delete ql;
|
||||
user->WriteServ("NOTICE %s :*** Q-Line for %s already exists",user->nick,parameters[0]);
|
||||
user->WriteServ("NOTICE %s :*** Q-Line for %s already exists",user->nick,parameters[0].c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ServerInstance->XLines->DelLine(parameters[0],"Q",user))
|
||||
if (ServerInstance->XLines->DelLine(parameters[0].c_str(), "Q", user))
|
||||
{
|
||||
ServerInstance->SNO->WriteToSnoMask('x',"%s Removed Q-line on %s.",user->nick,parameters[0]);
|
||||
ServerInstance->SNO->WriteToSnoMask('x',"%s Removed Q-line on %s.",user->nick,parameters[0].c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
user->WriteServ("NOTICE %s :*** Q-Line %s not found in list, try /stats q.",user->nick,parameters[0]);
|
||||
user->WriteServ("NOTICE %s :*** Q-Line %s not found in list, try /stats q.",user->nick,parameters[0].c_str());
|
||||
return CMD_FAILURE;
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
|
||||
return new CommandQuit(Instance);
|
||||
}
|
||||
|
||||
CmdResult CommandQuit::Handle (const char* const* parameters, int pcnt, User *user)
|
||||
CmdResult CommandQuit::Handle (const std::vector<std::string>& parameters, User *user)
|
||||
{
|
||||
|
||||
std::string quitmsg;
|
||||
@ -31,12 +31,12 @@ CmdResult CommandQuit::Handle (const char* const* parameters, int pcnt, User *us
|
||||
if (*ServerInstance->Config->FixedQuit)
|
||||
quitmsg = ServerInstance->Config->FixedQuit;
|
||||
else
|
||||
quitmsg = pcnt ?
|
||||
quitmsg = parameters.size() ?
|
||||
ServerInstance->Config->PrefixQuit + std::string(parameters[0]) + ServerInstance->Config->SuffixQuit
|
||||
: "Client exited";
|
||||
}
|
||||
else
|
||||
quitmsg = pcnt ? parameters[0] : "Client exited";
|
||||
quitmsg = parameters.size() ? parameters[0] : "Client exited";
|
||||
|
||||
ServerInstance->Users->QuitUser(user, quitmsg);
|
||||
|
||||
|
@ -22,23 +22,20 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
|
||||
return new CommandRehash(Instance);
|
||||
}
|
||||
|
||||
CmdResult CommandRehash::Handle (const char* const* parameters, int pcnt, User *user)
|
||||
CmdResult CommandRehash::Handle (const std::vector<std::string>& parameters, User *user)
|
||||
{
|
||||
std::string old_disabled = ServerInstance->Config->DisabledCommands;
|
||||
|
||||
ServerInstance->Logs->Log("fuckingrehash", DEBUG, "parc %d p0 %s", pcnt, parameters[0]);
|
||||
if (pcnt && parameters[0][0] != '-')
|
||||
if (parameters.size() && parameters[0][0] != '-')
|
||||
{
|
||||
if (!ServerInstance->MatchText(ServerInstance->Config->ServerName, parameters[0]))
|
||||
{
|
||||
ServerInstance->Logs->Log("fuckingrehash", DEBUG, "rehash for a server, and not for us");
|
||||
FOREACH_MOD(I_OnRehash,OnRehash(user, parameters[0]));
|
||||
return CMD_SUCCESS; // rehash for a server, and not for us
|
||||
}
|
||||
}
|
||||
else if (pcnt)
|
||||
else if (parameters.size())
|
||||
{
|
||||
ServerInstance->Logs->Log("fuckingrehash", DEBUG, "rehash for a subsystem, ignoring");
|
||||
FOREACH_MOD(I_OnRehash,OnRehash(user, parameters[0]));
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
@ -65,7 +62,7 @@ CmdResult CommandRehash::Handle (const char* const* parameters, int pcnt, User *
|
||||
if (!ServerInstance->ConfigThread)
|
||||
{
|
||||
ServerInstance->Config->RehashUser = user;
|
||||
ServerInstance->Config->RehashParameter = pcnt ? parameters[0] : "";
|
||||
ServerInstance->Config->RehashParameter = parameters.size() ? parameters[0] : "";
|
||||
|
||||
ServerInstance->ConfigThread = new ConfigReaderThread(ServerInstance, false, user);
|
||||
ServerInstance->Threads->Create(ServerInstance->ConfigThread);
|
||||
|
@ -19,20 +19,20 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
|
||||
return new CommandReloadmodule(Instance);
|
||||
}
|
||||
|
||||
CmdResult CommandReloadmodule::Handle (const char* const* parameters, int, User *user)
|
||||
CmdResult CommandReloadmodule::Handle (const std::vector<std::string>& parameters, User *user)
|
||||
{
|
||||
if (ServerInstance->Modules->Unload(parameters[0]))
|
||||
if (ServerInstance->Modules->Unload(parameters[0].c_str()))
|
||||
{
|
||||
ServerInstance->SNO->WriteToSnoMask('A', "RELOAD MODULE: %s unloaded %s",user->nick, parameters[0]);
|
||||
if (ServerInstance->Modules->Load(parameters[0]))
|
||||
ServerInstance->SNO->WriteToSnoMask('A', "RELOAD MODULE: %s unloaded %s",user->nick, parameters[0].c_str());
|
||||
if (ServerInstance->Modules->Load(parameters[0].c_str()))
|
||||
{
|
||||
ServerInstance->SNO->WriteToSnoMask('A', "RELOAD MODULE: %s reloaded %s",user->nick, parameters[0]);
|
||||
user->WriteNumeric(975, "%s %s :Module successfully reloaded.",user->nick, parameters[0]);
|
||||
ServerInstance->SNO->WriteToSnoMask('A', "RELOAD MODULE: %s reloaded %s",user->nick, parameters[0].c_str());
|
||||
user->WriteNumeric(975, "%s %s :Module successfully reloaded.",user->nick, parameters[0].c_str());
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
ServerInstance->SNO->WriteToSnoMask('A', "RELOAD MODULE: %s unsuccessfully reloaded %s",user->nick, parameters[0]);
|
||||
user->WriteNumeric(975, "%s %s :%s",user->nick, parameters[0], ServerInstance->Modules->LastError().c_str());
|
||||
ServerInstance->SNO->WriteToSnoMask('A', "RELOAD MODULE: %s unsuccessfully reloaded %s",user->nick, parameters[0].c_str());
|
||||
user->WriteNumeric(975, "%s %s :%s",user->nick, parameters[0].c_str(), ServerInstance->Modules->LastError().c_str());
|
||||
return CMD_FAILURE;
|
||||
}
|
||||
|
@ -19,10 +19,10 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
|
||||
return new CommandRestart(Instance);
|
||||
}
|
||||
|
||||
CmdResult CommandRestart::Handle (const char* const* parameters, int, User *user)
|
||||
CmdResult CommandRestart::Handle (const std::vector<std::string>& parameters, User *user)
|
||||
{
|
||||
ServerInstance->Logs->Log("COMMAND",DEFAULT,"Restart: %s",user->nick);
|
||||
if (!ServerInstance->PassCompare(user, ServerInstance->Config->restartpass, parameters[0], ServerInstance->Config->powerhash))
|
||||
if (!ServerInstance->PassCompare(user, ServerInstance->Config->restartpass, parameters[0].c_str(), ServerInstance->Config->powerhash))
|
||||
{
|
||||
ServerInstance->SNO->WriteToSnoMask('A', "RESTART command from %s!%s@%s, restarting server.",user->nick,user->ident,user->host);
|
||||
|
||||
|
@ -19,7 +19,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
|
||||
return new CommandRules(Instance);
|
||||
}
|
||||
|
||||
CmdResult CommandRules::Handle (const char* const* parameters, int pcnt, User *user)
|
||||
CmdResult CommandRules::Handle (const std::vector<std::string>& parameters, User *user)
|
||||
{
|
||||
user->ShowRULES();
|
||||
return CMD_SUCCESS;
|
||||
|
@ -21,7 +21,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
|
||||
return new CommandServer(Instance);
|
||||
}
|
||||
|
||||
CmdResult CommandServer::Handle (const char* const*, int, User *user)
|
||||
CmdResult CommandServer::Handle (const std::vector<std::string>&, User *user)
|
||||
{
|
||||
user->WriteNumeric(666, "%s :You cannot identify as a server, you are a USER. IRC Operators informed.",user->nick);
|
||||
ServerInstance->SNO->WriteToSnoMask('A', "WARNING: %s attempted to issue a SERVER command and is registered as a user!", user->nick);
|
||||
|
@ -24,7 +24,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
|
||||
return new CommandSquit(Instance);
|
||||
}
|
||||
|
||||
CmdResult CommandSquit::Handle (const char* const*, int, User *user)
|
||||
CmdResult CommandSquit::Handle (const std::vector<std::string>&, User *user)
|
||||
{
|
||||
user->WriteServ( "NOTICE %s :Look into loading a linking module (like m_spanningtree) if you want this to do anything useful.", user->nick);
|
||||
return CMD_FAILURE;
|
||||
|
@ -31,12 +31,12 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
|
||||
return new CommandStats(Instance);
|
||||
}
|
||||
|
||||
CmdResult CommandStats::Handle (const char* const* parameters, int /* pcnt */, User *user)
|
||||
CmdResult CommandStats::Handle (const std::vector<std::string>& parameters, User *user)
|
||||
{
|
||||
if (IS_LOCAL(user))
|
||||
{
|
||||
string_list values;
|
||||
DoStats(this->ServerInstance, *parameters[0], user, values);
|
||||
DoStats(this->ServerInstance, parameters[0][0], user, values);
|
||||
for (size_t i = 0; i < values.size(); i++)
|
||||
user->Write(":%s", values[i].c_str());
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user