Roster: Add user if only is registered

Hi,
I need to add list of users to roster. The problem is some of those users have not (yet) registered with the XMPP server. No I can try to add entry and catch the error and ignore it and add next, but I feel it is dirty and hacky.
Is there a way I can register a batch of jids in single go telling server to ignore the error?
Sorry if the answer is obvious. Am not an XMPP maverick yet.

TIA,
S.

I’d expect that you are able to add a new roster item (RFC 6120 § 2.3) which contains a not (yet) existent XMPP address. Currently Smack’s Roster.createEntry() method will additionally add a subscription request, which will eventually fail for non existend XMPP addresses. But the roster entry should possibly still be kept by the service.

Thank you for reply. Am finding a way to avoid having those gibberish users in the service, as some of them might never join the chat service at all. Can you suggest as better way of doing so?

Basically I need something like this:

  1. User have list of friends
  2. Some friends are on chat service ad others have opted out
  3. Add to the roster friends that opted for the service

Again thank you for the reply!

I think the sensible way to would be implement some service side feature for this. Most XMPP servers provide a plugin/module architecture which should allow for this.

1 Like

Thank you for great advice. I will implement that. I wanted to be sure there is no such a solution already built in XMPP.

Thank you and good day!