|
|
@@ -655,8 +655,9 @@ readsocks(const char *fname)
|
|
|
if (!conf.bot->hub)
|
|
|
restarting = 1;
|
|
|
|
|
|
- char *nick = NULL, *jnick = NULL, *ip4 = NULL, *ip6 = NULL;
|
|
|
- time_t old_buildts = 0;
|
|
|
+ char *_botname = NULL, *ip4 = NULL, *ip6 = NULL,
|
|
|
+ *_origbotname = NULL, *_jupenick = NULL;
|
|
|
+ time_t old_buildts = 0, _server_online = 0;
|
|
|
|
|
|
bool cached_005 = 0;
|
|
|
const char salt1[] = SALT1;
|
|
|
@@ -678,7 +679,7 @@ readsocks(const char *fname)
|
|
|
else if (type == STR("+online_since"))
|
|
|
online_since = strtol(str.c_str(), NULL, 10);
|
|
|
else if (type == STR("+server_online"))
|
|
|
- server_online = strtol(str.c_str(), NULL, 10);
|
|
|
+ _server_online = strtol(str.c_str(), NULL, 10);
|
|
|
else if (type == STR("+server_floodless"))
|
|
|
floodless = 1;
|
|
|
else if (type == STR("+in_deaf"))
|
|
|
@@ -697,7 +698,11 @@ readsocks(const char *fname)
|
|
|
else if (type == STR("+buildts"))
|
|
|
old_buildts = strtol(str.c_str(), NULL, 10);
|
|
|
else if (type == STR("+botname"))
|
|
|
- nick = str.dup();
|
|
|
+ _botname = str.dup();
|
|
|
+ else if (type == STR("+origbotname"))
|
|
|
+ _origbotname = str.dup();
|
|
|
+ else if (type == STR("+jupenick"))
|
|
|
+ _jupenick = str.dup();
|
|
|
else if (type == STR("+rolls"))
|
|
|
rolls = atoi(str.c_str());
|
|
|
else if (type == STR("+altnick_char"))
|
|
|
@@ -730,6 +735,13 @@ readsocks(const char *fname)
|
|
|
|
|
|
unlink(fname);
|
|
|
|
|
|
+ /* server_online is not yet set so these will safely not send NICK. */
|
|
|
+ if (_origbotname) {
|
|
|
+ var_set_by_name(conf.bot->nick, "nick", _origbotname);
|
|
|
+ }
|
|
|
+ if (_jupenick) {
|
|
|
+ var_set_by_name(conf.bot->nick, "jupenick", _jupenick);
|
|
|
+ }
|
|
|
if (servidx >= 0) {
|
|
|
char nserv[50] = "";
|
|
|
|
|
|
@@ -752,8 +764,10 @@ readsocks(const char *fname)
|
|
|
curserv = 0;
|
|
|
keepnick = 0; /* Wait to change nicks until relinking, fixes nick/jupenick switching issues during restart */
|
|
|
reset_flood();
|
|
|
- if (!server_online) server_online = now;
|
|
|
- rehash_server(dcc[servidx].host, nick);
|
|
|
+ if (!_server_online)
|
|
|
+ _server_online = now;
|
|
|
+ server_online = _server_online;
|
|
|
+ rehash_server(dcc[servidx].host, _botname);
|
|
|
if (cached_005)
|
|
|
replay_cache(servidx, NULL);
|
|
|
else
|
|
|
@@ -762,11 +776,11 @@ readsocks(const char *fname)
|
|
|
reset_chans = 1;
|
|
|
}
|
|
|
}
|
|
|
- delete[] nick;
|
|
|
+ delete[] _botname;
|
|
|
+ delete[] _origbotname;
|
|
|
+ delete[] _jupenick;
|
|
|
delete[] ip4;
|
|
|
delete[] ip6;
|
|
|
- if (jnick)
|
|
|
- free(jnick);
|
|
|
if (socksfile)
|
|
|
free(socksfile);
|
|
|
}
|
|
|
@@ -817,6 +831,10 @@ restart(int idx)
|
|
|
if (server_online) {
|
|
|
if (botname[0])
|
|
|
stream << bd::String::printf(STR("+botname %s\n"), botname);
|
|
|
+ if (origbotname[0])
|
|
|
+ stream << bd::String::printf(STR("+origbotname %s\n"), origbotname);
|
|
|
+ if (jupenick[0])
|
|
|
+ stream << bd::String::printf(STR("+jupenick %s\n"), jupenick);
|
|
|
if (rolls)
|
|
|
stream << bd::String::printf(STR("+rolls %d\n"), rolls);
|
|
|
if (altnick_char)
|