Permalink
Browse files

Pass message objects to message filters when possible

The message object may be undefined. Filters should ensure its existence before using it.
  • Loading branch information...
1 parent 18f0141 commit abb5bd9ae3e36f868e43b1ece8e12e397a0af3fd @raws raws committed May 1, 2012
Showing with 4 additions and 4 deletions.
  1. +3 −3 src/js/alice/src/alice/application.js
  2. +1 −1 src/js/alice/src/alice/window.js
@@ -351,12 +351,12 @@ Alice.Application = Class.create({
this.message_filters = this.message_filters.concat(list);
},
- applyFilters: function(li, win) {
+ applyFilters: function(li, win, message) {
if (li.hasClassName("filtered")) return;
var length = this.base_filters.length;
for (var i=0; i < length; i++) {
- this.base_filters[i].call(this, li, win);
+ this.base_filters[i].call(this, li, win, message);
}
li.addClassName("filtered");
@@ -365,7 +365,7 @@ Alice.Application = Class.create({
var msg = li.down("div.msg");
var length = this.message_filters.length;
for (var i=0; i < length; i++) {
- var stop = this.message_filters[i].call(this, msg, win);
+ var stop = this.message_filters[i].call(this, msg, win, message);
if (stop) return;
}
}
@@ -351,7 +351,7 @@ Alice.Window = Class.create({
this.scrollToPosition(position);
var li = this.messages.select("li").last();
- this.application.applyFilters(li, this);
+ this.application.applyFilters(li, this, message);
this.scrollToPosition(position);

0 comments on commit abb5bd9

Please sign in to comment.