]> jfr.im git - irc/quakenet/newserv.git/blobdiff - chanserv/chancmds/suspendchanlist.c
chanserv: Fix pattern matching for suspendchanlist.
[irc/quakenet/newserv.git] / chanserv / chancmds / suspendchanlist.c
index 1a6213867b3b5a8c6f40235f7df137046dd78d45..86776b29f244e5a8d2e38acaac48e51cc39b7380 100644 (file)
@@ -27,10 +27,9 @@ int csc_dosuspendchanlist(void *source, int cargc, char **cargv) {
   reguser *rup=getreguserfromnick(sender);
   chanindex *cip;
   regchan *rcp;
-  int i;
-  char *bywhom, buf[200];
+  int i, seewhom;
+  char *bywhom, buf[TIMELEN];
   unsigned int count=0;
-  struct tm *tmp;
   if (!rup)
     return CMD_ERROR;
   
@@ -39,6 +38,11 @@ int csc_dosuspendchanlist(void *source, int cargc, char **cargv) {
     return CMD_ERROR;
   }
   
+  seewhom = cs_privcheck(QPRIV_VIEWSUSPENDEDBY, sender);
+  if(!seewhom)
+    bywhom = "(hidden)";
+
+  /* @TIMELEN */
   chanservstdmessage(sender, QM_SUSPENDCHANLISTHEADER);
   for (i=0; i<CHANNELHASHSIZE; i++) {
     for (cip=chantable[i]; cip; cip=cip->next) {
@@ -48,24 +52,26 @@ int csc_dosuspendchanlist(void *source, int cargc, char **cargv) {
       if (!CIsSuspended(rcp))
         continue;
       
-      if ((rcp->suspendby != rup->ID) && match(cargv[0], cip->name->content))
+      if (match(cargv[0], cip->name->content) != 0)
         continue;
-      
-      if (rcp->suspendby == rup->ID)
-        bywhom=rup->username;
-      else {
-        reguser *trup=findreguserbyID(rcp->suspendby);
-        if (trup)
-          bywhom=trup->username;
-        else
-          bywhom="unknown";
+
+      if(seewhom) {      
+        if (rcp->suspendby == rup->ID)
+          bywhom=rup->username;
+        else {
+          reguser *trup=findreguserbyID(rcp->suspendby);
+          if (trup)
+            bywhom=trup->username;
+          else
+            bywhom="(unknown)";
+        }
       }
       count++;
 
-      tmp=gmtime(&(rcp->suspendtime));
-      strftime(buf,15,"%d/%m/%y %H:%M",tmp);
+      q9strftime(buf,sizeof(buf),rcp->suspendtime);
 
-      chanservsendmessage(sender, "%-30s %-15s %-15s %s", cip->name->content, bywhom, buf, rcp->suspendreason?rcp->suspendreason->content:"(no reason)");
+      /* @TIMELEN */
+      chanservsendmessage(sender, "%-30s %-15s %-19s %s", cip->name->content, bywhom, buf, rcp->suspendreason?rcp->suspendreason->content:"(no reason)");
       if (count >= 2000) {
         chanservstdmessage(sender, QM_TOOMANYRESULTS, 2000, "channels");
         return CMD_ERROR;