#include "../lib/irc_string.h"
#include "../lib/strlfunc.h"
#include "../lib/version.h"
+#include "../authext/authext.h"
#include "noperserv.h"
#include "noperserv_db.h"
#include "noperserv_hooks.h"
#define NO_FOUND_NICKNAME 1
#define NO_FOUND_AUTHNAME 2
+int noperserv_ext;
+
const flag no_commandflags[] = {
{ 'o', __NO_OPER },
{ 't', __NO_TRUST },
{ 'k', NL_KICKKILLS }, /* KICK/KILL commands */
{ 'I', NL_MISC }, /* misc commands */
{ 'g', NL_GLINES }, /* GLINE commands */
+ { 'G', NL_GLINES_AUTO }, /* automated gline messages */
{ 'h', NL_HITS }, /* Where a gline or kill is set automatically by the bot */
{ 'c', NL_CLONING }, /* Clone detection */
{ 'C', NL_CLEARCHAN }, /* When someone clearchans */
int noperserv_userflags(void *sender, int cargc, char **cargv);
int noperserv_deluser(void *sender, int cargc, char **cargv);
void noperserv_oper_detection(int hooknum, void *arg);
-void noperserv_reply(nick *np, char *format, ...);
+void noperserv_reply(nick *np, char *format, ...) __attribute__ ((format (printf, 2, 3)));
int init = 0;
" +t: Trusts\n"
" +k: KICK/KILL commands\n"
" +g: GLINE commands\n"
- " +h: Shows when glines are played automatically (hits)\n"
+ " +G: automated gline messages\n"
+ " +h: Shows when glines are set by code (hits)\n"
" +c: Clone information\n"
" +C: CLEARCHAN command\n"
" +f: FAKEUSER commands\n"
newaccount = np->authname;
} else {
if(cargv[0][0] == '#') {
- nick *np2;
- for(i=0;i<NICKHASHSIZE;i++)
- for(np2=nicktable[i];np2;np2=np2->next)
- if(IsAccount(np2) && !ircd_strcmp(cargv[0] + 1, np2->authname)) {
- target = np2;
- newaccount = target->authname;
- break;
- }
- if(!target) {
+ authname *a = getauthbyname(cargv[0] + 1);
+ if(!a) {
controlreply(np, "Cannot find anyone with that authname on the network.");
return CMD_ERROR;
}
+ newaccount = a->name;
} else {
target = getnickbynick(cargv[0]);
if(!target) {
}
void noperserv_oper_detection(int hooknum, void *arg) {
- void **args = (void **)arg;
- nick *np = args[0];
- char *modestr = args[1];
- flag_t after = np->umodes;
+ nick *np = (nick *)arg;
- setflags(&after, UMODE_ALL, modestr, umodeflags, REJECT_NONE);
if(np->umodes & UMODE_OPER) {
- if(!(after & UMODE_OPER))
- controlwall(NO_OPER, NL_OPERING, "%s!%s@%s%s%s just DEOPERed", np->nick, np->ident, np->host->name->content, IsAccount(np)?"/":"", IsAccount(np)?np->authname:"");
- } else {
- if(after & UMODE_OPER)
+ if(np->opername && strcmp(np->opername->content, "-")) {
+ controlwall(NO_OPER, NL_OPERING, "%s!%s@%s%s%s just OPERed as %s", np->nick, np->ident, np->host->name->content, IsAccount(np)?"/":"", IsAccount(np)?np->authname:"", np->opername->content);
+ } else {
controlwall(NO_OPER, NL_OPERING, "%s!%s@%s%s%s just OPERed", np->nick, np->ident, np->host->name->content, IsAccount(np)?"/":"", IsAccount(np)?np->authname:"");
+ }
+ } else {
+ controlwall(NO_OPER, NL_OPERING, "%s!%s@%s%s%s just DEOPERed", np->nick, np->ident, np->host->name->content, IsAccount(np)?"/":"", IsAccount(np)?np->authname:"");
}
}