use of cx.ring.utils.ProfileChunk in project ring-client-android by savoirfairelinux.
the class SipCall method appendToVCard.
public boolean appendToVCard(StringMap messages) {
StringVect keys = messages.keys();
for (int i = 0, n = keys.size(); i < n; i++) {
String key = keys.get(i);
HashMap<String, String> messageKeyValue = VCardUtils.parseMimeAttributes(key);
String mimeType = messageKeyValue.get(VCardUtils.VCARD_KEY_MIME_TYPE);
if (!VCardUtils.MIME_RING_PROFILE_VCARD.equals(mimeType)) {
continue;
}
int part = Integer.parseInt(messageKeyValue.get(VCardUtils.VCARD_KEY_PART));
int nbPart = Integer.parseInt(messageKeyValue.get(VCardUtils.VCARD_KEY_OF));
if (null == mProfileChunk) {
mProfileChunk = new ProfileChunk(nbPart);
}
String content = messages.getRaw(keys.get(i)).toJavaString();
mProfileChunk.addPartAtIndex(content, part);
if (mProfileChunk.isProfileComplete()) {
if (mContact != null) {
mContact.setVCardProfile(Ezvcard.parse(mProfileChunk.getCompleteProfile()).first());
}
mProfileChunk = null;
return true;
}
}
return false;
}
Aggregations