From 14ada0cad90860d02bea16970d51fdc1f7bea3de Mon Sep 17 00:00:00 2001 From: brain Date: Mon, 5 Dec 2005 08:59:26 +0000 Subject: Added FNAME and FHOST git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2182 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_spanningtree.cpp | 51 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'src/modules/m_spanningtree.cpp') diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index edbb3506b..f33149be2 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -928,6 +928,33 @@ class TreeSocket : public InspSocket DoOneToAllButSender(prefix,"VERSION",params,prefix); return true; } + + bool ChangeHost(std::string prefix, std::deque params) + { + if (params.size() < 1) + return true; + userrec* u = Srv->FindNick(prefix); + if (u) + { + Srv->ChangeHost(u,params[0]); + } + DoOneToAllButSender(prefix,"FHOST",params,prefix); + return true; + } + + bool ChangeName(std::string prefix, std::deque params) + { + if (params.size() < 1) + return true; + userrec* u = Srv->FindNick(prefix); + if (u) + { + Srv->ChangeGECOS(u,params[0]); + } + params[0] = ":" + params[0]; + DoOneToAllButSender(prefix,"FNAME",params,prefix); + return true; + } bool LocalPing(std::string prefix, std::deque params) { @@ -1245,6 +1272,14 @@ class TreeSocket : public InspSocket { return this->ServerVersion(prefix,params); } + else if (command == "FHOST") + { + return this->ChangeHost(prefix,params); + } + else if (command == "FNAME") + { + return this->ChangeName(prefix,params); + } else if (command == "SQUIT") { if (params.size() == 2) @@ -2000,6 +2035,22 @@ class ModuleSpanningTree : public Module } } + virtual void OnChangeHost(userrec* user, std::string newhost) + { + // only occurs for local clients + std::deque params; + params.push_back(newhost); + DoOneToMany(user->nick,"FHOST",params); + } + + virtual void OnChangeName(userrec* user, std::string gecos) + { + // only occurs for local clients + std::deque params; + params.push_back(gecos); + DoOneToMany(user->nick,"FNAME",params); + } + virtual void OnUserPart(userrec* user, chanrec* channel) { if (std::string(user->server) == Srv->GetServerName()) -- cgit v1.2.3