Forráskód Böngészése

Merge branch 'maint'

* maint:
  Must share SET entries to all bots if the target is not online.
  Slightly optimize check in nextbot()
  No need to send write_userfile_protected entries to localhubs.
Bryan Drewery 10 éve
szülő
commit
7655ca0c58
4 módosított fájl, 15 hozzáadás és 7 törlés
  1. 2 0
      doc/UPDATES.md
  2. 1 1
      src/botnet.cc
  3. 2 1
      src/mod/share.mod/share.cc
  4. 10 5
      src/userent.cc

+ 2 - 0
doc/UPDATES.md

@@ -17,6 +17,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.

+ 1 - 1
src/botnet.cc

@@ -388,7 +388,7 @@ int nextbot(const char *who)
     return -1;
 
   for (int j = 0; j < dcc_total; j++) {
-    if (dcc[j].type && bot->via && !strcasecmp(bot->via->bot, dcc[j].nick) && (dcc[j].type == &DCC_BOT))
+    if (dcc[j].type && bot->via && (dcc[j].type == &DCC_BOT) && !strcasecmp(bot->via->bot, dcc[j].nick))
       return j;
   }
 

+ 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);
     }
   }

+ 10 - 5
src/userent.cc

@@ -95,9 +95,8 @@ bool def_kill(struct user_entry *e)
 
 void write_userfile_protected(bd::Stream& stream, const struct userrec *u, const struct user_entry *e, int idx)
 {
-  int localhub = nextbot(u->handle);
-  /* only write if saving local, or if sending to hub, or if sending to same user as entry, or the localhub in the chain */
-  if (idx == -1 || dcc[idx].hub || dcc[idx].user == u || (localhub != -1 && idx == localhub)) {
+  /* only write if saving local, or if sending to hub, or if sending to same user as entry */
+  if (idx == -1 || dcc[idx].hub || dcc[idx].user == u) {
     stream << bd::String::printf("--%s %s\n", e->type->name, e->u.string);
   }
 }
@@ -363,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 : "");
     }
   }