]>
jfr.im git - irc/quakenet/snircd.git/blob - ircd/m_privs.c
2 * IRC - Internet Relay Chat, ircd/m_privs.c
3 * Copyright (C) 1990 Jarkko Oikarinen and
4 * University of Oulu, Computing Center
6 * See file AUTHORS in IRC package for additional names of
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 1, or (at your option)
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 * @brief Report operators' privileges to others
25 * @version $Id: m_privs.c,v 1.6 2005/04/02 02:50:14 entrope Exp $
34 #include "ircd_reply.h"
35 #include "ircd_string.h"
41 /** Handle a local operator's privilege query.
42 * @param[in] cptr Client that sent us the message.
43 * @param[in] sptr Original source of message.
44 * @param[in] parc Number of arguments.
45 * @param[in] parv Argument vector.
46 * @see \ref m_functions
48 int mo_privs(struct Client
* cptr
, struct Client
* sptr
, int parc
, char* parv
[])
56 return client_report_privs(sptr
, sptr
);
58 for (i
= 1; i
< parc
; i
++) {
59 for (name
= ircd_strtok(&p
, parv
[i
], " "); name
;
60 name
= ircd_strtok(&p
, 0, " ")) {
61 if (!(acptr
= FindUser(name
)))
63 else if (MyUser(acptr
))
64 client_report_privs(sptr
, acptr
);
66 sendcmdto_one(cptr
, CMD_PRIVS
, acptr
, "%s%s", NumNick(acptr
));
73 /** Handle a remote user's privilege query.
74 * @param[in] cptr Client that sent us the message.
75 * @param[in] sptr Original source of message.
76 * @param[in] parc Number of arguments.
77 * @param[in] parv Argument vector.
78 * @see \ref m_functions
80 int ms_privs(struct Client
* cptr
, struct Client
* sptr
, int parc
, char* parv
[])
83 char *numnick
, *p
= 0;
87 return protocol_violation(cptr
, "PRIVS with no arguments");
89 for (i
= 1; i
< parc
; i
++) {
90 for (numnick
= ircd_strtok(&p
, parv
[i
], " "); numnick
;
91 numnick
= ircd_strtok(&p
, 0, " ")) {
92 if (!(acptr
= findNUser(numnick
)))
94 else if (MyUser(acptr
))
95 client_report_privs(sptr
, acptr
);
97 sendcmdto_one(cptr
, CMD_PRIVS
, acptr
, "%s%s", NumNick(acptr
));