فهرست منبع

Only share LASTON to hubs.

Leaf bots don't need it and it is very spammy.
Bryan Drewery 10 سال پیش
والد
کامیت
3f1eaf506d
3فایلهای تغییر یافته به همراه27 افزوده شده و 1 حذف شده
  1. 25 0
      src/mod/share.mod/share.cc
  2. 1 0
      src/mod/share.mod/share.h
  3. 1 1
      src/userent.cc

+ 25 - 0
src/mod/share.mod/share.cc

@@ -1241,6 +1241,31 @@ shareout_prot(struct userrec *u, const char *format, ...)
   q_resync(s);
 }
 
+void
+shareout_hub(const char *format, ...)
+{
+  char s[601] = "";
+  int l;
+  va_list va;
+
+  va_start(va, format);
+
+  strlcpy(s, "s ", 3);
+  if ((l = egg_vsnprintf(s + 2, 509, format, va)) < 0)
+    s[2 + (l = 509)] = 0;
+  va_end(va);
+
+  for (int i = 0; i < dcc_total; i++) {
+    if (dcc[i].type && (dcc[i].type->flags & DCT_BOT) &&
+       (dcc[i].status & STAT_SHARE) && !(dcc[i].status & (STAT_GETTING | STAT_SENDING)) &&
+       /* only send to hubs */
+       dcc[i].hub) {
+      tputs(dcc[i].sock, s, l + 2);
+    }
+  }
+  q_resync(s);
+}
+
 static void
 shareout_but(int x, const char *format, ...)
 {

+ 1 - 0
src/mod/share.mod/share.h

@@ -16,6 +16,7 @@
 void sharein(int, char *);
 void shareout(const char *, ...) __attribute__((format(printf, 1, 2)));
 void shareout_prot(struct userrec *, const char *, ...) __attribute__((format(printf, 2, 3)));
+void shareout_hub(const char *, ...) __attribute__((format(printf, 1, 2)));
 void finish_share(int);
 void dump_resync(int);
 void share_report(int, int);

+ 1 - 1
src/userent.cc

@@ -726,7 +726,7 @@ static bool laston_set(struct userrec *u, struct user_entry *e, void *buf)
   }
 
   if (!noshare)
-    shareout("c LASTON %s %s %li\n", u->handle, li->lastonplace ? li->lastonplace : "-", (long) li->laston);
+    shareout_hub("c LASTON %s %s %li\n", u->handle, li->lastonplace ? li->lastonplace : "-", (long) li->laston);
 
   return 1;
 }