Merge pull request #816 from MarkTraceur/develop

Add in a new hook for handleMessage
pull/817/merge
John McLear 2012-06-26 15:40:17 -07:00
commit e23a9bff73
1 changed files with 6 additions and 0 deletions

View File

@ -33,6 +33,7 @@ var plugins = require("ep_etherpad-lite/static/js/pluginfw/plugins.js");
var log4js = require('log4js');
var messageLogger = log4js.getLogger("message");
var _ = require('underscore');
var hooks = require("ep_etherpad-lite/static/js/pluginfw/hooks.js");
/**
* A associative array that saves which sessions belong to a pad
@ -158,6 +159,11 @@ exports.handleDisconnect = function(client)
*/
exports.handleMessage = function(client, message)
{
_.map(hooks.callAll( "handleMessage", { client: client, message: message }), function ( newmessage ) {
if ( newmessage || newmessage === null ) {
message = newmessage;
}
});
if(message == null)
{
messageLogger.warn("Message is null!");