Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #162 from noraesae/support-encoding

Support various encodings
  • Loading branch information...
commit ac23ef44bc2b1bb939922ad3de2dd617f7398769 2 parents 00afc4d + f348bfd
@thedjpetersen authored
View
6 assets/js/views/overview.js
@@ -56,7 +56,8 @@ var OverviewView = Backbone.View.extend({
secure = $('#connect-secure').is(':checked'),
selfSigned = $('#connect-selfSigned').is(':checked'),
rejoin = $('#connect-rejoin').is(':checked'),
- password = $('#connect-password').val();
+ password = $('#connect-password').val(),
+ encoding = $('#connect-encoding').val();
if (!server) {
$('#connect-server').closest('.control-group').addClass('error');
@@ -79,7 +80,8 @@ var OverviewView = Backbone.View.extend({
rejoin: rejoin,
away: away,
realName: realName,
- password: password
+ password: password,
+ encoding: encoding
};
irc.me = new User(connectInfo);
View
7 lib/irclink.js
@@ -8,7 +8,7 @@ var Connection = mongoose.model('Connection');
var Message = mongoose.model('Message');
// Constructor
-var IRCLink = function(hostname, port, ssl, selfSigned, nick, realName, password, rejoin, away, channels) {
+var IRCLink = function(hostname, port, ssl, selfSigned, nick, realName, password, rejoin, away, encoding, channels) {
this.sockets = new Array();
this.server = hostname;
@@ -39,7 +39,8 @@ var IRCLink = function(hostname, port, ssl, selfSigned, nick, realName, password
certExpired: false,
floodProtection: true,
floodProtectionDelay: 1000,
- stripColors: true
+ stripColors: true,
+ encoding: encoding
});
// Events to signal TO the front-end
@@ -182,4 +183,4 @@ IRCLink.prototype = {
};
// node.js module export
-module.exports = IRCLink;
+module.exports = IRCLink;
View
5 lib/models.js
@@ -20,7 +20,8 @@ module.exports = function() {
selfSigned: Boolean,
channels: [String],
nick: String,
- password: String
+ password: String,
+ encoding: String
});
var Messages = new Schema({
@@ -35,4 +36,4 @@ module.exports = function() {
mongoose.model('User', Users);
mongoose.model('Connection', Connections);
mongoose.model('Message', Messages);
-};
+};
View
4 lib/restore.js
@@ -8,11 +8,11 @@ module.exports = function (connections) {
// restore connections
Connection.find({},function(err, docs){
docs.forEach(function(doc){
- var connection = new IRCLink(doc.hostname, doc.port, doc.ssl, doc.selfSigned, doc.nick, doc.realName, doc.password, doc.rejoin, doc.away, doc.channels);
+ var connection = new IRCLink(doc.hostname, doc.port, doc.ssl, doc.selfSigned, doc.nick, doc.realName, doc.password, doc.rejoin, doc.away, doc.encoding, doc.channels);
connection.associateUser(doc.user);
connections[doc.user] = connection;
// set ourselves as away
connection.setAway();
});
});
-}
+}
View
5 lib/socket.js
@@ -56,7 +56,7 @@ module.exports = function(socket, connections) {
connection = connections[current_user.username];
}
if(connection === undefined) {
- connection = new IRCLink(data.server, data.port, data.secure, data.selfSigned, data.nick, data.realName, data.password, data.rejoin, data.away);
+ connection = new IRCLink(data.server, data.port, data.secure, data.selfSigned, data.nick, data.realName, data.password, data.rejoin, data.away, data.encoding);
// save this connection
if(current_user){
@@ -73,7 +73,8 @@ module.exports = function(socket, connections) {
selfSigned: data.selfSigned,
channels: data.channels,
nick: data.nick,
- password: data.password });
+ password: data.password,
+ encoding: data.encoding});
conn.save();
connections[current_user.username] = connection;
View
7 package.json
@@ -20,14 +20,15 @@
"express": "2.5.x",
"jade": "0.26.x",
"connect-assets": "2.2.x",
- "irc": "git://github.com/martynsmith/node-irc.git",
+ "irc": "git://github.com/noraesae/node-irc.git",
"socket.io": "0.9.x",
"mongoose": "2.7.x",
- "bcrypt": "0.7.x"
+ "bcrypt": "0.7.x",
+ "iconv": "1.2.x"
},
"noAnalyze": true,
"subdomain": "subway",
"scripts": {
"start": "subway"
}
-}
+}
View
25 views/templates.jade
@@ -62,6 +62,31 @@ script(id="overview_connection", type="text/html")
.control-group
label(for="connect-rejoin") Bouncer Mode
input#connect-rejoin(type="checkbox")
+ .control-group
+ label(for="connect-encoding") Encoding
+ select#connect-encoding
+ option(value="", selected="selected") UTF-8
+ option(disabled="disabled") --------------
+ option(value="ISO-8859-1") ISO-8859-1
+ option(value="ISO-8859-15") ISO-8859-15
+ option(value="ISO-8859-2") ISO-8859-2
+ option(value="ISO-8859-7") ISO-8859-7 (Greek)
+ option(value="ISO-8859-8") ISO-8859-8 (Hebrew)
+ option(value="ISO-8859-9") ISO-8859-9 (Turkish)
+ option(value="ISO-8859-11") ISO-8859-11 (Thai)
+ option(disabled="disabled") --------------
+ option(value="ISO-2022-JP") ISO-2022-JP (Japanese)
+ option(value="CP949") CP949 (Korean)
+ option(value="EUC-KR") EUC-KR (Korean)
+ option(value="GBK") GBK (Chinese)
+ option(value="GB18030") GB18030 (Chinese)
+ option(value="BIG5") BIG5 (Chinese)
+ option(disabled="disabled") --------------
+ option(value="KOI8-U") KOI8-U (Ukrainian)
+ option(value="KOI8-R") KOI8-R (Cyrillic)
+ option(value="CP1251") CP1251 (Cyrillic)
+ option(value="CP1256") CP1256 (Arabic)
+ option(value="CP1257") CP1257 (baltic)
a(id="connect-button", class="btn btn-primary spacing-right", type="button") Connect
a(id="connect-more-options-button", class="btn", type="button") More Options
Please sign in to comment.
Something went wrong with that request. Please try again.