X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Fu_listmode.h;h=f98faefd5d97799ff6f303ef4db8932f8addae8d;hb=50fb079808cf6ff76fb8213c3469e435774ae42f;hp=67e8934e5772d3d1eabaa8193f5bebbae321f5cb;hpb=c2d1f2cdafb0a38446844f6bd3d683e8636e37b4;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/u_listmode.h b/include/u_listmode.h index 67e8934e5..f98faefd5 100644 --- a/include/u_listmode.h +++ b/include/u_listmode.h @@ -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,17 +172,17 @@ class ListModeBase : public ModeHandler channel->GetExt(infokey, el); if (el) { - irc::modestacker modestack(false); + irc::modestacker modestack(ServerInstance, false); std::deque stackresult; std::vector 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) @@ -194,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); @@ -284,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. @@ -304,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(); @@ -323,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 = ""; @@ -396,13 +394,13 @@ class ListModeBase : public ModeHandler { modelist* mlist; chan->GetExt(infokey, mlist); - irc::modestacker modestack(true); + irc::modestacker modestack(ServerInstance, true); std::deque 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))