* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
- * $Id: channel.c 3131 2007-01-21 15:36:31Z 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;
sendto_realops_snomask(SNO_BOTS, L_ALL,
"User %s (%s@%s) trying to join %s is a possible spambot",
source_p->name,
- source_p->username, source_p->host, name);
+ source_p->username, source_p->orighost, name);
else
sendto_realops_snomask(SNO_BOTS, L_ALL,
"User %s (%s@%s) is a possible spambot",
source_p->name,
- source_p->username, source_p->host);
+ source_p->username, source_p->orighost);
source_p->localClient->oper_warn_count_down = OPER_SPAM_COUNTDOWN;
}
}