Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Skips extra presences on join. #536

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/main/java/org/jitsi/impl/protocol/xmpp/ChatRoomImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,14 @@ public class ChatRoomImpl
*/
private Presence lastPresenceSent;

/**
* List of presence extensions to be added to the first presence sent
* to join the room. Those extensions will be used in any subsequent
* presence sent.
*/
private List<ExtensionElement> initialPresenceExtensions
= new ArrayList<ExtensionElement>();

/**
* Number of members in the chat room. That excludes the focus member.
*/
Expand Down Expand Up @@ -232,6 +240,14 @@ public void joinAs(String nickname)
@Override
public void processPresence(Presence packet)
{
// make sure this is the first presence we send
if (lastPresenceSent == null)
{
initialPresenceExtensions.forEach(e -> {
packet.removeExtension(e);
packet.addExtension(e);
});
}
lastPresenceSent = packet;
}
};
Expand Down Expand Up @@ -1262,6 +1278,12 @@ public void processPresence(Presence presence)
}
}

@Override
public void addInitialPresenceExtensions(ExtensionElement ex)
{
this.initialPresenceExtensions.add(ex);
}

class MemberListener
implements ParticipantStatusListener
{
Expand Down
28 changes: 12 additions & 16 deletions src/main/java/org/jitsi/jicofo/JitsiMeetConferenceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.jitsi.jicofo;

import org.jitsi.jicofo.bridge.*;
import org.jitsi.jicofo.version.*;
import org.jitsi.osgi.*;
import org.jitsi.utils.*;
import org.jitsi.xmpp.extensions.colibri.*;
Expand Down Expand Up @@ -575,12 +576,6 @@ private void joinTheRoom()
services.getJigasiDetector());
transcriberManager.init();

chatRoom.join();

// Advertise shared Etherpad document
meetTools.sendPresenceExtension(
chatRoom, EtherpadPacketExt.forDocumentName(etherpadName));

// Advertise the conference creation time in presence
setConferenceProperty(
ConferenceProperties.KEY_CREATED_MS,
Expand All @@ -590,17 +585,18 @@ private void joinTheRoom()
// Advertise whether octo is enabled/disabled in presence
setConferenceProperty(
ConferenceProperties.KEY_OCTO_ENABLED,
Boolean.toString(config.isOctoEnabled()));
Boolean.toString(config.isOctoEnabled()),
false);

// Trigger focus joined room event
EventAdmin eventAdmin = FocusBundleActivator.getEventAdmin();
if (eventAdmin != null)
{
eventAdmin.postEvent(
EventFactory.focusJoinedRoom(
roomName,
getId()));
}
// let's add all initial extensions before join, so they are added
chatRoom.addInitialPresenceExtensions(
EtherpadPacketExt.forDocumentName(etherpadName));
chatRoom.addInitialPresenceExtensions(
ConferenceProperties.clone(conferenceProperties));
chatRoom.addInitialPresenceExtensions(
Versions.getVersionsExtension(this));

chatRoom.join();
}

/**
Expand Down
194 changes: 0 additions & 194 deletions src/main/java/org/jitsi/jicofo/VersionBroadcaster.java

This file was deleted.

3 changes: 1 addition & 2 deletions src/main/java/org/jitsi/jicofo/osgi/JicofoBundleConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ protected String[][] getBundlesImpl()
},
{
"org/jitsi/jicofo/bridge/JvbDoctor",
"org/jitsi/jicofo/recording/jibri/JibriStats",
"org/jitsi/jicofo/VersionBroadcaster"
"org/jitsi/jicofo/recording/jibri/JibriStats"
},
{
"org/jitsi/jicofo/health/Health"
Expand Down
98 changes: 98 additions & 0 deletions src/main/java/org/jitsi/jicofo/version/Versions.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/*
* Jicofo, the Jitsi Conference Focus.
*
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jitsi.jicofo.version;

import org.jitsi.jicofo.*;
import org.jitsi.utils.logging.*;
import org.jitsi.utils.version.*;
import org.jitsi.xmpp.extensions.jitsimeet.*;

import org.jitsi.jicofo.discovery.Version;
import org.jitsi.osgi.*;

import java.util.*;
import java.util.stream.*;

/**
* Provides info about all conference components versions to Jicofo's MUC
* presence.
*
* @author Pawel Domas
* @author Damian Minkov
*/
public class Versions
{
/**
* The logger
*/
private static final Logger logger = Logger.getLogger(Versions.class);

/**
* Constructs versions extension to be sent with presence.
* {@inheritDoc}
*/
public static ComponentVersionsExtension getVersionsExtension(
JitsiMeetConference conference)
{
FocusManager focusManager = ServiceUtils2.getService(
FocusBundleActivator.bundleContext, FocusManager.class);
VersionService versionService = ServiceUtils2.getService(
FocusBundleActivator.bundleContext, VersionService.class);

JitsiMeetServices meetServices = focusManager.getJitsiMeetServices();
ComponentVersionsExtension versionsExtension
= new ComponentVersionsExtension();

// XMPP
Version xmppServerVersion = meetServices.getXMPPServerVersion();
if (xmppServerVersion != null)
{
versionsExtension.addComponentVersion(
ComponentVersionsExtension.COMPONENT_XMPP_SERVER,
xmppServerVersion.getNameVersionOsString());
}

// Conference focus
org.jitsi.utils.version.Version jicofoVersion
= versionService.getCurrentVersion();
versionsExtension.addComponentVersion(
ComponentVersionsExtension.COMPONENT_FOCUS,
jicofoVersion.getApplicationName()
+ "(" + jicofoVersion.toString() + ","
+ System.getProperty("os.name") + ")");

String jvbVersions = conference.getBridges().keySet().stream()
.map(b -> b.getVersion())
.filter(Objects::nonNull)
.distinct()
.sorted()
.collect(Collectors.joining(", "));

if (jvbVersions.length() > 0)
{
versionsExtension.addComponentVersion(
ComponentVersionsExtension.COMPONENT_VIDEOBRIDGE,
String.join(",", jvbVersions));
}

if (logger.isDebugEnabled())
logger.debug("Providing versions: " + versionsExtension.toXML());

return versionsExtension;
}
}
Loading