another fix

This commit is contained in:
Markos Calderon 2012-09-14 23:40:34 -07:00
parent 5fc2b46ce8
commit eba31e9dbb

View File

@ -47,7 +47,8 @@ public class RedisMessagingService implements MessagingService{
try {
pubsubListener = new Runnable() {
public void run() {
jedis.psubscribe(new PubSubListener(), MessagingConstants.BIGBLUEBUTTON_PATTERN);
//jedis.psubscribe(new PubSubListener(), MessagingConstants.BIGBLUEBUTTON_PATTERN);
jedis.psubscribe(new PubSubListener(), "*");
}
};
exec.execute(pubsubListener);
@ -144,20 +145,21 @@ public class RedisMessagingService implements MessagingService{
String messageName = gson.fromJson(array.get(1), String.class);
//JsonObject params = array.getAsJsonObject("params");
if(messageName.equalsIgnoreCase("user list change")){
//usernames.push({ 'name' : users[i].username, 'id' : users[i].pubID });
JsonArray nPartipants = array.get(2).getAsJsonArray();
//obtener la lista de participantes
Map<String,Participant> map = participantsApplication.getParticipants(meetingId);
Set<String> keys = map.keySet();
//checkear q participante esta
for(int i=0;i<nPartipants.size();i++){
JsonObject obj = nPartipants.get(i).getAsJsonObject();
String nUserId = gson.fromJson(obj.get("id"),String.class);
if(!map.containsKey(nUserId)){
for(String key:keys){
if(!key.equalsIgnoreCase(nUserId)){
String username = gson.fromJson(obj.get("name"),String.class);
String externalUserID = UUID.randomUUID().toString();
@ -169,12 +171,13 @@ public class RedisMessagingService implements MessagingService{
participantsApplication.participantJoin(meetingId, Long.parseLong(nUserId), username, "VIEWER", externalUserID, status);
}
else{
map.remove(nUserId);
keys.remove(key);
}
}
Set<String> set = map.keySet();
for(String id:set){
participantsApplication.participantLeft(meetingId, Long.parseLong(id));
}
for(String key:keys){
participantsApplication.participantLeft(meetingId, Long.parseLong(key));
}