]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/u_listmode.h
Support SASL messages other than 'C' and 'D'
[user/henk/code/inspircd.git] / src / modules / u_listmode.h
index c6e1f9add129abb98af4e4c131f6ab8246d54140..0f5903e53acc3543ffc185d2a247146254ade24d 100644 (file)
@@ -100,8 +100,6 @@ class ListModeBase : public ModeHandler
                configtag(ctag), extItem("listbase_mode_" + name + "_list", Creator)
        {
                list = true;
-               this->DoRehash();
-               ServerInstance->Extensions.Register(&extItem);
        }
 
        /** See mode.h
@@ -203,7 +201,7 @@ class ListModeBase : public ModeHandler
                        if (limit.mask.size() && limit.limit > 0)
                                chanlimits.push_back(limit);
                }
-               if (chanlimits.size() == 0)
+               if (chanlimits.empty())
                {
                        ListLimit limit;
                        limit.mask = "*";
@@ -216,8 +214,10 @@ class ListModeBase : public ModeHandler
         */
        virtual void DoImplements(Module* m)
        {
+               ServerInstance->Modules->AddService(extItem);
+               this->DoRehash();
                Implementation eventlist[] = { I_OnSyncChannel, I_OnRehash };
-               ServerInstance->Modules->Attach(eventlist, m, 2);
+               ServerInstance->Modules->Attach(eventlist, m, sizeof(eventlist)/sizeof(Implementation));
        }
 
        /** Handle the list mode.
@@ -303,7 +303,7 @@ class ListModeBase : public ModeHandler
                                source->WriteNumeric(478, "%s %s %s :Channel ban/ignore list is full", source->nick.c_str(), channel->name.c_str(), parameter.c_str());
                        }
 
-                       parameter = "";
+                       parameter.clear();
                        return MODEACTION_DENY;
                }
                else
@@ -316,7 +316,7 @@ class ListModeBase : public ModeHandler
                                        if (parameter == it->mask)
                                        {
                                                el->erase(it);
-                                               if (el->size() == 0)
+                                               if (el->empty())
                                                {
                                                        extItem.unset(channel);
                                                }
@@ -325,14 +325,14 @@ class ListModeBase : public ModeHandler
                                }
                                /* Tried to remove something that wasn't set */
                                TellNotSet(source, channel, parameter);
-                               parameter = "";
+                               parameter.clear();
                                return MODEACTION_DENY;
                        }
                        else
                        {
                                /* Hmm, taking an exception off a non-existant list, DIE */
                                TellNotSet(source, channel, parameter);
-                               parameter = "";
+                               parameter.clear();
                                return MODEACTION_DENY;
                        }
                }