String messageText = chatMessageText.getText();
IMasterServerSession server = KnapperServerCore.getDefault()
.getMasterServer();
server.sendMessage(new ChatMessageBody(messageText, "SERVER"));
chatMessageText.setText("");
chatMessageText.setFocus();
appendChatMessage("SERVER", messageText);
}
});
eventListener = new IEventListener() {
public void handleEvent(IEvent event) {
if (event instanceof MessageReceiveEvent) {
MessageReceiveEvent mre = (MessageReceiveEvent) event;
IMessage message = mre.getMessage();
ChatMessageBody body = ChatMessageBody.parseBody(message.getBody());
if (body != null) {
handleChatMessageBody(message.getSender(), body);
}
}