]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/privmsg.cpp
fixed some indentation and spacing in modules
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / privmsg.cpp
index 3e27258151ff56bf060f79fa651bfbd85637d53f..a685900480e34ff42792961f70f0de3d2473ae1f 100644 (file)
@@ -32,15 +32,15 @@ bool TreeSocket::ServerMessage(const std::string &messagetype, const std::string
                const char* target = params[0].c_str();
                std::string text = params[1].c_str();
 
-               if ((*target == '@') || (*target == '%') || (*target == '+'))
+               if (Instance->Modes->FindPrefix(*target))
                {
                        status = *target;
                        target++;
                }
 
                Channel* channel = Instance->FindChan(target);
-               
-               if (target)
+
+               if (channel)
                {
                        if (messagetype == "PRIVMSG")
                        {
@@ -54,13 +54,13 @@ bool TreeSocket::ServerMessage(const std::string &messagetype, const std::string
                        if (s)
                        {
                                FOREACH_MOD_I(Instance, I_OnText, OnText(NULL, channel, TYPE_CHANNEL, text, status, except_list));
-                               channel->WriteChannelWithServ(s->GetName().c_str(), "%s %s :%s", messagetype.c_str(), channel->name, text.c_str());
+                               channel->WriteChannelWithServ(s->GetName().c_str(), "%s %s :%s", messagetype.c_str(), channel->name.c_str(), text.c_str());
                        }
                }
                else
                {
                        User* user = Instance->FindNick(target);
-                       
+
                        if (user)
                        {
                                if (messagetype == "PRIVMSG")
@@ -75,7 +75,7 @@ bool TreeSocket::ServerMessage(const std::string &messagetype, const std::string
                                if (s)
                                {
                                        FOREACH_MOD_I(Instance, I_OnText, OnText(NULL, user, TYPE_USER, text, status, except_list));
-                                       user->Write(":%s %s %s :%s", s->GetName().c_str(), messagetype.c_str(), user->nick, text.c_str());
+                                       user->Write(":%s %s %s :%s", s->GetName().c_str(), messagetype.c_str(), user->nick.c_str(), text.c_str());
                                }
 
                        }