@@ -310,13 +310,16 @@ bot_version(int idx, char *par)
if (conf.bot->hub || conf.bot->localhub) {
if (bot_hublevel(dcc[idx].user) < 999) {
- if (!bot_aggressive_to(dcc[idx].user)) //not aggressive, so they are technically my uplink.
+ if (!bot_aggressive_to(dcc[idx].user)) { //not aggressive, so they are technically my uplink.
uplink_idx = idx;
+ have_linked_to_hub = 1;
+ }
dcc[idx].hub = 1;
}
botnet_send_nlinked(idx, dcc[idx].nick, conf.bot->nick, '!', vlocalhub, vbuildts, vcommit, vversion);
} else {
@@ -98,6 +98,7 @@ bool used_B = 0; /* did we get started with -B? */
int role;
bool loading = 0;
int default_flags = 0; /* Default user flags and */
+bool have_linked_to_hub = 0; /* Have we ever been linked to a hub? */
int default_uflags = 0; /* Default userdefinied flags for people
who say 'hello' or for .adduser */
int do_restart = 0;
@@ -15,7 +15,7 @@ enum {
extern int role, default_flags, default_uflags, do_confedit,
updating, do_restart;
-extern bool use_stderr, backgrd, used_B, term_z, loading, restart_was_update, restarting;
+extern bool use_stderr, backgrd, used_B, term_z, loading, have_linked_to_hub, restart_was_update, restarting;
extern char tempdir[], *binname, owner[], version[151], ver[101], quit_msg[], *socksfile;
extern time_t online_since, now, restart_time;
extern uid_t myuid;
@@ -831,8 +831,17 @@ void write_vars_and_cmdpass(bd::Stream& stream, int idx)
int i = 0;
for (i = 0; vars[i].name; i++) {
- /* send blanks if our variable isn't set, theirs MIGHT be set and needs to be UNSET */
- stream << buf.printf("@ %s %s\n", vars[i].name, vars[i].gdata ? vars[i].gdata : "");
+ // If we're a localhub, dont share variables set to not leaf default unless we're linked to a hub.
+ // Otherwise, we share out servers, and the child bots connect to the default list,
+ // before ever receiving the actual list from the hub. (Along with stuff like realname)
+ if (conf.bot->hub ||
+ (conf.bot->localhub &&
+ (!(vars[i].flags & VAR_NOLDEF) ||
+ ((vars[i].flags & VAR_NOLDEF) && have_linked_to_hub))
+ )) {
+ /* send blanks if our variable isn't set, theirs MIGHT be set and needs to be UNSET */
+ stream << buf.printf("@ %s %s\n", vars[i].name, vars[i].gdata ? vars[i].gdata : "");
for (struct cmd_pass *cp = cmdpass; cp; cp = cp->next)