static struct channelList dead_channels;
/* These correspond to 1 << X: 012345678901234567 */
-const char irc_user_mode_chars[] = "o iw dkgn I";
+const char irc_user_mode_chars[] = "o iw dkgn x I";
static struct userNode *AddUser(struct server* uplink, const char *nick, const char *ident, const char *hostname, const char *modes, const char *numeric, const char *userinfo, unsigned long timestamp, const char *realip);
irc_gline(struct server *srv, struct gline *gline)
{
if (gline->lastmod)
- putsock("%s " P10_GLINE " %s +%s %lu %lu :%s",
- self->numeric, (srv ? srv->numeric : "*"), gline->target, (unsigned long)(gline->expires-now), (unsigned long)gline->lastmod, gline->reason);
+ putsock("%s " P10_GLINE " %s +%s %lu %lu %lu :%s",
+ self->numeric, (srv ? srv->numeric : "*"), gline->target, gline->expires, gline->lastmod, gline->lifetime, gline->reason);
else
putsock("%s " P10_GLINE " %s +%s %lu :%s",
- self->numeric, (srv ? srv->numeric : "*"), gline->target, (unsigned long)(gline->expires-now), gline->reason);
+ self->numeric, (srv ? srv->numeric : "*"), gline->target, gline->expires, gline->reason);
}
void
void
irc_ungline(const char *mask)
{
- putsock("%s " P10_GLINE " * -%s", self->numeric, mask);
+ putsock("%s " P10_GLINE " * -%s %lu", self->numeric, mask, now);
}
/* Return negative if *(struct modeNode**)pa is "less than" pb,
static CMD_FUNC(cmd_num_gline)
{
unsigned long lastmod;
+ unsigned long lifetime;
+
if (argc < 6)
return 0;
lastmod = (argc > 5) ? strtoul(argv[5], NULL, 0) : 0;
- gline_add(origin, argv[3], atoi(argv[4])-now, argv[argc - 1], now, lastmod, 0);
+ lifetime = (argc > 6) ? strtoul(argv[6], NULL, 0) : 0;
+ gline_add(origin, argv[3], atoi(argv[4])-now, argv[argc - 1], now, lastmod, lifetime, 0);
return 1;
}
static CMD_FUNC(cmd_gline)
{
+#define PASTWATCH (5*365*24*3600)
unsigned long lastmod;
+ unsigned long lifetime;
+ unsigned long expiration;
if (argc < 3)
return 0;
if (argv[2][0] == '+') {
if (argc < 5)
return 0;
- lastmod = (argc > 5) ? strtoul(argv[5], NULL, 0) : 0;
- gline_add(origin, argv[2]+1, strtoul(argv[3], NULL, 0), argv[argc-1], now, lastmod, 0);
+ expiration = strtoul(argv[3], NULL, 10);
+ if (expiration < now - PASTWATCH)
+ expiration += now;
+ lastmod = (argc > 5) ? strtoul(argv[4], NULL, 10) : 0;
+ lifetime = (argc > 6) ? strtoul(argv[5], NULL, 10) : 0;
+ gline_add(origin, argv[2]+1, expiration - now, argv[argc-1], now, lastmod, lifetime, 0);
return 1;
} else if (argv[2][0] == '-') {
gline_remove(argv[2]+1, 0);
return 1;
}
+static CMD_FUNC(cmd_time)
+{
+ extern int clock_skew;
+ char buf[MAXLEN];
+ struct userNode *who;
+ time_t when;
+
+ who = GetUserH(origin);
+ if (!who)
+ return 0;
+
+ when = time(NULL);
+ strftime(buf, sizeof(buf), "%a %b %d %Y -- %H:%M %z", localtime(&when));
+ irc_numeric(who, 391, "%s %lu %d :%s", self->name, now, clock_skew, buf);
+ return 1;
+}
+
void
free_user(struct userNode *user)
{
dict_insert(irc_func_dict, TOK_VERSION, cmd_version);
dict_insert(irc_func_dict, CMD_ADMIN, cmd_admin);
dict_insert(irc_func_dict, TOK_ADMIN, cmd_admin);
+ dict_insert(irc_func_dict, CMD_TIME, cmd_time);
+ dict_insert(irc_func_dict, TOK_TIME, cmd_time);
/* In P10, DESTRUCT doesn't do anything except be broadcast to servers.
* Apparently to obliterate channels from any servers that think they
char mask[MAXLEN];
char *host, *ident;
unsigned int ii;
+
for (ii=0; (*word != ' ') && (*word != '\0'); )
mask[ii++] = *word++;
mask[ii] = 0;
ident = NULL;
host = mask;
}
+ user->modes |= FLAGS_HIDDEN_HOST;
assign_fakehost(user, host, ident, 0, 0);
}
break;
}
break;
case 'U':
+ if (flags & MCP_NO_APASS)
+ goto error;
if (add)
{
if ((in_arg >= argc)
}
break;
case 'A':
+ if (flags & MCP_NO_APASS)
+ goto error;
if (add) {
if ((in_arg >= argc)
|| keyncpy(change->new_apass, modes[in_arg++], sizeof(change->new_apass)))