diff --git a/modules/core/m_join.c b/modules/core/m_join.c index 57bd259f5..6c950bc46 100644 --- a/modules/core/m_join.c +++ b/modules/core/m_join.c @@ -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)) @@ -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)) diff --git a/src/channel.c b/src/channel.c index edf9412ad..592c5500f 100644 --- a/src/channel.c +++ b/src/channel.c @@ -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;