]> jfr.im git - irc/quakenet/newserv.git/blobdiff - noperserv/noperserv.c
whowas: Fix reason newsearch operator.
[irc/quakenet/newserv.git] / noperserv / noperserv.c
index 0c689565d8312fe91f4771ee155d89a4851cf45c..ae5c3c1062c03079923834e8bbc9753df684e3ca 100644 (file)
@@ -27,6 +27,8 @@ MODULE_VERSION("");
 #define NO_FOUND_NICKNAME 1
 #define NO_FOUND_AUTHNAME 2
 
+int noperserv_ext;
+
 const flag no_commandflags[] = {
     { 'o', __NO_OPER },
     { 't', __NO_TRUST },
@@ -57,6 +59,7 @@ const flag no_noticeflags[] = {
     { '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 */
@@ -74,7 +77,7 @@ int noperserv_noticeflags(void *sender, int cargc, char **cargv);
 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;
 
@@ -113,7 +116,8 @@ void _init() {
     "  +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"
@@ -170,7 +174,7 @@ int noperserv_hello(void *sender, int cargc, char **cargv) {
         controlreply(np, "Cannot find anyone with that authname on the network.");
         return CMD_ERROR;
       }
-      target = a->nicks;
+      newaccount = a->name;
     } else {
       target = getnickbynick(cargv[0]);
       if(!target) {
@@ -484,17 +488,15 @@ int noperserv_userflags(void *sender, int cargc, char **cargv) {
 }
 
 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:"");
   }
 }