/** * this is a convenience method to add a JID to the roster. It probably will satisfy 80% of the * uses. If you need to set more features, then you should create your own roster item and use the * alternate method. Normally, the jid of the contact (friends, etc) is a jid without resource. * This method does not return any values because if there is an error, exception will be thrown * instead. Otherwise, you can assume that the request was successful. This only applies when wait * is true. * * @param conn the connection that the packet will be sent through * @param jid the contact's JID * @param name optional nickname for the contact * @param group optional group name for the contact to be in * @param wait true to wait for confirmation, false to return immediately * @throws SendPacketFailedException if packet cannot be sent or if timeout occurred while waiting * for reply * @throws XMPPStanzaErrorException if wait is true and reply packet is an error packet, then this * exception will be thrown to indicate an error. */ public static final void addItem( IXMPPConnection conn, JID jid, String name, String group, boolean wait) throws SendPacketFailedException, XMPPStanzaErrorException { RosterItem item = new RosterItem(); item.setJid(jid); item.setName(name); item.addGroup(group); addItem(conn, item, wait); }