From c5a46583800374344d8676eccd7061a15a5ac1ce Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Thu, 16 May 2013 01:56:06 +0200 Subject: Allow spaces (and more) in oper types The spaces are converted to '_' characters in OPERTYPE for 2.0 servers Issue #533 suggested by @ankitkv --- src/modules/m_check.cpp | 2 +- src/modules/m_httpd_stats.cpp | 2 +- src/modules/m_spanningtree/compat.cpp | 13 +++++++++++++ src/modules/m_spanningtree/main.cpp | 6 ++++-- src/modules/m_spanningtree/netburst.cpp | 2 +- src/modules/m_spanningtree/opertype.cpp | 2 +- 6 files changed, 21 insertions(+), 6 deletions(-) (limited to 'src/modules') 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 << "" << Sanitize(u->awaymsg) << "" << u->awaytime << ""; if (u->IsOper()) - data << "" << Sanitize(u->oper->NameStr()) << ""; + data << "" << Sanitize(u->oper->name) << ""; data << "" << u->FormatModes() << "" << Sanitize(u->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& 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; } -- cgit v1.2.3