summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-07-08 19:46:55 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-07-08 19:46:55 +0000
commit4fa01bc07bed242efabb82cb5a31959d0075abac (patch)
tree8f8f563e8f1d3fa6c8c9a8ee9b6173f22c9475e5 /src
parentbb319272f8afffcca49c881e8de3e1a1f6eaa570 (diff)
Implement DisplayList virtual method calls, and implement it in cmode_b
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4185 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/mode.cpp21
-rw-r--r--src/modes/cmode_b.cpp11
2 files changed, 31 insertions, 1 deletions
diff --git a/src/mode.cpp b/src/mode.cpp
index 25c98fd1a..3dcfec5dc 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -304,12 +304,31 @@ void ModeParser::Process(char **parameters, int pcnt, userrec *user, bool server
WriteServ(user->fd,"401 %s %s :No such nick/channel",user->nick, parameters[0]);
return;
}
+
+ /* Special case for displaying the list for listmodes,
+ * e.g. MODE #chan b, or MODE #chan +b without a parameter
+ */
+ if ((type== MODETYPE_CHANNEL) && (pcnt == 2))
+ {
+ char* mode = parameters[1];
+ if (*mode == '+')
+ mode++;
+
+ unsigned char handler_id = ((*mode) - 65) | mask;
+ ModeHandler* mh = modehandlers[handler_id];
+
+ if ((mh) && (mh->IsListMode()))
+ {
+ mh->DisplayList(user, targetchannel);
+ }
+ }
+
std::string mode_sequence = parameters[1];
std::string parameter = "";
std::ostringstream parameter_list;
std::string output_sequence = "";
bool adding = true, state_change = false;
- int handler_id = 0;
+ unsigned char handler_id = 0;
int parameter_counter = 2; /* Index of first parameter */
for (std::string::const_iterator letter = mode_sequence.begin(); letter != mode_sequence.end(); letter++)
diff --git a/src/modes/cmode_b.cpp b/src/modes/cmode_b.cpp
index 5d709d4b7..ccc6bdfcf 100644
--- a/src/modes/cmode_b.cpp
+++ b/src/modes/cmode_b.cpp
@@ -45,6 +45,17 @@ ModeAction ModeChannelBan::OnModeChange(userrec* source, userrec* dest, chanrec*
return MODEACTION_ALLOW;
}
+void ModeChannelBan::DisplayList(userrec* user, chanrec* channel)
+{
+ /* Display the channel banlist */
+ for (BanList::iterator i = channel->bans.begin(); i != channel->bans.end(); i++)
+ {
+ WriteServ(user->fd,"367 %s %s %s %s %d",user->nick, channel->name, i->data, i->set_by, i->set_time);
+ }
+ WriteServ(user->fd,"368 %s %s :End of channel ban list",user->nick, channel->name);
+ return;
+}
+
std::string& ModeChannelBan::AddBan(userrec *user,std::string &dest,chanrec *chan,int status)
{
if ((!user) || (!chan))