From 195799e69229cdeb95828ca59da2b8abeec992ac Mon Sep 17 00:00:00 2001
From: deuce <>
Date: Wed, 13 Jan 2016 22:49:30 +0000
Subject: [PATCH] Fix M_ADR command. Fix bugs in previous commit. Use
 Date.toString() instead of system.timestr for TIME value.

---
 exec/load/binkp.js | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/exec/load/binkp.js b/exec/load/binkp.js
index 4224f78f29..0a09e19cc0 100644
--- a/exec/load/binkp.js
+++ b/exec/load/binkp.js
@@ -66,7 +66,7 @@ function BinkP(inbound, rx_callback, auth_callback)
 	this.system_name = system.name;
 	this.system_operator = system.operator;
 	this.system_location = system.location;
-	system.fido_addr_list.forEach(function(addr, this){this.addr_list.push(addr);});
+	system.fido_addr_list.forEach(function(addr){this.addr_list.push(addr);}, this);
 
 	this.sent_files = [];
 	this.failed_sent_files = [];
@@ -230,14 +230,13 @@ BinkP.prototype.session = function(addr, password, port)
 	}
 
 	this.authenticated = undefined;
-	this.sendCmd(this.command.M_NUL, "SYS "+system_name);
-	this.sendCmd(this.command.M_NUL, "ZYZ "+system_operator);
-	this.sendCmd(this.command.M_NUL, "LOC "+system_location);
+	this.sendCmd(this.command.M_NUL, "SYS "+this.system_name);
+	this.sendCmd(this.command.M_NUL, "ZYZ "+this.system_operator);
+	this.sendCmd(this.command.M_NUL, "LOC "+this.system_location);
 	this.sendCmd(this.command.M_NUL, "NDL 115200,TCP,BINKP");
-	this.sendCmd(this.command.M_NUL, "TIME "+system.timestr());
+	this.sendCmd(this.command.M_NUL, "TIME "+new Date().toString());
 	this.sendCmd(this.command.M_NUL, "VER JSBinkP/0.0.0/"+system.platform+" binkp/1.1");
-	for (i=0; i<this.addr_list.length; i++)
-		this.sendCmd(this.command.M_ADR, this.addr_list[i]);
+	this.sendCmd(this.command.M_ADR, this.addr_list.join(' '));
 
 	while(!js.terminated && this.remote_addrs === undefined) {
 		pkt = this.recvFrame(this.timeout);
-- 
GitLab