/* modules/m_monitor.c
- *
+ *
* Copyright (C) 2005 Lee Hardy <lee@leeh.co.uk>
* Copyright (C) 2005 ircd-ratbox development team
*
*/
#include "stdinc.h"
-#include "tools.h"
#include "client.h"
#include "msg.h"
#include "parse.h"
#include "monitor.h"
#include "numeric.h"
#include "s_conf.h"
+#include "send.h"
+#include "supported.h"
-static int m_monitor(struct Client *, struct Client *, int, const char **);
+static int monitor_init(void);
+static void monitor_deinit(void);
+static int m_monitor(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message monitor_msgtab = {
- "MONITOR", 0, 0, 0, MFLG_SLOW,
+ "MONITOR", 0, 0, 0, 0,
{mg_unreg, {m_monitor, 2}, mg_ignore, mg_ignore, mg_ignore, {m_monitor, 2}}
};
mapi_clist_av1 monitor_clist[] = { &monitor_msgtab, NULL };
-DECLARE_MODULE_AV1(monitor, NULL, NULL, monitor_clist, NULL, NULL, "$Revision: 312 $");
+DECLARE_MODULE_AV1(monitor, monitor_init, monitor_deinit, monitor_clist, NULL, NULL, "$Revision: 312 $");
+
+static int monitor_init(void)
+{
+ add_isupport("MONITOR", isupport_intptr, &ConfigFileEntry.max_monitor);
+ return 0;
+}
+
+static void monitor_deinit(void)
+{
+ delete_isupport("MONITOR");
+}
static void
add_monitor(struct Client *client_p, const char *nicks)
tmp = LOCAL_COPY(nicks);
- for(name = strtoken(&p, tmp, ","); name; name = strtoken(&p, NULL, ","))
+ for(name = rb_strtok_r(tmp, ",", &p); name; name = rb_strtok_r(NULL, ",", &p))
{
if(EmptyString(name) || strlen(name) > NICKLEN-1)
continue;
if(rb_dlink_list_length(&client_p->localClient->monitor_list) >=
- ConfigFileEntry.max_monitor)
+ (unsigned long)ConfigFileEntry.max_monitor)
{
char buf[100];
return;
}
+ if (!clean_nick(name, 0))
+ continue;
+
monptr = find_monitor(name, 1);
/* already monitoring this nick */
- if(dlinkFind(client_p, &monptr->users))
+ if(rb_dlinkFind(client_p, &monptr->users))
continue;
- dlinkAddAlloc(client_p, &monptr->users);
- dlinkAddAlloc(monptr, &client_p->localClient->monitor_list);
+ rb_dlinkAddAlloc(client_p, &monptr->users);
+ rb_dlinkAddAlloc(monptr, &client_p->localClient->monitor_list);
if((target_p = find_named_person(name)) != NULL)
{
- if(cur_onlen + strlen(target_p->name) +
+ if(cur_onlen + strlen(target_p->name) +
strlen(target_p->username) + strlen(target_p->host) + 3 >= BUFSIZE-3)
{
sendto_one(client_p, "%s", onbuf);
tmp = LOCAL_COPY(nicks);
- for(name = strtoken(&p, tmp, ","); name; name = strtoken(&p, NULL, ","))
+ for(name = rb_strtok_r(tmp, ",", &p); name; name = rb_strtok_r(NULL, ",", &p))
{
if(EmptyString(name))
continue;
rb_dlinkFindDestroy(client_p, &monptr->users);
rb_dlinkFindDestroy(monptr, &client_p->localClient->monitor_list);
+
+ free_monitor(monptr);
}
}
}
sendto_one(client_p, "%s", buf);
- sendto_one(client_p, form_str(RPL_ENDOFMONLIST),
+ sendto_one(client_p, form_str(RPL_ENDOFMONLIST),
me.name, client_p->name);
}
if((target_p = find_named_person(monptr->name)) != NULL)
{
- if(cur_onlen + strlen(target_p->name) +
+ if(cur_onlen + strlen(target_p->name) +
strlen(target_p->username) + strlen(target_p->host) + 3 >= BUFSIZE-3)
{
sendto_one(client_p, "%s", onbuf);
}
static int
-m_monitor(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
+m_monitor(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
switch(parv[1][0])
{
return 0;
}
-