I am currently working with Smack and Openfire and I am having trouble taking the status message from client (built using smack) to send across transports.
For instance:
The user is logged on to yahoo, msn, google and ICQ.
If the user changes his status (custom text) as “I am gone for fishing, call me on my cell”, then the user presence in yahoo, msn, gmail (all allow custom text presence message) should be changed accordingly.
I am not able to get this working. Is there a special way of doing this?
Here is the snippit of code that I am using in the IM Gateway with Smack to set the appropriate “verbose status” as I call it:
org.jivesoftware.smack.packet.Presence.Mode mode = ((XMPPTransport)getTransport()).convertGatewayStatusToXMPP(presenceType);
if (mode != null && mode != presence.getMode()) {
presence.setMode(mode);
}
if (presence.getType() != org.jivesoftware.smack.packet.Presence.Type.available) {
presence.setType(org.jivesoftware.smack.packet.Presence.Type.available);
}
if (verboseStatus != null) {
presence.setStatus(verboseStatus);
}
else {
presence.setStatus("");
}
try {
conn.sendPacket(presence);
setPresenceAndStatus(presenceType, verboseStatus);
}
catch (IllegalStateException e) {
Log.debug("XMPP: Not connected while trying to change status.");
}
It would be interesting to see what is coming from the client you are using to the transports.
One thing that might be helpful … did you register with the transports using Spark? If so, that might be the problem right there. Spark handles registration in a special manner that involves not putting the transports themselves in the user’s roster. Because of this, the transports have no automated (via XMPP) way of knowing when your status changes. Spark has to send directed presences to each transport every time the user’s status changes. If you registered with the transports using any other client, or via the admin console, this should not be a problem. Likewise, if you registered using your own client following XEP-0100, then you shouldn’t have this problem.
No, I am not using Spark / Psi or any other XMPP client. I am trying to change the presence through the client built using smack API.
Lets call my client as ClientA.
ClientA publishes presence : <presence id=“vajQs-12”><status>I am gone fishing</status></presence>
When ClientA is registered with Gtalk directly, his gtalk buddies sees the change in presence. But, when ClientA is logged on to gtalk through the transport, his status (Text message) is not updated. But if there is “show” field in the presence and sent to Openfire, Gtalk transport updates the show (and no text)
Other transport doesn’t see any change.
Let me know if this information gives you any clue?