From 41837210e19d855ca323f99603cf70c3652c3c44 Mon Sep 17 00:00:00 2001 From: Yuki Morishita Date: Mon, 8 Sep 2014 14:35:50 -0500 Subject: [PATCH] Customizable server name Read server name from config if "name" is present. --- src/client.js | 4 +++- src/models/network.js | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/client.js b/src/client.js index 7011d18..4a59267 100644 --- a/src/client.js +++ b/src/client.js @@ -74,7 +74,8 @@ Client.prototype.connect = function(args) { var client = this; var server = { host: args.host || "irc.freenode.org", - port: args.port || 6667 + port: args.port || 6667, + name: args.name }; var stream = args.tls ? tls.connect(server) : net.connect(server); @@ -92,6 +93,7 @@ Client.prototype.connect = function(args) { var network = new Network({ host: server.host, + name: server.name, irc: irc }); diff --git a/src/models/network.js b/src/models/network.js index de9dfcc..25c85e9 100644 --- a/src/models/network.js +++ b/src/models/network.js @@ -11,9 +11,9 @@ function Network(attr) { connected: false, host: "", id: id++, - irc: null, - name: prettify(attr.host) + irc: null }, attr)); + this.name = attr.name || prettify(attr.host); this.channels.unshift( new Chan({name: this.name, type: Chan.Type.LOBBY}) );