void
irc_gline(struct server *srv, struct gline *gline)
{
+ //<prefix> GL <target> [!][+|-|>|<]<mask> [<expiration>] [<lastmod>] [<lifetime>] [:<reason>]
+ //expiration = relative time (seconds)
+ //lastmod = timestamp
+ //livetime = timestamp
if (gline->lastmod)
- 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);
+ putsock("%s " P10_GLINE " %s +%s %lu %lu %lu :%s", self->numeric, (srv ? srv->numeric : "*"),
+ gline->target, gline->expires-now, gline->lastmod, gline->lifetime, gline->reason);
else
- putsock("%s " P10_GLINE " %s +%s %lu :%s",
- self->numeric, (srv ? srv->numeric : "*"), gline->target, gline->expires, gline->reason);
+ putsock("%s " P10_GLINE " %s +%s %lu :%s", self->numeric, (srv ? srv->numeric : "*"),
+ gline->target, gline->expires-now, gline->reason);
}
void
} else {
devnull[0] = 0;
}
+ /*
if(!HANDLE_FLAGGED(hi, AUTOHIDE)) {
sprintf(tmp,"%s LA %s 0 %s\n",argv[3],hi->handle,devnull);
- } else if(getfakehost(argv[4])) {
+ } else */
+ if(getfakehost(argv[4])) {
sprintf(tmp,"%s LA %s %s %s\n",argv[3],hi->handle,getfakehost(argv[4]),devnull);
} else {
extern const char *hidden_host_suffix;
}
struct mod_chanmode *
-mod_chanmode_parse(struct chanNode *channel, char **modes, unsigned int argc, unsigned int flags, short base_oplevel)
+mod_chanmode_parse(struct chanNode *channel, struct userNode *user, char **modes, unsigned int argc, unsigned int flags, short base_oplevel)
{
struct mod_chanmode *change;
unsigned int ii, in_arg, ch_arg, add;
if (add) {
if (in_arg >= argc)
goto error;
+ char *altchan = modes[in_arg++];
+ struct chanNode *target;
+ if(!IsChannelName(altchan) || !(target = GetChannel(altchan)))
+ goto error;
+ if(!(flags & MCP_OPERMODE)) {
+ //check if the user has the permissions to use this channel as target
+ struct modeNode *mn;
+ struct userData *uData;
+ struct chanData *cData;
+ if(user && (mn = GetUserMode(target, user)) && (mn->modes & MODE_CHANOP)) {
+ //allow - user is opped on target channel
+ } else if(user && user->handle_info &&
+ (uData = GetChannelUser(channel->channel_info, user->handle_info)) &&
+ (cData = uData->channel) &&
+ uData->access >= cData->lvlOpts[lvlGiveOps]
+ ) {
+ //allow - user has access to get op on the channel
+ } else
+ goto error;
+ }
change->modes_set |= MODE_ALTCHAN;
- safestrncpy(change->new_altchan, modes[in_arg++], sizeof(change->new_altchan));
+ safestrncpy(change->new_altchan, altchan, sizeof(change->new_altchan));
} else {
change->modes_clear |= MODE_ALTCHAN;
}