diff options
author | Mike DeRosa <derosm2@gmail.com> | 2015-02-09 00:18:12 -0500 |
---|---|---|
committer | Mike DeRosa <derosm2@gmail.com> | 2015-02-09 00:18:12 -0500 |
commit | 4c6bd37286ca2d2639fb0b379108a8a5f4ee4ea0 (patch) | |
tree | 31422b381bf942a011ffaa2832ece5017aee8e8e /src/node/db | |
parent | 5c31d1f52834d6b6f5641d31ea026e57b4615b4a (diff) | |
download | etherpad-lite-4c6bd37286ca2d2639fb0b379108a8a5f4ee4ea0.zip |
Adding api call for appending a chat message.
Diffstat (limited to 'src/node/db')
-rw-r--r-- | src/node/db/API.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/node/db/API.js b/src/node/db/API.js index 81dedcfe..75e4986b 100644 --- a/src/node/db/API.js +++ b/src/node/db/API.js @@ -494,6 +494,33 @@ exports.getChatHistory = function(padID, start, end, callback) }); } +/** +appendChatMessage(padID, text, userID, time), creates a chat message for the pad id + +Example returns: + +{code: 0, message:"ok", data: null +{code: 1, message:"padID does not exist", data: null} +*/ +exports.appendChatMessage = function(padID, text, userID, time, callback) +{ + //text is required + if(typeof text != "string") + { + callback(new customError("text is no string","apierror")); + return; + } + + //get the pad + getPadSafe(padID, true, function(err, pad) + { + if(ERR(err, callback)) return; + + pad.appendChatMessage(text, userID, parseInt(time)); + callback(); + }); +} + /*****************/ /**PAD FUNCTIONS */ /*****************/ |