Hi,
I am able to register new gateway / transports successfully to My Openfire using the below code. Next i am adding the newly added gateway / transports to my roster successfully.
But i can’t get / see the contacts from my transports / gateway. It works when i add gateway / transports manually.
Please need help. The below is code is alraedy available in my other post so sorry for that.
** GATEWAY / TRANSPORTS Registration code to Openfire**:-
public static void register(XMPPConnection conn, String gateway,
String username, String password, String nickname) throws XMPPException
{ if(username == null || username.length() == 0 ||
password == null || password.length() == 0 ||
nickname == null || nickname.length() == 0 ||
gateway == null || gateway.length() == 0)
throw new XMPPException(“Incorrect paramaters”);Registration registration = new Registration(); registration.setType(IQ.Type.SET); registration.setTo(gateway); registration.addExtension(new GatewayRegisterExtension()); Map attributes = new HashMap(); if (username != null) attributes.put("username", username); if (password != null) attributes.put("password", password); if (nickname != null) attributes.put("nick", nickname); registration.setAttributes(attributes); PacketCollector collector = conn.createPacketCollector(new PacketIDFilter(registration.getPacketID())); conn.sendPacket(registration); IQ response = (IQ) collector.nextResult(SmackConfiguration.getPacketReplyTimeout()); collector.cancel(); if(response == null) throw new XMPPException("Server timed out"); if(response.getType() == IQ.Type.ERROR) { System.out.println(response.getXmlns()); System.out.println(response.getChildElementXML()); throw new XMPPException("Error registering user", response.getError()); } if(!conn.getRoster().contains(gateway)) conn.getRoster().createEntry(gateway, gateway, null); Presence subscribe = new Presence(Presence.Type.subscribe); subscribe.setTo(gateway); subscribe.setFrom(conn.getUser()); conn.sendPacket(subscribe); }