]> jfr.im git - irc/quakenet/newserv.git/blobdiff - chanserv/authcmds/authhistory.c
Merge - fixed conflicts in chanserv/authcmds/authhistory.c.
[irc/quakenet/newserv.git] / chanserv / authcmds / authhistory.c
index 1816a0376acbf455cea15c987a21dfdd08821a39..44f32a278a105cfb68edd88462ba789744828697 100644 (file)
@@ -132,15 +132,28 @@ int csa_doauthhistory(void *source, int cargc, char **cargv) {
     if (!(trup=findreguser(sender, cargv[arg])))
       return CMD_ERROR;
 
-    /* don't allow non-opers to view oper auth history, but allow helpers to view non-oper history */
-    if ((trup != rup) && ((UHasOperPriv(trup) && !UHasOperPriv(rup)) || !UHasHelperPriv(rup))) {
-      chanservstdmessage(sender, QM_NOACCESSONUSER, "authhistory", cargv[arg]);
-      return CMD_ERROR;
+    /* if target != command issuer */
+    if (trup != rup) {
+      /* only opers and helpers can view authhistory of other users */
+      if (!UHasHelperPriv(rup)) {
+        chanservstdmessage(sender, QM_NOACCESSONUSER, "authhistory", cargv[arg]);
+        return CMD_ERROR;
+      }
+
+      /* and only opers can view opers history */
+      if (UHasOperPriv(trup) && !UHasOperPriv(rup)) {
+        chanservwallmessage("%s (%s) just FAILED using AUTHHISTORY on %s", sender->nick, rup->username, trup->username);
+        chanservstdmessage(sender, QM_NOACCESSONUSER, "authhistory", cargv[arg]);
+        return CMD_ERROR;
+      }
+
+      /* checks passed */
+      chanservwallmessage("%s (%s) used AUTHHISTORY on %s", sender->nick, rup->username, trup->username);
     }
   } else {
     trup=rup;
   }
-  
+
   csdb_retreiveauthhistory(sender, trup, limit);
 
   return CMD_OK;