olist: give proper error message if oper does not have oper_spy priv

This commit is contained in:
Jilles Tjoelker 2008-05-21 00:56:53 +02:00
parent 57d78ae1ca
commit d4715e8f28
1 changed files with 18 additions and 12 deletions

View File

@ -68,19 +68,25 @@ static void list_named_channel(struct Client *source_p, const char *name);
static int static int
mo_olist(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) 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 */ sendto_one(source_p, form_str(ERR_NOPRIVS),
if(parc < 2 || EmptyString(parv[1])) me.name, source_p->name, "oper_spy");
{ sendto_one(source_p, form_str(RPL_LISTEND),
report_operspy(source_p, "LIST", NULL); me.name, source_p->name);
list_all_channels(source_p); return 0;
} }
else
{ /* If no arg, do all channels *whee*, else just one channel */
report_operspy(source_p, "LIST", parv[1]); if(parc < 2 || EmptyString(parv[1]))
list_named_channel(source_p, 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); sendto_one(source_p, form_str(RPL_LISTEND), me.name, source_p->name);