Fixes issue with automatically open chat rooms on startup.

cusax-fix 5044
hristoterezov 13 years ago
parent 4571e6f2a8
commit 1faa2ee7a8

@ -1301,6 +1301,8 @@ public void invitationRejected(AdHocChatRoomInvitationRejectedEvent evt) {}
@Override
public void localUserRoleChanged(ChatRoomLocalUserRoleChangeEvent evt)
{
if(evt.isInitial())
return;
ChatRoom sourceChatRoom = evt.getSourceChatRoom();
ChatRoomWrapper chatRoomWrapper
= GuiActivator.getMUCService().findChatRoomWrapperFromChatRoom(

@ -989,7 +989,18 @@ public ChatRoomMemberRole getUserRole()
*/
public void setLocalUserRole(ChatRoomMemberRole role)
{
fireLocalUserRoleEvent(getUserRole(), role);
setLocalUserRole(role, false);
}
/**
* Sets the new rolefor the local user in the context of this chatroom.
*
* @param role the new role to be set for the local user
* @param isInitial if <tt>true</tt> this is initial role set.
*/
public void setLocalUserRole(ChatRoomMemberRole role, boolean isInitial)
{
fireLocalUserRoleEvent(getUserRole(), role, isInitial);
this.role = role;
}
@ -2201,13 +2212,15 @@ public void adminRevoked()
*
* @param previousRole the previous role that local user had
* @param newRole the new role the local user gets
* @param isInitial if <tt>true</tt> this is initial role set.
*/
private void fireLocalUserRoleEvent(ChatRoomMemberRole previousRole,
ChatRoomMemberRole newRole)
ChatRoomMemberRole newRole,
boolean isInitial)
{
ChatRoomLocalUserRoleChangeEvent evt
= new ChatRoomLocalUserRoleChangeEvent(
this, previousRole, newRole);
this, previousRole, newRole, isInitial);
if (logger.isTraceEnabled())
logger.trace("Will dispatch the following ChatRoom event: " + evt);
@ -2726,10 +2739,10 @@ private void processOwnPresence(Presence presence)
if(affiliation.equalsIgnoreCase(ChatRoomMemberRole.OWNER
.getRoleName().toLowerCase()))
{
setLocalUserRole(ChatRoomMemberRole.OWNER);
setLocalUserRole(ChatRoomMemberRole.OWNER, true);
}
else
setLocalUserRole(ChatRoomMemberRole.MODERATOR);
setLocalUserRole(ChatRoomMemberRole.MODERATOR, true);
}
else
{
@ -2743,7 +2756,7 @@ private void processOwnPresence(Presence presence)
|| jitsiRole == ChatRoomMemberRole.OWNER
|| jitsiRole == ChatRoomMemberRole.ADMINISTRATOR)
{
setLocalUserRole(jitsiRole);
setLocalUserRole(jitsiRole, true);
}
}
}

@ -37,6 +37,11 @@ public class ChatRoomLocalUserRoleChangeEvent
* The new role that local participant get.
*/
private ChatRoomMemberRole newRole = null;
/**
* If <tt>true</tt> this is initial role set.
*/
private boolean isInitial = false;
/**
* Creates a <tt>ChatRoomLocalUserRoleChangeEvent</tt> representing that
@ -46,14 +51,17 @@ public class ChatRoomLocalUserRoleChangeEvent
* @param sourceRoom the <tt>ChatRoom</tt> that produced the event
* @param previousRole the previous role that local participant had
* @param newRole the new role that local participant get
* @param isInitial if <tt>true</tt> this is initial role set.
*/
public ChatRoomLocalUserRoleChangeEvent(ChatRoom sourceRoom,
ChatRoomMemberRole previousRole,
ChatRoomMemberRole newRole)
ChatRoomMemberRole newRole,
boolean isInitial)
{
super(sourceRoom);
this.previousRole = previousRole;
this.newRole = newRole;
this.isInitial = isInitial;
}
/**
@ -85,4 +93,13 @@ public ChatRoom getSourceChatRoom()
{
return (ChatRoom)getSource();
}
/**
* Returns <tt>true</tt> if this is initial role set.
* @return <tt>true</tt> if this is initial role set.
*/
public boolean isInitial()
{
return isInitial;
}
}

Loading…
Cancel
Save