diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-12-15 14:12:13 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-12-15 14:12:13 +0000 |
commit | 818ead2412e2f9a3661f99d165e850ff0f49b092 (patch) | |
tree | b8881ce90336ebffdf6a878cdba53bca7b5da5fb /src/inspircd.cpp | |
parent | 704ae49baa572ecc0779be85a23c55ae2db7732e (diff) |
Tidied up call_handler to use strings
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2476 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/inspircd.cpp')
-rw-r--r-- | src/inspircd.cpp | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp index f409fcc18..65f8af0fa 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -378,13 +378,6 @@ InspIRCd::InspIRCd(int argc, char** argv) return; } -template<typename T> inline string ConvToStr(const T &in) -{ - stringstream tmp; - if (!(tmp << in)) return string(); - return tmp.str(); -} - /* re-allocates a nick in the user_hash after they change nicknames, * returns a pointer to the new user as it may have moved */ @@ -473,11 +466,11 @@ std::string InspIRCd::GetVersionString() } -bool is_valid_cmd(const char* commandname, int pcnt, userrec * user) +bool is_valid_cmd(std::string &commandname, int pcnt, userrec * user) { for (unsigned int i = 0; i < cmdlist.size(); i++) { - if (!strcasecmp(cmdlist[i].command,commandname)) + if (!strcasecmp(cmdlist[i].command,commandname.c_str())) { if (cmdlist[i].handler_function) { @@ -487,7 +480,7 @@ bool is_valid_cmd(const char* commandname, int pcnt, userrec * user) { if (cmdlist[i].flags_needed) { - if ((user->HasPermission((char*)commandname)) || (is_uline(user->server))) + if ((user->HasPermission(commandname)) || (is_uline(user->server))) { return true; } @@ -507,11 +500,11 @@ bool is_valid_cmd(const char* commandname, int pcnt, userrec * user) // calls a handler function for a command -void call_handler(const char* commandname,char **parameters, int pcnt, userrec *user) +void call_handler(std::string &commandname,char **parameters, int pcnt, userrec *user) { for (unsigned int i = 0; i < cmdlist.size(); i++) { - if (!strcasecmp(cmdlist[i].command,commandname)) + if (!strcasecmp(cmdlist[i].command,commandname.c_str())) { if (cmdlist[i].handler_function) { @@ -521,7 +514,7 @@ void call_handler(const char* commandname,char **parameters, int pcnt, userrec * { if (cmdlist[i].flags_needed) { - if ((user->HasPermission((char*)commandname)) || (is_uline(user->server))) + if ((user->HasPermission(commandname)) || (is_uline(user->server))) { cmdlist[i].handler_function(parameters,pcnt,user); } |