]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/irc-channel.c
Don't stop join handling on faulty channel, skip it (part #2)
[ngircd-alex.git] / src / ngircd / irc-channel.c
index 196b5477487cebdfa0c073277a1ff81115a7d798..77deed7abde03f455c33018d8e01cf33fba47e53 100644 (file)
@@ -364,7 +364,7 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
                         /* channel must be created, but forbidden by config */
                        IRC_WriteStrClient(Client, ERR_BANNEDFROMCHAN_MSG,
                                           Client_ID(Client), channame);
-                       break;
+                       goto join_next;
                }
 
                /* Local client? */
@@ -377,15 +377,19 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
 
                        /* Test if the user has reached the channel limit */
                        if ((Conf_MaxJoins > 0) &&
-                           (Channel_CountForUser(Client) >= Conf_MaxJoins))
-                               return IRC_WriteStrClient(Client,
+                           (Channel_CountForUser(Client) >= Conf_MaxJoins)) {
+                               if (!IRC_WriteStrClient(Client,
                                                ERR_TOOMANYCHANNELS_MSG,
-                                               Client_ID(Client), channame);
+                                               Client_ID(Client), channame))
+                                       return DISCONNECTED;
+                               goto join_next;
+                       }
+
                        if (chan) {
                                /* Already existing channel: check if the
                                 * client is allowed to join */
                                if (!join_allowed(Client, chan, channame, key))
-                                       break;
+                                       goto join_next;
                        } else {
                                /* New channel: first user will become channel
                                 * operator unless this is a modeless channel */