Skip to content

Commit

Permalink
Get messages from notice
Browse files Browse the repository at this point in the history
  • Loading branch information
dj-emberex committed Mar 3, 2012
1 parent 6137256 commit d84f3cc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
19 changes: 16 additions & 3 deletions assets/js/client.js
Expand Up @@ -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]);
Expand Down Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions assets/js/views/chat_application.js
Expand Up @@ -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;
},
Expand Down

0 comments on commit d84f3cc

Please sign in to comment.