} /* Client_SetIntroducer */
-GLOBAL void
-Client_SetOperByMe( CLIENT *Client, bool OperByMe )
-{
- assert( Client != NULL );
- Client->oper_by_me = OperByMe;
-} /* Client_SetOperByMe */
-
-
GLOBAL bool
Client_ModeAdd( CLIENT *Client, char Mode )
{
} /* Client_Flags */
-GLOBAL bool
-Client_OperByMe( CLIENT *Client )
-{
- assert( Client != NULL );
- return Client->oper_by_me;
-} /* Client_OperByMe */
-
-
GLOBAL int
Client_Hops( CLIENT *Client )
{
c->type = CLIENT_UNKNOWN;
c->conn_id = NONE;
- c->oper_by_me = false;
c->hops = -1;
c->token = -1;
c->mytoken = -1;
char info[CLIENT_INFO_LEN]; /* long user name (user) / info text (server) */
char modes[CLIENT_MODE_LEN]; /* client modes */
int hops, token, mytoken; /* "hops" and "Token" (see SERVER command) */
- bool oper_by_me; /* client is local IRC operator on this server? */
char *away; /* AWAY text (valid if mode 'a' is set) */
char flags[CLIENT_FLAGS_LEN]; /* flags of the client */
char *account_name; /* login account (for services) */
GLOBAL char *Client_Modes PARAMS(( CLIENT *Client ));
GLOBAL char *Client_Flags PARAMS(( CLIENT *Client ));
GLOBAL CLIENT *Client_Introducer PARAMS(( CLIENT *Client ));
-GLOBAL bool Client_OperByMe PARAMS(( CLIENT *Client ));
GLOBAL int Client_Hops PARAMS(( CLIENT *Client ));
GLOBAL int Client_Token PARAMS(( CLIENT *Client ));
GLOBAL int Client_MyToken PARAMS(( CLIENT *Client ));
GLOBAL void Client_SetType PARAMS(( CLIENT *Client, int Type ));
GLOBAL void Client_SetHops PARAMS(( CLIENT *Client, int Hops ));
GLOBAL void Client_SetToken PARAMS(( CLIENT *Client, int Token ));
-GLOBAL void Client_SetOperByMe PARAMS(( CLIENT *Client, bool OperByMe ));
GLOBAL void Client_SetModes PARAMS(( CLIENT *Client, const char *Modes ));
GLOBAL void Client_SetFlags PARAMS(( CLIENT *Client, const char *Flags ));
GLOBAL void Client_SetIntroducer PARAMS(( CLIENT *Client, CLIENT *Introducer ));
return false;
}
- if (Channel_HasMode(chan, 'O') && !Client_OperByMe(Client)) {
+ if (Channel_HasMode(chan, 'O') && !Client_HasMode(Client, 'o')) {
/* Only IRC operators are allowed! */
IRC_WriteErrClient(Client, ERR_OPONLYCHANNEL_MSG,
Client_ID(Client), channame);
/* Gotcha! */
if (!Channel_HasMode(chan, 's')
|| Channel_IsMemberOf(chan, from)
- || (!Conf_MorePrivacy && Client_OperByMe(Client))) {
+ || (!Conf_MorePrivacy
+ && Client_HasMode(Client, 'o')
+ && Client_Conn(Client) > NONE))
+ {
if ((Conf_MaxListSize > 0)
&& IRC_CheckListTooBig(from, count,
Conf_MaxListSize,
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,
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';
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
/* 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;
}
Client_ID(Client));
}
- if (!Client_OperByMe(Client))
- Log(LOG_NOTICE|LOG_snotice,
- "Got valid OPER for \"%s\" from \"%s\", user is an IRC operator now.",
- Req->argv[0], Client_Mask(Client));
+ Log(LOG_NOTICE|LOG_snotice,
+ "Got valid OPER for \"%s\" from \"%s\", user is an IRC operator now.",
+ Req->argv[0], Client_Mask(Client));
- Client_SetOperByMe(Client, true);
return IRC_WriteStrClient(Client, RPL_YOUREOPER_MSG, Client_ID(Client));
} /* IRC_OPER */
switch (Client_Type(Client)) {
case CLIENT_USER:
- if (!Client_OperByMe(Client))
- return IRC_WriteErrClient(Client, ERR_NOPRIVILEGES_MSG,
- Client_ID(Client));
+ if (!Op_Check(Client, Req))
+ return Op_NoPrivileges(Client, Req);
from = Client;
break;
case CLIENT_SERVER:
#include "match.h"
#include "messages.h"
#include "parse.h"
+#include "op.h"
#include "tool.h"
#include "exp.h"
assert (Client != NULL);
assert (Req != NULL);
- if (Client_Type(Client) != CLIENT_SERVER && !Client_OperByMe(Client))
- return IRC_WriteErrClient(Client, ERR_NOPRIVILEGES_MSG,
- Client_ID(Client));
+ if (Client_Type(Client) != CLIENT_SERVER && !Op_Check(Client, Req))
+ return Op_NoPrivileges(Client, Req);
/* Get prefix (origin); use the client if no prefix is given. */
if (Req->prefix)
return c;
if (!Client_HasMode(c, 'o'))
return NULL;
- if (!Client_OperByMe(c) && !Conf_AllowRemoteOper)
+ if (Client_Conn(c) <= NONE && !Conf_AllowRemoteOper)
return NULL;
/* The client is an local IRC operator, or this server is configured