Skip to content

Commit

Permalink
Use the connection resource as nickname when joining brewery room.
Browse files Browse the repository at this point in the history
Avoids reusing the same nickname.
  • Loading branch information
damencho authored and paweldomas committed Jan 7, 2019
1 parent 7e9a026 commit 048e43e
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions src/main/java/org/jitsi/jigasi/xmpp/CallControlMucActivator.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.jivesoftware.smack.*;
import org.jivesoftware.smack.iqrequest.*;
import org.jivesoftware.smack.packet.*;
import org.jxmpp.jid.parts.*;
import org.osgi.framework.*;

import java.util.*;
Expand Down Expand Up @@ -283,15 +284,7 @@ private void joinCommonRoom(ProtocolProviderService pps)
{
logger.info(
"Joining call control room: " + roomName + " pps:" + pps);

ChatRoom mucRoom = muc.findRoom(roomName);

mucRoom.join();

// sends initial stats, used some kind of advertising
// so jicofo can recognize us as real jigasi and load balance us
Statistics.updatePresenceStatusForXmppProviders(
Collections.singletonList(pps));
Resourcepart connectionResource = null;

// getting direct access to the xmpp connection in order to add
// a listener for incoming iqs
Expand All @@ -305,7 +298,25 @@ private void joinCommonRoom(ProtocolProviderService pps)
((ProtocolProviderServiceJabberImpl) pps).getConnection();
conn.registerIQRequestHandler(new DialIqHandler(pps));
conn.registerIQRequestHandler(new HangUpIqHandler(pps));

connectionResource = conn.getUser().getResourceOrNull();
}


ChatRoom mucRoom = muc.findRoom(roomName);
if (connectionResource != null)
{
mucRoom.joinAs(connectionResource.toString());
}
else
{
mucRoom.join();
}

// sends initial stats, used some kind of advertising
// so jicofo can recognize us as real jigasi and load balance us
Statistics.updatePresenceStatusForXmppProviders(
Collections.singletonList(pps));
}
catch (Exception e)
{
Expand Down Expand Up @@ -531,4 +542,4 @@ public final IQ handleIQRequest(IQ iqRequest)

protected abstract IQ processIQ(T iq, CallContext ctx);
}
}
}

0 comments on commit 048e43e

Please sign in to comment.