#include "stdinc.h"
#include "channel.h"
+#include "chmode.h"
#include "client.h"
#include "common.h"
#include "hash.h"
free_channel(struct Channel *chptr)
{
rb_free(chptr->chname);
+ rb_free(chptr->mode_lock);
rb_bh_free(channel_heap, chptr);
}
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);
}
}
+
+void
+resv_chan_forcepart(const char *name, const char *reason, int temp_time)
+{
+ rb_dlink_node *ptr;
+ rb_dlink_node *next_ptr;
+ struct Channel *chptr;
+ struct membership *msptr;
+ struct Client *target_p;
+
+ if(!ConfigChannel.resv_forcepart)
+ return;
+
+ /* for each user on our server in the channel list
+ * send them a PART, and notify opers.
+ */
+ chptr = find_channel(name);
+ if(chptr != NULL)
+ {
+ RB_DLINK_FOREACH_SAFE(ptr, next_ptr, chptr->locmembers.head)
+ {
+ msptr = ptr->data;
+ target_p = msptr->client_p;
+
+ if(IsExemptResv(target_p))
+ continue;
+
+ sendto_server(target_p, chptr, CAP_TS6, NOCAPS,
+ ":%s PART %s", target_p->id, chptr->chname);
+
+ sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s PART %s :%s",
+ target_p->name, target_p->username,
+ target_p->host, chptr->chname, target_p->name);
+
+ remove_user_from_channel(msptr);
+
+ /* notify opers & user they were removed from the channel */
+ sendto_realops_snomask(SNO_GENERAL, L_ALL,
+ "Forced PART for %s!%s@%s from %s (%s)",
+ target_p->name, target_p->username,
+ target_p->host, name, reason);
+
+ if(temp_time > 0)
+ sendto_one_notice(target_p, ":*** Channel %s is temporarily unavailable on this server.",
+ name);
+ else
+ sendto_one_notice(target_p, ":*** Channel %s is no longer available on this server.",
+ name);
+ }
+ }
+}