Enable onlyoffice reconnection

This commit is contained in:
yflory
2020-01-29 16:40:46 +01:00
parent e32398b308
commit 0a543ae6ea
3 changed files with 45 additions and 20 deletions

View File

@@ -53,7 +53,7 @@ define([
// all our client IDs.
if (chan.clients) {
chan.clients.forEach(function (cl) {
if (ctx.clients[cl] && !ctx.clients[cl].id) {
if (ctx.clients[cl]) {
ctx.clients[cl].id = wc.myID + '-' + cl;
}
});
@@ -189,15 +189,22 @@ define([
if (!c) { return void cb({ error: 'NOT_IN_CHANNEL' }); }
var chan = ctx.channels[c.channel];
if (!chan) { return void cb({ error: 'INVALID_CHANNEL' }); }
// Prepare the callback: broadcast the message to the other local tabs
// if the message is sent
var _cb = function (obj) {
if (obj && obj.error) { return void cb(obj); }
ctx.emit('MESSAGE', {
msg: data.msg
}, chan.clients.filter(function (cl) {
return cl !== clientId;
}));
cb();
};
// Send the message
if (data.isCp) {
return void chan.sendMsg(data.isCp, cb);
return void chan.sendMsg(data.isCp, _cb);
}
chan.sendMsg(data.msg, cb);
ctx.emit('MESSAGE', {
msg: data.msg
}, chan.clients.filter(function (cl) {
return cl !== clientId;
}));
chan.sendMsg(data.msg, _cb);
};
var reencrypt = function (ctx, data, cId, cb) {