public SnacCommand genSnacCommand(SnacPacket packet) { if (packet.getFamily() != MailCheckCmd.FAMILY_MAILCHECK) return null; int command = packet.getCommand(); if (command == MailCheckCmd.CMD_UPDATE) { return new MailUpdate(packet); } else { return null; } }
/** * Generates a new set-ICBM-parameter-information command from the given incoming SNAC packet. * * @param packet an incoming set-ICBM-parameters packet */ protected SetParamInfoCmd(SnacPacket packet) { super(CMD_SET_PARAM_INFO); DefensiveTools.checkNull(packet, "packet"); ByteBlock snacData = packet.getData(); paramInfo = ParamInfo.readParamInfo(snacData); }
public SnacCommand genSnacCommand(SnacPacket packet) { if (packet.getFamily() != LocCommand.FAMILY_LOC) return null; int command = packet.getCommand(); if (command == LocCommand.CMD_RIGHTS_REQ) { return new LocRightsRequest(packet); } else if (command == LocCommand.CMD_SET_INFO) { return new SetInfoCmd(packet); } else if (command == LocCommand.CMD_OLD_GET_INFO) { return new OldGetInfoCmd(packet); } else if (command == LocCommand.CMD_GET_DIR) { return new GetDirInfoCmd(packet); } else if (command == LocCommand.CMD_SET_INTERESTS) { return new SetInterestsCmd(packet); } else if (command == LocCommand.CMD_SET_DIR) { return new SetDirInfoCmd(packet); } else if (command == LocCommand.CMD_NEW_GET_INFO) { return new GetInfoCmd(packet); } else { return null; } }
/** * Generates a new item-based command from the given incoming SNAC packet. * * @param command the SNAC command subtype for this command * @param packet an incoming item-based command packet */ protected ItemsCmd(int command, SnacPacket packet) { super(command); DefensiveTools.checkNull(packet, "packet"); ByteBlock block = packet.getData(); List<SsiItem> itemList = new ArrayList<SsiItem>(); for (; ; ) { SsiItem item = SsiItem.readSsiItem(block); if (item == null) break; itemList.add(item); block = block.subBlock(item.getTotalSize()); } items = DefensiveTools.getUnmodifiable(itemList); }
/** * Generates a new service request command from the given incoming SNAC packet. * * @param packet the incoming service request packet */ protected ServiceRequest(SnacPacket packet) { super(CMD_SERVICE_REQ); DefensiveTools.checkNull(packet, "packet"); ByteBlock snacData = packet.getData(); family = BinaryTools.getUShort(snacData, 0); ByteBlock tlvBlock = snacData.subBlock(2); TlvChain chatChain = TlvTools.readChain(tlvBlock); Tlv chatInfoTlv = chatChain.getLastTlv(TYPE_ROOM_INFO); if (chatInfoTlv != null) { ByteBlock chatBlock = chatInfoTlv.getData(); roomInfo = MiniRoomInfo.readMiniRoomInfo(chatBlock); } else { roomInfo = null; } }