#include "stdinc.h"
#include "channel.h"
+#include "chmode.h"
#include "client.h"
#include "common.h"
#include "hash.h"
source_p->localClient->oper_warn_count_down--;
else
source_p->localClient->oper_warn_count_down = 0;
- if(source_p->localClient->oper_warn_count_down == 0)
+ if(source_p->localClient->oper_warn_count_down == 0 &&
+ name != NULL)
{
/* Its already known as a possible spambot */
- if(name != NULL)
- sendto_realops_snomask(SNO_BOTS, L_NETWIDE,
- "User %s (%s@%s) trying to join %s is a possible spambot",
- source_p->name,
- source_p->username, source_p->orighost, name);
- else
- sendto_realops_snomask(SNO_BOTS, L_NETWIDE,
- "User %s (%s@%s) is a possible spambot",
- source_p->name,
- source_p->username, source_p->orighost);
+ sendto_realops_snomask(SNO_BOTS, L_NETWIDE,
+ "User %s (%s@%s) trying to join %s is a possible spambot",
+ source_p->name,
+ source_p->username, source_p->orighost, name);
source_p->localClient->oper_warn_count_down = OPER_SPAM_COUNTDOWN;
}
}
JOIN_LEAVE_COUNT_EXPIRE_TIME)
{
decrement_count = (t_delta / JOIN_LEAVE_COUNT_EXPIRE_TIME);
- if(decrement_count > source_p->localClient->join_leave_count)
+ if(name != NULL)
+ ;
+ else if(decrement_count > source_p->localClient->join_leave_count)
source_p->localClient->join_leave_count = 0;
else
source_p->localClient->join_leave_count -= decrement_count;
sendto_server(client_p, chptr, cap, nocap, "%s %s", modebuf, parabuf);
}
}
+
+/* Check what we will forward to, without sending any notices to the user
+ * -- jilles
+ */
+struct Channel *
+check_forward(struct Client *source_p, struct Channel *chptr,
+ char *key)
+{
+ int depth = 0, i;
+
+ /* User is +Q */
+ if (IsNoForward(source_p))
+ return NULL;
+
+ while (depth < 16)
+ {
+ chptr = find_channel(chptr->mode.forward);
+ /* Can only forward to existing channels */
+ if (chptr == NULL)
+ return NULL;
+ /* Already on there, show original error message */
+ if (IsMember(source_p, chptr))
+ return NULL;
+ /* Juped. Sending a warning notice would be unfair */
+ if (hash_find_resv(chptr->chname))
+ return NULL;
+ /* Don't forward to +Q channel */
+ if (chptr->mode.mode & MODE_DISFORWARD)
+ return NULL;
+ i = can_join(source_p, chptr, key);
+ if (i == 0)
+ return chptr;
+ if (i != ERR_INVITEONLYCHAN && i != ERR_NEEDREGGEDNICK && i != ERR_THROTTLE && i != ERR_CHANNELISFULL)
+ return NULL;
+ depth++;
+ }
+
+ return NULL;
+}