# HG changeset patch # User Emmanuel Gil Peyrot # Date 1328197048 -3600 # Node ID d3b37bbb2b885f65530c87700d0acb6856c12179 # Parent 7b2ca4d5af6df9bffcae5b68e6807f74c8a36986 Support multiple participants. diff --git a/script2.js b/script2.js --- a/script2.js +++ b/script2.js @@ -261,7 +261,7 @@ var offerState = function(to, type, sid) conn.send(message); }; -var sendState = function(sid) { +var sendState = function(sid, from) { var doc = documents[sid]; var initialState = doc.createState([]).map(function(element) { return Lightstring.DOM2XML(element); @@ -283,6 +283,8 @@ var sendState = function(sid) { conn.send(message); } else { // host for (var jid in doc.participants) { + if (from == jid) + continue; var type = doc.participants[jid]; var message = "" + @@ -351,6 +353,8 @@ conn.on('message/' + Lightstring.ns['sxe var elements = payload.children; doc.empty(); doc.processState(from, elements); + if (doc.host === conn.jid.full) + sendState(sid, from); break; default: var elements = sxe.children;