Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit a50517e4 authored by Randy Sommerfeld's avatar Randy Sommerfeld

Improve server connects (both auto and manual)

parent 71eb0da6
......@@ -1614,17 +1614,23 @@ function IRCClient_trace_all_opers() {
}
}
function IRCClient_do_connect(con_server,con_port) {
function Find_CLine_by_Server(str) {
var i;
var con_cline = "";
for (i in CLines) {
if (wildmatch(CLines[i].servername,con_server) ||
wildmatch(CLines[i].host,con_server) ) {
con_cline = CLines[i];
break;
}
if (wildmatch(CLines[i].servername,str) || wildmatch(CLines[i].host,str))
return CLines[i];
}
return false;
}
function IRCClient_do_connect(con_server,con_port) {
var i;
var con_cline;
var msg;
var con_type;
con_cline = Find_CLine_by_Server(con_server);
if (!con_cline) {
this.numeric402(con_server);
return 0;
......@@ -1637,19 +1643,28 @@ function IRCClient_do_connect(con_server,con_port) {
this.server_notice("Invalid port: " + con_port);
return 0;
}
var msg = " CONNECT " + con_cline.servername + " " + con_port +
" from " + this.nick + "[" + this.uprefix + "@" +
this.hostname + "]";
var con_type = "Local";
msg = format(" CONNECT %s %u from %s [%s@%s]",
con_cline.servername,
con_port,
this.nick,
this.uprefix,
this.hostname
);
con_type = "Local";
if (this.parent) {
con_type = "Remote";
server_bcast_to_servers("GNOTICE :Remote" + msg);
}
umode_notice(USERMODE_ROUTING,"Routing","from "+ServerName+": " +
con_type + msg);
umode_notice(USERMODE_ROUTING,"Routing",format("from %s: %s%s",
ServerName,
con_type,
msg
));
if (con_cline.next_connect)
js.clearTimeout(con_cline.next_connect);
con_cline.next_connect = js.setTimeout(
connect_to_server,
YLines[con_cline.ircclass].connfreq * 1000,
1, /* connect as soon as possible */
con_cline
);
return 1;
......
......@@ -1272,29 +1272,55 @@ function IRCClient_bcast_to_servers_raw(str) {
}
function Server_Quit(str,suppress_bcast,is_netsplit,origin) {
var cline;
if (!str)
str = this.nick;
if (is_netsplit) {
this.netsplit(str);
} else if (this.local) {
this.netsplit(ServerName + " " + this.nick);
if (!suppress_bcast)
this.bcast_to_servers_raw("SQUIT " + this.nick + " :" + str);
this.netsplit(format("%s %s", ServerName, this.nick));
if (!suppress_bcast) {
this.bcast_to_servers_raw(format("SQUIT %s :%s",
this.nick,
str
));
}
} else if (origin) {
this.netsplit(origin.nick + " " + this.nick);
if (!suppress_bcast)
this.bcast_to_servers_raw(":" + origin.nick + " SQUIT " + this.nick + " :" + str);
this.netsplit(format("%s %s", origin.nick, this.nick));
if (!suppress_bcast) {
this.bcast_to_servers_raw(format(":%s SQUIT %s :%s",
origin.nick,
this.nick,
str
));
}
} else {
umode_notice(USERMODE_OPER,"Notice",
"Netspliting a server which isn't local and doesn't " +
"have an origin?!");
if (!suppress_bcast)
this.bcast_to_servers_raw("SQUIT " + this.nick + " :" + str);
umode_notice(USERMODE_OPER,"Notice","Bogus netsplit???");
if (!suppress_bcast) {
this.bcast_to_servers_raw(format("SQUIT %s :%s",
this.nick,
str
));
}
this.netsplit();
}
if (this.local) {
if (YLines[this.ircclass].connfreq) {
cline = Find_CLine_by_Server(this.nick);
if (cline) {
if (cline.next_connect)
js.clearTimeout(cline.next_connect);
cline.next_connect = js.setTimeout(
connect_to_server,
YLines[this.ircclass].connfreq * 1000,
cline
);
}
}
if (YLines[this.ircclass].active > 0) {
YLines[this.ircclass].active--;
log(LOG_DEBUG, format("Class %s down to %d active out of %d",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment