]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/commands/cmd_privmsg.cpp
m_spanningtree Remove SpanningTreeUtilities* fields and parameters
[user/henk/code/inspircd.git] / src / commands / cmd_privmsg.cpp
index eb9468bb96186c4618b08b3872ab2b9f7fb8f139..ed98c771f64f967fbede63e113faef7cacc39fff 100644 (file)
@@ -28,9 +28,14 @@ namespace
 
 class MessageCommandBase : public Command
 {
+       ChanModeReference moderatedmode;
+       ChanModeReference noextmsgmode;
+
  public:
        MessageCommandBase(Module* parent, MessageType mt)
                : Command(parent, MessageTypeString[mt], 2, 2)
+               , moderatedmode(parent, "moderated")
+               , noextmsgmode(parent, "noextmsg")
        {
                syntax = "<target>{,<target>} <message>";
        }
@@ -62,7 +67,7 @@ CmdResult MessageCommandBase::HandleMessage(const std::vector<std::string>& para
        if (localuser)
                localuser->idle_lastmsg = ServerInstance->Time();
 
-       if (ServerInstance->Parser->LoopCall(user, this, parameters, 0))
+       if (CommandParser::LoopCall(user, this, parameters, 0))
                return CMD_SUCCESS;
 
        if (parameters[0][0] == '$')
@@ -79,12 +84,12 @@ CmdResult MessageCommandBase::HandleMessage(const std::vector<std::string>& para
                const char* text = temp.c_str();
                const char* servermask = (parameters[0].c_str()) + 1;
 
-               FOREACH_MOD(I_OnText,OnText(user, (void*)parameters[0].c_str(), TYPE_SERVER, text, 0, except_list));
+               FOREACH_MOD(OnText, (user, (void*)parameters[0].c_str(), TYPE_SERVER, text, 0, except_list));
                if (InspIRCd::Match(ServerInstance->Config->ServerName, servermask, NULL))
                {
                        user->SendAll(MessageTypeString[mt], "%s", text);
                }
-               FOREACH_MOD(I_OnUserMessage,OnUserMessage(user, (void*)parameters[0].c_str(), TYPE_SERVER, text, 0, except_list, mt));
+               FOREACH_MOD(OnUserMessage, (user, (void*)parameters[0].c_str(), TYPE_SERVER, text, 0, except_list, mt));
                return CMD_SUCCESS;
        }
        char status = 0;
@@ -105,13 +110,13 @@ CmdResult MessageCommandBase::HandleMessage(const std::vector<std::string>& para
                {
                        if (localuser && chan->GetPrefixValue(user) < VOICE_VALUE)
                        {
-                               if (chan->IsModeSet('n') && !chan->HasUser(user))
+                               if (chan->IsModeSet(noextmsgmode) && !chan->HasUser(user))
                                {
                                        user->WriteNumeric(404, "%s %s :Cannot send to channel (no external messages)", user->nick.c_str(), chan->name.c_str());
                                        return CMD_FAILURE;
                                }
 
-                               if (chan->IsModeSet('m'))
+                               if (chan->IsModeSet(moderatedmode))
                                {
                                        user->WriteNumeric(404, "%s %s :Cannot send to channel (+m)", user->nick.c_str(), chan->name.c_str());
                                        return CMD_FAILURE;
@@ -142,7 +147,7 @@ CmdResult MessageCommandBase::HandleMessage(const std::vector<std::string>& para
                                return CMD_FAILURE;
                        }
 
-                       FOREACH_MOD(I_OnText,OnText(user,chan,TYPE_CHANNEL,text,status,except_list));
+                       FOREACH_MOD(OnText, (user,chan,TYPE_CHANNEL,text,status,except_list));
 
                        if (status)
                        {
@@ -160,7 +165,7 @@ CmdResult MessageCommandBase::HandleMessage(const std::vector<std::string>& para
                                chan->WriteAllExcept(user, false, status, except_list, "%s %s :%s", MessageTypeString[mt], chan->name.c_str(), text);
                        }
 
-                       FOREACH_MOD(I_OnUserMessage, OnUserMessage(user,chan, TYPE_CHANNEL, text, status, except_list, mt));
+                       FOREACH_MOD(OnUserMessage, (user,chan, TYPE_CHANNEL, text, status, except_list, mt));
                }
                else
                {
@@ -219,7 +224,7 @@ CmdResult MessageCommandBase::HandleMessage(const std::vector<std::string>& para
 
                const char* text = temp.c_str();
 
-               FOREACH_MOD(I_OnText,OnText(user, dest, TYPE_USER, text, 0, except_list));
+               FOREACH_MOD(OnText, (user, dest, TYPE_USER, text, 0, except_list));
 
                if (IS_LOCAL(dest))
                {
@@ -227,7 +232,7 @@ CmdResult MessageCommandBase::HandleMessage(const std::vector<std::string>& para
                        user->WriteTo(dest, "%s %s :%s", MessageTypeString[mt], dest->nick.c_str(), text);
                }
 
-               FOREACH_MOD(I_OnUserMessage,OnUserMessage(user, dest, TYPE_USER, text, 0, except_list, mt));
+               FOREACH_MOD(OnUserMessage, (user, dest, TYPE_USER, text, 0, except_list, mt));
        }
        else
        {