Anonymous avatar Anonymous committed 4abd2b7

[svn] Allow /invite (but not invex) to override +r, +l, +j in
addition to +i. As before, a restrictive mode must be in
place at /invite time for the invite to have an effect;
+r does not count as a restrictive mode if the user is
logged in; +l and +j always count as restrictive modes to
allow for cases where they would allow join at /invite
time but not when the user tries to join.

Comments (0)

Files changed (4)

+jilles      2007/03/13 16:09:28 UTC	(20070313-3257)
+  Log:
+  Remove invite_ops_only, forcing it to YES.
+  
+
+  Changes:	Modified:
+  +0 -1		trunk/doc/example.conf (File Modified) 
+  +0 -5		trunk/doc/reference.conf (File Modified) 
+  +1 -3		trunk/doc/sgml/oper-guide/cmodes.sgml (File Modified) 
+  +0 -1		trunk/include/s_conf.h (File Modified) 
+  +0 -6		trunk/modules/m_info.c (File Modified) 
+  +10 -14	trunk/modules/m_invite.c (File Modified) 
+  +0 -1		trunk/src/newconf.c (File Modified) 
+  +0 -1		trunk/src/s_conf.c (File Modified) 
+
+
 jilles      2007/03/06 14:07:11 UTC	(20070306-3255)
   Log:
   Move username check after xline and dnsbl checks, so it
-#define SERNO "20070306-3255"
+#define SERNO "20070313-3257"

modules/m_invite.c

  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
  *  USA
  *
- *  $Id: m_invite.c 3257 2007-03-13 16:09:28Z jilles $
+ *  $Id: m_invite.c 3259 2007-03-15 18:09:08Z jilles $
  */
 
 #include "stdinc.h"
 	{mg_unreg, {m_invite, 3}, {m_invite, 3}, mg_ignore, mg_ignore, {m_invite, 3}}
 };
 mapi_clist_av1 invite_clist[] = { &invite_msgtab, NULL };
-DECLARE_MODULE_AV1(invite, NULL, NULL, invite_clist, NULL, NULL, "$Revision: 3257 $");
+DECLARE_MODULE_AV1(invite, NULL, NULL, invite_clist, NULL, NULL, "$Revision: 3259 $");
 
 static void add_invite(struct Channel *, struct Client *);
 
 		return 0;
 	}
 
-	/* only store invites for +i channels */
 	/* unconditionally require ops, unless the channel is +g */
 	/* treat remote clients as chanops */
 	if(MyClient(source_p) && !is_chanop(msptr) &&
 		return 0;
 	}
 
-	if(chptr->mode.mode & MODE_INVITEONLY)
+	/* store invites when they could affect the ability to join
+	 * for +l/+j just check if the mode is set, this varies over time
+	 */
+	if(chptr->mode.mode & MODE_INVITEONLY ||
+			(chptr->mode.mode & MODE_REGONLY && EmptyString(target_p->user->suser)) ||
+			chptr->mode.limit || chptr->mode.join_num)
 		store_invite = 1;
 
 	if(MyConnect(source_p))
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
  *  USA
  *
- *  $Id: channel.c 3173 2007-01-31 23:57:18Z jilles $
+ *  $Id: channel.c 3259 2007-03-15 18:09:08Z jilles $
  */
 
 #include "stdinc.h"
 int
 can_join(struct Client *source_p, struct Channel *chptr, char *key)
 {
-	dlink_node *lp;
+	dlink_node *invite = NULL;
 	dlink_node *ptr;
 	struct Ban *invex = NULL;
 	char src_host[NICKLEN + USERLEN + HOSTLEN + 6];
 	char src_iphost[NICKLEN + USERLEN + HOSTLEN + 6];
 	char src_althost[NICKLEN + USERLEN + HOSTLEN + 6];
 	int use_althost = 0;
+	int i = 0;
 	hook_data_channel moduledata;
 
 	s_assert(source_p->localClient != NULL);
 
 	if(chptr->mode.mode & MODE_INVITEONLY)
 	{
-		DLINK_FOREACH(lp, source_p->user->invited.head)
+		DLINK_FOREACH(invite, source_p->user->invited.head)
 		{
-			if(lp->data == chptr)
+			if(invite->data == chptr)
 				break;
 		}
-		if(lp == NULL)
+		if(invite == NULL)
 		{
 			if(!ConfigChannel.use_invex)
 				return (ERR_INVITEONLYCHAN);
 
 	if(chptr->mode.limit &&
 	   dlink_list_length(&chptr->members) >= (unsigned long) chptr->mode.limit)
-		return (ERR_CHANNELISFULL);
-
+		i = ERR_CHANNELISFULL;
 	if(chptr->mode.mode & MODE_REGONLY && EmptyString(source_p->user->suser))
-		return ERR_NEEDREGGEDNICK;
-
+		i = ERR_NEEDREGGEDNICK;
 	/* join throttling stuff --nenolod */
-	if(chptr->mode.join_num > 0 && chptr->mode.join_time > 0)
+	else if(chptr->mode.join_num > 0 && chptr->mode.join_time > 0)
 	{
 		if ((CurrentTime - chptr->join_delta <= 
 			chptr->mode.join_time) && (chptr->join_count >=
 			chptr->mode.join_num))
-			return ERR_THROTTLE;
+			i = ERR_THROTTLE;
+	}
+
+	/* allow /invite to override +l/+r/+j also -- jilles */
+	if (i != 0 && invite == NULL)
+	{
+		DLINK_FOREACH(invite, source_p->user->invited.head)
+		{
+			if(invite->data == chptr)
+				break;
+		}
+		if (invite == NULL)
+			return i;
 	}
 
 	moduledata.client = source_p;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.