Search in sources :

Example 1 with RosterGroup

use of org.jivesoftware.smack.roster.RosterGroup in project Smack by igniterealtime.

the class RosterExchange method addRosterEntry.

/**
     * Adds a roster entry to the packet.
     *
     * @param rosterEntry a roster entry to add.
     */
public void addRosterEntry(RosterEntry rosterEntry) {
    // Obtain a String[] from the roster entry groups name 
    List<String> groupNamesList = new ArrayList<String>();
    String[] groupNames;
    for (RosterGroup group : rosterEntry.getGroups()) {
        groupNamesList.add(group.getName());
    }
    groupNames = groupNamesList.toArray(new String[groupNamesList.size()]);
    // Create a new Entry based on the rosterEntry and add it to the packet
    RemoteRosterEntry remoteRosterEntry = new RemoteRosterEntry(rosterEntry.getJid(), rosterEntry.getName(), groupNames);
    addRosterEntry(remoteRosterEntry);
}
Also used : ArrayList(java.util.ArrayList) RosterGroup(org.jivesoftware.smack.roster.RosterGroup) RemoteRosterEntry(org.jivesoftware.smackx.xroster.RemoteRosterEntry)

Aggregations

ArrayList (java.util.ArrayList)1 RosterGroup (org.jivesoftware.smack.roster.RosterGroup)1 RemoteRosterEntry (org.jivesoftware.smackx.xroster.RemoteRosterEntry)1