]> 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 88d2294bad203efe377820bc8f9aaee822056544..8e76db17084461f8c6c971bbd79b9858cd0c8c3e 100644 (file)
@@ -69,7 +69,6 @@ IRC_MODE( CLIENT *Client, REQUEST *Req )
        assert(Client != NULL);
        assert(Req != NULL);
 
-       _IRC_ARGC_GE_OR_RETURN_(Client, Req, 1)
        _IRC_GET_SENDER_OR_RETURN_(origin, Req, Client)
 
        /* Channel or user mode? */
@@ -224,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,
@@ -236,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';
@@ -275,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
@@ -456,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;
        }
 
@@ -945,8 +935,6 @@ IRC_AWAY( CLIENT *Client, REQUEST *Req )
        assert (Client != NULL);
        assert (Req != NULL);
 
-       _IRC_ARGC_LE_OR_RETURN_(Client, Req, 1)
-
        if (Req->argc == 1 && Req->argv[0][0]) {
                Client_SetAway(Client, Req->argv[0]);
                Client_ModeAdd(Client, 'a');