The InspIRCd Project
Home | Developers | Wiki | Forums | Bug Tracker | SVN | Download
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

opertype.cpp

Go to the documentation of this file.
00001 /*       +------------------------------------+
00002  *       | Inspire Internet Relay Chat Daemon |
00003  *       +------------------------------------+
00004  *
00005  *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
00006  * See: http://www.inspircd.org/wiki/index.php/Credits
00007  *
00008  * This program is free but copyrighted software; see
00009  *            the file COPYING for details.
00010  *
00011  * ---------------------------------------------------
00012  */
00013 
00014 #include "inspircd.h"
00015 #include "xline.h"
00016 
00017 #include "m_spanningtree/treesocket.h"
00018 #include "m_spanningtree/treeserver.h"
00019 #include "m_spanningtree/utils.h"
00020 
00021 /* $ModDep: m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */
00022 
00023 
00027 bool TreeSocket::OperType(const std::string &prefix, std::deque<std::string> &params)
00028 {
00029         if (params.size() != 1)
00030                 return true;
00031         std::string opertype = params[0];
00032         User* u = this->Instance->FindNick(prefix);
00033         if (u)
00034         {
00035                 if (!u->IsModeSet('o'))
00036                         this->Instance->Users->all_opers.push_back(u);
00037                 u->modes[UM_OPERATOR] = 1;
00038                 u->oper.assign(opertype, 0, 512);
00039                 Utils->DoOneToAllButSender(u->uuid, "OPERTYPE", params, u->server);
00040 
00041                 TreeServer* remoteserver = Utils->FindServer(u->server);
00042                 bool dosend = true;
00043 
00044                 if (this->Utils->quiet_bursts)
00045                 {
00046                         /*
00047                          * If quiet bursts are enabled, and server is bursting or silent uline (i.e. services),
00048                          * then do nothing. -- w00t
00049                          */
00050                         if (
00051                                 remoteserver->bursting ||
00052                                 this->Instance->SilentULine(this->Instance->FindServerNamePtr(u->server))
00053                            )
00054                         {
00055                                 dosend = false;
00056                         }
00057                 }
00058 
00059                 if (dosend)
00060                         this->Instance->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()));
00061         }
00062         return true;
00063 }
00064