This is designed to stop the spam bots which sit outside a channel, while a spy sits inside, preventing channel operators dealing with the problem.
We currently also block invites, this might not be such a good idea, but these days everyone can get Q.
-diff -r f2182ca2442a include/channel.h
---- a/include/channel.h Sun Jan 11 22:53:16 2009 +0000
-+++ b/include/channel.h Sun Jan 11 22:54:00 2009 +0000
+diff -r 4296495df0fb include/channel.h
+--- a/include/channel.h Mon Jan 12 18:07:52 2009 +0100
++++ b/include/channel.h Mon Jan 12 18:14:16 2009 +0100
@@ -462,5 +462,6 @@
extern void free_ban(struct Ban *ban);
+extern int common_chan_count(struct Client *a, struct Client *b, int max);
#endif /* INCLUDED_channel_h */
-diff -r f2182ca2442a include/client.h
---- a/include/client.h Sun Jan 11 22:53:16 2009 +0000
-+++ b/include/client.h Sun Jan 11 22:54:00 2009 +0000
+diff -r 4296495df0fb include/client.h
+--- a/include/client.h Mon Jan 12 18:07:52 2009 +0100
++++ b/include/client.h Mon Jan 12 18:14:16 2009 +0100
@@ -90,7 +90,7 @@
#define FlagClr(set,flag) ((set)->bits[FLAGSET_INDEX(flag)] &= ~FLAGSET_MASK(flag))
/* free flags */
#define FREEFLAG_SOCKET 0x0001 /**< socket needs to be freed */
-diff -r f2182ca2442a include/numeric.h
---- a/include/numeric.h Sun Jan 11 22:53:16 2009 +0000
-+++ b/include/numeric.h Sun Jan 11 22:54:00 2009 +0000
+diff -r 4296495df0fb include/numeric.h
+--- a/include/numeric.h Mon Jan 12 18:07:52 2009 +0100
++++ b/include/numeric.h Mon Jan 12 18:14:16 2009 +0100
@@ -420,6 +420,7 @@
/* ERR_HTMDISABLED 486 unreal */
#define ERR_ACCOUNTONLY 486 /* QuakeNet/ASUKA extension */
/* ERR_TSLESSCHAN 488 IRCnet extension (?) */
#define ERR_VOICENEEDED 489 /* Undernet extension */
-diff -r f2182ca2442a ircd/channel.c
---- a/ircd/channel.c Sun Jan 11 22:53:16 2009 +0000
-+++ b/ircd/channel.c Sun Jan 11 22:54:00 2009 +0000
+diff -r 4296495df0fb ircd/channel.c
+--- a/ircd/channel.c Mon Jan 12 18:07:52 2009 +0100
++++ b/ircd/channel.c Mon Jan 12 18:14:16 2009 +0100
@@ -3801,3 +3801,39 @@
return marker;
+
+ return count;
+}
-diff -r f2182ca2442a ircd/ircd_relay.c
---- a/ircd/ircd_relay.c Sun Jan 11 22:53:16 2009 +0000
-+++ b/ircd/ircd_relay.c Sun Jan 11 22:54:00 2009 +0000
+diff -r 4296495df0fb ircd/ircd_relay.c
+--- a/ircd/ircd_relay.c Mon Jan 12 18:07:52 2009 +0100
++++ b/ircd/ircd_relay.c Mon Jan 12 18:14:17 2009 +0100
@@ -308,6 +308,10 @@
if (IsAccountOnly(acptr) && !IsAccount(sptr) && !IsXtraOp(sptr))
return;
if (!(is_silenced(sptr, acptr)))
sendcmdto_one(sptr, CMD_NOTICE, acptr, "%s :%s", name, text);
}
-@@ -399,6 +406,11 @@
- return;
- }
+@@ -396,6 +403,11 @@
-+ if (IsCommonChansOnly(acptr) && !IsXtraOp(sptr) && !common_chan_count(acptr, sptr, 1)) {
-+ send_reply(sptr, ERR_COMMONCHANSONLY, cli_name(acptr));
+ if (IsAccountOnly(acptr) && !IsAccount(sptr) && !IsXtraOp(sptr)) {
+ send_reply(sptr, ERR_ACCOUNTONLY, cli_name(acptr), feature_str(FEAT_URLREG));
+ return;
+ }
+
- /*
- * send away message if user away
- */
-@@ -443,6 +455,9 @@
- if (IsAccountOnly(acptr) && !IsAccount(sptr) && !IsXtraOp(sptr))
++ if (IsCommonChansOnly(acptr) && !IsXtraOp(sptr) && !common_chan_count(acptr, sptr, 1)) {
++ send_reply(sptr, ERR_COMMONCHANSONLY, cli_name(acptr));
return;
+ }
-+ if (IsCommonChansOnly(acptr) && !IsXtraOp(sptr) && !common_chan_count(acptr, sptr, 1))
+@@ -441,6 +453,9 @@
+ */
+
+ if (IsAccountOnly(acptr) && !IsAccount(sptr) && !IsXtraOp(sptr))
+ return;
+
++ if (IsCommonChansOnly(acptr) && !IsXtraOp(sptr) && !common_chan_count(acptr, sptr, 1))
+ return;
+
/*
- * deliver the message
- */
-diff -r f2182ca2442a ircd/m_invite.c
---- a/ircd/m_invite.c Sun Jan 11 22:53:16 2009 +0000
-+++ b/ircd/m_invite.c Sun Jan 11 22:54:00 2009 +0000
+diff -r 4296495df0fb ircd/m_invite.c
+--- a/ircd/m_invite.c Mon Jan 12 18:07:52 2009 +0100
++++ b/ircd/m_invite.c Mon Jan 12 18:14:17 2009 +0100
@@ -171,6 +171,9 @@
return 0;
}
if (check_target_limit(sptr, acptr, cli_name(acptr), 0))
return 0;
-diff -r f2182ca2442a ircd/s_err.c
---- a/ircd/s_err.c Sun Jan 11 22:53:16 2009 +0000
-+++ b/ircd/s_err.c Sun Jan 11 22:54:00 2009 +0000
+diff -r 4296495df0fb ircd/s_err.c
+--- a/ircd/s_err.c Mon Jan 12 18:07:52 2009 +0100
++++ b/ircd/s_err.c Mon Jan 12 18:14:17 2009 +0100
@@ -1006,7 +1006,7 @@
/* 486 */
{ ERR_ACCOUNTONLY, "%s :You must be authed in order to message this user -- For details of how to obtain an account visit %s", "486" },
/* 488 */
{ 0 },
/* 489 */
-diff -r f2182ca2442a ircd/s_user.c
---- a/ircd/s_user.c Sun Jan 11 22:53:16 2009 +0000
-+++ b/ircd/s_user.c Sun Jan 11 22:54:00 2009 +0000
+diff -r 4296495df0fb ircd/s_user.c
+--- a/ircd/s_user.c Mon Jan 12 18:07:52 2009 +0100
++++ b/ircd/s_user.c Mon Jan 12 18:14:17 2009 +0100
@@ -546,7 +546,8 @@
{ FLAG_NOCHAN, 'n' },
{ FLAG_NOIDLE, 'I' },
if (is_notice)
sendcmdto_one(source, CMD_NOTICE, dest, "%C :%s", dest, text);
else
-@@ -1428,6 +1431,12 @@
+@@ -1427,6 +1430,12 @@
+ SetParanoid(sptr);
else
ClearParanoid(sptr);
- break;
++ break;
+ case 'q':
+ if (what == MODE_ADD)
+ SetCommonChansOnly(sptr);
+ else
+ ClearCommonChansOnly(sptr);
-+ break;
+ break;
case 'r':
if ((what == MODE_ADD) && *(p + 1)) {
- account = *(++p);