Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #136 from ericbarch/master

Fix for issue #101 (PMs that are case sensitive). Configuration of away message and real name. Auto set of away when disconnected.
  • Loading branch information...
commit 0959cd9ca4817c981925f801a4d35a328efac44f 2 parents 239f3bd + 5e65210
David Petersen authored
View
2  assets/css/subway.css
@@ -441,7 +441,7 @@ html { overflow: hidden; }
.userlist_user_name{
font-weight: bold;
- max-width: 100px;
+ width: 100%;
overflow: hidden;
text-overflow: ellipsis;
}
View
5 assets/js/client.js
@@ -332,13 +332,12 @@ $(function() {
case '/query':
case '/privmsg':
case '/msg':
- var target = commandText[1];
+ var target = commandText[1].toLowerCase();
var myNick = irc.me.get('nick');
- var logname = (myNick < target) ? myNick + target : target + myNick;
if (typeof irc.chatWindows.getByName(target) === 'undefined') {
irc.chatWindows.add({name: target, type: 'pm'});
}
- irc.socket.emit('getOldMessages',{channelName: logname, skip:-50, amount: 50});
+ irc.socket.emit('getOldMessages',{channelName: target, skip:-50, amount: 50});
irc.socket.emit('say', {
target: target,
message: commandText.splice(2).join(" ")
View
2  assets/js/views/chat.js
@@ -120,7 +120,7 @@ var ChatView = Backbone.View.extend({
match = true;
//We decide whether or not to add colon
if (sentence.length === 1) {
- $('#chat-input').val(sentence.join(' ') + ":");
+ $('#chat-input').val(sentence.join(' ') + ": ");
} else {
$('#chat-input').val(sentence.join(' '));
}
View
6 assets/js/views/overview.js
@@ -50,6 +50,8 @@ var OverviewView = Backbone.View.extend({
var server = $('#connect-server').val();
var nick = $('#connect-nick').val();
var port = $('#connect-port').val();
+ var away = $('#connect-away').val();
+ var realName = $('#connect-realName').val();
var secure = $('#connect-secure').is(':checked');
var selfSigned = $('#connect-selfSigned').is(':checked');
var rejoin = $('#connect-rejoin').is(':checked');
@@ -72,10 +74,12 @@ var OverviewView = Backbone.View.extend({
var connectInfo = {
nick: nick,
server: server,
- port: port,
+ port: port,
secure: secure,
selfSigned: selfSigned,
rejoin: rejoin,
+ away: away,
+ realName: realName,
password: password
};
View
7 lib/irclink.js
@@ -8,10 +8,15 @@ var Channel = mongoose.model('Channel');
var Message = mongoose.model('Message');
// Constructor
-var IRCLink = function(hostname, port, ssl, selfSigned, nick, realName, password, rejoin, channels) {
+var IRCLink = function(hostname, port, ssl, selfSigned, nick, realName, password, rejoin, away, channels) {
this.sockets = new Array();
this.server = hostname;
+ if (away === undefined || away == '')
+ this.away = 'AFK';
+ else
+ this.away = away;
+
if (channels === undefined || !rejoin)
var channels = new Array();
View
2  lib/models.js
@@ -15,6 +15,8 @@ module.exports = function() {
port: Number,
ssl: Boolean,
rejoin: Boolean,
+ away: String,
+ realName: String,
selfSigned: Boolean,
channels: [String],
nick: String,
View
4 lib/restore.js
@@ -11,9 +11,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.nick, doc.password, doc.rejoin, 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.channels);
connection.associateUser(doc.user);
connections[doc.user] = connection;
+ // set ourselves as away
+ connection.client.send('AWAY', doc.away);
});
});
}
View
12 lib/socket.js
@@ -57,7 +57,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.nick, data.password, data.rejoin);
+ connection = new IRCLink(data.server, data.port, data.secure, data.selfSigned, data.nick, data.realName, data.password, data.rejoin, data.away);
// save this connection
if(current_user){
@@ -69,6 +69,8 @@ module.exports = function(socket, connections) {
port: data.port || (data.secure ? 6697 : 6667),
ssl: data.secure,
rejoin: data.rejoin,
+ away: data.away,
+ realName: data.realName,
selfSigned: data.selfSigned,
channels: data.channels,
nick: data.nick,
@@ -81,6 +83,10 @@ module.exports = function(socket, connections) {
socket.emit('restore_connection', {nick: connection.client.nick,
server: connection.client.opt.server, channels: connection.client.chans});
connection.clearUnreads();
+
+ // set ourselves as not being away
+ if (connection.sockets.length == 0)
+ connection.client.send('AWAY', '');
}
// register this socket with our user's IRC connection
@@ -150,6 +156,10 @@ module.exports = function(socket, connections) {
// keep the session alive, remove this socket, and clear unreads
connection.removeSocket(socket);
connection.clearUnreads();
+
+ // set ourselves as away
+ if (connection.sockets.length == 0)
+ connection.client.send('AWAY', connection.away);
}
});
View
8 views/templates.jade
@@ -59,6 +59,14 @@ script(id="overview_connection", type="text/html")
.controls
input#connect-nick(type="text")
.control-group
+ label(for="connect-realName") Real Name
+ .controls
+ input#connect-realName(type="text")
+ .control-group
+ label(for="connect-away") Away Message
+ .controls
+ input#connect-away(type="text", placeholder="AFK")
+ .control-group
label(for="connect-password") Password
.controls
input#connect-password(type="password")
Please sign in to comment.
Something went wrong with that request. Please try again.