* @param[in] banlist The list of bans to test.
* @return Pointer to a matching ban, or NULL if none exit.
*/
-struct Ban *find_ban(struct Client *cptr, struct Ban *banlist)
+static struct Ban *find_ban_with_nick(struct Client *cptr, const char *nick, struct Ban *banlist)
{
char nu[NICKLEN + USERLEN + 2];
char tmphost[HOSTLEN + 1];
/* Build nick!user and alternate host names. */
ircd_snprintf(0, nu, sizeof(nu), "%s!%s",
- cli_name(cptr), cli_user(cptr)->username);
+ (nick ? nick : cli_name(cptr)), cli_user(cptr)->username);
ircd_ntoa_r(iphost, &cli_ip(cptr));
/* Check for all three possible hosts:
return found;
}
+struct Ban *find_ban(struct Client *cptr, struct Ban *banlist) {
+ return find_ban_with_nick(cptr, NULL, banlist);
+}
+
/**
* This function returns true if the user is banned on the said channel.
* This function will check the ban cache if applicable, otherwise will
}
}
+static int is_banned_with_nick(struct Membership* member, const char *nick) {
+ if (find_ban_with_nick(member->user, nick, member->channel->banlist))
+ return 1;
+ else
+ return 0;
+}
+
/** add a user to a channel.
* adds a user to a channel by adding another link to the channels member
* chain.
*/
if (!member) {
if ((chptr->mode.mode & (MODE_NOPRIVMSGS|MODE_MODERATED)) ||
- ((chptr->mode.mode & MODE_REGONLY) && !IsAccount(cptr)))
+ ((chptr->mode.mode & MODE_REGONLY) && !IsAccount(cptr)) ||
+ ((chptr->mode.mode & MODE_SSLCHAN) && !IsSSL(cptr)))
return 0;
else
return !find_ban(cptr, chptr->banlist);
* the name of the first channel banned on.
*
* @param cptr The client
+ * @param new_nick The new nick of the client
*
* @returns the name of the first channel banned on, or NULL if the user
* can change nicks.
*/
-const char* find_no_nickchange_channel(struct Client* cptr)
+const char* find_no_nickchange_channel(struct Client* cptr, const char *new_nick)
{
if (MyUser(cptr)) {
struct Membership* member;
continue;
if ((member->channel->mode.mode & MODE_MODERATED)
|| (member->channel->mode.mode & MODE_REGONLY && !IsAccount(cptr))
- || is_banned(member))
+ || (member->channel->mode.mode & MODE_SSLCHAN && !IsSSL(cptr))
+ || is_banned(member) || (new_nick && is_banned_with_nick(member, new_nick)))
return member->channel->chname;
}
}
*mbuf++ = 'Q';
if (chptr->mode.mode & MODE_AUDITORIUM)
*mbuf++ = 'u';
+ if (chptr->mode.mode & MODE_SSLCHAN)
+ *mbuf++ = 'S';
if (chptr->mode.limit) {
*mbuf++ = 'l';
ircd_snprintf(0, pbuf, buflen, "%u", chptr->mode.limit);
MODE_NONOTICE, 'N',
MODE_QUARANTINE, 'Q',
MODE_AUDITORIUM, 'u',
+ MODE_SSLCHAN, 'S',
0x0, 0x0
};
static ulong64 local_flags[] = {
MODE_TOPICLIMIT | MODE_INVITEONLY | MODE_NOPRIVMSGS | MODE_REGONLY |
MODE_DELJOINS | MODE_WASDELJOINS | MODE_REGISTERED | MODE_PERSIST |
MODE_NOCOLOUR | MODE_NOCTCP | MODE_NOAMSGS | MODE_NONOTICE |
- MODE_QUARANTINE | MODE_AUDITORIUM);
+ MODE_QUARANTINE | MODE_AUDITORIUM | MODE_SSLCHAN);
if (!(mode & ~(MODE_ADD | MODE_DEL))) /* don't add empty modes... */
return;
MODE_ALTCHAN, 'F',
MODE_ACCESS, 'a',
MODE_AUDITORIUM, 'u',
+ MODE_SSLCHAN, 'S',
MODE_NOFLOOD, 'f',
0x0, 0x0
};
if (!IsChannelName(t_str) || !strIsIrcCh(t_str) || strlen(t_str) > IRCD_MIN(CHANNELLEN, feature_int(FEAT_CHANNELLEN)) || t_str[0] == '&') /* only parse it if it's a valid channel name! */
return;
- struct Channel *chptr;
- struct Membership *member;
- if (!(chptr = FindChannel(t_str)))
+ if(!(state->flags & MODE_PARSE_FORCE)) {
+ struct Channel *chptr;
+ struct Membership *member;
+ if (!(chptr = FindChannel(t_str)))
return;
- if(!(member = find_member_link(chptr, state->sptr)))
+ if(!(member = find_member_link(chptr, state->sptr)))
return;
- if(!IsChanOp(member)) {
+ if(!IsChanOp(member)) {
send_notoper(state);
return;
+ }
}
if (!(state->flags & MODE_PARSE_WIPEOUT) &&
MODE_ALTCHAN, 'F',
MODE_ACCESS, 'a',
MODE_AUDITORIUM, 'u',
+ MODE_SSLCHAN, 'S',
MODE_NOFLOOD, 'f',
MODE_ADD, '+',
MODE_DEL, '-',