Implement operspy for /LIST.
This commit is contained in:
parent
a0a6c0dd39
commit
e78f804d42
|
@ -12,3 +12,4 @@ mode !#channel - Gives the full modes of a channel including any keys.
|
||||||
chantrace !#channel - Gives full output despite not being on channel.
|
chantrace !#channel - Gives full output despite not being on channel.
|
||||||
masktrace !nick!user@host :gecos - Lists matching users on all servers.
|
masktrace !nick!user@host :gecos - Lists matching users on all servers.
|
||||||
topic !#channel - Gives full output despite not being on channel.
|
topic !#channel - Gives full output despite not being on channel.
|
||||||
|
list ![,options...] - Lists all channels, including secret channels.
|
||||||
|
|
|
@ -306,6 +306,7 @@ struct ListClient
|
||||||
{
|
{
|
||||||
unsigned int hash_indice;
|
unsigned int hash_indice;
|
||||||
unsigned int users_min, users_max;
|
unsigned int users_min, users_max;
|
||||||
|
int operspy;
|
||||||
|
|
||||||
/* It would be nice to add other modifiers,
|
/* It would be nice to add other modifiers,
|
||||||
* but not for 1.1 --nenolod
|
* but not for 1.1 --nenolod
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include "ircd.h"
|
#include "ircd.h"
|
||||||
#include "numeric.h"
|
#include "numeric.h"
|
||||||
#include "s_conf.h"
|
#include "s_conf.h"
|
||||||
|
#include "s_newconf.h"
|
||||||
#include "s_serv.h"
|
#include "s_serv.h"
|
||||||
#include "send.h"
|
#include "send.h"
|
||||||
#include "msg.h"
|
#include "msg.h"
|
||||||
|
@ -153,13 +154,14 @@ static int mo_list(struct Client *client_p, struct Client *source_p, int parc, c
|
||||||
/* Let the user set it */
|
/* Let the user set it */
|
||||||
params.users_min = ConfigFileEntry.hide_channel_below_users;
|
params.users_min = ConfigFileEntry.hide_channel_below_users;
|
||||||
params.users_max = INT_MAX;
|
params.users_max = INT_MAX;
|
||||||
|
params.operspy = 0;
|
||||||
|
|
||||||
if (parc > 1 && parv[1] != NULL && !IsChannelName(parv[1]))
|
if (parc > 1 && parv[1] != NULL && !IsChannelName(parv[1]))
|
||||||
{
|
{
|
||||||
args = LOCAL_COPY(parv[1]);
|
args = LOCAL_COPY(parv[1]);
|
||||||
/* Make any specification cancel out defaults */
|
|
||||||
if (*args == '<')
|
/* Cancel out default minimum. */
|
||||||
params.users_min = 0;
|
params.users_min = 0;
|
||||||
|
|
||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
|
@ -188,6 +190,12 @@ static int mo_list(struct Client *client_p, struct Client *source_p, int parc, c
|
||||||
else
|
else
|
||||||
params.users_min = 0;
|
params.users_min = 0;
|
||||||
}
|
}
|
||||||
|
/* Only accept operspy as the first option. */
|
||||||
|
else if (*args == '!' && IsOperSpy(source_p) && i == 0)
|
||||||
|
{
|
||||||
|
params.operspy = 1;
|
||||||
|
report_operspy(source_p, "LIST", p);
|
||||||
|
}
|
||||||
|
|
||||||
if (EmptyString(p))
|
if (EmptyString(p))
|
||||||
break;
|
break;
|
||||||
|
@ -249,6 +257,7 @@ static void safelist_client_instantiate(struct Client *client_p, struct ListClie
|
||||||
self->hash_indice = 0;
|
self->hash_indice = 0;
|
||||||
self->users_min = params->users_min;
|
self->users_min = params->users_min;
|
||||||
self->users_max = params->users_max;
|
self->users_max = params->users_max;
|
||||||
|
self->operspy = params->operspy;
|
||||||
|
|
||||||
client_p->localClient->safelist_data = self;
|
client_p->localClient->safelist_data = self;
|
||||||
|
|
||||||
|
@ -320,8 +329,8 @@ static void safelist_channel_named(struct Client *source_p, const char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SecretChannel(chptr) || IsMember(source_p, chptr))
|
if (!SecretChannel(chptr) || IsMember(source_p, chptr))
|
||||||
sendto_one(source_p, form_str(RPL_LIST), me.name, source_p->name, chptr->chname,
|
sendto_one(source_p, form_str(RPL_LIST), me.name, source_p->name, "",
|
||||||
rb_dlink_list_length(&chptr->members),
|
chptr->chname, rb_dlink_list_length(&chptr->members),
|
||||||
chptr->topic == NULL ? "" : chptr->topic);
|
chptr->topic == NULL ? "" : chptr->topic);
|
||||||
|
|
||||||
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);
|
||||||
|
@ -340,15 +349,17 @@ static void safelist_one_channel(struct Client *source_p, struct Channel *chptr)
|
||||||
{
|
{
|
||||||
struct ListClient *safelist_data = source_p->localClient->safelist_data;
|
struct ListClient *safelist_data = source_p->localClient->safelist_data;
|
||||||
|
|
||||||
if (SecretChannel(chptr) && !IsMember(source_p, chptr))
|
if (SecretChannel(chptr) && !IsMember(source_p, chptr) && !safelist_data->operspy)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ((unsigned int)chptr->members.length < safelist_data->users_min
|
if ((unsigned int)chptr->members.length < safelist_data->users_min
|
||||||
|| (unsigned int)chptr->members.length > safelist_data->users_max)
|
|| (unsigned int)chptr->members.length > safelist_data->users_max)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sendto_one(source_p, form_str(RPL_LIST), me.name, source_p->name, chptr->chname,
|
sendto_one(source_p, form_str(RPL_LIST), me.name, source_p->name,
|
||||||
chptr->members.length, chptr->topic == NULL ? "" : chptr->topic);
|
(safelist_data->operspy && SecretChannel(chptr)) ? "!" : "",
|
||||||
|
chptr->chname, rb_dlink_list_length(&chptr->members),
|
||||||
|
chptr->topic == NULL ? "" : chptr->topic);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -343,7 +343,7 @@ static const char * replies[] = {
|
||||||
/* 319 RPL_WHOISCHANNELS, */ ":%s 319 %s %s :",
|
/* 319 RPL_WHOISCHANNELS, */ ":%s 319 %s %s :",
|
||||||
/* 320 */ NULL,
|
/* 320 */ NULL,
|
||||||
/* 321 RPL_LISTSTART, */ ":%s 321 %s Channel :Users Name",
|
/* 321 RPL_LISTSTART, */ ":%s 321 %s Channel :Users Name",
|
||||||
/* 322 RPL_LIST, */ ":%s 322 %s %s %d :%s",
|
/* 322 RPL_LIST, */ ":%s 322 %s %s%s %d :%s",
|
||||||
/* 323 RPL_LISTEND, */ ":%s 323 %s :End of /LIST",
|
/* 323 RPL_LISTEND, */ ":%s 323 %s :End of /LIST",
|
||||||
/* 324 RPL_CHANNELMODEIS, */ ":%s 324 %s %s %s",
|
/* 324 RPL_CHANNELMODEIS, */ ":%s 324 %s %s %s",
|
||||||
/* 325 RPL_CHANNELMLOCKIS, */ ":%s 325 %s %s %s :is the current channel mode-lock",
|
/* 325 RPL_CHANNELMLOCKIS, */ ":%s 325 %s %s %s :is the current channel mode-lock",
|
||||||
|
|
Loading…
Reference in New Issue