Reputation: 139832
One of the contacts of my jabber robot,
whose 'subscription' attribute value is 'to',
which according to jabber protocol mean:
****the robot has subscribed to the other party's online status, but the other party has not subscribed to my robot's.****
But when I login to the other party account,
I can see that robot is online,
why is it like this?
Is the jabber protocol now in chaos?
Upvotes: 0
Views: 361
Reputation: 10414
If you say "My bot has a subscription TO shore" or "Shore has a subscription FROM my bot", "from" and "to" will make more sense.
So, if the bot's roster has:
<item jid='[email protected]' subscription='to'/>
Then the bot will see shore's presence, but shore will not see the bot's presence, assuming that shore's roster has:
<item jid='[email protected]' subscription='from'/>
It's possible for these states to get out of sync, due to network problems and the like. In those cases, the easiest way to fix the problem is to remove the item (which should end up effectively removing the item on the other side), then re-add (see RFC 3921bis, section 2.5.1 for details):
<iq from='[email protected]/background'
id='delete_1'
type='set'>
<query xmlns='jabber:iq:roster'>
<item jid='[email protected]' subscription='remove'/>
</query>
</iq>
<presence type='subscribe'
from='[email protected]/background'
to='[email protected]'/>
The thing to keep in mind is that even if the subscription is in the direction shown, the bot MAY be sending directed presence to shore, in which case shore would see presence from the both even though he is not subscribed to the bot. Check the bot's protocol log, and you may see something like:
<presence to='[email protected]'/>
Upvotes: 3
Reputation: 2761
It has been a while since I've mucked with XMPP, but a quick re-reading of the spec has me thinking that you have the meaning of "to" mixed up. If the user is listed as "to" on the robot's roster, then that means the user is following the robots presence, not the other way around. "from" means that the robot is following -- or will receive presence stanzas from -- the user account.
Do you know what the roster for the user looks like? If things are synced up, the users's roster should have the robot listed as "from".
Upvotes: 1