Skip to content

Commit

Permalink
Response to disco queries was forwarded to observers *before* the dis…
Browse files Browse the repository at this point in the history
…co query itself (so response appeared in console before the query). Fixed.

darcs-hash:20060826174652-8cc29-3a4d0bd3b2a2ad17ef30f1d8d986571da2bc11b4.gz
  • Loading branch information
bard committed Aug 26, 2006
1 parent 19b9a56 commit 7cf6822
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions chrome/content/service/client_service.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,20 @@ function open(jid, server, port, ssl) {
transport.write(
subject.QueryInterface(Ci.nsISupportsString).toString());

if(topic == 'stream-out' &&
'close' == subject.QueryInterface(Components.interfaces.nsISupportsString).toString()) {
var presences = cache.presence.getEnumeration();
while(presences.hasMoreElements()) {
var presence = presences.getNext();
var syntheticPresence = presence.stanza.cloneNode(true);
syntheticPresence.removeAttribute('id');
syntheticPresence.setAttribute('type', 'unavailable');
session.receive(serializer.serializeToString(syntheticPresence));
}
}

client.notifyObservers(subject, topic, data);

if(topic == 'stanza-in')
switch(subject.nodeName) {
case 'presence':
Expand All @@ -115,20 +129,6 @@ function open(jid, server, port, ssl) {
}
break;
}

if(topic == 'stream-out' &&
'close' == subject.QueryInterface(Components.interfaces.nsISupportsString).toString()) {
var presences = cache.presence.getEnumeration();
while(presences.hasMoreElements()) {
var presence = presences.getNext();
var syntheticPresence = presence.stanza.cloneNode(true);
syntheticPresence.removeAttribute('id');
syntheticPresence.setAttribute('type', 'unavailable');
session.receive(serializer.serializeToString(syntheticPresence));
}
}

client.notifyObservers(subject, topic, data);
}}, null, false);

transport.connect();
Expand Down

0 comments on commit 7cf6822

Please sign in to comment.