Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Allow nick change #120

Merged
merged 1 commit into from

3 participants

Cameron Currie David Petersen Johnny Sørensen
Cameron Currie
cwc commented

Squashed and tested @johsoe's nick change fix, seems to work fine.

Fixes #114.

Johnny Sørensen johsoe Allow nick change
Added simple nick change functionality on frontend and backend.
Doesn't account for when the new nick is taken.
f75c1ac
David Petersen thedjpetersen merged commit 1aa2dfe into from
David Petersen

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 6, 2012
  1. Johnny Sørensen Cameron Currie

    Allow nick change

    johsoe authored cwc committed
    Added simple nick change functionality on frontend and backend.
    Doesn't account for when the new nick is taken.
This page is out of date. Refresh to see the latest.
Showing with 18 additions and 2 deletions.
  1. +12 −2 assets/js/client.js
  2. +6 −0 lib/irchandler.js
14 assets/js/client.js
View
@@ -210,13 +210,17 @@ $(function() {
if (data.oldNick === irc.me.get('nick'))
irc.me.set('nick', data.newNick);
- // TODO: If not me, change name in user list and send channel message
var channel = irc.chatWindows.getByName(data.channels[0]);
var user = channel.userList.getByNick(data.oldNick);
user.set({nick: data.newNick});
user.view.render();
+
+ // Add nickmessage to all channels
var nickMessage = new Message({type: 'nick', oldNick: data.oldNick, newNick: data.newNick});
- channel.stream.add(nickMessage);
+ for( var i in data.channels ) {
+ channel = irc.chatWindows.getByName(data.channels[i]);
+ channel.stream.add(nickMessage);
+ }
});
irc.socket.on('topic', function(data) {
@@ -300,6 +304,12 @@ $(function() {
irc.appView.channelList.channelTabs[0].setActive();
}
break;
+
+ case '/nick':
+ if (commandText[1]) {
+ irc.socket.emit('nick', {nick : commandText[1]});
+ }
+ break;
case '/topic':
if (commandText[2]) {
irc.socket.emit('topic', {name: commandText[1], topic: commandText[2]});
6 lib/irchandler.js
View
@@ -207,6 +207,12 @@ var irchandler = exports.irchandler = function(socket, app) {
client.send('TOPIC ' + data.name + ' ' + data.topic);
});
+ socket.on('nick', function(data){
+ client.send('NICK ' + data.nick);
+ client.nick = data.nick;
+ client.opt.nick = data.nick;
+ });
+
socket.on('command', function(text) { console.log(text); client.send(text); });
socket.on('disconnect', function() {
Something went wrong with that request. Please try again.