struct tls;
#endif
+#define MONITOR_LIMIT 100
+
#define SETBIT(var, bit, val) ((void)((val) ? ((var)|=(bit)) : ((var)&=~(bit))))
#define UMODE_INVISIBLE 1
#define UMODE_OPER 2
if (strchr(args[1], ' '))
return err_needmoreparams(client, command), sendbuf(client), 0; /* FIXME: wrong error */
stringlower(args[1]);
+ int monitor_count = 0;
+ map_foreach(&client->monitor, 0, 0)
+ monitor_count++;
char *p = args[1];
do {
char *nick = p;
+ if (monitor_count == MONITOR_LIMIT)
+ return rpl_monlistfull(client, MONITOR_LIMIT,nick), sendbuf(client), 0;
if ((p = strchr(nick, ',')))
*p++ = '\0';
- /* TODO: rpl_monlistfull */
- if (map_set(&client->monitor, nick, /* dummy */ nick, 0) == -1)
+ char *existing;
+ if (map_set(&client->monitor, nick, /* dummy */ nick, (void **)&existing) == -1)
abort();
+ monitor_count += !existing;
struct client_data *cl = map_get(&client_map, nick);
if (cl)
rpl_mononline(client, cl), sendbuf(client);
}
void rpl_isupport(struct client_data *client) // 005
{
- copy_strf(&databuf, ":%s 005 %s NETWORK=PatchyIRC CASEMAPPING=ascii NICKLEN=%u EXCEPTS=e INVEX=I MAXTARGETS=1 CHANMODES=beIqw,k,l,Pimnst CHANTYPES=#& PREFIX=(ov)@+ STATUSMSG=@+ BOT=B WHOX MONITOR :are supported by this server\r\n", hostname, client->nick, MAX_NICKLEN-1);
+ copy_strf(&databuf, ":%s 005 %s NETWORK=PatchyIRC CASEMAPPING=ascii NICKLEN=%u EXCEPTS=e INVEX=I MAXTARGETS=1 CHANMODES=beIqw,k,l,Pimnst CHANTYPES=#& PREFIX=(ov)@+ STATUSMSG=@+ BOT=B WHOX MONITOR=%u :are supported by this server\r\n", hostname, client->nick, MAX_NICKLEN-1, MONITOR_LIMIT);
}
#if 0
{
copy_strf(&databuf, ":%s 733 %s :End of MONITOR list\r\n", hostname, client->nick);
}
-#if 0
void rpl_monlistfull(struct client_data *client, int limit, const char *targets) // 734
{
copy_strf(&databuf, ":%s 734 %s %d %s :Monitor list is full.\r\n", hostname, client->nick, limit, targets);
}
-#endif
// 900 RPL_LOGGEDIN
// 901 RPL_LOGGEDOUT
// 902 ERR_NICKLOCKED