}
ContactExchange.Item rosterItem = new ContactExchange.Item(contact.getJid(), contact.getName(), contact.getGroups(), ContactExchange.Item.Action.ADD);
contactExchange.getItems().add(rosterItem);
}
// http://xmpp.org/extensions/xep-0144.html#stanza
Presence presence = xmppSession.getPresenceManager().getPresence(jid);
if (presence.isAvailable()) {
xmppSession.query(new IQ(presence.getFrom(), IQ.Type.SET, contactExchange));
} else {
// If the sending entity does not know that the receiving entity is online and available, it MUST send a <message/> stanza to the receiving entity's "bare JID" (user@host) rather than an <iq/> stanza to a particular resource.
Message message = new Message(jid, Message.Type.NORMAL);
message.getExtensions().add(contactExchange);
xmppSession.send(message);