]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
More stuff
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Wed, 31 Oct 2007 17:30:18 +0000 (17:30 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Wed, 31 Oct 2007 17:30:18 +0000 (17:30 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8429 e03df62e-2008-0410-955e-edbf42e46eb7

include/xline.h
src/configreader.cpp
src/xline.cpp

index cca0e9b764561db1ca04fa35917ed67fa6da60ad..b8b045fd57318ac1fa5bc9c43b5faac1c50c7a72 100644 (file)
@@ -79,6 +79,8 @@ class CoreExport XLine : public classbase
 
        virtual void DisplayExpiry() = 0;
 
+       virtual const char* Displayable() = 0;
+
        virtual void OnAdd() { }
 
        /** The time the line was added.
@@ -145,6 +147,8 @@ class CoreExport KLine : public XLine
 
        virtual void DisplayExpiry();
 
+       virtual const char* Displayable();
+
        /** Ident mask
         */
        char* identmask;
@@ -194,6 +198,8 @@ class CoreExport GLine : public XLine
 
        virtual void DisplayExpiry();
 
+       virtual const char* Displayable();
+
        /** Ident mask
         */
        char* identmask;
@@ -243,6 +249,8 @@ class CoreExport ELine : public XLine
 
        virtual void OnAdd();
 
+       virtual const char* Displayable();
+
        /** Ident mask
         */
        char* identmask;
@@ -287,6 +295,8 @@ class CoreExport ZLine : public XLine
 
        virtual void DisplayExpiry();
 
+       virtual const char* Displayable();
+
        /** IP mask
         */
        char* ipaddr;
@@ -326,6 +336,8 @@ class CoreExport QLine : public XLine
 
        virtual void DisplayExpiry();
 
+       virtual const char* Displayable();
+
        /** Nickname mask
         */
        char* nick;
@@ -336,10 +348,6 @@ class CoreExport QLine : public XLine
 class ServerConfig;
 class InspIRCd;
 
-/** Done adding elines from the config
- */
-bool DoneELine(ServerConfig* conf, const char* tag);
-
 /** Contains an ident and host split into two strings
  */
 typedef std::pair<std::string, std::string> IdentHostPair;
index 96f46116239cdd655b0ca875ea9c81d8a02db219..4c41cf2474e052afcce3427cc7ccfaf1a73968c3 100644 (file)
@@ -31,6 +31,7 @@ std::vector<std::string> old_module_names, new_module_names, added_modules, remo
 
 /* Needs forward declaration */
 bool ValidateDnsServer(ServerConfig* conf, const char* tag, const char* value, ValueItem &data);
+bool DoneELine(ServerConfig* conf, const char* tag);
 
 ServerConfig::ServerConfig(InspIRCd* Instance) : ServerInstance(Instance)
 {
@@ -1973,3 +1974,16 @@ bool DoELine(ServerConfig* conf, const char* tag, char** entries, ValueList &val
        return true;
 }
 
+// this should probably be moved to configreader, but atm it relies on CheckELines above.
+bool DoneELine(ServerConfig* conf, const char* tag)
+{
+       for (std::vector<User*>::const_iterator u2 = conf->GetInstance()->local_users.begin(); u2 != conf->GetInstance()->local_users.end(); u2++)
+       {
+               User* u = (User*)(*u2);
+               u->exempt = false;
+       }
+
+       conf->GetInstance()->XLines->CheckELines(conf->GetInstance()->XLines->lookup_lines['E']);
+       return true;
+}
+
index bc505dcc5391448d82d17cdd82453a558d6b0456..231152f25cdd9835ccc4f5fa26b202fae583e275 100644 (file)
@@ -130,7 +130,7 @@ bool XLineManager::AddLine(XLine* line)
 {
        /*IdentHostPair ih = IdentSplit(hostmask);*/
 
-       if (DelLine(hostmask, line->type, true))
+       if (DelLine(line->Displayable(), line->type, true))
                return false;
 
        /*ELine* item = new ELine(ServerInstance, ServerInstance->Time(), duration, source, reason, ih.first.c_str(), ih.second.c_str());*/
@@ -568,32 +568,32 @@ bool GLine::Matches(const std::string &str)
        return ((match(str.c_str(), matchtext.c_str(), true)));
 }
 
-virtual bool ELine::MatchesLiteral(const std::string &str)
+bool ELine::MatchesLiteral(const std::string &str)
 {
-       return (assign(str) == irc::string(this->identmask) + '@' + this->hostmask);
+       return (assign(str) == matchtext);
 }
 
-virtual bool ZLine::MatchesLiteral(const std::string &str)
+bool ZLine::MatchesLiteral(const std::string &str)
 {       
        return (assign(str) == this->ipmask);
 }
 
-virtual bool GLine::MatchesLiteral(const std::string &str)
+bool GLine::MatchesLiteral(const std::string &str)
 {       
-       return (assign(str) == irc::string(this->identmask) + '@' + this->hostmask);
+       return (assign(str) == matchtext);
 }
 
-virtual bool KLine::MatchesLiteral(const std::string &str)
+bool KLine::MatchesLiteral(const std::string &str)
 {       
-       return (assign(str) == irc::string(this->identmask) + '@' + this->hostmask);
+       return (assign(str) == matchtext);
 }
 
-virtual bool QLine::MatchesLiteral(const std::string &str)
+bool QLine::MatchesLiteral(const std::string &str)
 {       
        return (assign(str) == this->nickmask);
 }
 
-virtual void ELine::OnAdd()
+void ELine::OnAdd()
 {
        ServerInstance->XLines->CheckELines(ServerInstance->XLines->lookup_lines['E']);
 }
@@ -623,3 +623,28 @@ void GLine::DisplayExpiry()
        ServerInstance->SNO->WriteToSnoMask('x',"Expiring timed G-Line %s@%s (set by %s %d seconds ago)",this->identmask,this->hostmask,this->source,this->duration);
 }
 
+const char* ELine::Displayable()
+{
+       return matchtext.c_str();
+}
+
+const char* KLine::Displayable()
+{
+       return matchtext.c_str();
+}
+
+const char* GLine::Displayable()
+{
+       return matchtext.c_str();
+}
+
+const char* ZLine::Displayable()
+{
+       return ipaddr;
+}
+
+const char* QLine::Displayable()
+{
+       return nickmask;
+}
+