summaryrefslogtreecommitdiff
path: root/src/commands.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-25 20:47:35 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-25 20:47:35 +0000
commite63acfd42200a41705bf4469c8507366592a7100 (patch)
tree143cd0863c1da242948b9bb76dfbb8a9a6d86cda /src/commands.cpp
parent77b32677820dfa6ce92395d6d6c02c80f84485b0 (diff)
Added MaxWhoReplies stuff (bahamut-style /WHO limiting)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@729 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/commands.cpp')
-rw-r--r--src/commands.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/commands.cpp b/src/commands.cpp
index d5ec4307c..6873e4e9c 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -68,6 +68,7 @@ extern int WHOWAS_MAX;
extern int DieDelay;
extern time_t startup_time;
extern int NetBufferSize;
+int MaxWhoResults;
extern time_t nb_start;
extern std::vector<int> fd_reap;
@@ -778,12 +779,17 @@ void handle_who(char **parameters, int pcnt, userrec *user)
{
if (user->chans[0].channel)
{
- Ptr = user->chans[0].channel;
+ int n_list = 0;
for (user_hash::const_iterator i = clientlist.begin(); i != clientlist.end(); i++)
{
- if ((common_channels(user,i->second)) && (isnick(i->second->nick)))
+ Ptr = i->second->chans[0].channel;
+ // suggested by phidjit and FCS
+ if ((!common_channels(user,i->second)) && (isnick(i->second->nick)))
{
- WriteServ(user->fd,"352 %s %s %s %s %s %s Hr@ :0 %s",user->nick, Ptr->name, i->second->ident, i->second->dhost, i->second->server, i->second->nick, i->second->fullname);
+ WriteServ(user->fd,"352 %s %s %s %s %s %s Hr@ :0 %s",user->nick, Ptr ? Ptr->name : "*", i->second->ident, i->second->dhost, i->second->server, i->second->nick, i->second->fullname);
+ n_list++;
+ if (n_list > MaxWhoResults)
+ break;
}
}
}