#include "hash.h"
#include "common.h"
#include "hash.h"
-#include "irc_string.h"
+#include "match.h"
#include "ircd.h"
#include "numeric.h"
-#include "commio.h"
#include "s_serv.h"
#include "s_conf.h"
#include "s_newconf.h"
#include "msg.h"
#include "parse.h"
#include "modules.h"
+#include "logger.h"
static int mo_scan(struct Client *, struct Client *, int, const char **);
static int scan_umodes(struct Client *, struct Client *, int, const char **);
/*
* m_scan
- * parv[0] = sender prefix
* parv[1] = options [or target]
* parv[2] = [target]
*/
int what = MODE_ADD;
int mode;
int list_users = YES;
- int list_max = 0;
+ int list_max = 500;
int list_count = 0, count = 0;
const char *mask = NULL;
const char *c;
struct Client *target_p;
- dlink_list *target_list = &lclient_list; /* local clients only by default */
- dlink_node *tn;
+ rb_dlink_list *target_list = &lclient_list; /* local clients only by default */
+ rb_dlink_node *tn;
int i;
const char *sockhost;
char buf[512];
return -1;
}
+ if (parv[2][0] != '+' && parv[2][0] != '-')
+ {
+ sendto_one_notice(source_p, ":SCAN UMODES: umodes parameter must start with '+' or '-'");
+ return -1;
+ }
+
for (c = parv[2]; *c; c++)
{
switch(*c)
list_max = atoi(parv[++i]);
else if (!irccmp(parv[i], "mask"))
mask = parv[++i];
+ else
+ {
+ sendto_one_notice(source_p, ":SCAN UMODES: invalid parameters");
+ return -1;
+ }
+ }
+ else
+ {
+ sendto_one_notice(source_p, ":SCAN UMODES: invalid parameters");
+ return -1;
}
}
- if (target_list == &global_client_list && (list_users || mask))
+ if (target_list == &global_client_list && list_users)
{
if (IsOperSpy(source_p))
{
if (!ConfigFileEntry.operspy_dont_care_user_info)
{
- strlcpy(buf, "UMODES", sizeof buf);
+ rb_strlcpy(buf, "UMODES", sizeof buf);
for (i = 2; i < parc; i++)
{
- strlcat(buf, " ", sizeof buf);
- strlcat(buf, parv[i], sizeof buf);
+ rb_strlcat(buf, " ", sizeof buf);
+ rb_strlcat(buf, parv[i], sizeof buf);
}
report_operspy(source_p, "SCAN", buf);
}
}
}
- DLINK_FOREACH(tn, target_list->head)
+ RB_DLINK_FOREACH(tn, target_list->head)
{
unsigned int working_umodes = 0;
char maskbuf[BUFSIZE];
if (mask != NULL)
{
- ircsnprintf(maskbuf, BUFSIZE, "%s!%s@%s",
+ rb_snprintf(maskbuf, BUFSIZE, "%s!%s@%s",
target_p->name, target_p->username, target_p->host);
if (!match(mask, maskbuf))