]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/irc-mode.c
Remove imp.h and exp.h header files
[ngircd-alex.git] / src / ngircd / irc-mode.c
index 38fec0d028b5761bcf2bd432a2633cae9871f7fc..b83c1eb49bc179119b278f75064737bc6f099b24 100644 (file)
@@ -16,7 +16,6 @@
  * IRC commands for mode changes (like MODE, AWAY, etc.)
  */
 
-#include "imp.h"
 #include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -33,7 +32,6 @@
 #include "messages.h"
 #include "conf.h"
 
-#include "exp.h"
 #include "irc-mode.h"
 
 static bool Client_Mode PARAMS((CLIENT *Client, REQUEST *Req, CLIENT *Origin,
@@ -223,11 +221,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 +234,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 +263,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
@@ -366,7 +355,6 @@ Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target )
                         Client_Modes(Target));
        }
 
-       IRC_SetPenalty(Client, 1);
        return ok;
 } /* Client_Mode */
 
@@ -455,7 +443,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;
        }
 
@@ -592,9 +580,13 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
                                goto chan_exit;
                        if (!set) {
                                if (is_oper || is_machine || is_owner ||
-                                   is_admin || is_op || is_halfop)
+                                   is_admin || is_op || is_halfop) {
                                        x[0] = *mode_ptr;
-                               else
+                                       if (Channel_HasMode(Channel, 'k'))
+                                               strlcpy(argadd, "*", sizeof(argadd));
+                                       if (arg_arg > mode_arg)
+                                               arg_arg++;
+                               } else
                                        connected = IRC_WriteErrClient(Origin,
                                                ERR_CHANOPRIVSNEEDED_MSG,
                                                Client_ID(Origin),
@@ -927,7 +919,6 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
                }
        }
 
-       IRC_SetPenalty(Client, 1);
        return connected;
 } /* Channel_Mode */