Customizable server name

Read server name from config if "name" is present.
This commit is contained in:
Yuki Morishita 2014-09-08 14:35:50 -05:00
parent 2f5be12d00
commit 41837210e1
2 changed files with 5 additions and 3 deletions

View File

@ -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
});

View File

@ -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})
);