summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/inspircd.h4
-rw-r--r--include/users.h2
-rw-r--r--src/inspircd.cpp19
-rw-r--r--src/modules.cpp4
-rw-r--r--src/users.cpp15
5 files changed, 25 insertions, 19 deletions
diff --git a/include/inspircd.h b/include/inspircd.h
index fa8f1e886..34ad92cb3 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -115,8 +115,8 @@ class InspIRCd
/* prototypes */
void force_nickchange(userrec* user,const char* newnick);
-void call_handler(const char* commandname,char **parameters, int pcnt, userrec *user);
-bool is_valid_cmd(const char* commandname, int pcnt, userrec * user);
+void call_handler(std::string &commandname,char **parameters, int pcnt, userrec *user);
+bool is_valid_cmd(std::string &commandname, int pcnt, userrec * user);
int loop_call(handlerfunc fn, char **parameters, int pcnt, userrec *u, int start, int end, int joins);
userrec* ReHashNick(char* Old, char* New);
/* userrec optimization stuff */
diff --git a/include/users.h b/include/users.h
index 9d0dabe74..ee15f4845 100644
--- a/include/users.h
+++ b/include/users.h
@@ -36,6 +36,8 @@
#define CC_ALLOW 0
#define CC_DENY 1
+template<typename T> inline string ConvToStr(const T &in);
+
/** Holds a channel name to which a user has been invited.
*/
class Invited : public classbase
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);
}
diff --git a/src/modules.cpp b/src/modules.cpp
index 93f05cdf1..9b98c7d12 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -400,12 +400,12 @@ bool Server::IsUlined(std::string server)
void Server::CallCommandHandler(std::string commandname, char** parameters, int pcnt, userrec* user)
{
- call_handler(commandname.c_str(),parameters,pcnt,user);
+ call_handler(commandname,parameters,pcnt,user);
}
bool Server::IsValidModuleCommand(std::string commandname, int pcnt, userrec* user)
{
- return is_valid_cmd(commandname.c_str(), pcnt, user);
+ return is_valid_cmd(commandname, pcnt, user);
}
void Server::Log(int level, std::string s)
diff --git a/src/users.cpp b/src/users.cpp
index f73aa7a15..8e5d996da 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -30,11 +30,15 @@ using namespace std;
#include "commands.h"
#include "helperfuncs.h"
#include "typedefs.h"
+#include "socketengine.h"
#include "hashcomp.h"
+#include "message.h"
+#include "wildcard.h"
+#include "xline.h"
extern InspIRCd* ServerInstance;
-extern int WHOWAS_STALE = 48; // default WHOWAS Entries last 2 days before they go 'stale'
-extern int WHOWAS_MAX = 100; // default 100 people maximum in the WHOWAS list
+extern int WHOWAS_STALE;
+extern int WHOWAS_MAX;
extern std::vector<Module*> modules;
extern std::vector<ircd_module*> factory;
extern std::vector<InspSocket*> module_sockets;
@@ -50,6 +54,13 @@ extern whowas_hash whowas;
std::vector<userrec*> all_opers;
+template<typename T> inline string ConvToStr(const T &in)
+{
+ stringstream tmp;
+ if (!(tmp << in)) return string();
+ return tmp.str();
+}
+
userrec::userrec()
{
// the PROPER way to do it, AVOID bzero at *ALL* costs