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
29 #include "irc-write.h"
36 * Return and log a "no privileges" message.
39 Op_NoPrivileges(CLIENT * Client, REQUEST * Req)
44 from = Client_Search(Req->prefix);
47 Log(LOG_NOTICE, "No privileges: client \"%s\" (%s), command \"%s\"",
48 Req->prefix, Client_Mask(Client), Req->command);
49 return IRC_WriteErrClient(from, ERR_NOPRIVILEGES_MSG,
52 Log(LOG_NOTICE, "No privileges: client \"%s\", command \"%s\"",
53 Client_Mask(Client), Req->command);
54 return IRC_WriteErrClient(Client, ERR_NOPRIVILEGES_MSG,
57 } /* Op_NoPrivileges */
61 * Check that the originator of a request is an IRC operator and allowed
62 * to administer this server.
64 * @param CLient Client from which the command has been received.
65 * @param Req Request structure.
66 * @return CLIENT structure of the client that initiated the command or
67 * NULL if client is not allowed to execute operator commands.
70 Op_Check(CLIENT * Client, REQUEST * Req)
74 assert(Client != NULL);
77 if (Client_Type(Client) == CLIENT_SERVER && Req->prefix)
78 c = Client_Search(Req->prefix);
84 if (Client_Type(Client) == CLIENT_SERVER
85 && Client_Type(c) == CLIENT_SERVER)
87 if (!Client_HasMode(c, 'o'))
89 if (!Client_OperByMe(c) && !Conf_AllowRemoteOper)
92 /* The client is an local IRC operator, or this server is configured
93 * to trust remote operators. */