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(); } }
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(); } }
private Bitmap loadProfileImageWithVCard(String username) { Bitmap bitmap = null; Log.e(TAG, "Get pic from server"); VCard vCard = new VCard(); try { vCard.load(JabberConnection.getInstance().getConnection(), username + "@pc-pc"); byte[] bytes = vCard.getAvatar(); bitmap = BitmapUtil.getBitmapFromBytes(bytes); } catch (SmackException.NoResponseException e) { e.printStackTrace(); } catch (XMPPException.XMPPErrorException e) { e.printStackTrace(); } catch (SmackException.NotConnectedException e) { e.printStackTrace(); } return bitmap; }
private ContactPeer(Context context) { this.context = context; jc = JabberConnection.getInstance(); contactList = new HashMap<String, User>(); }