]> jfr.im git - irc/quakenet/newserv.git/blobdiff - trusts/trusts_api.c
Merge default.
[irc/quakenet/newserv.git] / trusts / trusts_api.c
index fff5f53e096cb35ef6d99f700d3b603deee97bc0..a66ba6f043ab9751cceab2b5741eb956b51cb0ae 100644 (file)
@@ -1,34 +1,25 @@
 #include <stdio.h>
+#include "../lib/version.h"
 #include <../nick/nick.h>
 #include "../irc/irc.h"
 #include "trusts.h"
 
+MODULE_VERSION("");
+
 int istrusted(nick *np) {
   return gettrusthost(np) != NULL;
 }
 
-int trustgline(trustgroup *tg, const char *ident, int duration, const char *reason) {
+unsigned char getnodebits(struct irc_in_addr *ip) {
   trusthost *th;
-  int count = 0;
-
-  for(th=tg->hosts;th;th=th->next) {
-    char *cidrstr = trusts_cidr2str(&th->ip, th->bits);
-    irc_send("%s GL * +%s@%s %d %jd :%s", mynumeric->content, ident, cidrstr, duration, (intmax_t)getnettime(), reason);
-    count++;
-  }
 
-  return count;
-}
-
-int trustungline(trustgroup *tg, const char *ident, int duration, const char *reason) {
-  trusthost *th;
-  int count = 0;
+  th = th_getbyhost(ip);
 
-  for(th=tg->hosts;th;th=th->next) {
-    char *cidrstr = trusts_cidr2str(&th->ip, th->bits);
-    irc_send("%s GL * +%s@%s %d %jd :%s", mynumeric->content, ident, cidrstr, duration, (intmax_t)getnettime(), reason);
-    count++;
-  }
+  if(th)
+    return th->nodebits;
 
-  return count;
+  if(irc_in_addr_is_ipv4(ip))
+    return 128;
+  else
+    return 64;
 }