mirror of https://git.matrix.org/git/olm.git
Fix the group javascript demo
parent
f274adfe24
commit
6dfa64342a
|
@ -261,7 +261,7 @@ DemoUser.prototype.receiveOneToOne = function(jsonpacket) {
|
||||||
if (!self.peerGroupSessions[sender] ||
|
if (!self.peerGroupSessions[sender] ||
|
||||||
!self.peerGroupSessions[sender][body.session_id]) {
|
!self.peerGroupSessions[sender][body.session_id]) {
|
||||||
self.createInboundSession(
|
self.createInboundSession(
|
||||||
sender, body.session_id, body.message_index, body.session_key
|
sender, body.session_id, body.session_key
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -337,15 +337,18 @@ DemoUser.prototype.getGroupSession = function() {
|
||||||
* add a task to create an inbound group session
|
* add a task to create an inbound group session
|
||||||
*/
|
*/
|
||||||
DemoUser.prototype.createInboundSession = function(
|
DemoUser.prototype.createInboundSession = function(
|
||||||
peer_id, session_id, message_index, session_key, callback
|
peer_id, session_id, session_key, callback
|
||||||
) {
|
) {
|
||||||
var self = this;
|
var self = this;
|
||||||
this.addTask("init inbound session", function(done) {
|
this.addTask("init inbound session", function(done) {
|
||||||
session = new Olm.InboundGroupSession();
|
session = new Olm.InboundGroupSession();
|
||||||
session.create(message_index, session_key);
|
session.create(session_key);
|
||||||
if (!self.peerGroupSessions[peer_id]) {
|
if (!self.peerGroupSessions[peer_id]) {
|
||||||
self.peerGroupSessions[peer_id] = {};
|
self.peerGroupSessions[peer_id] = {};
|
||||||
}
|
}
|
||||||
|
if (session_id != session.session_id()) {
|
||||||
|
throw new Error("Mismatched session_ids");
|
||||||
|
}
|
||||||
self.peerGroupSessions[peer_id][session_id] = session;
|
self.peerGroupSessions[peer_id][session_id] = session;
|
||||||
done(session);
|
done(session);
|
||||||
}, callback);
|
}, callback);
|
||||||
|
|
Loading…
Reference in New Issue