Esempio n. 1
0
 public void removeFriend(String username) {
   Roster roster = jc.getConnection().getRoster();
   RosterEntry entry = roster.getEntry(username);
   try {
     jc.getConnection().getRoster().removeEntry(entry);
   } catch (SmackException.NotLoggedInException e) {
     e.printStackTrace();
   } catch (SmackException.NoResponseException e) {
     e.printStackTrace();
   } catch (XMPPException.XMPPErrorException e) {
     e.printStackTrace();
   } catch (SmackException.NotConnectedException e) {
     e.printStackTrace();
   }
 }
Esempio n. 2
0
  public void addFriend(String username, String nickname) {
    Roster roster = jc.getConnection().getRoster();
    try {

      roster.createEntry(username, nickname, null);
      Log.i("AddFriend:", username);
    } catch (SmackException.NotLoggedInException e) {
      e.printStackTrace();
    } catch (SmackException.NoResponseException e) {
      e.printStackTrace();
    } catch (XMPPException.XMPPErrorException e) {
      e.printStackTrace();
    } catch (SmackException.NotConnectedException e) {
      e.printStackTrace();
    }
  }