Skip to content
Browse files

Get messages from notice

  • Loading branch information...
1 parent 6137256 commit d84f3cc005caf266b0d6eeb44450e7a2f80f8dc1 @dj-emberex dj-emberex committed Mar 3, 2012
Showing with 16 additions and 5 deletions.
  1. +16 −3 assets/js/client.js
  2. +0 −2 assets/js/views/chat_application.js
View
19 assets/js/client.js
@@ -41,10 +41,15 @@ $(function() {
// Registration (server joined)
irc.socket.on('registered', function(data) {
+ var window = irc.chatWindows.getByName('status');
irc.socket.emit('getNick', {});
irc.connected = true;
- irc.appView.render();
- irc.chatWindows.add({name: 'status', type: 'status'});
+ if(window === undefined){
+ irc.appView.render();
+ irc.chatWindows.add({name: 'status', type: 'status'});
+ } else {
+ irc.appView.renderUserBox();
+ }
// Will reflect modified nick, if chosen nick was taken already
irc.me.set('nick', data.message.args[0]);
@@ -101,7 +106,15 @@ $(function() {
irc.socket.on('notice', function(data) {
//TODO: make this work
- //irc.chatWindows.getByName('status').stream.add({sender: 'notice', raw: data.text, type: 'notice'});
+ var window = irc.chatWindows.getByName('status');
+ if(window === undefined){
+ irc.connected = true;
+ irc.appView.render();
+ irc.chatWindows.add({name: 'status', type: 'status'});
+ window = irc.chatWindows.getByName('status');
+ }
+ var sender = (data.nick !== undefined) ? data.nick : 'notice';
+ window.stream.add({sender: sender, raw: data.text, type: 'notice'});
});
// Message of the Day
View
2 assets/js/views/chat_application.js
@@ -42,8 +42,6 @@ var ChatApplicationView = Backbone.View.extend({
var overview = new OverviewView;
} else {
this.channelList = new ChannelListView;
- // irc.me.on('change:nick', this.renderUserBox, this);
- this.renderUserBox();
}
return this;
},

0 comments on commit d84f3cc

Please sign in to comment.
Something went wrong with that request. Please try again.