From ed11b18f0f935fb68a6b0939b1a91d817f1edc83 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Sat, 4 Feb 2012 18:46:28 +0100 Subject: [PATCH] Allow normal users to do PRIVS on themselves. This basically shows a subset of the information shown by the notices on connect like "*** You are exempt from K/X lines". --- modules/m_privs.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/modules/m_privs.c b/modules/m_privs.c index 1d24aad5a..f6a328913 100644 --- a/modules/m_privs.c +++ b/modules/m_privs.c @@ -40,12 +40,13 @@ #include "s_conf.h" #include "s_newconf.h" +static int m_privs(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); static int me_privs(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); static int mo_privs(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); struct Message privs_msgtab = { "PRIVS", 0, 0, 0, MFLG_SLOW, - {mg_unreg, mg_not_oper, mg_ignore, mg_ignore, {me_privs, 0}, {mo_privs, 0}} + {mg_unreg, {m_privs, 0}, mg_ignore, mg_ignore, {me_privs, 0}, {mo_privs, 0}} }; mapi_clist_av1 privs_clist[] = { @@ -151,3 +152,16 @@ static int mo_privs(struct Client *client_p, struct Client *source_p, int parc, use_id(target_p)); return 0; } + +static int m_privs(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) +{ + if (parc >= 2 && !EmptyString(parv[1]) && + irccmp(parv[1], source_p->name)) { + sendto_one_numeric(source_p, ERR_NOPRIVILEGES, + form_str(ERR_NOPRIVILEGES)); + return 0; + } + + show_privs(source_p, source_p); + return 0; +}