]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/irc-mode.c
Adjust severity levels of some log messages
[ngircd-alex.git] / src / ngircd / irc-mode.c
index ce4044d0bf7b154401e10096af47abed1911550b..b5f28fa36d73cc0f3bac75d394d1504c667b79a7 100644 (file)
@@ -154,7 +154,7 @@ Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target )
        /* Mode request: let's answer it :-) */
        if (Req->argc == 1)
                return IRC_WriteStrClient(Origin, RPL_UMODEIS_MSG,
-                                         Client_ID(Origin),
+                                         Client_ID(Target),
                                          Client_Modes(Target));
 
        mode_arg = 1;
@@ -366,11 +366,17 @@ Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target )
                                                  "MODE %s :%s",
                                                  Client_ID(Target),
                                                  the_modes);
-                       if (send_RPL_HOSTHIDDEN_MSG)
-                               IRC_WriteStrClient(Client, RPL_HOSTHIDDEN_MSG,
-                                                  Client_ID(Client),
-                                                  Client_HostnameCloaked(Client));
                }
+
+               if (send_RPL_HOSTHIDDEN_MSG && Client_Conn(Target) > NONE) {
+                       /* A new (cloaked) hostname must be annoucned */
+                       IRC_WriteStrClientPrefix(Target, Origin,
+                                                RPL_HOSTHIDDEN_MSG,
+                                                Client_ID(Target),
+                                                Client_HostnameDisplayed(Target));
+
+               }
+
                LogDebug("%s \"%s\": Mode change, now \"%s\".",
                         Client_TypeText(Target), Client_Mask(Target),
                         Client_Modes(Target));
@@ -544,7 +550,7 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
                if (arg_arg >= Req->argc)
                        arg_arg = -1;
 
-               if(!is_machine) {
+               if(!is_machine && !is_oper) {
                        o_mode_ptr = Channel_UserModes(Channel, Client);
                        while( *o_mode_ptr ) {
                                if ( *o_mode_ptr == 'q')
@@ -622,9 +628,13 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
                                Req->argv[arg_arg][0] = '\0';
                                arg_arg++;
                        } else {
+#ifdef STRICT_RFC
+                               /* Only send error message in "strict" mode,
+                                * this is how ircd2.11 and others behave ... */
                                connected = IRC_WriteStrClient(Origin,
                                        ERR_NEEDMOREPARAMS_MSG,
                                        Client_ID(Origin), Req->command);
+#endif
                                goto chan_exit;
                        }
                        break;
@@ -662,9 +672,13 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
                                Req->argv[arg_arg][0] = '\0';
                                arg_arg++;
                        } else {
+#ifdef STRICT_RFC
+                               /* Only send error message in "strict" mode,
+                                * this is how ircd2.11 and others behave ... */
                                connected = IRC_WriteStrClient(Origin,
                                        ERR_NEEDMOREPARAMS_MSG,
                                        Client_ID(Origin), Req->command);
+#endif
                                goto chan_exit;
                        }
                        break;
@@ -755,9 +769,17 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
                                Req->argv[arg_arg][0] = '\0';
                                arg_arg++;
                        } else {
+#ifdef STRICT_RFC
+                               /* Report an error to the client, when a user
+                                * mode should be changed but no nickname is
+                                * given. But don't do it when not in "strict"
+                                * mode, because most other servers don't do
+                                * it as well and some clients send "wired"
+                                * MODE commands like "MODE #chan -ooo nick". */
                                connected = IRC_WriteStrClient(Origin,
                                        ERR_NEEDMOREPARAMS_MSG,
                                        Client_ID(Origin), Req->command);
+#endif
                                goto chan_exit;
                        }
                        break;