]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/extra/m_rline.cpp
The rest of the server protocol interface and fix a warning in m_rline
[user/henk/code/inspircd.git] / src / modules / extra / m_rline.cpp
index 189479efc138eebf373ae6bbd4f3bbc85167c82d..88e40811bb878a267ad571d44862bcb76c34d510 100644 (file)
@@ -62,7 +62,7 @@ class CoreExport RLine : public XLine
        {
                std::string compare = std::string(u->nick) + "!" + u->ident + "@" + u->host + " " + u->fullname;
 
-               ServerInstance->Log(DEBUG, "Matching " + matchtext + " against string " + compare);
+               ServerInstance->Logs->Log("m_rline",DEBUG, "Matching " + matchtext + " against string " + compare);
 
                if (pcre_exec(regex, NULL, compare.c_str(), compare.length(), 0, 0, NULL, 0) > -1)
                {
@@ -91,7 +91,7 @@ class CoreExport RLine : public XLine
 
        void DisplayExpiry()
        {
-               ServerInstance->SNO->WriteToSnoMask('x',"Expiring timed R-Line %s (set by %s %d seconds ago)", this->matchtext.c_str(), this->source, this->duration);
+               ServerInstance->SNO->WriteToSnoMask('x',"Expiring timed R-Line %s (set by %s %ld seconds ago)", this->matchtext.c_str(), this->source, this->duration);
        }
 
        const char* Displayable()
@@ -205,6 +205,10 @@ class ModuleRLine : public Module
 
                f = new RLineFactory(ServerInstance);
                ServerInstance->XLines->RegisterFactory(f);
+
+               Implementation eventlist[] = { I_OnUserConnect };
+               ServerInstance->Modules->Attach(eventlist, this, 1);
+
        }
 
        virtual ~ModuleRLine()
@@ -214,7 +218,19 @@ class ModuleRLine : 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);
+       }
+
+       virtual void OnUserConnect(User* user)
+       {
+               // Apply lines on user connect
+               XLine *rl = ServerInstance->XLines->MatchesLine("R", user);
+
+               if (rl)
+               {
+                       // Bang. :P
+                       rl->Apply(user);
+               }
        }
 };