]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_redirect.cpp
httpd connection close fixes (these need to be backported to 1.1 at some point?)...
[user/henk/code/inspircd.git] / src / modules / m_redirect.cpp
index 373ac097c1d377630a04af69ab61a7875533260a..44cea9b0bd64bd8cbc9a263433cec708cefd2193 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
  * See: http://www.inspircd.org/wiki/index.php/Credits
  *
  * This program is free but copyrighted software; see
@@ -36,7 +36,7 @@ class Redirect : public ModeHandler
                return (their_param < our_param);
        }
        
-       ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding)
+       ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding, bool)
        {
                if (adding)
                {
@@ -44,7 +44,7 @@ class Redirect : public ModeHandler
 
                        if (!ServerInstance->IsChannel(parameter.c_str()))
                        {
-                               source->WriteServ("403 %s %s :Invalid channel name",source->nick, parameter.c_str());
+                               source->WriteNumeric(403, "%s %s :Invalid channel name",source->nick, parameter.c_str());
                                parameter.clear();
                                return MODEACTION_DENY;
                        }
@@ -57,7 +57,7 @@ class Redirect : public ModeHandler
                                {
                                        if ((c == channel) || (c->IsModeSet('L')))
                                        {
-                                               source->WriteServ("690 %s :Circular or chained +L to %s not allowed (Channel already has +L). Pack of wild dogs has been unleashed.",source->nick,parameter.c_str());
+                                               source->WriteNumeric(690, "%s :Circular or chained +L to %s not allowed (Channel already has +L). Pack of wild dogs has been unleashed.",source->nick,parameter.c_str());
                                                parameter.clear();
                                                return MODEACTION_DENY;
                                        }
@@ -67,7 +67,7 @@ class Redirect : public ModeHandler
                                                {
                                                        if ((i->second != channel) && (i->second->IsModeSet('L')) && (irc::string(i->second->GetModeParameter('L').c_str()) == irc::string(channel->name)))
                                                        {
-                                                               source->WriteServ("690 %s :Circular or chained +L to %s not allowed (Already forwarded here from %s). Angry monkeys dispatched.",source->nick,parameter.c_str(),i->second->name);
+                                                               source->WriteNumeric(690, "%s :Circular or chained +L to %s not allowed (Already forwarded here from %s). Angry monkeys dispatched.",source->nick,parameter.c_str(),i->second->name);
                                                                return MODEACTION_DENY;
                                                        }
                                                }
@@ -105,14 +105,14 @@ class ModuleRedirect : public Module
        {
                
                re = new Redirect(ServerInstance);
-               if (!ServerInstance->AddMode(re))
+               if (!ServerInstance->Modes->AddMode(re))
                        throw ModuleException("Could not add new modes!");
                Implementation eventlist[] = { I_OnUserPreJoin };
                ServerInstance->Modules->Attach(eventlist, this, 1);
        }
        
 
-       virtual int OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs)
+       virtual int OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
        {
                if (chan)
                {
@@ -127,12 +127,12 @@ class ModuleRedirect : public Module
                                        destchan = ServerInstance->FindChan(channel);
                                        if (destchan && destchan->IsModeSet('L'))
                                        {
-                                               user->WriteServ("470 %s :%s is full, but has a circular redirect (+L), not following redirection to %s", user->nick, cname, channel.c_str());
+                                               user->WriteNumeric(470, "%s :%s is full, but has a circular redirect (+L), not following redirection to %s", user->nick, cname, channel.c_str());
                                                return 1;
                                        }
 
-                                       user->WriteServ("470 %s :%s has become full, so you are automatically being transferred to the linked channel %s", user->nick, cname, channel.c_str());
-                                       Channel::JoinUser(ServerInstance, user, channel.c_str(), false, "", false, ServerInstance->Time(true));
+                                       user->WriteNumeric(470, "%s :%s has become full, so you are automatically being transferred to the linked channel %s", user->nick, cname, channel.c_str());
+                                       Channel::JoinUser(ServerInstance, user, channel.c_str(), false, "", false, ServerInstance->Time());
                                        return 1;
                                }
                        }
@@ -148,7 +148,7 @@ class ModuleRedirect : public Module
        
        virtual Version GetVersion()
        {
-               return Version(1, 1, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION);
+               return Version(1, 2, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION);
        }
 };