mirror of
https://github.com/matrix-construct/construct
synced 2024-12-30 17:34:04 +01:00
whowas: Abort listing if 90% of sendq is in use.
This commit is contained in:
parent
4e4a5fcc61
commit
df2516e6d8
1 changed files with 9 additions and 0 deletions
|
@ -64,6 +64,7 @@ m_whowas(struct Client *client_p, struct Client *source_p, int parc, const char
|
|||
char *p;
|
||||
const char *nick;
|
||||
char tbuf[26];
|
||||
long sendq_limit;
|
||||
|
||||
static time_t last_used = 0L;
|
||||
|
||||
|
@ -96,12 +97,20 @@ m_whowas(struct Client *client_p, struct Client *source_p, int parc, const char
|
|||
|
||||
nick = parv[1];
|
||||
|
||||
sendq_limit = get_sendq(client_p) * 9 / 10;
|
||||
|
||||
temp = WHOWASHASH[hash_whowas_name(nick)];
|
||||
found = 0;
|
||||
for (; temp; temp = temp->next)
|
||||
{
|
||||
if(!irccmp(nick, temp->name))
|
||||
{
|
||||
if(cur > 0 && rb_linebuf_len(&client_p->localClient->buf_sendq) > sendq_limit)
|
||||
{
|
||||
sendto_one(source_p, form_str(ERR_TOOMANYMATCHES),
|
||||
me.name, source_p->name, "WHOWAS");
|
||||
break;
|
||||
}
|
||||
sendto_one(source_p, form_str(RPL_WHOWASUSER),
|
||||
me.name, source_p->name, temp->name,
|
||||
temp->username, temp->hostname, temp->realname);
|
||||
|
|
Loading…
Reference in a new issue