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 ed4109685dc2 include/channel.h
---- a/include/channel.h
-+++ b/include/channel.h
-@@ -462,5 +462,6 @@
+diff -r 5787dbfaa811 include/channel.h
+--- a/include/channel.h Sat Jul 20 11:50:29 2013 +0100
++++ b/include/channel.h Sat Jul 20 11:50:33 2013 +0100
+@@ -463,5 +463,6 @@
extern void free_ban(struct Ban *ban);
extern unsigned int get_channel_marker(void);
+extern int common_chan_count(struct Client *a, struct Client *b, int max);
#endif /* INCLUDED_channel_h */
-diff -r ed4109685dc2 include/client.h
---- a/include/client.h
-+++ b/include/client.h
+diff -r 5787dbfaa811 include/client.h
+--- a/include/client.h Sat Jul 20 11:50:29 2013 +0100
++++ b/include/client.h Sat Jul 20 11:50:33 2013 +0100
@@ -90,7 +90,7 @@
#define FlagClr(set,flag) ((set)->bits[FLAGSET_INDEX(flag)] &= ~FLAGSET_MASK(flag))
/** Character to indicate no oper name available */
#define NOOPERNAMECHARACTER '-'
-@@ -190,7 +190,8 @@
+@@ -191,6 +191,8 @@
+ FLAG_NOCHAN, /**< user's channels are hidden */
FLAG_NOIDLE, /**< user's idletime is hidden */
FLAG_XTRAOP, /**< oper has special powers */
- FLAG_OPERNAME, /**< Server sends oper name in mode string */
--
+ FLAG_COMMONCHANSONLY, /**< SNIRCD_q: hide privmsgs/notices if in no
+ common channels (with +ok exceptions) */
+
FLAG_LAST_FLAG, /**< number of flags */
FLAG_LOCAL_UMODES = FLAG_LOCOP, /**< First local mode flag */
- FLAG_GLOBAL_UMODES = FLAG_OPER /**< First global mode flag */
-@@ -622,6 +623,8 @@
+@@ -623,6 +625,8 @@
#define IsParanoid(x) HasFlag(x, FLAG_PARANOID)
/** Return non-zero if the server should send opername information */
#define IsSendOperName(x) HasFlag(x, FLAG_OPERNAME)
/** Return non-zero if the client has operator or server privileges. */
#define IsPrivileged(x) (IsAnOper(x) || IsServer(x))
-@@ -684,6 +687,8 @@
+@@ -689,6 +693,8 @@
#define SetAccountOnly(x) SetFlag(x, FLAG_ACCOUNTONLY)
/** Mark a client as having mode +P (paranoid). */
#define SetParanoid(x) SetFlag(x, FLAG_PARANOID)
/** Return non-zero if \a sptr sees \a acptr as an operator. */
#define SeeOper(sptr,acptr) (IsAnOper(acptr) && (HasPriv(acptr, PRIV_DISPLAY) \
-@@ -731,6 +736,8 @@
+@@ -738,6 +744,8 @@
#define ClearAccountOnly(x) ClrFlag(x, FLAG_ACCOUNTONLY)
/** Remove mode +P (paranoid) from a client */
#define ClearParanoid(x) ClrFlag(x, FLAG_PARANOID)
/* free flags */
#define FREEFLAG_SOCKET 0x0001 /**< socket needs to be freed */
-diff -r ed4109685dc2 include/numeric.h
---- a/include/numeric.h
-+++ b/include/numeric.h
+diff -r 5787dbfaa811 include/numeric.h
+--- a/include/numeric.h Sat Jul 20 11:50:29 2013 +0100
++++ b/include/numeric.h Sat Jul 20 11:50:33 2013 +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 ed4109685dc2 ircd/channel.c
---- a/ircd/channel.c
-+++ b/ircd/channel.c
-@@ -3818,3 +3818,39 @@
+diff -r 5787dbfaa811 ircd/channel.c
+--- a/ircd/channel.c Sat Jul 20 11:50:29 2013 +0100
++++ b/ircd/channel.c Sat Jul 20 11:50:33 2013 +0100
+@@ -3819,3 +3819,39 @@
return marker;
}
+
+ return count;
+}
-diff -r ed4109685dc2 ircd/ircd_relay.c
---- a/ircd/ircd_relay.c
-+++ b/ircd/ircd_relay.c
+diff -r 5787dbfaa811 ircd/ircd_relay.c
+--- a/ircd/ircd_relay.c Sat Jul 20 11:50:29 2013 +0100
++++ b/ircd/ircd_relay.c Sat Jul 20 11:50:33 2013 +0100
@@ -310,6 +310,10 @@
if (IsAccountOnly(acptr) && !IsAccount(sptr) && !IsXtraOp(sptr))
- return;
+ return;
+ /* slug: same applies here, since only opers can be +k */
+ if (IsCommonChansOnly(acptr) && !IsXtraOp(sptr) && !common_chan_count(acptr, sptr, 1))
/*
* deliver the message
*/
-diff -r ed4109685dc2 ircd/m_invite.c
---- a/ircd/m_invite.c
-+++ b/ircd/m_invite.c
+diff -r 5787dbfaa811 ircd/m_invite.c
+--- a/ircd/m_invite.c Sat Jul 20 11:50:29 2013 +0100
++++ b/ircd/m_invite.c Sat Jul 20 11:50:33 2013 +0100
@@ -171,6 +171,9 @@
return 0;
}
if (check_target_limit(sptr, acptr, cli_name(acptr), 0))
return 0;
-diff -r ed4109685dc2 ircd/s_err.c
---- a/ircd/s_err.c
-+++ b/ircd/s_err.c
+diff -r 5787dbfaa811 ircd/s_err.c
+--- a/ircd/s_err.c Sat Jul 20 11:50:29 2013 +0100
++++ b/ircd/s_err.c Sat Jul 20 11:50:33 2013 +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 ed4109685dc2 ircd/s_user.c
---- a/ircd/s_user.c
-+++ b/ircd/s_user.c
+diff -r 5787dbfaa811 ircd/s_user.c
+--- a/ircd/s_user.c Sat Jul 20 11:50:29 2013 +0100
++++ b/ircd/s_user.c Sat Jul 20 11:50:33 2013 +0100
@@ -540,7 +540,8 @@
{ FLAG_NOCHAN, 'n' },
{ FLAG_NOIDLE, 'I' },