Search in sources :

Example 1 with IChatPanel

use of games.strategy.engine.chat.IChatPanel in project triplea by triplea-game.

the class HeadlessGameServer method remoteGetChatLog.

public String remoteGetChatLog(final String hashedPassword, final String salt) {
    final String password = System.getProperty(LOBBY_GAME_SUPPORT_PASSWORD, "");
    if (password.equals(GameRunner.NO_REMOTE_REQUESTS_ALLOWED)) {
        return "Host not accepting remote requests!";
    }
    final String localPassword = System.getProperty(LOBBY_GAME_SUPPORT_PASSWORD, "");
    if (hashPassword(localPassword, salt).equals(hashedPassword)) {
        final IChatPanel chat = getServerModel().getChatPanel();
        if (chat == null || chat.getAllText() == null) {
            return "Empty or null chat";
        }
        return chat.getAllText();
    }
    System.out.println("Attempted remote get chat log with invalid password.");
    return "Invalid password!";
}
Also used : IChatPanel(games.strategy.engine.chat.IChatPanel)

Example 2 with IChatPanel

use of games.strategy.engine.chat.IChatPanel in project triplea by triplea-game.

the class MainPanel method addChat.

private void addChat() {
    remove(mainPanel);
    remove(chatSplit);
    chatPanelHolder.removeAll();
    final IChatPanel chat = gameTypePanelModel.getPanel().getChatPanel();
    if (chat != null && !chat.isHeadless()) {
        chatPanelHolder = new JPanel();
        chatPanelHolder.setLayout(new BorderLayout());
        chatPanelHolder.setPreferredSize(new Dimension(chatPanelHolder.getPreferredSize().width, 62));
        chatPanelHolder.add((Component) chat, BorderLayout.CENTER);
        chatSplit.setTopComponent(mainPanel);
        chatSplit.setBottomComponent(chatPanelHolder);
        add(chatSplit, BorderLayout.CENTER);
    } else {
        add(mainPanel, BorderLayout.CENTER);
    }
    isChatShowing = chat != null;
}
Also used : JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) IChatPanel(games.strategy.engine.chat.IChatPanel) Dimension(java.awt.Dimension)

Aggregations

IChatPanel (games.strategy.engine.chat.IChatPanel)2 BorderLayout (java.awt.BorderLayout)1 Dimension (java.awt.Dimension)1 JPanel (javax.swing.JPanel)1