/** * Sends a roster entry to userID. * * @param rosterEntry the roster entry to send * @param targetUserID the user that will receive the roster entries */ public void send(RosterEntry rosterEntry, String targetUserID) { // Create a new message to send the roster Message msg = new Message(targetUserID); // Create a RosterExchange Package and add it to the message RosterExchange rosterExchange = new RosterExchange(); rosterExchange.addRosterEntry(rosterEntry); msg.addExtension(rosterExchange); // Send the message that contains the roster con.sendPacket(msg); }
/** * Sends a roster group to userID. All the entries of the group will be sent to the target user. * * @param rosterGroup the roster group to send * @param targetUserID the user that will receive the roster entries */ public void send(RosterGroup rosterGroup, String targetUserID) { // Create a new message to send the roster Message msg = new Message(targetUserID); // Create a RosterExchange Package and add it to the message RosterExchange rosterExchange = new RosterExchange(); for (RosterEntry entry : rosterGroup.getEntries()) { rosterExchange.addRosterEntry(entry); } msg.addExtension(rosterExchange); // Send the message that contains the roster con.sendPacket(msg); }