1 import org.jivesoftware.smack.PacketListener; 2 import org.jivesoftware.smack.packet.Packet; 3 import org.jivesoftware.smack.packet.IQ; 4 5 public final class VersionIQListener implements PacketListener{ 6 private static final String OS=System.getProperties().getProperty("os.name"); 7 8 public void processPacket(Packet packet){ 9 VersionIQ in; 10 try{ 11 in=(VersionIQ) packet; 12 } 13 catch(ClassCastException cce){ 14 return; 15 } 16 if(in.getType()!=IQ.Type.GET){ 17 return; 18 } 19 VersionIQ out=new VersionIQ("Whisper IM",WhisperIM.VERSION,OS); 20 out.setType(IQ.Type.RESULT); 21 out.setTo(in.getFrom()); 22 out.setPacketID(in.getPacketID()); 23 try{ 24 WhisperIM.MainWindow.Conn.sendPacket(out); 25 } 26 catch(Exception e){ 27 } 29 } 30 } | Popular Tags |