/** * @param targetUID * @return */ public String getTokenFor(String targetUID) { if (targetUID == null) { throw new NullPointerException(); } return mTable.getTokenFor(targetUID); }
/** @param sender */ public void deleteRequest(PersonInfo sender) { if (sender == null) { throw new NullPointerException(); } mTable.deleteEntryOf(sender.getIdentifier()); }
/** @param targetUID */ public void sendContactRequestTo( String targetUID, String passphrase, String displayName, Bitmap profilePic, List<String> circles) { if (targetUID == null) { throw new NullPointerException(); } String token; try { token = mTable.createEntryForSentRequest(targetUID, passphrase); } catch (GeneralSecurityException e) { Log.e(TAG, "Error encrypting token", e); return; } Log.d(TAG, "Encrypted token: " + token); if (circles != null) { for (String circle : circles) { addPersontoCircle(targetUID, circle); } } mContactDetail.saveContactDetail(targetUID, displayName, profilePic); ContactRequest message = ContactRequest.create(token); SPF.get().getPeopleManager().getPerson(targetUID).sendContactRequest(message); }
private List<PersonInfo> getRequestByStatus(int status) { ArrayList<PersonInfo> result = new ArrayList<PersonInfo>(); for (PersonAuth auth : mTable.getPersonAuthList(status)) { result.add(mContactDetail.getContactInfo(auth)); } return result; }
/** * @param fr * @param accessToken */ public void onFriendShipMessageReceived(ContactRequest fr) { if (fr == null) { throw new NullPointerException(); } if (mTable.createEntryForReceivedRequest(fr)) { mContactDetail.saveContactDetail( fr.getUserIdentifier(), fr.getDisplayName(), fr.getProfilePicture()); SPFContext.get().broadcastEvent(SPFContext.EVENT_CONTACT_REQUEST_RECEIVED); } else { Log.e(TAG, "Cannot create entry for request from " + fr.getUserIdentifier()); } }
/** * @param sender * @param circles */ public void confirmRequest(PersonInfo sender, String passphrase, List<String> circles) throws TokenCipher.WrongPassphraseException { if (sender == null || circles == null) { throw new NullPointerException(); } try { mTable.confirmRequest(sender.getIdentifier(), passphrase); } catch (GeneralSecurityException e) { Log.e(TAG, "Decypher error:", e); return; } for (String circle : circles) { addPersontoCircle(sender.getIdentifier(), circle); } }
public boolean addPersonToGroup(String identifier, String group) { return mTable.addPersonToCircle(identifier, group); }
public boolean removePersonFromGroup(PersonInfo contact, String group) { return mTable.removePersonFromCircle(contact.getIdentifier(), group); }
public boolean addPersonToGroup(PersonInfo contact, String group) { return mTable.addPersonToCircle(contact.getIdentifier(), group); }
public boolean removeGroup(String group) { return mTable.removeCircle(group); }
public boolean addGroup(String group) { return mTable.addCircle(group); }
@Deprecated public boolean addPersontoCircle(String userUID, String circle) { return mTable.addPersonToCircle(userUID, circle); }
@Deprecated public boolean removeCircle(String circle) { return mTable.removeCircle(circle); }
@Deprecated public boolean addCircle(String circle) { return mTable.addCircle(circle); }
// Circles @Deprecated public Collection<String> getCircles() { return mTable.getCircles(); }
public void deletePerson(PersonInfo person) { mTable.deleteEntryOf(person.getIdentifier()); }
@Deprecated public void deletePerson(String userUID) { mTable.deleteEntryOf(userUID); }
public boolean removePersonFromGroup(String identifier, String group) { return mTable.removePersonFromCircle(identifier, group); }
/** * @param token * @return */ public PersonAuth getPersonAuthFrom(String token) { return mTable.getPersonAuthFrom(token); }
// Groups public Collection<String> getGroups() { return mTable.getCircles(); }
@Deprecated public boolean removePersonFromCircle(String userUID, String circle) { return mTable.removePersonFromCircle(userUID, circle); }
public int getPendingRequestCount() { return mTable.getPendingRequestCount(); }