Search in sources :

Example 1 with UnreadPrivateMessageEvent

use of com.faforever.client.chat.event.UnreadPrivateMessageEvent in project downlords-faf-client by FAForever.

the class PrivateChatTabController method onChatMessage.

@Override
public void onChatMessage(ChatMessage chatMessage) {
    Player player = playerService.getPlayerForUsername(chatMessage.getUsername());
    ChatPrefs chatPrefs = preferencesService.getPreferences().getChat();
    if (player != null && player.getSocialStatus() == FOE && chatPrefs.getHideFoeMessages()) {
        return;
    }
    super.onChatMessage(chatMessage);
    if (!hasFocus()) {
        audioService.playPrivateMessageSound();
        showNotificationIfNecessary(chatMessage);
        setUnread(true);
        incrementUnreadMessagesCount(1);
        eventBus.post(new UnreadPrivateMessageEvent(chatMessage));
    }
}
Also used : Player(com.faforever.client.player.Player) UnreadPrivateMessageEvent(com.faforever.client.chat.event.UnreadPrivateMessageEvent) ChatPrefs(com.faforever.client.preferences.ChatPrefs)

Aggregations

UnreadPrivateMessageEvent (com.faforever.client.chat.event.UnreadPrivateMessageEvent)1 Player (com.faforever.client.player.Player)1 ChatPrefs (com.faforever.client.preferences.ChatPrefs)1