- /* Are there already too many members? */
- if ((strchr(channel_modes, 'l')) && (Channel_MaxUsers(chan) <= Channel_MemberCount(chan))) {
- IRC_WriteStrClient(Client, ERR_CHANNELISFULL_MSG, Client_ID(Client), channame);
+
+ if (Channel_HasMode(chan, 'l') &&
+ (Channel_MaxUsers(chan) <= Channel_MemberCount(chan))) {
+ /* There are more clints joined to this channel than allowed */
+ IRC_WriteErrClient(Client, ERR_CHANNELISFULL_MSG,
+ Client_ID(Client), channame);
+ return false;
+ }
+
+ if (Channel_HasMode(chan, 'z') && !Conn_UsesSSL(Client_Conn(Client))) {
+ /* Only "secure" clients are allowed, but clients doesn't
+ * use SSL encryption */
+ IRC_WriteErrClient(Client, ERR_SECURECHANNEL_MSG,
+ Client_ID(Client), channame);
+ return false;
+ }
+
+ if (Channel_HasMode(chan, 'O') && !Client_HasMode(Client, 'o')) {
+ /* Only IRC operators are allowed! */
+ IRC_WriteErrClient(Client, ERR_OPONLYCHANNEL_MSG,
+ Client_ID(Client), channame);
+ return false;
+ }
+
+ if (Channel_HasMode(chan, 'R') && !Client_HasMode(Client, 'R')) {
+ /* Only registered users are allowed! */
+ IRC_WriteErrClient(Client, ERR_REGONLYCHANNEL_MSG,
+ Client_ID(Client), channame);