]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_redirect.cpp
Decide that it wasn't quite appropriate :(
[user/henk/code/inspircd.git] / src / modules / m_redirect.cpp
index bedb900777f6a7e7199a7601f352b0930064d372..a91ddef7f6104d0d00424a8e1add07f2cfd956bf 100644 (file)
@@ -45,7 +45,15 @@ class ModuleRedirect : public Module
                        if (mode_on)
                        {
                                std::string ChanToJoin = params[0];
-                               chanrec* c = Srv->FindChannel(ChanToJoin);
+                               chanrec *c;
+
+                               if (!IsValidChannelName(ChanToJoin.c_str()))
+                               {
+                                       WriteServ(user->fd,"403 %s %s :Invalid channel name",user->nick, ChanToJoin.c_str());
+                                       return 0;
+                               }
+
+                               c = Srv->FindChannel(ChanToJoin);
                                if (c)
                                {
                                        /* Fix by brain: Dont let a channel be linked to *itself* either */
@@ -66,25 +74,10 @@ class ModuleRedirect : public Module
                List[I_On005Numeric] = List[I_OnUserPreJoin] = List[I_OnExtendedMode] = 1;
        }
 
-        virtual void On005Numeric(std::string &output)
-        {
-                std::stringstream line(output);
-                std::string temp1, temp2;
-                while (!line.eof())
-                {
-                        line >> temp1;
-                        if (temp1.substr(0,10) == "CHANMODES=")
-                        {
-                               // By doing this we're *assuming* no other module has fucked up the CHANMODES=
-                               // section of the 005 numeric. If they have, we're going DOWN in a blaze of glory,
-                               // with a honking great EXCEPTION :)
-                               temp1.insert(temp1.find(",")+1,"L");
-                        }
-                        temp2 = temp2 + temp1 + " ";
-                }
-               if (temp2.length())
-                       output = temp2.substr(0,temp2.length()-1);
-        }
+       virtual void On005Numeric(std::string &output)
+       {
+               InsertMode(output, "L", 3);
+       }
        
        virtual int OnUserPreJoin(userrec* user, chanrec* chan, const char* cname)
        {