mirror of
https://github.com/matrix-construct/construct
synced 2024-12-28 00:14:07 +01:00
olist: do not send operspy notices for nonexistent channels
This commit is contained in:
parent
3d106847c5
commit
732280d99e
1 changed files with 12 additions and 15 deletions
|
@ -79,15 +79,9 @@ mo_olist(struct Client *client_p, struct Client *source_p, int parc, const char
|
||||||
|
|
||||||
/* If no arg, do all channels *whee*, else just one channel */
|
/* If no arg, do all channels *whee*, else just one channel */
|
||||||
if(parc < 2 || EmptyString(parv[1]))
|
if(parc < 2 || EmptyString(parv[1]))
|
||||||
{
|
|
||||||
report_operspy(source_p, "LIST", NULL);
|
|
||||||
list_all_channels(source_p);
|
list_all_channels(source_p);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
report_operspy(source_p, "LIST", parv[1]);
|
|
||||||
list_named_channel(source_p, 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);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -105,6 +99,8 @@ list_all_channels(struct Client *source_p)
|
||||||
{
|
{
|
||||||
struct Channel *chptr;
|
struct Channel *chptr;
|
||||||
rb_dlink_node *ptr;
|
rb_dlink_node *ptr;
|
||||||
|
|
||||||
|
report_operspy(source_p, "LIST", NULL);
|
||||||
sendto_one(source_p, form_str(RPL_LISTSTART), me.name, source_p->name);
|
sendto_one(source_p, form_str(RPL_LISTSTART), me.name, source_p->name);
|
||||||
|
|
||||||
RB_DLINK_FOREACH(ptr, global_channel_list.head)
|
RB_DLINK_FOREACH(ptr, global_channel_list.head)
|
||||||
|
@ -133,19 +129,20 @@ list_named_channel(struct Client *source_p, const char *name)
|
||||||
char *p;
|
char *p;
|
||||||
char *n = LOCAL_COPY(name);
|
char *n = LOCAL_COPY(name);
|
||||||
|
|
||||||
sendto_one(source_p, form_str(RPL_LISTSTART), me.name, source_p->name);
|
|
||||||
|
|
||||||
if((p = strchr(n, ',')))
|
if((p = strchr(n, ',')))
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
|
|
||||||
if(EmptyString(n))
|
/* Put operspy notice before any output, but only if channel exists */
|
||||||
{
|
chptr = EmptyString(n) ? NULL : find_channel(n);
|
||||||
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
|
if(chptr != NULL)
|
||||||
form_str(ERR_NOSUCHCHANNEL), n);
|
report_operspy(source_p, "LIST", chptr->chname);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if((chptr = find_channel(n)) == NULL)
|
sendto_one(source_p, form_str(RPL_LISTSTART), me.name, source_p->name);
|
||||||
|
|
||||||
|
if(EmptyString(n))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(chptr == NULL)
|
||||||
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
|
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
|
||||||
form_str(ERR_NOSUCHCHANNEL), n);
|
form_str(ERR_NOSUCHCHANNEL), n);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue