HI
I’'m using this protocol : http://www.jabber.org/jeps/jep-0100.html
and after all the steps that i did i recieve a black result iq from the gateway. According to the protocol that the way of the getway to tell me that all went smoth.
But in my ICQ i can’'t see the user going online… starage.
And another problem when i’‘m tring to connect with a user for the secound time i’'m getting an error “username not aviable”
here’‘s my code for tring to connect with a test user that i’'ve opend.
code:
import org.jivesoftware.smack.packet.*;
import org.jivesoftware.smack.*;
import java.util.HashMap;
import org.jivesoftware.smack.filter.*; public class ICQConn { public final static String ICQ_GETWAY = "icq.chote.com";
private XMPPConnection conn; private boolean con1 = false;
private boolean con2 = false;
private String err = null; public Packet RegPacket = new Packet() {
public String toXML() {
return "<iq id=''jcl_1'' to=''"+ ICQ_GETWAY +"'' type=''get''>"+
"<query xmlns=''jabber:iq:register''/></iq> "; }
}; public Packet AuthPacket = new Packet() {
public String toXML() {
return " <iq id=''jcl_2'' to=''"+ ICQ_GETWAY +"'' type=''set''>"+
"<query xmlns=''jabber:iq:register''>"+
"<username>331635353</username> <password>NBTyea</password> </query></iq>";
}
}; public Packet PresencePacket = new Packet() {
public String toXML() {
return "<presence to=''"+ ICQ_GETWAY +"/registered'' type=''subscribed''/>";
}
}; public Packet unRegPacket = new Packet() {
public String toXML() {
return "<iq id=''unreg_1'' to=''"+ ICQ_GETWAY +"'' type=''set''>"+
"<query xmlns=''jabber:iq:register''><remove/></query></iq> ";
}
}; public void unreg(){
conn.sendPacket(unRegPacket);
} public boolean reg(){
System.out.println("Sending reg packet");
conn.sendPacket(RegPacket);
while (!con1); System.out.println("Sending auth packet");
conn.sendPacket(AuthPacket); while (!con2); System.out.println("Sending pre packet");
conn.sendPacket(PresencePacket); conn.sendPacket(PresencePacket2); return (true);
} public String getErr(){
return (err);
} public ICQConn(XMPPConnection conn) {
this.conn = conn;
conn.addPacketListener(new PL(), null);
} class PL implements PacketListener{
public void processPacket(Packet packet) {
if (packet != null && packet.getPacketID() != null){
if (packet.getPacketID().equals("jcl_1")){
con1 = true;
System.out.println("reg packet send ok");
//System.out.println("xml : " + packet.toXML().toString() );
if (packet.getError() != null){
err = packet.getError().getMessage();
//con1 = false;
}
}
if (packet.getPacketID().equals("jcl_2")){
con2 = true;
System.out.println("Auth packet send ok");
System.out.println("xml : " + packet.toXML().toString() );
if (packet.getError() != null){
err = packet.getError().getMessage();
//con2 = false;
}
}
if (packet.getPacketID().equals("unreg_1"))
System.out.println("Xml: " + packet.toXML().toString());
}
}
}
}