* 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;
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);
that didn't fit (full==1) */
if (opped_members)
MyFree(opped_members);
+ if (feature_bool(FEAT_TOPIC_BURST) && (chptr->topic[0] != '\0'))
+ sendcmdto_one(&me, CMD_TOPIC, cptr, "%H %Tu %Tu :%s", chptr,
+ chptr->creationtime, chptr->topic_time, chptr->topic);
}
/*
int can_join(struct Client *sptr, struct Channel *chptr, char *key)
{
- struct SLink *lp;
int overrideJoin = 0;
/*
* Now a user CAN escape anything if invited -- Isomer
*/
- for (lp = (cli_user(sptr))->invited; lp; lp = lp->next)
- if (lp->value.chptr == chptr)
- return 0;
+ if (IsInvited(sptr, chptr))
+ return 0;
/* An oper can force a join on a local channel using "OVERRIDE" as the key.
a HACK(4) notice will be sent if he would not have been supposed
{
for (; chptr; chptr = chptr->next)
{
- if (!cli_user(cptr) || (!(HasPriv(cptr, PRIV_LIST_CHAN) && IsAnOper(cptr)) &&
- SecretChannel(chptr) && !find_channel_member(cptr, chptr)))
+ if (!cli_user(cptr))
+ continue;
+ if (!(HasPriv(cptr, PRIV_LIST_CHAN) && IsAnOper(cptr)) &&
+ SecretChannel(chptr) && !find_channel_member(cptr, chptr))
continue;
if (chptr->users > args->min_users && chptr->users < args->max_users &&
chptr->creationtime > args->min_time &&
chptr->creationtime < args->max_time &&
- (!args->topic_limits || (*chptr->topic &&
+ (!(args->flags & LISTARG_TOPICLIMITS) || (*chptr->topic &&
chptr->topic_time > args->min_topic_time &&
chptr->topic_time < args->max_topic_time)))
{
- if (ShowChannel(cptr,chptr))
+ if ((args->flags & LISTARG_SHOWSECRET) || ShowChannel(cptr,chptr))
send_reply(cptr, RPL_LIST, chptr->chname, chptr->users,
chptr->topic);
chptr = chptr->next;
MODE_WASDELJOINS, 'd',
/* MODE_KEY, 'k', */
/* MODE_BAN, 'b', */
-/* MODE_LIMIT, 'l', */
+ MODE_LIMIT, 'l',
/* MODE_APASS, 'A', */
/* MODE_UPASS, 'u', */
0x0, 0x0
if (mbuf->mb_dest & MODEBUF_DEST_HACK4)
sendto_opmask_butone(0, SNO_HACK4, "HACK(4): %s MODE %s %s%s%s%s%s%s "
"[%Tu]",
-#ifdef HEAD_IN_SAND_SNOTICES
- cli_name(mbuf->mb_source),
-#else
- cli_name(app_source),
-#endif
+ cli_name(feature_bool(FEAT_HIS_SNOTICES) ?
+ mbuf->mb_source : app_source),
mbuf->mb_channel->chname,
rembuf_i ? "-" : "", rembuf, addbuf_i ? "+" : "",
addbuf, remstr, addstr,
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;
state->parc--;
state->max_args--;
+ if ((int)t_limit<0) /* don't permit a negative limit */
+ return;
+
if (!(state->flags & MODE_PARSE_WIPEOUT) &&
(!t_limit || t_limit == state->chptr->mode.limit))
return;
return;
}
+ /* Can't remove a limit that's not there */
+ if (state->dir == MODE_DEL && !state->chptr->mode.limit)
+ return;
+
+ /* Skip if this is a burst and a lower limit than this is set already */
+ if ((state->flags & MODE_PARSE_BURST) &&
+ (state->chptr->mode.mode & flag_p[0]) &&
+ (state->chptr->mode.limit < t_limit))
+ return;
+
if (state->done & DONE_LIMIT) /* allow limit to be set only once */
return;
state->done |= DONE_LIMIT;
/* clean up the key string */
s = t_str;
- while (*++s > ' ' && *s != ':' && --t_len)
- ;
+ while (*s > ' ' && *s != ':' && *s != ',' && t_len--)
+ s++;
*s = '\0';
if (!*t_str) { /* warn if empty */
if (!state->mbuf)
return;
+ /* Skip if this is a burst, we have a key already and the new key is
+ * after the old one alphabetically */
+ if ((state->flags & MODE_PARSE_BURST) &&
+ *(state->chptr->mode.key) &&
+ ircd_strcmp(state->chptr->mode.key, t_str) <= 0)
+ return;
+
/* can't add a key if one is set, nor can one remove the wrong key */
if (!(state->flags & MODE_PARSE_FORCE))
if ((state->dir == MODE_ADD && *state->chptr->mode.key) ||
if (MyUser(state->sptr)) {
/* don't allow local opers to be deopped on local channels */
- if (MyUser(state->sptr) &&
- state->cli_change[i].client != state->sptr &&
+ if (state->cli_change[i].client != state->sptr &&
IsLocalChannel(state->chptr->chname) &&
HasPriv(state->cli_change[i].client, PRIV_DEOP_LCHAN)) {
send_reply(state->sptr, ERR_ISOPERLCHAN,
/* 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);
}
}