Search in sources :

Example 1 with StringVect

use of cx.ring.daemon.StringVect 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;
}
Also used : ProfileChunk(cx.ring.utils.ProfileChunk) StringVect(cx.ring.daemon.StringVect)

Example 2 with StringVect

use of cx.ring.daemon.StringVect in project ring-client-android by savoirfairelinux.

the class AccountService method setAccountsActive.

/**
 * Sets the activation state of all the accounts in the Daemon
 */
public void setAccountsActive(final boolean active, final boolean allowProxy) {
    FutureUtils.executeDaemonThreadCallable(mExecutor, mDeviceRuntimeService.provideDaemonThreadId(), false, () -> {
        Log.i(TAG, "setAccountsActive() thread running... " + active);
        StringVect list = Ringservice.getAccountList();
        for (int i = 0, n = list.size(); i < n; i++) {
            String accountId = list.get(i);
            Account a = getAccount(accountId);
            if (!allowProxy || active || a == null || !a.isDhtProxyEnabled()) {
                Ringservice.setAccountActive(accountId, active);
            }
        }
        return true;
    });
}
Also used : Account(cx.ring.model.Account) StringVect(cx.ring.daemon.StringVect)

Aggregations

StringVect (cx.ring.daemon.StringVect)2 Account (cx.ring.model.Account)1 ProfileChunk (cx.ring.utils.ProfileChunk)1