]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/opertype.cpp
Change more modules to VF_OPTCOMMON and assert identical charsets in m_nationalchars
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / opertype.cpp
index c1105aa71c7b19cd956f6196f789f7bdc847714f..cdc47861aaa0a3bd308ff749d4b01b61e565fccf 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ *  InspIRCd: (C) 2002-2010 InspIRCd Development Team
  * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
@@ -29,13 +29,20 @@ bool TreeSocket::OperType(const std::string &prefix, parameterlist &params)
        if (params.size() != 1)
                return true;
        std::string opertype = params[0];
-       User* u = this->ServerInstance->FindNick(prefix);
+       User* u = ServerInstance->FindNick(prefix);
        if (u)
        {
                if (!IS_OPER(u))
-                       this->ServerInstance->Users->all_opers.push_back(u);
+                       ServerInstance->Users->all_opers.push_back(u);
                u->modes[UM_OPERATOR] = 1;
-               u->oper.assign(opertype, 0, 512);
+               OperIndex::iterator iter = ServerInstance->Config->oper_blocks.find(" " + opertype);
+               if (iter != ServerInstance->Config->oper_blocks.end())
+                       u->oper = iter->second;
+               else
+               {
+                       u->oper = new OperInfo;
+                       u->oper->name = opertype;
+               }
                Utils->DoOneToAllButSender(u->uuid, "OPERTYPE", params, u->server);
 
                TreeServer* remoteserver = Utils->FindServer(u->server);
@@ -47,17 +54,14 @@ bool TreeSocket::OperType(const std::string &prefix, parameterlist &params)
                         * If quiet bursts are enabled, and server is bursting or silent uline (i.e. services),
                         * then do nothing. -- w00t
                         */
-                       if (
-                               remoteserver->bursting ||
-                               this->ServerInstance->SilentULine(this->ServerInstance->FindServerNamePtr(u->server))
-                          )
+                       if (remoteserver->bursting || ServerInstance->SilentULine(u->server))
                        {
                                dosend = false;
                        }
                }
 
                if (dosend)
-                       this->ServerInstance->SNO->WriteToSnoMask('O',"From %s: User %s (%s@%s) is now an IRC operator of type %s",u->server, 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(), irc::Spacify(opertype.c_str()));
        }
        return true;
 }