tags:

views:

61

answers:

2

As the title says, I would like to send a welcome message when a user subscribes to a bot.

However, as I understand it, presence subscribe stanzas should not contain a from-JID that includes resource (and my testing with Adium indicates that is also the case). That is, welcome message could easily be sent to the bare JID but is that really the right way to do it? It feels like it should be sent to the actual instance where the subscription originated.

Perhaps I'm seeing a problem where there is none? If not, any ideas on how to solve it?

+3  A: 

Do not fear sending a message to a bare JID. Almost all the time this is what you want. The user may already have a fantastic system in place using priority to get the answer at the right device, like a blackberry, their home jabber client, the one at work, and so on. Heck, they may have sent the request from their blackberry that has a 0 priority, and they want to get the answer back at their desk.

Just send a message stanza with a type of headline, since you don't want them to reply to the notice.

A. R. Diederich
Thanks! Much appreciated!
lemonad
A: 

The things said about messages are all right. If you care about whom to send presence subscribe stanzas to, I wonder whether you really know resources at that time. IIRC, resources are stripped off before forwarding presence subscribes and I assume that you are responding to them. Furthermore, the bot wants to be informed about all presences, so subscribing to the bare jid is the right thing to do.