]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/protocolinterface.cpp
Merge pull request #623 from ChrisTX/insp20+compilerfixes
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / protocolinterface.cpp
index 7434400a00a61fae922e4d1af4d83f12f51a75d5..3ab5dae9df0c9aa5b54fed4fc8c53e4f244bb10d 100644 (file)
@@ -1,3 +1,23 @@
+/*
+ * InspIRCd -- Internet Relay Chat Daemon
+ *
+ *   Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
+ *   Copyright (C) 2008 Craig Edwards <craigedwards@brainbox.cc>
+ *
+ * This file is part of InspIRCd.  InspIRCd is free software: you can
+ * redistribute it and/or modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
 #include "inspircd.h"
 #include "main.h"
 #include "utils.h"
@@ -28,7 +48,7 @@ void SpanningTreeProtocolInterface::GetServerList(ProtoServerList &sl)
 
 bool SpanningTreeProtocolInterface::SendEncapsulatedData(const parameterlist &encap)
 {
-       if (encap[0].find('*') != std::string::npos)
+       if (encap[0].find_first_of("*?") != std::string::npos)
        {
                Utils->DoOneToMany(ServerInstance->Config->GetSID(), "ENCAP", encap);
                return true;
@@ -144,26 +164,16 @@ void SpanningTreeProtocolInterface::SendChannelNotice(Channel* target, char stat
 
 void SpanningTreeProtocolInterface::SendUserPrivmsg(User* target, const std::string &text)
 {
-       TreeServer* serv = Utils->FindServer(target->server);
-       if (serv)
-       {
-               TreeSocket* sock = serv->GetSocket();
-               if (sock)
-               {
-                       sock->WriteLine(":" + ServerInstance->Config->GetSID() + " PRIVMSG " + target->nick + " :"+text);
-               }
-       }
+       parameterlist p;
+       p.push_back(target->uuid);
+       p.push_back(":" + text);
+       Utils->DoOneToOne(ServerInstance->Config->GetSID(), "PRIVMSG", p, target->server);
 }
 
 void SpanningTreeProtocolInterface::SendUserNotice(User* target, const std::string &text)
 {
-       TreeServer* serv = Utils->FindServer(target->server);
-       if (serv)
-       {
-               TreeSocket* sock = serv->GetSocket();
-               if (sock)
-               {
-                       sock->WriteLine(":" + ServerInstance->Config->GetSID() + " NOTICE " + target->nick + " :"+text);
-               }
-       }
+       parameterlist p;
+       p.push_back(target->uuid);
+       p.push_back(":" + text);
+       Utils->DoOneToOne(ServerInstance->Config->GetSID(), "NOTICE", p, target->server);
 }