]> jfr.im git - irc/quakenet/newserv.git/blobdiff - trusts/formats.c
Implement pernodemax/nodebits for THs.
[irc/quakenet/newserv.git] / trusts / formats.c
index 771673511824a4d1a9917fe2a86103e93363add2..d6a15c181026705e7a9814c5a60ae4a3fe12728c 100644 (file)
@@ -79,7 +79,7 @@ char *dumpth(trusthost *th, int oformat) {
   if(oformat) {
     snprintf(buf, sizeof(buf), "#%u,%s,%u,%u,%jd", th->group->id, trusts_cidr2str(th->ip, th->mask), th->count, th->maxusage, (intmax_t)th->lastseen);
   } else {
-    snprintf(buf, sizeof(buf), "%u,%s,%u,%u,%jd,%jd", th->group->id, trusts_cidr2str(th->ip, th->mask), th->id, th->maxusage, (intmax_t)th->lastseen, (intmax_t)th->created);
+    snprintf(buf, sizeof(buf), "%u,%s,%u,%u,%jd,%jd,%u,%u", th->group->id, trusts_cidr2str(th->ip, th->mask), th->id, th->maxusage, (intmax_t)th->lastseen, (intmax_t)th->created, th->maxpernode, th->nodebits);
   }
 
   return buf;
@@ -189,6 +189,7 @@ int parsetg(char *buf, trustgroup *tg, int oformat) {
 
 int parseth(char *line, trusthost *th, unsigned int *tgid, int oformat) {
   unsigned long lastseen, created;
+  int maxpernode, nodebits;
   char *ip, xbuf[1024], *id;
 
 /* #id,213.230.192.128/26,20,23,1222732944
@@ -223,12 +224,14 @@ int parseth(char *line, trusthost *th, unsigned int *tgid, int oformat) {
       return 0;
     created = time(NULL);
   } else {
-    if(sscanf(line, "%u,%u,%lu,%lu", &th->id, &th->maxusage, &lastseen, &created) != 4)
+    if(sscanf(line, "%u,%u,%lu,%lu,%d,%d", &th->id, &th->maxusage, &lastseen, &created, &maxpernode, &nodebits) != 6)
       return 0;
   }
 
   th->lastseen = (time_t)lastseen;
   th->created = (time_t)created;
+  th->maxpernode = maxpernode;
+  th->nodebits = nodebits;
 
   return 1;
 }