]> jfr.im git - irc/quakenet/newserv.git/blobdiff - trojanscan/trojanscan.c
fix indentation
[irc/quakenet/newserv.git] / trojanscan / trojanscan.c
index 721bd46f88240af1a54d6976cb9d1f4423cc957d..21d2849576eef63931c1f4442f58cbb61295c1db 100644 (file)
@@ -15,6 +15,7 @@
 #include "../lib/strlfunc.h"
 #include "../lib/version.h"
 #include "../core/nsmalloc.h"
+#include <stdint.h>
 
 #define tmalloc(x)     nsmalloc(POOL_TROJANSCAN, x)
 #define tfree(x)       nsfree(POOL_TROJANSCAN, x)
@@ -372,7 +373,9 @@ void trojanscan_free_database(void) {
   trojanscan_database.total_channels = 0;
   trojanscan_database.total_phrases = 0;
   trojanscan_database.total_worms = 0;
-  
+  trojanscan_database.channels = NULL;
+  trojanscan_database.phrases = NULL;
+  trojanscan_database.worms = NULL;  
 }
 
 char *trojanscan_sanitise(char *input) {
@@ -738,7 +741,7 @@ int trojanscan_whois(void *sender, int cargc, char **cargv) {
     for(i=0;i<TROJANSCAN_CLONE_TOTAL;i++) {
       if(trojanscan_swarm[i].clone->nick && !ircd_strcmp(trojanscan_swarm[i].clone->nick, np2->nick)) {
         trojanscan_reply(np, "Nickname   : %s", np2->nick);
-        trojanscan_reply(np, "Swarm      : yes", trojanscan_swarm[i].clone->nick);
+        trojanscan_reply(np, "Swarm      : yes");
         return CMD_OK;
       }
     }
@@ -1995,16 +1998,14 @@ static int trojanscan_hostcount(nick *sender, int hostmode, char *mask, int mask
   nick *np = NULL; /* sigh at warnings */
 
   if(hostmode)
-    for (j=0;j<NICKHASHSIZE;j++)
-      for (np=nicktable[j];np;np=np->next)
-        if (np->ipnode==sender->ipnode)
-          usercount++;
+    usercount = sender->ipnode->usercount;
 
   if(usercount > TROJANSCAN_MAX_HOST_GLINE) {
     hostmode = 0;
     usercount = 0;
   }
 
+  /* should really go through the ipnode I guess */
   if(!hostmode)
     for (j=0;j<NICKHASHSIZE;j++)
       for (np=nicktable[j];np;np=np->next)
@@ -2078,9 +2079,9 @@ void trojanscan_phrasematch(channel *chp, nick *sender, trojanscan_phrases *phra
     trojanscan_database_query("INSERT INTO hits (nickname, ident, host, phrase, messagetype, glined) VALUES ('%s', '%s', '%s', %d, '%c', %d)", enick, eident, ehost, phrase->id, messagetype, glining);
     trojanscan_database.glines++;
     
-    irc_send("%s GL * +%s %d %d :You (%s!%s@%s) are infected with a trojan (%s/%d), see %s%d for details - banned for %d hours\r\n", mynumeric->content, glinemask, glinetime * 3600, time(NULL), sender->nick, sender->ident, sender->host->name->content, worm->name->content, phrase->id, TROJANSCAN_URL_PREFIX, worm->id, glinetime);
+    irc_send("%s GL * +%s %d %jd :You (%s!%s@%s) are infected with a trojan (%s/%d), see %s%d for details - banned for %d hours\r\n", mynumeric->content, glinemask, glinetime * 3600, (intmax_t)time(NULL), sender->nick, sender->ident, sender->host->name->content, worm->name->content, phrase->id, TROJANSCAN_URL_PREFIX, worm->id, glinetime);
 
-    trojanscan_mainchanmsg("g: *!%s t: %c u: %s!%s@%s%s%s c: %d w: %s%s p: %d f: %d", glinemask, messagetype, sender->nick, sender->ident, sender->host->name->content, messagetype=='N'||messagetype=='M'||messagetype=='P'?" #: ":"", messagetype=='N'||messagetype=='M'||messagetype=='P'?chp->index->name->content:"", usercount, worm->name->content, worm->epidemic?"(E)":"", phrase->id, frequency);
+    trojanscan_mainchanmsg("g: *!%s t: %c u: %s!%s@%s%s%s c: %d w: %s%s p: %d f: %d%s%s", glinemask, messagetype, sender->nick, sender->ident, sender->host->name->content, messagetype=='N'||messagetype=='M'||messagetype=='P'?" #: ":"", messagetype=='N'||messagetype=='M'||messagetype=='P'?chp->index->name->content:"", usercount, worm->name->content, worm->epidemic?"(E)":"", phrase->id, frequency, matchbuf[0]?" --: ":"", matchbuf[0]?matchbuf:"");
   }
 }