May 27, 2008 4:12 PM
no "add buddy" dialogue after subscribing to gateway user's presence
-
Like (0)
Hi all,
I'm probably have a basic error here, but have tried a few variations with no luck.
The problem: I subscribe to a yahoo or AIM member's presence, but the IM client logged into aim/yahoo does not pop up the "authorize add buddy" dialogue. Instead the user appears as "unavailable".
Any suggestions?
thanks,
bill m
_The code: _
Presence auth = new Presence(Presence.Type.subscribe);
auth.setFrom("myAccount@myServer.mycompany.com")
auth.setTo("myname@yahoo.myname.mycompany.com")
fConnection.sendPacket(authorize);
_The stdout excerpt: _
RECV (22610276):
<presence id="6333i-5" to="myname@yahoo.myname.mycompany.com" from="otherAccount@myname.mycompany.com" type="subscribe"></presence>
INTERPRETED:
<presence id="6333i-5" to="myname@yahoo.myserver.mycompany.com" from="otherAccount@myserver.mycompany.com/myResource" type="subscribe"/>
INTERPRETED:
<presence type="subscribed" to="otherAccount@myserver.mycompany.com" from="myname@yahoo.myserver.mycompany.com"/>
INTERPRETED:
<presence to="otherAccount@myserver.mycompany.com" from="myname@yahoo.myserver.mycompany.com" type="unavailable"/>
SENT (22610276):
<iq type="set" id="424-70" to="otherAccount@myserver.mycompany.com/myResource"><query xmlns="jabber:iq:roster"><item jid="myname@yahoo.myserver.mycompany.com" ask="subscribe" subscription="none"/></query></iq>
SENT (22610276):
<iq type="set" id="454-71" to="otherAccount@myserver.mycompany.com/myResource"><query xmlns="jabber:iq:roster"><item jid="myname@yahoo.myserver.mycompany.com" subscription="to"/></query></iq>
SENT (22610276):
<presence type="subscribed" to="otherAccount@myserver.mycompany.com" from="myname@yahoo.myserver.mycompany.com"/>
SENT (22610276):
<presence to="otherAccount@myserver.mycompany.com" from="myname@yahoo.myserver.mycompany.com" type="unavailable"/>
OK. Here's the solution. I definitely didn't see this in the pai docs, but perhaps missed it.
Instead I examined the stdout when set in debug mode. The Spark client added the extra 'iq roster' stanzas.
I needed to explicitly send the roster packet:
RosterPacket rosterPacket = new RosterPacket();
rosterPacket.setTo(serverJid);
rosterPacket.setType(IQ.Type.SET);
RosterPacket.Item item = new RosterPacket.Item(pJid,pJid);
item.setItemType(RosterPacket.ItemType.to);
rosterPacket.addRosterItem(item);
fConn.sendPacket(rosterPacket);
bill m