- WriteServ(user->fd,"470 %s :%s has become full, so you are automatically being transferred to the linked channel %s",user->nick,cname,channel.c_str());
- Srv->JoinUserToChannel(user,channel.c_str(),"");
+
+ /* sometimes broken ulines can make circular or chained +L, avoid this */
+ Channel* destchan = NULL;
+ destchan = ServerInstance->FindChan(channel);
+ if (destchan && destchan->IsModeSet('L'))
+ {
+ user->WriteServ("470 %s :%s is full, but has a circular redirect (+L), not following redirection to %s", user->nick, cname, channel.c_str());
+ return 1;
+ }
+
+ user->WriteServ("470 %s :%s has become full, so you are automatically being transferred to the linked channel %s", user->nick, cname, channel.c_str());
+ Channel::JoinUser(ServerInstance, user, channel.c_str(), false, "", false, ServerInstance->Time());