]> jfr.im git - irc/quakenet/newserv.git/commitdiff
Merge.
authorsplidge <redacted>
Thu, 18 Feb 2010 23:43:15 +0000 (23:43 +0000)
committersplidge <redacted>
Thu, 18 Feb 2010 23:43:15 +0000 (23:43 +0000)
chanserv/authcmds/authhistory.c
chanserv/chancmds/giveowner.c

index 3621657d3a5935f7d4f8639f3022c912024ddf42..1816a0376acbf455cea15c987a21dfdd08821a39 100644 (file)
@@ -3,7 +3,7 @@
  *
  * CMDNAME: authhistory
  * CMDLEVEL: QCMD_AUTHED
- * CMDARGS: 1
+ * CMDARGS: 2
  * CMDDESC: View auth history for an account.
  * CMDFUNC: csa_doauthhistory
  * CMDPROTO: int csa_doauthhistory(void *source, int cargc, char **cargv);
@@ -94,36 +94,54 @@ void csdb_doauthhistory_real(DBConn *dbconn, void *arg) {
 
 void csdb_retreiveauthhistory(nick *np, reguser *rup, int limit) {
   struct authhistoryinfo *ahi;
+  char limitstr[30];
+
+  if (limit) {
+    sprintf(limitstr, " limit %d",limit);
+  } else {
+    limitstr[0]='\0';
+  }
 
   ahi=(struct authhistoryinfo *)malloc(sizeof(struct authhistoryinfo));
   ahi->numeric=np->numeric;
   ahi->userID=rup->ID;
   q9a_asyncquery(csdb_doauthhistory_real, (void *)ahi,
     "SELECT userID, nick, username, host, authtime, disconnecttime, quitreason from chanserv.authhistory where "
-    "userID=%u order by authtime desc limit %d", rup->ID, limit);
+    "userID=%u order by authtime desc%s", rup->ID, limitstr);
 }
 
 int csa_doauthhistory(void *source, int cargc, char **cargv) {
   reguser *rup, *trup;
   nick *sender=source;
-
+  unsigned int arg=0;
+  unsigned int limit=10;
+  
   if (!(rup=getreguserfromnick(sender)))
     return CMD_ERROR;
 
-  if (cargc >= 1) {
-    if (!(trup=findreguser(sender, cargv[0])))
+  if (cargc) {
+    if (!ircd_strcmp(cargv[0], "-a")) {
+      if (UHasOperPriv(rup))
+        limit=0;
+      
+      arg++;
+    }
+  }
+
+  if (cargc > arg) {
+    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[0]);
+      chanservstdmessage(sender, QM_NOACCESSONUSER, "authhistory", cargv[arg]);
       return CMD_ERROR;
     }
   } else {
     trup=rup;
   }
   
-  csdb_retreiveauthhistory(sender, trup, 10);
+  csdb_retreiveauthhistory(sender, trup, limit);
 
   return CMD_OK;
 }
index 7cd7f6101e33687cc1e2aa602182e95fe788ae32..dab11172be5b172673bc7d099e66474578236638 100644 (file)
@@ -91,7 +91,8 @@ int csc_dogiveowner(void *source, int cargc, char **cargv) {
   /* OK, hash matches, do it. */
   oldflags = rcup->flags;
   rcup->flags |= QCUFLAG_OWNER;
-  
+  rcup->changetime=time(NULL);
+          
   chanservstdmessage(sender,QM_DONE);
 
   strcpy(flagbuf,printflags(oldflags,rcuflags));