From 644c5992ca253cc90783ac1454abd1d866632cfd Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 26 Aug 2007 21:01:04 +0000 Subject: Proper fix for end-of-list numerics on restricted lists in bug #386, rather than a hackish nonmodular one. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7838 e03df62e-2008-0410-955e-edbf42e46eb7 --- include/mode.h | 10 +++++++++- include/modes/cmode_b.h | 1 + include/u_listmode.h | 5 +++++ src/mode.cpp | 5 +++++ src/modes/cmode_b.cpp | 5 +++++ 5 files changed, 25 insertions(+), 1 deletion(-) diff --git a/include/mode.h b/include/mode.h index 6d91de1a8..c8a315cce 100644 --- a/include/mode.h +++ b/include/mode.h @@ -228,9 +228,17 @@ class CoreExport ModeHandler : public Extensible * If your mode is a listmode, then this method will be called for displaying an item list, e.g. on MODE #channel +modechar * without any parameter or other modes in the command. * @param user The user issuing the command - * @parameter channel The channel they're requesting an item list of (e.g. a banlist, or an exception list etc) + * @param channel The channel they're requesting an item list of (e.g. a banlist, or an exception list etc) */ virtual void DisplayList(userrec* user, chanrec* channel); + + /** + * If your mode is a listmode, this method will be called to display an empty list (just the end of list numeric) + * @param user The user issuing the command + * @param channel The channel tehy're requesting an item list of (e.g. a banlist, or an exception list etc) + */ + virtual void DisplayEmptyList(userrec* user, chanrec* channel); + /** * If your mode needs special action during a server sync to determine which side wins when comparing timestamps, * override this function and use it to return true or false. The default implementation just returns true if diff --git a/include/modes/cmode_b.h b/include/modes/cmode_b.h index 2fe3de614..417480777 100644 --- a/include/modes/cmode_b.h +++ b/include/modes/cmode_b.h @@ -28,6 +28,7 @@ class ModeChannelBan : public ModeHandler std::string& AddBan(userrec *user,std::string& dest,chanrec *chan,int status); std::string& DelBan(userrec *user,std::string& dest,chanrec *chan,int status); void DisplayList(userrec* user, chanrec* channel); + void DisplayEmptyList(userrec* user, chanrec* channel); ModePair ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter); void RemoveMode(userrec* user); void RemoveMode(chanrec* channel); diff --git a/include/u_listmode.h b/include/u_listmode.h index baf736745..f7a385196 100644 --- a/include/u_listmode.h +++ b/include/u_listmode.h @@ -174,6 +174,11 @@ class ListModeBase : public ModeHandler user->WriteServ("%s %s %s :%s", endoflistnumeric.c_str(), user->nick, channel->name, endofliststring.c_str()); } + virtual void DisplayEmptyList(userrec* user, chanrec* channel) + { + user->WriteServ("%s %s %s :%s", endoflistnumeric.c_str(), user->nick, channel->name, endofliststring.c_str()); + } + /** Remove all instances of the mode from a channel. * See mode.h * @param channel The channel to remove all instances of the mode from diff --git a/src/mode.cpp b/src/mode.cpp index d04b7df97..755165421 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -128,6 +128,10 @@ void ModeHandler::DisplayList(userrec* user, chanrec* channel) { } +void ModeHandler::DisplayEmptyList(userrec* user, chanrec* channel) +{ +} + bool ModeHandler::CheckTimeStamp(time_t theirs, time_t ours, const std::string &their_param, const std::string &our_param, chanrec* channel) { return (ours < theirs); @@ -327,6 +331,7 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool if (ServerInstance->Config->HideModeLists[mletter] && (targetchannel->GetStatus(user) < STATUS_HOP)) { user->WriteServ("482 %s %s :Only half-operators and above may view the +%c list",user->nick, targetchannel->name, *mode++); + mh->DisplayEmptyList(user, targetchannel); continue; } diff --git a/src/modes/cmode_b.cpp b/src/modes/cmode_b.cpp index e306f31f6..f82c1296b 100644 --- a/src/modes/cmode_b.cpp +++ b/src/modes/cmode_b.cpp @@ -85,6 +85,11 @@ void ModeChannelBan::DisplayList(userrec* user, chanrec* channel) return; } +void ModeChannelBan::DisplayEmptyList(userrec* user, chanrec* channel) +{ + user->WriteServ("368 %s %s :End of channel ban list",user->nick, channel->name); +} + std::string& ModeChannelBan::AddBan(userrec *user,std::string &dest,chanrec *chan,int status) { if ((!user) || (!chan)) -- cgit v1.2.3