Fix API call appendChatMessage to send new message to all connected clients
This commit is contained in:
parent
02c022aab1
commit
94cb743ca8
|
@ -511,14 +511,18 @@ exports.appendChatMessage = function(padID, text, authorID, time, callback)
|
|||
return;
|
||||
}
|
||||
|
||||
//get the pad
|
||||
getPadSafe(padID, true, function(err, pad)
|
||||
// if time is not an integer value
|
||||
if(time === undefined || !is_int(time))
|
||||
{
|
||||
if(ERR(err, callback)) return;
|
||||
// set time to current timestamp
|
||||
time = new Date().getTime();
|
||||
}
|
||||
|
||||
var padMessage = require("ep_etherpad-lite/node/handler/PadMessageHandler.js");
|
||||
// save chat message to database and send message to all connected clients
|
||||
padMessage.sendChatMessageToPadClients(parseInt(time), authorID, text, padID);
|
||||
|
||||
pad.appendChatMessage(text, authorID, parseInt(time));
|
||||
callback();
|
||||
});
|
||||
}
|
||||
|
||||
/*****************/
|
||||
|
|
|
@ -375,6 +375,17 @@ function handleChatMessage(client, message)
|
|||
var text = message.data.text;
|
||||
var padId = sessioninfos[client.id].padId;
|
||||
|
||||
exports.sendChatMessageToPadClients(time, userId, text, padId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a chat message to all clients of this pad
|
||||
* @param time the timestamp of the chat message
|
||||
* @param userId the author id of the chat message
|
||||
* @param text the text of the chat message
|
||||
* @param padId the padId to send the chat message to
|
||||
*/
|
||||
exports.sendChatMessageToPadClients = function (time, userId, text, padId) {
|
||||
var pad;
|
||||
var userName;
|
||||
|
||||
|
|
Loading…
Reference in New Issue