mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-23 08:56:17 -04:00
Adding api call for appending a chat message.
This commit is contained in:
parent
5c31d1f528
commit
4c6bd37286
3 changed files with 78 additions and 0 deletions
|
@ -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 */
|
||||
/*****************/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue