*
* $Id$
*/
+#include "config.h"
+
#include "channel.h"
#include "client.h"
#include "hash.h"
#include "ircd_alloc.h"
#include "ircd_chattr.h"
#include "ircd_defs.h"
+#include "ircd_features.h"
#include "ircd_log.h"
+#include "ircd_policy.h"
#include "ircd_reply.h"
#include "ircd_snprintf.h"
#include "ircd_string.h"
if (who)
return who;
- if (!(who = get_history(user, KILLCHASETIMELIMIT))) {
+ if (!(who = get_history(user, feature_int(FEAT_KILLCHASETIMELIMIT)))) {
send_reply(sptr, ERR_NOSUCHNICK, user);
return 0;
}
banp = &(*banp)->next;
}
}
- if (MyUser(cptr) && !removed_bans && (len > MAXBANLENGTH || (cnt >= MAXBANS)))
+ if (MyUser(cptr) && !removed_bans &&
+ (len > (feature_int(FEAT_AVBANLEN) * feature_int(FEAT_MAXBANS)) ||
+ (cnt >= feature_int(FEAT_MAXBANS))))
{
send_reply(cptr, ERR_BANLISTFULL, chptr->chname, banid);
return -1;
assert(0 != ban->value.ban.banstr);
strcpy(ban->value.ban.banstr, banid);
- ban->value.ban.who = (char*) MyMalloc(strlen(cli_name(cptr)) + 1);
+#ifdef HEAD_IN_SAND_BANWHO
+ if (IsServer(cptr))
+ DupString(ban->value.ban.who, cli_name(&me));
+ else
+#endif
+ DupString(ban->value.ban.who, cli_name(cptr));
assert(0 != ban->value.ban.who);
- strcpy(ban->value.ban.who, cli_name(cptr));
ban->value.ban.when = TStime();
ban->flags = CHFL_BAN; /* This bit is never used I think... */
/*
* You can't speak if your off channel, if the channel is modeless, or
- * +n.(no external messages)
+ * +n (no external messages) or +m (moderated).
*/
if (!member) {
- if ((chptr->mode.mode & MODE_NOPRIVMSGS) || IsModelessChannel(chptr->chname))
+ if ((chptr->mode.mode & (MODE_NOPRIVMSGS|MODE_MODERATED))
+ || IsModelessChannel(chptr->chname))
return 0;
else
return 1;
if (*chptr->mode.key) {
*mbuf++ = 'k';
+ if (chptr->mode.limit)
+ strcat(pbuf, " ");
if (is_chan_op(cptr, chptr) || IsServer(cptr)) {
- if (chptr->mode.limit)
- strcat(pbuf, " ");
strcat(pbuf, chptr->mode.key);
- }
+ } else
+ strcat(pbuf, "*");
}
*mbuf = '\0';
}
* Delete last link in chain if the list is max length
*/
assert(list_length((cli_user(cptr))->invited) == (cli_user(cptr))->invites);
- if ((cli_user(cptr))->invites>=MAXCHANNELSPERUSER)
+ if ((cli_user(cptr))->invites >= feature_int(FEAT_MAXCHANNELSPERUSER))
del_invite(cptr, (cli_user(cptr))->invited->value.chptr);
/*
* Add client to channel invite list
(cli_listing(cptr))->chptr = chptr;
chptr->mode.mode |= MODE_LISTED;
}
+
+ update_write(cptr);
}
/*
} else if (state->dir == MODE_ADD) {
/* if the ban already exists, don't worry about it */
if (!ircd_strcmp(ban->value.ban.banstr, t_str)) {
+ newban->flags &= ~MODE_ADD; /* don't add ban at all */
+ MyFree(newban->value.ban.banstr); /* stopper a leak */
+ state->numbans--; /* deallocate last ban */
if (state->done & DONE_BANCLEAN) /* If we're cleaning, finish */
break;
- continue;
} else if (!mmatch(ban->value.ban.banstr, t_str)) {
if (!(ban->flags & MODE_DEL))
newban->flags |= CHFL_BAN_OVERLAPPED; /* our ban overlaps */
} else if (!mmatch(t_str, ban->value.ban.banstr))
ban->flags |= MODE_DEL; /* mark ban for deletion: overlapping */
- if (!ban->next) {
+ if (!ban->next && (newban->flags & MODE_ADD)) {
ban->next = newban; /* add our ban with its flags */
break; /* get out of loop */
}
MyFree(ban->value.ban.banstr);
} else {
if (state->flags & MODE_PARSE_SET && MyUser(state->sptr) &&
- (len > MAXBANLENGTH || count >= MAXBANS)) {
+ (len > (feature_int(FEAT_AVBANLEN) * feature_int(FEAT_MAXBANS)) ||
+ count >= feature_int(FEAT_MAXBANS))) {
send_reply(state->sptr, ERR_BANLISTFULL, state->chptr->chname,
ban->value.ban.banstr);
count--;