Changes the behavior of chat room windows to be opened only on important events.

cusax-fix
hristoterezov 12 years ago
parent ed6fbb3968
commit 0b566e6a78

@ -44,7 +44,7 @@ public class ConferenceChatManager
AdHocChatRoomInvitationRejectionListener,
LocalUserChatRoomPresenceListener,
LocalUserAdHocChatRoomPresenceListener,
ServiceListener
ServiceListener, ChatRoomLocalUserRoleListener
{
/**
* The object used for logging.
@ -277,10 +277,10 @@ else if(o instanceof ChatRoomMessageReceivedEvent)
message.getMessageUID(),
null);
chatWindowManager.openChat(chatPanel, false);
if(evt.isImportantMessage())
chatWindowManager.openChat(chatPanel, true);
}
/**
* Implements the <tt>ChatRoomMessageListener.messageDeliveryFailed</tt>
* method.
@ -489,8 +489,8 @@ public void run()
if(chatPanel.isShown())
((ConferenceChatSession) chatPanel.getChatSession())
.loadChatRoom(sourceChatRoom);
else
chatWindowManager.openChat(chatPanel, true);
// else
// chatWindowManager.openChat(chatPanel, true);
}
if (sourceChatRoom.isSystem())
@ -504,6 +504,7 @@ public void run()
}
sourceChatRoom.addMessageListener(this);
sourceChatRoom.addLocalUserRoleListener(this);
}
else if (LocalUserChatRoomPresenceChangeEvent
.LOCAL_USER_JOIN_FAILED.equals(eventType))
@ -536,6 +537,7 @@ else if (LocalUserChatRoomPresenceChangeEvent
}
sourceChatRoom.removeMessageListener(this);
sourceChatRoom.removelocalUserRoleListener(this);
}
}
@ -1259,5 +1261,19 @@ public void messageReceived(AdHocChatRoomMessageReceivedEvent evt)
}
public void invitationRejected(AdHocChatRoomInvitationRejectedEvent evt) {}
@Override
public void localUserRoleChanged(ChatRoomLocalUserRoleChangeEvent evt)
{
ChatRoom sourceChatRoom = evt.getSourceChatRoom();
ChatRoomWrapper chatRoomWrapper
= GuiActivator.getMUCService().findChatRoomWrapperFromChatRoom(
sourceChatRoom);
ChatWindowManager chatWindowManager
= GuiActivator.getUIService().getChatWindowManager();
ChatPanel chatPanel
= chatWindowManager.getMultiChat(chatRoomWrapper, true);
chatWindowManager.openChat(chatPanel, true);
}
}

@ -2008,6 +2008,13 @@ public void processPacket(Packet packet)
if(delay != null)
msgReceivedEvt.setHistoryMessage(true);
if(messageReceivedEventType
== ChatRoomMessageReceivedEvent.CONVERSATION_MESSAGE_RECEIVED
&& newMessage.getContent().contains(getUserNickname() + ":"))
{
msgReceivedEvt.setImportantMessage(true);
}
fireMessageEvent(msgReceivedEvt);
}
}

@ -72,6 +72,11 @@ public class ChatRoomMessageReceivedEvent
* Some services can fill our room with message history.
*/
private boolean historyMessage = false;
/**
* Indicates whether the message is important or not.
*/
private boolean isImportantMessage = false;
/**
* Creates a <tt>MessageReceivedEvent</tt> representing reception of the
@ -167,4 +172,22 @@ public void setHistoryMessage(boolean historyMessage)
{
this.historyMessage = historyMessage;
}
/**
* Sets the the important message flag of the event.
* @param isImportant the value to be set.
*/
public void setImportantMessage(boolean isImportant)
{
isImportantMessage = isImportant;
}
/**
* Returns <tt>true</tt> if message is important and <tt>false</tt> if not.
* @return <tt>true</tt> if message is important and <tt>false</tt> if not.
*/
public boolean isImportantMessage()
{
return isImportantMessage;
}
}

Loading…
Cancel
Save