Added default connection values

This commit is contained in:
Mattias Erming 2014-07-18 07:40:08 -07:00
parent a9db46cf2c
commit 76ccf0f204
6 changed files with 30 additions and 21 deletions

View File

@ -76,31 +76,31 @@
<div class="col-xs-8">
<label>
Server
<input class="input" name="host" placeholder="irc.freenode.org">
<input class="input" name="host" placeholder="<%=defaults.host%>">
</label>
</div>
<div class="col-xs-4">
<label class="port">
Port
<input class="input" name="port" placeholder="6667">
<input class="input" name="port" placeholder="<%=defaults.port%>">
</label>
</div>
<div class="col-xs-5">
<label>
Nick
<input class="input" name="nick" placeholder="shout">
<input class="input" name="nick" placeholder="<%=defaults.nick%>">
</label>
</div>
<div class="col-xs-7">
<label>
Real Name
<input class="input" name="realname" class="input" placeholder="Shout User">
<input class="input" name="realname" class="input" placeholder="<%=defaults.realname%>">
</label>
</div>
<div class="col-xs-12">
<label>
Channels
<input class="input" name="join" class="input" placeholder="#shout-irc">
<input class="input" name="join" class="input" placeholder="<%=defaults.join%>">
</label>
</div>
<div class="col-xs-12">

View File

@ -376,6 +376,7 @@ $(function() {
}
});
console.log(post);
socket.emit("conn", post);
});

View File

@ -1,5 +1,12 @@
module.exports = {
port: 9000,
theme: "themes/example.css",
public: true,
theme: "themes/example.css"
defaults: {
host: "irc.freenode.net",
port: 6667,
nick: "shout-user",
realname: "Shout User",
join: "#shout-irc"
}
};

View File

@ -1,4 +1,5 @@
var _ = require("lodash");
var config = require("../config");
var net = require("net");
var Network = require("./models/network");
var slate = require("slate-irc");
@ -62,8 +63,8 @@ Client.prototype.find = function(id) {
Client.prototype.connect = function(args) {
var client = this;
var options = {
host: args.host || "irc.freenode.org",
port: args.port || 6667
host: args.host || config.defaults.host,
port: args.port || config.defaults.port
};
var stream = args.tls ? tls.connect(options) : net.connect(options);
@ -71,8 +72,8 @@ Client.prototype.connect = function(args) {
console.log(e);
});
var nick = args.nick || "shout";
var realname = args.realname || "Shout User";
var nick = args.nick || config.defaults.nick;
var realname = args.realname || config.defaults.realname;
var irc = slate(stream);
irc.me = nick;
@ -96,7 +97,7 @@ Client.prototype.connect = function(args) {
]);
});
var join = (args.join || "#shout-irc").replace(/\,/g, " ").split(/\s+/g);
var join = (args.join || config.defaults.join).replace(/\,/g, " ").split(/\s+/g);
irc.on("welcome", function() {
irc.join(join);
});

View File

@ -1,6 +1,6 @@
var _ = require("lodash");
var Client = require("./client");
var config = require("../config") || {};
var config = require("../config");
var fs = require("fs");
var http = require("connect");
var indicator = require("indicator");

View File

@ -1,7 +1,7 @@
{
"name": "shout",
"description": "The modern IRC client",
"version": "0.8.0",
"version": "0.8.1",
"homepage": "http://github.com/erming/shout",
"author": {
"name": "Mattias Erming",
@ -33,7 +33,7 @@
},
"dependencies": {
"connect": "~2.19.6",
"indicator": "~0.1.0",
"indicator": "^0.1.2",
"lodash": "~2.4.1",
"moment": "~2.7.0",
"slate-irc": "~0.6.0",