Change summary
src/main/java/eu/siacs/conversations/parser/PresenceParser.java | 7
src/main/java/eu/siacs/conversations/services/XmppConnectionService.java | 22
2 files changed, 28 insertions(+), 1 deletion(-)
Detailed changes
@@ -88,6 +88,13 @@ public class PresenceParser extends AbstractParser
&& jid.equals(
Jid.Invalid.getNullForInvalid(
item.getAttributeAsJid("jid"))))) {
+ Log.d(
+ Config.LOGTAG,
+ account.getJid().asBareJid()
+ + ": got self-presence from "
+ + user.getFullJid()
+ + ". occupant-id="
+ + occupantId);
if (mucOptions.setOnline()) {
mXmppConnectionService.getAvatarService().clear(mucOptions);
}
@@ -3615,7 +3615,7 @@ public class XmppConnectionService extends Service {
}
private void joinMuc(
- Conversation conversation,
+ final Conversation conversation,
final OnConferenceJoined onConferenceJoined,
final boolean followedInvite) {
final Account account = conversation.getAccount();
@@ -4327,6 +4327,7 @@ public class XmppConnectionService extends Service {
bookmark == null ? null : bookmark.getBookmarkName(),
mucOptions.getName());
+ final var hadOccupantId = mucOptions.occupantId();
if (mucOptions.updateConfiguration(new ServiceDiscoveryResult(response))) {
Log.d(
Config.LOGTAG,
@@ -4336,6 +4337,25 @@ public class XmppConnectionService extends Service {
updateConversation(conversation);
}
+ final var hasOccupantId = mucOptions.occupantId();
+
+ if (!hadOccupantId && hasOccupantId && mucOptions.online()) {
+ final var me = mucOptions.getSelf().getFullJid();
+ Log.d(
+ Config.LOGTAG,
+ account.getJid().asBareJid()
+ + ": gained support for occupant-id in "
+ + me
+ + ". resending presence");
+ final var packet =
+ mPresenceGenerator.selfPresence(
+ account,
+ Presence.Status.ONLINE,
+ mucOptions.nonanonymous());
+ packet.setTo(me);
+ sendPresencePacket(account, packet);
+ }
+
if (bookmark != null
&& (sameBefore || bookmark.getBookmarkName() == null)) {
if (bookmark.setBookmarkName(