X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Flistmode.cpp;h=19f2d6061dd00220fd8809a075da364661d86470;hb=1c64da19e1f08e23fd7020427e89d1d5af35aa1c;hp=3c9183ff7ebb9d38a4c1fbd949441c64e48b6ef8;hpb=58d7827bb1bd3d90f38a1c199f6f41ae9f24885c;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/listmode.cpp b/src/listmode.cpp index 3c9183ff7..19f2d6061 100644 --- a/src/listmode.cpp +++ b/src/listmode.cpp @@ -34,25 +34,25 @@ void ListModeBase::DisplayList(User* user, Channel* channel) { for (ModeList::reverse_iterator it = cd->list.rbegin(); it != cd->list.rend(); ++it) { - user->WriteNumeric(listnumeric, "%s %s %s %s %lu", user->nick.c_str(), channel->name.c_str(), it->mask.c_str(), (!it->setter.empty() ? it->setter.c_str() : ServerInstance->Config->ServerName.c_str()), (unsigned long) it->time); + user->WriteNumeric(listnumeric, "%s %s %s %lu", channel->name.c_str(), it->mask.c_str(), (!it->setter.empty() ? it->setter.c_str() : ServerInstance->Config->ServerName.c_str()), (unsigned long) it->time); } } - user->WriteNumeric(endoflistnumeric, "%s %s :%s", user->nick.c_str(), channel->name.c_str(), endofliststring.c_str()); + user->WriteNumeric(endoflistnumeric, "%s :%s", channel->name.c_str(), endofliststring.c_str()); } void ListModeBase::DisplayEmptyList(User* user, Channel* channel) { - user->WriteNumeric(endoflistnumeric, "%s %s :%s", user->nick.c_str(), channel->name.c_str(), endofliststring.c_str()); + user->WriteNumeric(endoflistnumeric, "%s :%s", channel->name.c_str(), endofliststring.c_str()); } -void ListModeBase::RemoveMode(Channel* channel, irc::modestacker& stack) +void ListModeBase::RemoveMode(Channel* channel, Modes::ChangeList& changelist) { ChanData* cd = extItem.get(channel); if (cd) { for (ModeList::iterator it = cd->list.begin(); it != cd->list.end(); it++) { - stack.Push(this->GetModeChar(), it->mask); + changelist.push_remove(this, it->mask); } } } @@ -74,14 +74,16 @@ void ListModeBase::DoRehash() chanlimits.push_back(limit); } - if (chanlimits.empty()) - chanlimits.push_back(ListLimit("*", 64)); + // Add the default entry. This is inserted last so if the user specifies a + // wildcard record in the config it will take precedence over this entry. + chanlimits.push_back(ListLimit("*", 64)); // Most of the time our settings are unchanged, so we can avoid iterating the chanlist if (oldlimits == chanlimits) return; - for (chan_hash::const_iterator i = ServerInstance->chanlist->begin(); i != ServerInstance->chanlist->end(); ++i) + const chan_hash& chans = ServerInstance->GetChans(); + for (chan_hash::const_iterator i = chans.begin(); i != chans.end(); ++i) { ChanData* cd = extItem.get(i->second); if (cd) @@ -156,7 +158,6 @@ ModeAction ListModeBase::OnModeChange(User* source, User*, Channel* channel, std { /* List is full, give subclass a chance to send a custom message */ TellListTooLong(source, channel, parameter); - parameter.clear(); return MODEACTION_DENY; } @@ -199,7 +200,6 @@ ModeAction ListModeBase::OnModeChange(User* source, User*, Channel* channel, std /* Tried to remove something that wasn't set */ TellNotSet(source, channel, parameter); - parameter.clear(); return MODEACTION_DENY; } } @@ -211,7 +211,7 @@ bool ListModeBase::ValidateParam(User*, Channel*, std::string&) void ListModeBase::TellListTooLong(User* source, Channel* channel, std::string& parameter) { - source->WriteNumeric(478, "%s %s %s :Channel ban list is full", source->nick.c_str(), channel->name.c_str(), parameter.c_str()); + source->WriteNumeric(ERR_BANLISTFULL, "%s %s :Channel ban list is full", channel->name.c_str(), parameter.c_str()); } void ListModeBase::TellAlreadyOnList(User*, Channel*, std::string&)