]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_banexception.cpp
Fixes to make this module scale much better. Dont connect on each query, keep open...
[user/henk/code/inspircd.git] / src / modules / m_banexception.cpp
index 7c33e489e80881df653038967ba4f6d61fa57568..e606346c3b6fdbda5a08a610f14c802e966caf3c 100644 (file)
@@ -32,7 +32,7 @@
 class BanException : public ListModeBase
 {
  public:
-       BanException(InspIRCd* Instance) : ListModeBase(Instance, 'e', "End of Channel Exception List", "348", "349", true) { }
+       BanException(InspIRCd* Instance) : ListModeBase(Instance, 'e', "End of Channel Exception List", 348, 349, true) { }
 };
 
 
@@ -67,21 +67,23 @@ public:
                        modelist* list;
                        chan->GetExt(be->GetInfoKey(), list);
                        
-                       if (list)
+                       if (!list)
                        {
-                               char mask[MAXBUF];
-                               snprintf(mask, MAXBUF, "%s!%s@%s", user->nick, user->ident, user->GetIPString());
-                               for (modelist::iterator it = list->begin(); it != list->end(); it++)
+                               // No list, proceed normally
+                               return 0;
+                       }
+
+                       char mask[MAXBUF];
+                       snprintf(mask, MAXBUF, "%s!%s@%s", user->nick, user->ident, user->GetIPString());
+
+                       for (modelist::iterator it = list->begin(); it != list->end(); it++)
+                       {
+                               if (match(user->GetFullRealHost(), it->mask.c_str()) || match(user->GetFullHost(), it->mask.c_str()) || (match(mask, it->mask.c_str(), true)))
                                {
-                                       if (match(user->GetFullRealHost(), it->mask.c_str()) || match(user->GetFullHost(), it->mask.c_str()) || (match(mask, it->mask.c_str(), true)))
-                                       {
-                                               // They match an entry on the list, so let them in.
-                                               return 1;
-                                       }
+                                       // They match an entry on the list, so let them in.
+                                       return 1;
                                }
-                               return 0;
                        }
-                       // or if there wasn't a list, there can't be anyone on it, so we don't need to do anything.
                }
                return 0;       
        }