summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorattilamolnar <attilamolnar@hush.com>2013-05-16 01:56:06 +0200
committerattilamolnar <attilamolnar@hush.com>2013-05-16 01:56:06 +0200
commitc5a46583800374344d8676eccd7061a15a5ac1ce (patch)
tree486f8ecdc4abd23795c871a59fd0ec707c6a49d8 /src/modules
parent4b41feea830fc84e8c1b2fd0982f3e8d8840af96 (diff)
Allow spaces (and more) in oper types
The spaces are converted to '_' characters in OPERTYPE for 2.0 servers Issue #533 suggested by @ankitkv
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_check.cpp2
-rw-r--r--src/modules/m_httpd_stats.cpp2
-rw-r--r--src/modules/m_spanningtree/compat.cpp13
-rw-r--r--src/modules/m_spanningtree/main.cpp6
-rw-r--r--src/modules/m_spanningtree/netburst.cpp2
-rw-r--r--src/modules/m_spanningtree/opertype.cpp2
6 files changed, 21 insertions, 6 deletions
diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp
index e8f077a7b..fda211cf8 100644
--- a/src/modules/m_check.cpp
+++ b/src/modules/m_check.cpp
@@ -113,7 +113,7 @@ class CommandCheck : public Command
{
OperInfo* oper = targuser->oper;
/* user is an oper of type ____ */
- user->SendText(checkstr + " opertype " + oper->NameStr());
+ user->SendText(checkstr + " opertype " + oper->name);
if (loctarg)
{
std::string umodes;
diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp
index 0330b3073..8f25415a9 100644
--- a/src/modules/m_httpd_stats.cpp
+++ b/src/modules/m_httpd_stats.cpp
@@ -196,7 +196,7 @@ class ModuleHttpStats : public Module
if (u->IsAway())
data << "<away>" << Sanitize(u->awaymsg) << "</away><awaytime>" << u->awaytime << "</awaytime>";
if (u->IsOper())
- data << "<opertype>" << Sanitize(u->oper->NameStr()) << "</opertype>";
+ data << "<opertype>" << Sanitize(u->oper->name) << "</opertype>";
data << "<modes>" << u->FormatModes() << "</modes><ident>" << Sanitize(u->ident) << "</ident>";
LocalUser* lu = IS_LOCAL(u);
if (lu)
diff --git a/src/modules/m_spanningtree/compat.cpp b/src/modules/m_spanningtree/compat.cpp
index 433da9847..17266afe9 100644
--- a/src/modules/m_spanningtree/compat.cpp
+++ b/src/modules/m_spanningtree/compat.cpp
@@ -140,6 +140,19 @@ void TreeSocket::WriteLine(std::string line)
// Insert the source SID (and a space) between the command and the first parameter
line.insert(10, line.substr(1, 4));
}
+ else if (command == "OPERTYPE")
+ {
+ std::string::size_type colon = line.find(':', b);
+ if (colon != std::string::npos)
+ {
+ for (std::string::iterator i = line.begin()+colon; i != line.end(); ++i)
+ {
+ if (*i == ' ')
+ *i = '_';
+ }
+ line.erase(colon, 1);
+ }
+ }
}
}
}
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index bfd3f75ea..92d274679 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -537,7 +537,8 @@ void ModuleSpanningTree::OnUserConnect(LocalUser* user)
if (user->IsOper())
{
params.clear();
- params.push_back(user->oper->name);
+ params.push_back(":");
+ params[0].append(user->oper->name);
Utils->DoOneToMany(user->uuid,"OPERTYPE",params);
}
@@ -775,7 +776,8 @@ void ModuleSpanningTree::OnOper(User* user, const std::string &opertype)
if (user->registered != REG_ALL || !IS_LOCAL(user))
return;
parameterlist params;
- params.push_back(opertype);
+ params.push_back(":");
+ params[0].append(opertype);
Utils->DoOneToMany(user->uuid,"OPERTYPE",params);
}
diff --git a/src/modules/m_spanningtree/netburst.cpp b/src/modules/m_spanningtree/netburst.cpp
index 21404e68e..c22ad3acb 100644
--- a/src/modules/m_spanningtree/netburst.cpp
+++ b/src/modules/m_spanningtree/netburst.cpp
@@ -204,7 +204,7 @@ void TreeSocket::SendUsers()
this->WriteLine(data);
if (u->second->IsOper())
{
- snprintf(data,MAXBUF,":%s OPERTYPE %s", u->second->uuid.c_str(), u->second->oper->name.c_str());
+ snprintf(data,MAXBUF,":%s OPERTYPE :%s", u->second->uuid.c_str(), u->second->oper->name.c_str());
this->WriteLine(data);
}
if (u->second->IsAway())
diff --git a/src/modules/m_spanningtree/opertype.cpp b/src/modules/m_spanningtree/opertype.cpp
index 4772e9222..021100870 100644
--- a/src/modules/m_spanningtree/opertype.cpp
+++ b/src/modules/m_spanningtree/opertype.cpp
@@ -53,7 +53,7 @@ CmdResult CommandOpertype::Handle(const std::vector<std::string>& params, User *
return CMD_SUCCESS;
}
- ServerInstance->SNO->WriteToSnoMask('O',"From %s: User %s (%s@%s) is now an IRC operator of type %s",u->server.c_str(), u->nick.c_str(),u->ident.c_str(), u->host.c_str(), irc::Spacify(opertype.c_str()));
+ ServerInstance->SNO->WriteToSnoMask('O',"From %s: User %s (%s@%s) is now an IRC operator of type %s",u->server.c_str(), u->nick.c_str(),u->ident.c_str(), u->host.c_str(), opertype.c_str());
return CMD_SUCCESS;
}