diff options
author | lassulus <lassulus@googlemail.com> | 2013-11-12 02:48:45 +0100 |
---|---|---|
committer | lassulus <lassulus@googlemail.com> | 2013-11-12 02:48:45 +0100 |
commit | a170673b55215137b5e7fe19e587767c2ef57453 (patch) | |
tree | b672a2d9d220e4cde253de6aa3466d93caf933ec /webchat/public | |
parent | fc72fda5fc46daea25a991ba6b907a793e52ed06 (diff) |
webchat: refactor code
Diffstat (limited to 'webchat/public')
-rw-r--r-- | webchat/public/client.js | 5 | ||||
-rw-r--r-- | webchat/public/commands.js | 1 |
2 files changed, 5 insertions, 1 deletions
diff --git a/webchat/public/client.js b/webchat/public/client.js index a90cf8d6..58002f78 100644 --- a/webchat/public/client.js +++ b/webchat/public/client.js @@ -23,6 +23,10 @@ $(function connect() { var safe_oldnick = $('<div/>').text(params.oldnick).html(); var safe_newnick = $('<div/>').text(params.newnick).html(); var safe_type = $('<div/>').text(params.type).html(); + if (safe_oldnick === settings.nick){ + settings.nick = safe_newnick + $('#nick').html(settings.nick) + } $(getNicklistElement(safe_oldnick,safe_type)).remove(); $('#nicklist').append('<div class="'+safe_type+'_name">' + safe_newnick + '</div>') ; chatboxAppend(safe_oldnick, 'is now known as ' + safe_newnick, 'nick'); @@ -31,6 +35,7 @@ $(function connect() { rpc.register('your_nick', {nick: 'string'}, function(params, callback) { var safe_nick = $('<div/>').text(params.nick).html(); settings.nick = safe_nick + $('#nick').html(settings.nick) return callback(null) }) rpc.register('join', {type: 'string', nick: 'string'}, function(params, callback) { diff --git a/webchat/public/commands.js b/webchat/public/commands.js index d4408c4c..f19c78dc 100644 --- a/webchat/public/commands.js +++ b/webchat/public/commands.js @@ -9,7 +9,6 @@ commands.msg = function (settings, params) { } commands.nick = function (settings, params) { - settings.nick = params var sendObj = { method: 'nick', params: { nick: params }, |