Cristian Civera
Cristian Civera

Reputation: 11

Xmpp chat invisible presence

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!

Upvotes: 1

Views: 2038

Answers (4)

Jeff Hay
Jeff Hay

Reputation: 2645

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.

Upvotes: 0

tesmojones
tesmojones

Reputation: 2647

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

Upvotes: 0

Joe Hildebrand
Joe Hildebrand

Reputation: 10414

See XEP-0126: Invisibility, section 3.1:

<iq from='[email protected]/shire' type='set' id='inv1'>
  <query xmlns='jabber:iq:privacy'>
    <list name='invisible'>
      <item action='deny' order='1'>
        <presence-out/>
      </item>
    </list>
  </query>
</iq>

Upvotes: 2

ggozad
ggozad

Reputation: 13105

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="[email protected]" type="subscribe" />

followed by the user's authorization,

<presence to="[email protected]" type="subscribed" />

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

Upvotes: 0

Related Questions