Add notification support

This commit is contained in:
David Cormier 2013-10-08 10:03:44 -04:00
parent 236a82ec4e
commit c0f22c4ec8
2 changed files with 19 additions and 15 deletions

View file

@ -21,13 +21,18 @@ models.service('models', ['colors', function(colors) {
this.setActiveBuffer = function(bufferId) {
if (this.getActiveBuffer()) {
this.getActiveBuffer().active = false;
}
activeBuffer = _.find(this.model['buffers'], function(buffer) {
if (buffer['id'] == bufferId) {
return buffer;
}
});
activeBuffer.notification = false;
activeBuffer.active = true;
console.log(this.activeBuffer);
}
this.getBuffers = function() {
@ -37,7 +42,6 @@ models.service('models', ['colors', function(colors) {
this.getBuffer = function(bufferId) {
return _.find(this.model['buffers'], function(buffer) {
if (buffer['id'] == bufferId) {
console.log('yé');
return buffer;
}
});
@ -54,6 +58,12 @@ models.service('models', ['colors', function(colors) {
var fullName = message['full_name']
var pointer = message['pointers'][0]
var lines = []
var active = false;
var notification = false;
var notify = function() {
notification = true;
}
var addLine = function(line) {
lines.push(line);

View file

@ -202,21 +202,15 @@ weechat.factory('handlers', ['$rootScope', 'colors', 'models', 'pluginManager',
var handleBufferLineAdded = function(message) {
var buffer_line = {}
message = new models.BufferLine(message);
var message = new models.BufferLine(message);
var buffer = models.getBuffer(message.buffer);
message.metadata = pluginManager.contentForMessage(message.text);
buffer.addLine(message);
console.log(message);
console.log(message.buffer);
console.log(models.getBuffer(message.buffer));
models.getBuffer(message.buffer).addLine(message);
//if (!_isActiveBuffer(message.buffer)) {
// $rootScope.buffers[message.buffer]['notification'] = true;
//}
//$rootScope.buffers[message.buffer]['lines'].push(message);
if (!buffer.active) {
buffer.notification = true;
}
}
/*