[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.
This commit is contained in:
parent
307328bb13
commit
1ebf4db4c6
4 changed files with 47 additions and 16 deletions
16
ChangeLog
16
ChangeLog
|
@ -1,3 +1,19 @@
|
|||
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
|
||||
|
|
|
@ -1 +1 @@
|
|||
#define SERNO "20070306-3255"
|
||||
#define SERNO "20070313-3257"
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
* 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"
|
||||
|
@ -48,7 +48,7 @@ struct Message invite_msgtab = {
|
|||
{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 *);
|
||||
|
||||
|
@ -125,7 +125,6 @@ m_invite(struct Client *client_p, struct Client *source_p, int parc, const char
|
|||
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) &&
|
||||
|
@ -136,7 +135,12 @@ m_invite(struct Client *client_p, struct Client *source_p, int parc, const char
|
|||
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))
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
* 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"
|
||||
|
@ -716,13 +716,14 @@ is_quieted(struct Channel *chptr, struct Client *who, struct membership *msptr,
|
|||
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);
|
||||
|
@ -751,12 +752,12 @@ can_join(struct Client *source_p, struct Channel *chptr, char *key)
|
|||
|
||||
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);
|
||||
|
@ -780,18 +781,28 @@ can_join(struct Client *source_p, struct Channel *chptr, char *key)
|
|||
|
||||
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;
|
||||
|
|
Loading…
Reference in a new issue