1

I'm building a bot that monitor friends presences but doesn't need to be visible. I have tried to set presence using priority, show, type with all knowns values but without success. Is possibile to be invisibile and just receive presence notifications?

Thanks!

4 Answers4

2

See XEP-0126: Invisibility, section 3.1:

<iq from='bilbo@tolkien.lit/shire' type='set' id='inv1'>
  <query xmlns='jabber:iq:privacy'>
    <list name='invisible'>
      <item action='deny' order='1'>
        <presence-out/>
      </item>
    </list>
  </query>
</iq>
Joe Hildebrand
  • 10,354
  • 2
  • 38
  • 48
0

Have a look at the rfc. Presence has a subscription status. If your bot is subscribed to receive presence from your users but your users are not, they are not going to be notified of the bot's presence.

In other words, your bot should send:

<presence to="user@example.com" type="subscribe" />

followed by the user's authorization,

<presence to="bot@example.com" type="subscribed" />

Now the bot will receive presence from the user, but not the opposite.

ggozad
  • 13,105
  • 3
  • 40
  • 49
  • I have done some experiments with subscriptions, but it seems that facebook doesn't support it, because my subscription are ignored and I never receive a subscription request – Cristian Civera Apr 14 '12 at 12:01
  • I am afraid neither mine or Joe's solution will work with facebook if they do not support it. – ggozad Apr 14 '12 at 15:28
0

To set status for become invisible, you must send a presence with type "invisible".

<presence type="invisible"/>

And here is the code (in ios):

XMPPPresence *presence = [XMPPPresence presenceWithType:@"invisible"];
[[self xmppStream] sendElement:presence];

I use this code to set my status as "invisible". For more details, please read the documentation on http://xmpp.org/extensions/xep-0018.html#sect-id86210

tesmojones
  • 2,496
  • 2
  • 21
  • 40
  • 1
    Be aware that XEP-0018 has been rejected by the XMPP Council, and should not be implemented in general XMPP clients (http://xmpp.org/extensions/xep-0018.html). Privacy Lists via XEP-0126 is the recommended method, as suggested by Joe Hildebrand. – Jeff Hay Feb 15 '13 at 16:46
0

Last I knew from Facebook, it's not possible to implement invisibility via XMPP commands: https://developers.facebook.com/bugs/315067461919373. See also https://developers.facebook.com/docs/chat/ under Limitations.

Jeff Hay
  • 2,655
  • 28
  • 32