]> jfr.im git - irc/quakenet/newserv.git/blobdiff - trusts/data.c
fix indentation
[irc/quakenet/newserv.git] / trusts / data.c
index b19e875792dfa5d202ab127bb1f6a703baee4651..456699a68009bc500a95baaf83a0a249b3b5faa9 100644 (file)
@@ -101,6 +101,8 @@ trusthost *th_add(trustgroup *tg, unsigned int id, char *host, unsigned int maxu
   th->parent = NULL;
   th->children = NULL;
 
+  th->marker = 0;
+
   th->next = tg->hosts;
   tg->hosts = th;
 
@@ -141,6 +143,8 @@ trustgroup *tg_add(unsigned int id, char *name, unsigned int trustedfor, int mod
   tg->lastmaxuserreset = lastmaxuserreset;
   tg->hosts = NULL;
 
+  tg->marker = 0;
+
   tg->count = 0;
 
   memset(tg->exts, 0, sizeof(tg->exts));
@@ -391,3 +395,37 @@ void th_adjusthosts(trusthost *th, trusthost *superset, trusthost *subset) {
           trusts_newnick(np, 1);
   }
 }
+
+unsigned int nexttgmarker(void) {
+  static unsigned int tgmarker = 0;
+  trustgroup *tg;
+
+  tgmarker++;
+  if(!tgmarker) {
+    /* If we wrapped to zero, zap the marker on all groups */
+    for(tg=tglist;tg;tg=tg->next)
+      tg->marker=0;
+
+    tgmarker++;
+  }
+
+  return tgmarker;
+}
+
+unsigned int nextthmarker(void) {
+  static unsigned int thmarker = 0;
+  trustgroup *tg;
+  trusthost *th;
+
+  thmarker++;
+  if(!thmarker) {
+    /* If we wrapped to zero, zap the marker on all hosts */
+    for(tg=tglist;tg;tg=tg->next)
+      for(th=tg->hosts;th;th=th->next)
+        th->marker=0;
+
+    thmarker++;
+  }
+
+  return thmarker;
+}