@Override
public void handleMessage(Message message) {
logger.fine("got a message...");
if (message instanceof GetPlayersInRangeResponseMessage) {
GetPlayersInRangeResponseMessage msg =
(GetPlayersInRangeResponseMessage) message;
String[] playersInRange = msg.getPlayersInRange();
for (int i = 0; i < playersInRange.length; i++) {
playerInRange(new PlayerInRangeMessage(
msg.getPlayerID(), playersInRange[i], true));
}
return;
}
if (message instanceof GetVoiceBridgeResponseMessage) {
startSoftphone((GetVoiceBridgeResponseMessage) message);
return;
}
if (message instanceof ChangeUsernameAliasMessage) {
changeUsernameAlias((ChangeUsernameAliasMessage) message);
return;
}
if (message instanceof VoiceChatJoinRequestMessage) {
logger.warning("Got VoiceChatJoinRequestMessage");
final IncomingCallHUDPanel incomingCallHUDPanel =
new IncomingCallHUDPanel(this, session, cell.getCellID(),
(VoiceChatJoinRequestMessage) message);
HUD mainHUD = HUDManagerFactory.getHUDManager().getHUD("main");
final HUDComponent incomingCallHUDComponent =
mainHUD.createComponent(incomingCallHUDPanel);
incomingCallHUDPanel.setHUDComponent(incomingCallHUDComponent);
incomingCallHUDComponent.setPreferredLocation(Layout.CENTER);
incomingCallHUDComponent.setIcon(voiceChatIcon);
mainHUD.addComponent(incomingCallHUDComponent);
incomingCallHUDComponent.addEventListener(new HUDEventListener() {
public void HUDObjectChanged(HUDEvent e) {
if (e.getEventType().equals(HUDEventType.DISAPPEARED)) {
incomingCallHUDPanel.busy();
}
}
});
incomingCallHUDComponent.setVisible(true);
return;
}
if (message instanceof VoiceChatBusyMessage) {
VoiceChatBusyMessage msg = (VoiceChatBusyMessage) message;
VoiceChatBusyHUDPanel voiceChatBusyHUDPanel =
new VoiceChatBusyHUDPanel(msg.getCallee());
HUD mainHUD = HUDManagerFactory.getHUDManager().getHUD("main");
HUDComponent voiceChatBusyHUDComponent =
mainHUD.createComponent(voiceChatBusyHUDPanel);
voiceChatBusyHUDPanel.setHUDComponent(voiceChatBusyHUDComponent);
voiceChatBusyHUDComponent.setPreferredLocation(Layout.CENTER);
voiceChatBusyHUDComponent.setIcon(voiceChatIcon);
mainHUD.addComponent(voiceChatBusyHUDComponent);
voiceChatBusyHUDComponent.addEventListener(new HUDEventListener() {
public void HUDObjectChanged(HUDEvent e) {
if (e.getEventType().equals(HUDEventType.DISAPPEARED)) {
}
}
});
voiceChatBusyHUDComponent.setVisible(true);
notifyMemberChangeListeners(msg.getGroup(), msg.getCallee(), false);
return;
}
if (message instanceof VoiceChatInfoResponseMessage) {
VoiceChatInfoResponseMessage msg =
(VoiceChatInfoResponseMessage) message;
notifyMemberChangeListeners(msg.getGroup(), msg.getChatters());
return;
}
if (message instanceof VoiceChatJoinAcceptedMessage) {
joinVoiceChat((VoiceChatJoinAcceptedMessage) message);
return;
}
if (message instanceof VoiceChatHoldMessage) {
VoiceChatHoldMessage msg = (VoiceChatHoldMessage) message;
return;
}
if (message instanceof VoiceChatLeaveMessage) {
leaveVoiceChat((VoiceChatLeaveMessage) message);
return;
}
if (message instanceof VoiceChatCallEndedMessage) {
VoiceChatCallEndedMessage msg = (VoiceChatCallEndedMessage) message;
voiceChatCallEnded(msg);
sendMessage(new VoiceChatLeaveMessage(msg.getGroup(), msg.getCallee(),
COSName));
return;
}
if (message instanceof VoiceChatTransientMemberMessage) {