Change /stats O to show privset blocks (oper only).

To show operator blocks, only /stats o (lowercase) now works.
This commit is contained in:
Jilles Tjoelker 2009-01-18 01:35:24 +01:00
parent 9a67a652f8
commit 3619e29987
5 changed files with 33 additions and 1 deletions

View File

@ -1014,6 +1014,12 @@
<para>Show operator blocks</para> <para>Show operator blocks</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term>O</term>
<listitem>
<para>Show privset blocks</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term>p</term> <term>p</term>
<listitem> <listitem>

View File

@ -24,6 +24,7 @@ X f - Shows File Descriptors
l - Shows hostname and generic info about [nick] l - Shows hostname and generic info about [nick]
m - Shows commands and their usage m - Shows commands and their usage
n - Shows DNS blacklists n - Shows DNS blacklists
* O - Shows privset blocks
^ o - Shows operator blocks (Old O: lines) ^ o - Shows operator blocks (Old O: lines)
^ P - Shows configured ports ^ P - Shows configured ports
p - Shows online opers p - Shows online opers

View File

@ -47,5 +47,6 @@ struct PrivilegeSet *privilegeset_ref(struct PrivilegeSet *set);
void privilegeset_unref(struct PrivilegeSet *set); void privilegeset_unref(struct PrivilegeSet *set);
void privilegeset_mark_all_illegal(void); void privilegeset_mark_all_illegal(void);
void privilegeset_delete_all_illegal(void); void privilegeset_delete_all_illegal(void);
void privilegeset_report(struct Client *source_p);
#endif #endif

View File

@ -101,6 +101,7 @@ static void stats_klines(struct Client *);
static void stats_messages(struct Client *); static void stats_messages(struct Client *);
static void stats_dnsbl(struct Client *); static void stats_dnsbl(struct Client *);
static void stats_oper(struct Client *); static void stats_oper(struct Client *);
static void stats_privset(struct Client *);
static void stats_operedup(struct Client *); static void stats_operedup(struct Client *);
static void stats_ports(struct Client *); static void stats_ports(struct Client *);
static void stats_tresv(struct Client *); static void stats_tresv(struct Client *);
@ -148,7 +149,7 @@ static struct StatsStruct stats_cmd_table[] = {
{'M', stats_messages, 0, 0, }, {'M', stats_messages, 0, 0, },
{'n', stats_dnsbl, 0, 0, }, {'n', stats_dnsbl, 0, 0, },
{'o', stats_oper, 0, 0, }, {'o', stats_oper, 0, 0, },
{'O', stats_oper, 0, 0, }, {'O', stats_privset, 1, 0, },
{'p', stats_operedup, 0, 0, }, {'p', stats_operedup, 0, 0, },
{'P', stats_ports, 0, 0, }, {'P', stats_ports, 0, 0, },
{'q', stats_tresv, 1, 0, }, {'q', stats_tresv, 1, 0, },
@ -678,6 +679,11 @@ stats_oper(struct Client *source_p)
} }
} }
static void
stats_privset(struct Client *source_p)
{
privilegeset_report(source_p);
}
/* stats_operedup() /* stats_operedup()
* *

View File

@ -24,6 +24,7 @@
#include <stdinc.h> #include <stdinc.h>
#include "s_conf.h" #include "s_conf.h"
#include "privilege.h" #include "privilege.h"
#include "numeric.h"
static rb_dlink_list privilegeset_list = {}; static rb_dlink_list privilegeset_list = {};
@ -189,3 +190,20 @@ privilegeset_delete_all_illegal(void)
privilegeset_unref(set); privilegeset_unref(set);
} }
} }
void
privilegeset_report(struct Client *source_p)
{
rb_dlink_node *ptr;
RB_DLINK_FOREACH(ptr, privilegeset_list.head)
{
struct PrivilegeSet *set = ptr->data;
/* use RPL_STATSDEBUG for now -- jilles */
sendto_one_numeric(source_p, RPL_STATSDEBUG,
"O :%s %s",
set->name,
set->privs);
}
}