]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/irc-mode.c
Remove unneded IRC_SetPenalty() calls
[ngircd-alex.git] / src / ngircd / irc-mode.c
index e2fa59a2df67aa5f306629e0b3db9030a26d7c1d..8e76db17084461f8c6c971bbd79b9858cd0c8c3e 100644 (file)
@@ -223,11 +223,12 @@ Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target )
                        else
                                x[0] = 'B';
                        break;
-               case 'c': /* Receive connect notices
-                          * (only settable by IRC operators!) */
+               case 'c': /* Receive connect notices */
+               case 'q': /* KICK-protected user */
+                         /* (only settable by IRC operators!) */
                        if (!set || Client_Type(Client) == CLIENT_SERVER
-                           || Client_OperByMe(Origin))
-                               x[0] = 'c';
+                           || Client_HasMode(Origin, 'o'))
+                               x[0] = *mode_ptr;
                        else
                                ok = IRC_WriteErrClient(Origin,
                                                        ERR_NOPRIVILEGES_MSG,
@@ -235,22 +236,12 @@ Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target )
                        break;
                case 'o': /* IRC operator (only unsettable!) */
                        if (!set || Client_Type(Client) == CLIENT_SERVER) {
-                               Client_SetOperByMe(Target, false);
                                x[0] = 'o';
                        } else
                                ok = IRC_WriteErrClient(Origin,
                                                        ERR_NOPRIVILEGES_MSG,
                                                        Client_ID(Origin));
                        break;
-               case 'q': /* KICK-protected user */
-                       if (!set || Client_Type(Client) == CLIENT_SERVER
-                           || Client_OperByMe(Origin))
-                               x[0] = 'q';
-                       else
-                               ok = IRC_WriteErrClient(Origin,
-                                                       ERR_NOPRIVILEGES_MSG,
-                                                       Client_ID(Origin));
-                       break;
                case 'r': /* Restricted (only settable) */
                        if (set || Client_Type(Client) == CLIENT_SERVER)
                                x[0] = 'r';
@@ -274,7 +265,7 @@ Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target )
                                                        Client_ID(Origin));
                        else if (!set || Conf_CloakHostModeX[0]
                                 || Client_Type(Client) == CLIENT_SERVER
-                                || Client_OperByMe(Client)) {
+                                || Client_HasMode(Origin, 'o')) {
                                x[0] = 'x';
                                send_RPL_HOSTHIDDEN_MSG = true;
                        } else
@@ -455,7 +446,7 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
 
        /* Check if origin is oper and opers can use mode */
        use_servermode = Conf_OperServerMode;
-       if(Client_OperByMe(Client) && Conf_OperCanMode) {
+       if(Client_HasMode(Client, 'o') && Conf_OperCanMode) {
                is_oper = true;
        }
 
@@ -622,7 +613,6 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
 #ifdef STRICT_RFC
                                /* Only send error message in "strict" mode,
                                 * this is how ircd2.11 and others behave ... */
-                               IRC_SetPenalty(Origin, 2);
                                connected = IRC_WriteErrClient(Origin,
                                        ERR_NEEDMOREPARAMS_MSG,
                                        Client_ID(Origin), Req->command);
@@ -667,7 +657,6 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
 #ifdef STRICT_RFC
                                /* Only send error message in "strict" mode,
                                 * this is how ircd2.11 and others behave ... */
-                               IRC_SetPenalty(Origin, 2);
                                connected = IRC_WriteErrClient(Origin,
                                        ERR_NEEDMOREPARAMS_MSG,
                                        Client_ID(Origin), Req->command);
@@ -769,7 +758,6 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
                                 * mode, because most other servers don't do
                                 * it as well and some clients send "wired"
                                 * MODE commands like "MODE #chan -ooo nick". */
-                               IRC_SetPenalty(Origin, 2);
                                connected = IRC_WriteErrClient(Origin,
                                        ERR_NEEDMOREPARAMS_MSG,
                                        Client_ID(Origin), Req->command);