* Create a string of form "foo!bar@123.456.789.123" given foo, bar and the
* IP-number as the parameters. If NULL, they become "*".
*/
-#define NUI_BUFSIZE (NICKLEN + USERLEN + 16 + 3)
+#define NUI_BUFSIZE (NICKLEN + USERLEN + SOCKIPLEN + 4)
static char *make_nick_user_ip(char *ipbuf, char *nick, char *name,
- struct in_addr ip)
+ const struct irc_in_addr *ip)
{
- ircd_snprintf(0, ipbuf, NUI_BUFSIZE, "%s!%s@%s", nick, name,
- ircd_ntoa((const char*) &ip));
+ ircd_snprintf(0, ipbuf, NUI_BUFSIZE, "%s!%s@%s", nick, name, ircd_ntoa(ip));
return ipbuf;
}
if ((tmp->flags & CHFL_BAN_IPMASK)) {
if (!ip_s)
ip_s = make_nick_user_ip(nu_ip, cli_name(cptr),
- (cli_user(cptr))->username, cli_ip(cptr));
+ (cli_user(cptr))->username, &cli_ip(cptr));
if (match(tmp->value.ban.banstr, ip_s) == 0)
break;
}
- else if (match(tmp->value.ban.banstr, s) == 0)
+ if (match(tmp->value.ban.banstr, s) == 0)
break;
else if (sr && match(tmp->value.ban.banstr, sr) == 0)
break;
previous_parameter = 1;
}
if (*chptr->mode.upass) {
- *mbuf++ = 'u';
+ *mbuf++ = 'U';
if (previous_parameter)
strcat(pbuf, " ");
if (IsServer(cptr) || (member && IsChanOp(member) && OpLevel(member) == 0)) {
int opped_members_index = 0;
struct Membership** opped_members = NULL;
int last_oplevel = 0;
+ int feat_oplevels = (chptr->mode.mode & MODE_APASS) != 0;
assert(0 != cptr);
assert(0 != chptr);
* Do we have a nick with a new mode ?
* Or are we starting a new BURST line?
*/
- if (new_mode)
+ if (new_mode || !feat_oplevels)
{
/*
* This means we are at the _first_ member that has only
tbuf[loc++] = 'v';
if (IsChanOp(member)) /* flag_cnt == 2 or 3 */
{
- /* append the absolute value of the oplevel */
- loc += ircd_snprintf(0, tbuf + loc, sizeof(tbuf) - loc, "%u", member->oplevel);
- last_oplevel = member->oplevel;
+ /* append the absolute value of the oplevel */
+ if (feat_oplevels)
+ loc += ircd_snprintf(0, tbuf + loc, sizeof(tbuf) - loc, "%u", last_oplevel = member->oplevel);
+ else
+ tbuf[loc++] = 'o';
}
tbuf[loc] = '\0';
msgq_append(&me, mb, tbuf);
MODE_WASDELJOINS, 'd',
/* MODE_KEY, 'k', */
/* MODE_BAN, 'b', */
-/* MODE_LIMIT, 'l', */
+ MODE_LIMIT, 'l',
/* MODE_APASS, 'A', */
-/* MODE_UPASS, 'u', */
+/* MODE_UPASS, 'U', */
0x0, 0x0
};
int i;
mode_char = 'A';
break;
case MODE_UPASS:
- mode_char = 'u';
+ mode_char = 'U';
break;
default:
mode_char = 'b';
addbuf_i ? "+" : "", addbuf, remstr, addstr);
if (mbuf->mb_dest & MODEBUF_DEST_CHANNEL)
- sendcmdto_channel_butserv_butone(app_source, CMD_MODE, mbuf->mb_channel, NULL,
+ sendcmdto_channel_butserv_butone(app_source, CMD_MODE, mbuf->mb_channel, NULL, 0,
"%H %s%s%s%s%s%s", mbuf->mb_channel,
rembuf_i ? "-" : "", rembuf,
addbuf_i ? "+" : "", addbuf, remstr, addstr);
assert(0 != mbuf);
assert(0 != (mode & (MODE_ADD | MODE_DEL)));
+ if (mode == (MODE_LIMIT | MODE_DEL)) {
+ mbuf->mb_rem |= mode;
+ return;
+ }
MB_TYPE(mbuf, mbuf->mb_count) = mode;
MB_UINT(mbuf, mbuf->mb_count) = uint;
MODE_NOPRIVMSGS, 'n',
MODE_KEY, 'k',
MODE_APASS, 'A',
- MODE_UPASS, 'u',
+ MODE_UPASS, 'U',
/* MODE_BAN, 'b', */
MODE_LIMIT, 'l',
MODE_REGONLY, 'r',
build_string(buf, &bufpos, key, 0, ' ');
else if (buf[i] == 'l')
build_string(buf, &bufpos, limitbuf, 0, ' ');
- else if (buf[i] == 'u')
+ else if (buf[i] == 'U')
build_string(buf, &bufpos, upass, 0, ' ');
else if (buf[i] == 'A')
build_string(buf, &bufpos, apass, 0, ' ');
if (state->parc <= 0) { /* warn if not enough args */
if (MyUser(state->sptr))
- need_more_params(state->sptr, state->dir == MODE_ADD ? "MODE +u" :
- "MODE -u");
+ need_more_params(state->sptr, state->dir == MODE_ADD ? "MODE +U" :
+ "MODE -U");
return;
}
return;
}
+ /* If a non-service user is trying to force it, refuse. */
+ if (state->flags & MODE_PARSE_FORCE && !IsChannelService(state->sptr)) {
+ send_reply(state->sptr, ERR_NOTMANAGER, state->chptr->chname,
+ "Use /JOIN", state->chptr->chname, " <AdminPass>.");
+ return;
+ }
+
/* If they are not the channel manager, they are not allowed to change it */
if (MyUser(state->sptr) && !IsChannelManager(state->member)) {
if (*state->chptr->mode.apass) {
if (!*t_str) { /* warn if empty */
if (MyUser(state->sptr))
- need_more_params(state->sptr, state->dir == MODE_ADD ? "MODE +u" :
- "MODE -u");
+ need_more_params(state->sptr, state->dir == MODE_ADD ? "MODE +U" :
+ "MODE -U");
return;
}
return;
}
+ /* If a non-service user is trying to force it, refuse. */
+ if (state->flags & MODE_PARSE_FORCE && !IsChannelService(state->sptr)) {
+ send_reply(state->sptr, ERR_NOTMANAGER, state->chptr->chname,
+ "Use /JOIN", state->chptr->chname, " <AdminPass>.");
+ return;
+ }
+
/* Don't allow to change the Apass if the channel is older than 48 hours. */
if (TStime() - state->chptr->creationtime >= 172800 && !IsAnOper(state->sptr)) {
send_reply(state->sptr, ERR_CHANSECURED, state->chptr->chname);
MODE_NOPRIVMSGS, 'n',
MODE_KEY, 'k',
MODE_APASS, 'A',
- MODE_UPASS, 'u',
+ MODE_UPASS, 'U',
MODE_BAN, 'b',
MODE_LIMIT, 'l',
MODE_REGONLY, 'r',
mode_parse_apass(&state, flag_p);
break;
- case 'u': /* deal with user passes */
+ case 'U': /* deal with user passes */
if (feature_bool(FEAT_OPLEVELS))
mode_parse_upass(&state, flag_p);
break;
/* Send notification to channel */
if (!(flags & (CHFL_ZOMBIE | CHFL_DELAYED)))
- sendcmdto_channel_butserv_butone(jbuf->jb_source, CMD_PART, chan, NULL,
+ sendcmdto_channel_butserv_butone(jbuf->jb_source, CMD_PART, chan, NULL, 0,
(flags & CHFL_BANNED || !jbuf->jb_comment) ?
":%H" : "%H :%s", chan, jbuf->jb_comment);
else if (MyUser(jbuf->jb_source))
if (!((chan->mode.mode & MODE_DELJOINS) && !(flags & CHFL_VOICED_OR_OPPED))) {
/* Send the notification to the channel */
- sendcmdto_channel_butserv_butone(jbuf->jb_source, CMD_JOIN, chan, NULL, "%H", chan);
+ sendcmdto_channel_butserv_butone(jbuf->jb_source, CMD_JOIN, chan, NULL, 0, "%H", chan);
/* send an op, too, if needed */
if (!MyUser(jbuf->jb_source) && jbuf->jb_type == JOINBUF_TYPE_CREATE)
- sendcmdto_channel_butserv_butone(jbuf->jb_source, CMD_MODE, chan, NULL, "%H +o %C",
+ sendcmdto_channel_butserv_butone(jbuf->jb_source, CMD_MODE, chan, NULL, 0, "%H +o %C",
chan, jbuf->jb_source);
} else if (MyUser(jbuf->jb_source))
sendcmdto_one(jbuf->jb_source, CMD_JOIN, jbuf->jb_source, ":%H", chan);
void RevealDelayedJoin(struct Membership *member) {
ClearDelayedJoin(member);
- sendcmdto_channel_butserv_butone(member->user, CMD_JOIN, member->channel, member->user, ":%H",
+ sendcmdto_channel_butserv_butone(member->user, CMD_JOIN, member->channel, member->user, 0, ":%H",
member->channel);
CheckDelayedJoins(member->channel);
}
if (!memb2) {
/* clear +d */
chan->mode.mode &= ~MODE_WASDELJOINS;
- sendcmdto_channel_butserv_butone(&me, CMD_MODE, chan, NULL,
+ sendcmdto_channel_butserv_butone(&me, CMD_MODE, chan, NULL, 0,
"%H -d", chan);
}
}