diff options
author | Mark Holmquist <mtraceur@member.fsf.org> | 2012-06-26 14:10:42 -0700 |
---|---|---|
committer | Mark Holmquist <mtraceur@member.fsf.org> | 2012-06-26 14:10:42 -0700 |
commit | 854e1092d9dcce1c25b89c0a5960025612bf53ba (patch) | |
tree | bfd143550c8f2b5a0869089bb7dbb61edf1920d3 | |
parent | e4ff4021ab016728a711dd98e8a734e0868ffd53 (diff) | |
download | etherpad-lite-854e1092d9dcce1c25b89c0a5960025612bf53ba.zip |
Add in a new hook for handleMessage
Add a new hook: handleMessage. Whenever a message comes in, it is
intercepted by this hook.
-rw-r--r-- | src/node/handler/PadMessageHandler.js | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/node/handler/PadMessageHandler.js b/src/node/handler/PadMessageHandler.js index 8d2ca6cd..b101a547 100644 --- a/src/node/handler/PadMessageHandler.js +++ b/src/node/handler/PadMessageHandler.js @@ -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!"); |