]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/u_listmode.h
Properly name the windows service error constants and put proper descriptions in...
[user/henk/code/inspircd.git] / include / u_listmode.h
index 61caa7c52cb0cbc6014bc16642ed7a692d68a144..f98faefd5d97799ff6f303ef4db8932f8addae8d 100644 (file)
@@ -14,8 +14,6 @@
 #ifndef INSPIRCD_LISTMODE_PROVIDER
 #define INSPIRCD_LISTMODE_PROVIDER
 
-#include "wildcard.h"
-
 /** Get the time as a string
  */
 inline std::string stringtime()
@@ -31,7 +29,7 @@ class ListItem : public classbase
 {
 public:
        std::string nick;
-       irc::string mask;
+       std::string mask;
        std::string time;
 };
 
@@ -87,10 +85,10 @@ class ListModeBase : public ModeHandler
        std::string infokey;
        /** Numeric to use when outputting the list
         */
-       std::string listnumeric;
+       unsigned int listnumeric;
        /** Numeric to indicate end of list
         */
-       std::string endoflistnumeric;
+       unsigned int endoflistnumeric;
        /** String to send for end of list
         */
        std::string endofliststring;
@@ -115,7 +113,7 @@ class ListModeBase : public ModeHandler
         * @param autotidy Automatically tidy list entries on add
         * @param ctag Configuration tag to get limits from
         */
-       ListModeBase(InspIRCd* Instance, char modechar, const std::string &eolstr, const std::string &lnum, const std::string &eolnum, bool autotidy, const std::string &ctag = "banlist")
+       ListModeBase(InspIRCd* Instance, char modechar, const std::string &eolstr, unsigned int lnum, unsigned int eolnum, bool autotidy, const std::string &ctag = "banlist")
        : ModeHandler(Instance, modechar, 1, 1, true, MODETYPE_CHANNEL, false), listnumeric(lnum), endoflistnumeric(eolnum), endofliststring(eolstr), tidy(autotidy), configtag(ctag)
        {
                this->DoRehash();
@@ -153,15 +151,15 @@ class ListModeBase : public ModeHandler
                {
                        for (modelist::reverse_iterator it = el->rbegin(); it != el->rend(); ++it)
                        {
-                               user->WriteServ("%s %s %s %s %s %s", listnumeric.c_str(), user->nick, channel->name, it->mask.c_str(), it->nick.c_str(), it->time.c_str());
+                               user->WriteNumeric(listnumeric, "%s %s %s %s %s", user->nick.c_str(), channel->name.c_str(), it->mask.c_str(), it->nick.c_str(), it->time.c_str());
                        }
                }
-               user->WriteServ("%s %s %s :%s", endoflistnumeric.c_str(), user->nick, channel->name, endofliststring.c_str());
+               user->WriteNumeric(endoflistnumeric, "%s %s :%s", user->nick.c_str(), channel->name.c_str(), endofliststring.c_str());
        }
 
        virtual void DisplayEmptyList(User* user, Channel* channel)
        {
-               user->WriteServ("%s %s %s :%s", endoflistnumeric.c_str(), user->nick, channel->name, endofliststring.c_str());
+               user->WriteNumeric(endoflistnumeric, "%s %s :%s", user->nick.c_str(), channel->name.c_str(), endofliststring.c_str());
        }
 
        /** Remove all instances of the mode from a channel.
@@ -174,18 +172,17 @@ class ListModeBase : public ModeHandler
                channel->GetExt(infokey, el);
                if (el)
                {
-                       irc::modestacker modestack(false);
+                       irc::modestacker modestack(ServerInstance, false);
                        std::deque<std::string> stackresult;
-                       //const char* mode_junk[MAXMODES+2];
                        std::vector<std::string> mode_junk;
-                       mode_junk[0] = channel->name;
+                       mode_junk.push_back(channel->name);
 
                        for (modelist::iterator it = el->begin(); it != el->end(); it++)
                        {
                                if (stack)
-                                       stack->Push(this->GetModeChar(), assign(it->mask));
+                                       stack->Push(this->GetModeChar(), it->mask);
                                else
-                                       modestack.Push(this->GetModeChar(), assign(it->mask));
+                                       modestack.Push(this->GetModeChar(), it->mask);
                        }
 
                        if (stack)
@@ -195,7 +192,7 @@ class ListModeBase : public ModeHandler
                        {
                                for (size_t j = 0; j < stackresult.size(); j++)
                                {
-                                       mode_junk[j+1] = stackresult[j];
+                                       mode_junk.push_back(stackresult[j]);
                                }
 
                                ServerInstance->SendMode(mode_junk, ServerInstance->FakeClient);                
@@ -285,11 +282,11 @@ class ListModeBase : public ModeHandler
 
                        for (limitlist::iterator it = chanlimits.begin(); it != chanlimits.end(); it++)
                        {
-                               if (match(channel->name, it->mask.c_str()))
+                               if (InspIRCd::Match(channel->name, it->mask))
                                {
                                        // We have a pattern matching the channel...
                                        maxsize = el->size();
-                                       if (maxsize < it->limit)
+                                       if (IS_LOCAL(source) || (maxsize < it->limit))
                                        {
                                                /* Ok, it *could* be allowed, now give someone subclassing us
                                                 * a chance to validate the parameter.
@@ -305,7 +302,7 @@ class ListModeBase : public ModeHandler
                                                {
                                                        // And now add the mask onto the list...
                                                        ListItem e;
-                                                       e.mask = assign(parameter);
+                                                       e.mask = parameter;
                                                        e.nick = servermode ? ServerInstance->Config->ServerName : source->nick;
                                                        e.time = stringtime();
 
@@ -324,7 +321,7 @@ class ListModeBase : public ModeHandler
                        /* List is full, give subclass a chance to send a custom message */
                        if (!TellListTooLong(source, channel, parameter))
                        {
-                               source->WriteNumeric(478, "%s %s %s :Channel ban/ignore list is full", source->nick, channel->name, parameter.c_str());
+                               source->WriteNumeric(478, "%s %s %s :Channel ban/ignore list is full", source->nick.c_str(), channel->name.c_str(), parameter.c_str());
                        }
                        
                        parameter = "";
@@ -397,13 +394,13 @@ class ListModeBase : public ModeHandler
        {
                modelist* mlist;
                chan->GetExt(infokey, mlist);
-               irc::modestacker modestack(true);
+               irc::modestacker modestack(ServerInstance, true);
                std::deque<std::string> stackresult;
                if (mlist)
                {
                        for (modelist::iterator it = mlist->begin(); it != mlist->end(); it++)
                        {
-                               modestack.Push(std::string(1, mode)[0], assign(it->mask));
+                               modestack.Push(std::string(1, mode)[0], it->mask);
                        }
                }
                while (modestack.GetStackedLine(stackresult))