Skip to content

Commit

Permalink
Move the check for max number of channels limit into can_join so that…
Browse files Browse the repository at this point in the history
… is applies everywhere instead of just one place
  • Loading branch information
cryogen committed Jul 13, 2016
1 parent bf1fd8b commit 6e334f7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 4 additions & 10 deletions modules/core/m_join.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,6 @@ m_join(struct Client *client_p, struct Client *source_p,
continue;
}

if ((dlink_list_length(&source_p->channel) >= ConfigChannel.max_chans_per_user) &&
(!IsOper(source_p) || (dlink_list_length(&source_p->channel) >=
ConfigChannel.max_chans_per_user * 3)))
{
sendto_one(source_p, form_str(ERR_TOOMANYCHANNELS),
me.name, source_p->name, chan);
break;
}

if ((chptr = hash_find_channel(chan)) != NULL)
{
if (IsMember(source_p, chptr))
Expand Down Expand Up @@ -238,7 +229,10 @@ m_join(struct Client *client_p, struct Client *source_p,
{
sendto_one(source_p, form_str(i), me.name,
source_p->name, chptr->chname);
continue;
if(i == ERR_TOOMANYCHANNELS)
break;
else
continue;
}

if(i != 0 && IsGod(source_p) && MyClient(source_p))
Expand Down
6 changes: 6 additions & 0 deletions src/channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,12 @@ can_join(struct Client *source_p, struct Channel *chptr, const char *key)
if(IsService(source_p))
return 0;

if ((dlink_list_length(&source_p->channel) >= ConfigChannel.max_chans_per_user) &&
(!IsOper(source_p) || (dlink_list_length(&source_p->channel) >=
ConfigChannel.max_chans_per_user * 3)))
return ERR_TOOMANYCHANNELS;


if (is_banned(chptr, source_p))
return ERR_BANNEDFROMCHAN;

Expand Down

0 comments on commit 6e334f7

Please sign in to comment.