]>
jfr.im git - irc/quakenet/newserv.git/blob - chanserv/chancmds/chanophistory.c
2 * CMDNAME: chanophistory
3 * CMDLEVEL: QCMD_AUTHED
5 * CMDDESC: Displays a list of who has been opped on a channel recently with account names.
6 * CMDFUNC: csc_dochanophistory
7 * CMDPROTO: int csc_dochanophistory(void *source, int cargc, char **cargv);
8 * CMDHELP: Usage: CHANOPHISTORY <channel>
9 * CMDHELP: Displays a list of users who have recently been opped on a channel by the
10 * CMDHELP: service, along with the account name responsible for the opping. Usually
11 * CMDHELP: this is the account the user being opped was using, but in the case of the
12 * CMDHELP: OP command being used to op other users, the account used by the user issuing
13 * CMDHELP: the OP command will be shown. Where:
14 * CMDHELP: channel - the channel to use
15 * CMDHELP: CHANOPHISTORY requires operator (+o) access on the named channel.
18 #include "../chanserv.h"
20 int csc_dochanophistory(void *source
, int cargc
, char **cargv
) {
29 chanservstdmessage(sender
, QM_NOTENOUGHPARAMS
, "chanophistory");
33 if (!(cip
=cs_checkaccess(sender
, cargv
[0], CA_OPPRIV
, NULL
, "chanophistory",
34 QPRIV_VIEWFULLCHANLEV
, 0)))
37 rcp
=cip
->exts
[chanservext
];
39 for (i
=0;i
<CHANOPHISTORY
;i
++) {
40 unsigned int idx
=(i
+rcp
->chanoppos
)%CHANOPHISTORY
;
42 if (!*rcp
->chanopnicks
[idx
])
46 chanservstdmessage(sender
, QM_CHANOPHISTORYHEADER
, cip
->name
->content
);
50 opact
=findreguserbyID(rcp
->chanopaccts
[idx
]);
51 chanservsendmessage(sender
, "%-15s %-15s", rcp
->chanopnicks
[idx
], opact
?opact
->username
:"(unknown)");
54 chanservstdmessage(sender
, QM_NOCHANOPHISTORY
, cip
->name
->content
);
56 chanservstdmessage(sender
, QM_ENDOFLIST
);