summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorom <om@e03df62e-2008-0410-955e-edbf42e46eb7>2006-02-05 09:55:13 +0000
committerom <om@e03df62e-2008-0410-955e-edbf42e46eb7>2006-02-05 09:55:13 +0000
commit4be4ccdf2628423644d42531322bea913dfe0191 (patch)
tree0f3ec5572d2dd19598671a83281f1abf9cb2727a
parent8c1b599dd3e1c224216fdfe5dc74100c4f4265df (diff)
Add .c_str()'s to m_sqloper in call to OneOfMatches(), and change prototype of OneOfMatches to take const char* instead of char*. Either that or case all the .c_str()'s to lose the const :"
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3091 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--include/cmd_oper.h2
-rw-r--r--src/cmd_oper.cpp2
-rw-r--r--src/modules/extra/m_sqloper.cpp44
3 files changed, 27 insertions, 21 deletions
diff --git a/include/cmd_oper.h b/include/cmd_oper.h
index 879671da6..e71ca07a6 100644
--- a/include/cmd_oper.h
+++ b/include/cmd_oper.h
@@ -28,7 +28,7 @@
#include "users.h"
#include "channels.h"
-bool OneOfMatches(char* host, char* hostlist);
+bool OneOfMatches(const char* host, const char* hostlist);
class cmd_oper : public command_t
{
diff --git a/src/cmd_oper.cpp b/src/cmd_oper.cpp
index 20a4b5ba8..8e57329d4 100644
--- a/src/cmd_oper.cpp
+++ b/src/cmd_oper.cpp
@@ -62,7 +62,7 @@ extern std::vector<userrec*> all_opers;
extern std::vector<userrec*> local_users;
extern userrec* fd_ref_table[MAX_DESCRIPTORS];
-bool OneOfMatches(char* host, char* hostlist)
+bool OneOfMatches(const char* host, const char* hostlist)
{
std::stringstream hl(hostlist);
std::string xhost;
diff --git a/src/modules/extra/m_sqloper.cpp b/src/modules/extra/m_sqloper.cpp
index 73422e49e..b4d8520cb 100644
--- a/src/modules/extra/m_sqloper.cpp
+++ b/src/modules/extra/m_sqloper.cpp
@@ -152,35 +152,40 @@ class ModuleSQLOper : public Module
{
found = true;
// oper up the user.
- for (int j =0; j < Conf->Enumerate("type"); j++)
- {
- std::string TypeName = Conf->ReadValue("type","name",j);
+
+ for (int j =0; j < Conf->Enumerate("type"); j++)
+ {
+ std::string TypeName = Conf->ReadValue("type","name",j);
Srv->Log(DEBUG,"Scanning opertype: "+TypeName);
std::string pattern = std::string(user->ident) + "@" + std::string(user->host);
- if ((TypeName == rowresult->GetField("type")) && (OneOfMatches(pattern,rowresult->GetField("hostname"))))
- {
+
+ if((TypeName == rowresult->GetField("type")) && OneOfMatches(pattern.c_str(), rowresult->GetField("hostname").c_str()))
+ {
+ /* found this oper's opertype */
Srv->Log(DEBUG,"Host and type match: "+TypeName+" "+rowresult->GetField("type"));
- /* found this oper's opertype */
std::string HostName = Conf->ReadValue("type","host",j);
- if (HostName != "")
- Srv->ChangeHost(user,HostName);
- strlcpy(user->oper,rowresult->GetField("type").c_str(),NICKMAX);
+
+ if(HostName != "")
+ Srv->ChangeHost(user,HostName);
+
+ strlcpy(user->oper,rowresult->GetField("type").c_str(),NICKMAX);
WriteOpers("*** %s (%s@%s) is now an IRC operator of type %s",user->nick,user->ident,user->host,rowresult->GetField("type").c_str());
WriteServ(user->fd,"381 %s :You are now an IRC operator of type %s",user->nick,rowresult->GetField("type").c_str());
- if (!strchr(user->modes,'o'))
- {
- strcat(user->modes,"o");
- WriteServ(user->fd,"MODE %s :+o",user->nick);
+ if(!strchr(user->modes,'o'))
+ {
+ strcat(user->modes,"o");
+ WriteServ(user->fd,"MODE %s :+o",user->nick);
FOREACH_MOD(I_OnOper,OnOper(user,rowresult->GetField("type")));
AddOper(user);
FOREACH_MOD(I_OnPostOper,OnPostOper(user,rowresult->GetField("type")));
- log(DEFAULT,"OPER: %s!%s@%s opered as type: %s",user->nick,user->ident,user->host,rowresult->GetField("type").c_str());
- }
- break;
- }
- }
-
+ log(DEFAULT,"OPER: %s!%s@%s opered as type: %s",user->nick,user->ident,user->host,rowresult->GetField("type").c_str());
+ }
+
+ break;
+ }
+ }
}
+
delete rowresult;
}
else
@@ -188,6 +193,7 @@ class ModuleSQLOper : public Module
// we didn't have a row.
found = false;
}
+
delete rowrequest;
delete result;
}