public void renameRosterItem(String user, String newName) throws ClientException {
    RosterEntry rosterEntry = roster.getEntry(user);

    if (!(newName.length() > 0) || (rosterEntry == null)) {
      throw new ClientException("ID  is invalid!");
    }
    rosterEntry.setName(newName);
  }
Beispiel #2
0
  public void renameRosterItem(String user, String newName) throws YaximXMPPException {
    RosterEntry rosterEntry = mRoster.getEntry(user);

    if (!(newName.length() > 0) || (rosterEntry == null)) {
      throw new YaximXMPPException("JabberID to rename is invalid!");
    }
    rosterEntry.setName(newName);
  }
Beispiel #3
0
 public boolean renameFriend(String userID, String name) {
   if (sConnection != null && sConnection.isConnected()) {
     Roster roster = sConnection.getRoster();
     if (roster.contains(userID)) {
       RosterEntry entry = roster.getEntry(userID);
       entry.setName(name);
     }
   }
   return false;
 }
Beispiel #4
0
 /**
  * @see net.sf.kraken.session.TransportSession#updateContact(net.sf.kraken.roster.TransportBuddy)
  */
 @Override
 public void updateContact(XMPPBuddy contact) {
   RosterEntry user2Update;
   String mail = getTransport().convertJIDToID(contact.getJID());
   user2Update = conn.getRoster().getEntry(mail);
   user2Update.setName(contact.getNickname());
   Collection<String> newgroups = contact.getGroups();
   if (newgroups == null) {
     newgroups = new ArrayList<String>();
   }
   for (RosterGroup group : conn.getRoster().getGroups()) {
     if (newgroups.contains(group.getName())) {
       if (!group.contains(user2Update)) {
         try {
           group.addEntry(user2Update);
         } catch (XMPPException e) {
           Log.debug("XMPP: Unable to add roster item to group.");
         }
       }
       newgroups.remove(group.getName());
     } else {
       if (group.contains(user2Update)) {
         try {
           group.removeEntry(user2Update);
         } catch (XMPPException e) {
           Log.debug("XMPP: Unable to delete roster item from group.");
         }
       }
     }
   }
   for (String group : newgroups) {
     RosterGroup newgroup = conn.getRoster().createGroup(group);
     try {
       newgroup.addEntry(user2Update);
     } catch (XMPPException e) {
       Log.debug("XMPP: Unable to add roster item to new group.");
     }
   }
 }