Package net.sf.jmyspaceiml.packet

Examples of net.sf.jmyspaceiml.packet.PacketType


        Log.debug("Parsing a packet : " + buffer.toString());

        HashMap<String, Object> rawPacket = MSIMParser.parse(buffer.toString());
        if (rawPacket.containsKey("bm")) {
            PacketType type = PacketType.eval((String) rawPacket.get("bm"));
            if (type.equals(PacketType.INSTANT_MESSAGE)) {
                InstantMessage message = new InstantMessage();
                message.setFrom((String) rawPacket.get("f"));
                message.setBody((String) rawPacket.get("msg"));
                invokeMessageListener(message);
            }
            else if (type.equals(PacketType.STATUS_MESSAGE)) {
                String statusPcs[] = rawPacket.get("msg").toString().split("\\|");
                int statusType = Integer.valueOf(statusPcs[2]);
                String statusMsg = statusPcs[4];
                StatusMessage message = new StatusMessage();
                message.setFrom((String) rawPacket.get("f"));
                message.setStatusMessage(statusMsg);
                message.setStatusCode(statusType);
                invokeMessageListener(message);
            }
            else if (type.equals(PacketType.ACTION_MESSAGE)) {
                ActionMessage message = new ActionMessage();
                message.setFrom((String) rawPacket.get("f"));
                message.setAction((String) rawPacket.get("msg"));
                invokeMessageListener(message);
            }
View Full Code Here

TOP

Related Classes of net.sf.jmyspaceiml.packet.PacketType

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.