From d4715e8f2867df6d775289446b4e002ff5656476 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Wed, 21 May 2008 00:56:53 +0200 Subject: [PATCH] olist: give proper error message if oper does not have oper_spy priv --- extensions/m_olist.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/extensions/m_olist.c b/extensions/m_olist.c index 4484ae5..c23fddc 100644 --- a/extensions/m_olist.c +++ b/extensions/m_olist.c @@ -68,19 +68,25 @@ static void list_named_channel(struct Client *source_p, const char *name); static int mo_olist(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { - if(IsOperSpy(source_p)) + if(!IsOperSpy(source_p)) { - /* If no arg, do all channels *whee*, else just one channel */ - if(parc < 2 || EmptyString(parv[1])) - { - report_operspy(source_p, "LIST", NULL); - list_all_channels(source_p); - } - else - { - report_operspy(source_p, "LIST", parv[1]); - list_named_channel(source_p, parv[1]); - } + sendto_one(source_p, form_str(ERR_NOPRIVS), + me.name, source_p->name, "oper_spy"); + sendto_one(source_p, form_str(RPL_LISTEND), + me.name, source_p->name); + return 0; + } + + /* If no arg, do all channels *whee*, else just one channel */ + if(parc < 2 || EmptyString(parv[1])) + { + report_operspy(source_p, "LIST", NULL); + list_all_channels(source_p); + } + else + { + report_operspy(source_p, "LIST", parv[1]); + list_named_channel(source_p, parv[1]); } sendto_one(source_p, form_str(RPL_LISTEND), me.name, source_p->name);