+2009-07-04 Michael Poole <mdpoole@troilus.org>
+
+ * include/channel.h (RevealDelayedJoinIfNeeded): Declare.
+
+ * ircd/channel.c (RevealDelayedJoinIfNeeded): Implement.
+
+ * ircd/ircd_relay.c (relay_channel_message): Only reveal the user
+ if he passes the check_target_limit() test.
+ (relay_channel_notice): Likewise.
+
+ * ircd/m_wallchops.c (m_wallchops): Likewise.
+
+ * ircd/m_wallvoices.c (m_wallvoices): Likewise.
+
+ * ircd/s_user.c (check_target_limit): Micro-optimize to only check
+ the user's channel list for invites if we are about to deny it.
+
2009-03-25 Michael Poole <mdpoole@troilus.org>
* ircd/ircd.c (main): Unconditionally set +6 flag on self.
extern void del_invite(struct Client *cptr, struct Channel *chptr);
extern void list_set_default(void); /* this belongs elsewhere! */
+extern void RevealDelayedJoinIfNeeded(struct Client *sptr, struct Channel *chptr);
extern void RevealDelayedJoin(struct Membership *member);
extern void CheckDelayedJoins(struct Channel *chan);
struct Gline *gl_next; /**< Next G-line in linked list. */
struct Gline**gl_prev_p; /**< Previous pointer to this G-line. */
char *gl_user; /**< Username mask (or channel/realname mask). */
- char *gl_host; /**< Host prtion of mask. */
+ char *gl_host; /**< Host portion of mask. */
char *gl_reason; /**< Reason for G-line. */
time_t gl_expire; /**< Expiration timestamp. */
time_t gl_lastmod; /**< Last modification timestamp. */
time_t gl_lifetime; /**< Record expiration timestamp. */
struct irc_in_addr gl_addr; /**< IP address (for IP-based G-lines). */
- unsigned char gl_bits; /**< Usable bits in gl_addr. */
+ unsigned char gl_bits; /**< Bits in gl_addr used in the mask. */
unsigned int gl_flags; /**< G-line status flags. */
enum GlineLocalState gl_state;/**< G-line local state. */
};
"%H -d", chan);
}
}
+
+/** Send a join for the user if (s)he is a hidden member of the channel.
+ */
+void RevealDelayedJoinIfNeeded(struct Client *sptr, struct Channel *chptr)
+{
+ struct Membership *member = find_member_link(chptr, sptr);
+ if (member && IsDelayedJoin(member))
+ RevealDelayedJoin(member);
+}
/*
* This first: Almost never a server/service
*/
- if (!client_can_send_to_channel(sptr, chptr, 1)) {
+ if (!client_can_send_to_channel(sptr, chptr, 0)) {
send_reply(sptr, ERR_CANNOTSENDTOCHAN, chptr->chname);
return;
}
check_target_limit(sptr, chptr, chptr->chname, 0))
return;
+ RevealDelayedJoinIfNeeded(sptr, chptr);
sendcmdto_channel_butone(sptr, CMD_PRIVATE, chptr, cli_from(sptr),
SKIP_DEAF | SKIP_BURST, "%H :%s", chptr, text);
}
/*
* This first: Almost never a server/service
*/
- if (!client_can_send_to_channel(sptr, chptr, 1))
+ if (!client_can_send_to_channel(sptr, chptr, 0))
return;
if ((chptr->mode.mode & MODE_NOPRIVMSGS) &&
check_target_limit(sptr, chptr, chptr->chname, 0))
return;
+ RevealDelayedJoinIfNeeded(sptr, chptr);
sendcmdto_channel_butone(sptr, CMD_NOTICE, chptr, cli_from(sptr),
SKIP_DEAF | SKIP_BURST, "%H :%s", chptr, text);
}
return send_reply(sptr, ERR_NOTEXTTOSEND);
if (IsChannelName(parv[1]) && (chptr = FindChannel(parv[1]))) {
- if (client_can_send_to_channel(sptr, chptr, 1)) {
+ if (client_can_send_to_channel(sptr, chptr, 0)) {
if ((chptr->mode.mode & MODE_NOPRIVMSGS) &&
check_target_limit(sptr, chptr, chptr->chname, 0))
return 0;
+ RevealDelayedJoinIfNeeded(sptr, chptr);
sendcmdto_channel_butone(sptr, CMD_WALLCHOPS, chptr, cptr,
SKIP_DEAF | SKIP_BURST | SKIP_NONOPS,
"%H :@ %s", chptr, parv[parc - 1]);
return send_reply(sptr, ERR_NOTEXTTOSEND);
if (IsChannelName(parv[1]) && (chptr = FindChannel(parv[1]))) {
- if (client_can_send_to_channel(sptr, chptr, 1)) {
+ if (client_can_send_to_channel(sptr, chptr, 0)) {
if ((chptr->mode.mode & MODE_NOPRIVMSGS) &&
check_target_limit(sptr, chptr, chptr->chname, 0))
return 0;
+ RevealDelayedJoinIfNeeded(sptr, chptr);
sendcmdto_channel_butone(sptr, CMD_WALLVOICES, chptr, cptr,
SKIP_DEAF | SKIP_BURST | SKIP_NONVOICES,
"%H :+ %s", chptr, parv[parc - 1]);
assert(cli_local(sptr));
targets = cli_targets(sptr);
- /* If user is invited to channel, give him/her a free target */
- if (IsChannelName(name) && IsInvited(sptr, target))
- return 0;
-
/*
* Same target as last time?
*/
*/
if (!created) {
if (CurrentTime < cli_nexttarget(sptr)) {
+ /* If user is invited to channel, give him/her a free target */
+ if (IsChannelName(name) && IsInvited(sptr, target))
+ return 0;
+
if (cli_nexttarget(sptr) - CurrentTime < TARGET_DELAY + 8) {
/*
* No server flooding
"HUB" = "TRUE";
"CONFIG_OPERCMDS" = "TRUE";
"CHANNELLEN" = "50";
+ "MAXCHANNELSPERUSER" = "20";
};