Răsfoiți Sursa

Must share SET entries to all bots if the target is not online.

The problem is if a new bot is added and they are not yet connected,
then a new .set is ran.  The new SET entry will never share to the
localhub.  Once the bot does connect it comes up with stale information
since the localhub is caching the userfile directly to it.  This is not
resolved until the localhub relinks to get a fresh userfile AND their
leaf bots are connected.

This reworks 1da96702 and 174b3caa.
Bryan Drewery 10 ani în urmă
părinte
comite
2f653e963f
3 a modificat fișierele cu 12 adăugiri și 3 ștergeri
  1. 2 0
      doc/UPDATES.md
  2. 2 1
      src/mod/share.mod/share.cc
  3. 8 2
      src/userent.cc

+ 2 - 0
doc/UPDATES.md

@@ -14,6 +14,8 @@
   * Fix auto-voice and auto-op not applying after a nick change.
   * Don't truncate bot's join time on .reset.
   * Fix various small memory leaks.
+  * Fix case where .[bot]set would not share to new bots until their localhub
+    was relinked.
 
 # 1.4.6
   * Disable demo TCL support by default to prevent confusion during build.

+ 2 - 1
src/mod/share.mod/share.cc

@@ -1233,7 +1233,8 @@ shareout_prot(struct userrec *u, const char *format, ...)
     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, the bot itself, or the localhub in the chain */
-       (dcc[i].hub || dcc[i].user == u || (localhub != -1 && i == localhub))) {
+       /* SA set_write_userfile */
+       (dcc[i].hub || dcc[i].user == u || (localhub == -1 || i == localhub))) {
       tputs(dcc[i].sock, s, l + 2);
     }
   }

+ 8 - 2
src/userent.cc

@@ -362,8 +362,14 @@ static void set_write_userfile(bd::Stream& stream, const struct userrec *u, cons
   struct xtra_key *x = (struct xtra_key *) e->u.extra;
 
   for (; x; x = x->next) {
-    /* only write if saving local, or if sending to hub, or if sending to same user as entry, or the localhub in the chain, or sending 'groups' */
-    if (idx == -1 || dcc[idx].hub || dcc[idx].user == u || (localhub != -1 && idx == localhub) || !strcmp(x->key, "groups")) {
+    /*
+     * only write if saving local, or if sending to hub, or if sending to
+     * same user as entry, or they are not connected,
+     * or the localhub in the chain, or sending 'groups'.
+     * SA shareout_prot
+     */
+    if (idx == -1 || dcc[idx].hub || dcc[idx].user == u ||
+        (localhub == -1 || idx == localhub) || !strcmp(x->key, "groups")) {
       stream << bd::String::printf("--%s %s %s\n", e->type->name, x->key, x->data ? x->data : "");
     }
   }