2 * ngIRCd -- The Next Generation IRC Daemon
3 * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 * Please read the file COPYING, README and AUTHORS for more information.
16 * IRC operator functions
28 #include "irc-write.h"
33 * Return and log a "no privileges" message.
36 Op_NoPrivileges(CLIENT * Client, REQUEST * Req)
41 from = Client_Search(Req->prefix);
44 Log(LOG_NOTICE, "No privileges: client \"%s\" (%s), command \"%s\"!",
45 Req->prefix, Client_Mask(Client), Req->command);
46 return IRC_WriteErrClient(from, ERR_NOPRIVILEGES_MSG,
49 Log(LOG_NOTICE, "No privileges: client \"%s\", command \"%s\"!",
50 Client_Mask(Client), Req->command);
51 return IRC_WriteErrClient(Client, ERR_NOPRIVILEGES_MSG,
54 } /* Op_NoPrivileges */
57 * Check that the originator of a request is an IRC operator and allowed
58 * to administer this server.
60 * @param CLient Client from which the command has been received.
61 * @param Req Request structure.
62 * @return CLIENT structure of the client that initiated the command or
63 * NULL if client is not allowed to execute operator commands.
66 Op_Check(CLIENT * Client, REQUEST * Req)
70 assert(Client != NULL);
73 if (Client_Type(Client) == CLIENT_SERVER && Req->prefix)
74 c = Client_Search(Req->prefix);
80 if (Client_Type(Client) == CLIENT_SERVER
81 && Client_Type(c) == CLIENT_SERVER)
83 if (!Client_HasMode(c, 'o'))
85 if (Client_Conn(c) <= NONE && !Conf_AllowRemoteOper)
88 /* The client is an local IRC operator, or this server is configured
89 * to trust remote operators. */