Merge branch 'feature/append-chat-api' of github.com:derosm2/etherpad-lite into append-chat-api

This commit is contained in:
John McLear 2015-04-01 13:32:07 +01:00
commit c705a058fb
3 changed files with 78 additions and 0 deletions

View file

@ -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 */
/*****************/