]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/irc-mode.c
Conn_Write(): Make sure there is a client when detecting its type
[ngircd-alex.git] / src / ngircd / irc-mode.c
index b469a16911f65292b0fddb3df21574dcaee0c642..d8329b1655e2a5f66b88277dd5a0274d86b09ab7 100644 (file)
@@ -253,7 +253,6 @@ Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target )
                                                        set ? '+' : '-',
                                                        *mode_ptr);
                                x[0] = '\0';
-                               goto client_exit;
                        } else {
                                Log(LOG_DEBUG,
                                    "Handling unknown mode \"%c%c\" from \"%s\" for \"%s\" ...",
@@ -278,7 +277,6 @@ Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target )
                                strlcat(the_modes, x, sizeof(the_modes));
                }
        }
-client_exit:
 
        /* Are there changed modes? */
        if (the_modes[1]) {
@@ -479,6 +477,7 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
                case 'i': /* Invite only */
                case 'm': /* Moderated */
                case 'n': /* Only members can write */
+               case 'R': /* Registered users only */
                case 's': /* Secret channel */
                case 't': /* Topic locked */
                case 'z': /* Secure connections only */
@@ -594,6 +593,16 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
                                        Channel_Name(Channel));
                        break;
                /* --- Channel user modes --- */
+               case 'a':
+               case 'h':
+               case 'q':
+                       if (Client_Type(Client) != CLIENT_SERVER) {
+                               connected = IRC_WriteStrClient(Origin,
+                                       ERR_CHANOPRIVSNEEDED_MSG,
+                                       Client_ID(Origin),
+                                       Channel_Name(Channel));
+                               goto chan_exit;
+                       }
                case 'o': /* Channel operator */
                case 'v': /* Voice */
                        if (arg_arg > mode_arg) {
@@ -650,18 +659,24 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
                        }
                        break;
                default:
-                       Log(LOG_DEBUG,
-                           "Unknown mode \"%c%c\" from \"%s\" on %s!?",
-                           set ? '+' : '-', *mode_ptr, Client_ID(Origin),
-                           Channel_Name(Channel));
-                       if (Client_Type(Client) != CLIENT_SERVER)
+                       if (Client_Type(Client) != CLIENT_SERVER) {
+                               Log(LOG_DEBUG,
+                                   "Unknown mode \"%c%c\" from \"%s\" on %s!?",
+                                   set ? '+' : '-', *mode_ptr,
+                                   Client_ID(Origin), Channel_Name(Channel));
                                connected = IRC_WriteStrClient(Origin,
                                        ERR_UMODEUNKNOWNFLAG2_MSG,
                                        Client_ID(Origin),
                                        set ? '+' : '-', *mode_ptr);
-                       x[0] = '\0';
-                       goto chan_exit;
-               }       /* switch() */
+                               x[0] = '\0';
+                       } else {
+                               Log(LOG_DEBUG,
+                                   "Handling unknown mode \"%c%c\" from \"%s\" on %s ...",
+                                   set ? '+' : '-', *mode_ptr,
+                                   Client_ID(Origin), Channel_Name(Channel));
+                               x[0] = *mode_ptr;
+                       }
+               }
 
                if (!connected)
                        break;