Commit 11c7a1f1 authored by Christian Schudt's avatar Christian Schudt

OF-860: Self-presence is not broadcast if room has more than one occupant.

The problem here was, that the presence's 'to' attribute was overridden on each iteration, making the if statement fail after the first iteration.
parent eebb2ffe
...@@ -1109,6 +1109,7 @@ public class LocalMUCRoom implements MUCRoom, GroupEventListener { ...@@ -1109,6 +1109,7 @@ public class LocalMUCRoom implements MUCRoom, GroupEventListener {
public void broadcast(BroadcastPresenceRequest presenceRequest) { public void broadcast(BroadcastPresenceRequest presenceRequest) {
String jid = null; String jid = null;
Presence presence = presenceRequest.getPresence(); Presence presence = presenceRequest.getPresence();
JID to = presence.getTo();
Element frag = presence.getChildElement("x", "http://jabber.org/protocol/muc#user"); Element frag = presence.getChildElement("x", "http://jabber.org/protocol/muc#user");
// Don't include the occupant's JID if the room is semi-anon and the new occupant // Don't include the occupant's JID if the room is semi-anon and the new occupant
// is not a moderator // is not a moderator
...@@ -1130,7 +1131,7 @@ public class LocalMUCRoom implements MUCRoom, GroupEventListener { ...@@ -1130,7 +1131,7 @@ public class LocalMUCRoom implements MUCRoom, GroupEventListener {
} }
} }
// Some status codes should only be included in the "self-presence", which is only sent to the user, but not to other occupants. // Some status codes should only be included in the "self-presence", which is only sent to the user, but not to other occupants.
if (occupant.getPresence().getFrom().equals(presence.getTo())) { if (occupant.getPresence().getFrom().equals(to)) {
Presence selfPresence = presence.createCopy(); Presence selfPresence = presence.createCopy();
Element fragSelfPresence = selfPresence.getChildElement("x", "http://jabber.org/protocol/muc#user"); Element fragSelfPresence = selfPresence.getChildElement("x", "http://jabber.org/protocol/muc#user");
fragSelfPresence.addElement("status").addAttribute("code", "110"); fragSelfPresence.addElement("status").addAttribute("code", "110");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment