Package org.knapper.core.messages

Examples of org.knapper.core.messages.IMessage


      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) {
            appendChatMessage(body.getNickName(), body.getText());
          }
        }
View Full Code Here


    }
   
    try {
      String fromServer;
      while ((fromServer = in.readLine()) != null) {
        IMessage message = MessageFactory.parseMessage(fromServer);
       
        if (message != null) {
          clientThread.receiveMessageEvent(
              new MessageReceiveEvent(
                  this,
View Full Code Here

      return false;
    }
   
    AuthRequestMessageBody armb = new AuthRequestMessageBody(clientSession.getClientLoginData());
   
    IMessage areqm = MessageFactory.createMessage(clientSession, null, armb);
    send(areqm.pack());
   
    String aresmText = readInputLine();
   
    IMessage aresm = MessageFactory.parseMessage(aresmText);
    if (aresm == null) {
      return false; // didn't receive interpretable message
    }
   
    AuthResponseMessageBody aresmb = AuthResponseMessageBody
      .parseBody(aresm.getBody());
   
    if (aresmb == null) {
      return false; // didn't receive interpretable message body
    }

    clientSession.authenticatedToServer(
        this,
        new MasterServerImpl(aresm.getSender().getGuid()),
        aresmb.getPlayer());
   
    return true;
  }
View Full Code Here

     
      if (fromServer == null) {
        break;
      }
     
      IMessage message = MessageFactory.parseMessage(fromServer);
     
      if (message != null) {
        clientSession.receiveServerMessage(message);
      } else {
        ConsoleService.getInstance().handleMessage(
View Full Code Here

TOP

Related Classes of org.knapper.core.messages.IMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.