Search in sources :

Example 21 with Account

use of cx.ring.model.Account in project ring-client-android by savoirfairelinux.

the class BlackListPresenter method updateList.

public void updateList() {
    if (getView() == null) {
        return;
    }
    Account account = mAccountService.getAccount(mAccountID);
    if (account == null) {
        return;
    }
    List<CallContact> list = account.getBannedContacts();
    if (list.isEmpty()) {
        getView().hideListView();
        getView().displayEmptyListMessage(true);
    } else {
        getView().updateView(list);
        getView().displayEmptyListMessage(false);
    }
}
Also used : Account(cx.ring.model.Account) CallContact(cx.ring.model.CallContact)

Example 22 with Account

use of cx.ring.model.Account in project ring-client-android by savoirfairelinux.

the class GeneralAccountPresenter method init.

// Init with current account
public void init() {
    Account currentAccount = mAccountService.getCurrentAccount();
    if (currentAccount == null) {
        Log.e(TAG, "init: No currentAccount available");
        return;
    }
    init(currentAccount.getAccountID());
}
Also used : Account(cx.ring.model.Account)

Example 23 with Account

use of cx.ring.model.Account 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)

Example 24 with Account

use of cx.ring.model.Account in project ring-client-android by savoirfairelinux.

the class AccountService method registrationStateChanged.

public void registrationStateChanged(String accountId, String newState, int code, String detailString) {
    Log.d(TAG, "stun status registrationStateChanged: " + accountId + ", " + newState + ", " + code + ", " + detailString);
    Account account = getAccount(accountId);
    if (account == null) {
        return;
    }
    String oldState = account.getRegistrationState();
    if (oldState.contentEquals(AccountConfig.STATE_INITIALIZING) && !newState.contentEquals(AccountConfig.STATE_INITIALIZING)) {
        account.setDetails(getAccountDetails(account.getAccountID()));
        account.setCredentials(getCredentials(account.getAccountID()));
        account.setDevices(getKnownRingDevices(account.getAccountID()));
        account.setVolatileDetails(getVolatileAccountDetails(account.getAccountID()));
    } else {
        account.setRegistrationState(newState, code);
    }
    if (!oldState.equals(newState)) {
        setChanged();
        ServiceEvent event = new ServiceEvent(ServiceEvent.EventType.REGISTRATION_STATE_CHANGED);
        event.addEventInput(ServiceEvent.EventInput.ACCOUNT_ID, accountId);
        event.addEventInput(ServiceEvent.EventInput.STATE, newState);
        event.addEventInput(ServiceEvent.EventInput.DETAIL_CODE, code);
        event.addEventInput(ServiceEvent.EventInput.DETAIL_STRING, detailString);
        notifyObservers(event);
    }
}
Also used : Account(cx.ring.model.Account) ServiceEvent(cx.ring.model.ServiceEvent)

Example 25 with Account

use of cx.ring.model.Account in project ring-client-android by savoirfairelinux.

the class AccountService method registeredNameFound.

public void registeredNameFound(String accountId, int state, String address, String name) {
    Log.d(TAG, "registeredNameFound: " + accountId + ", " + state + ", " + name + ", " + address);
    Account account = getAccount(accountId);
    if (account != null) {
        if (state == 0) {
            CallContact contact = account.getContact(address);
            if (contact != null) {
                contact.setUsername(name);
            }
        }
        TrustRequest request = account.getRequest(address);
        if (request != null) {
            Log.d(TAG, "registeredNameFound: updating TrustRequest " + name);
            boolean resolved = request.isNameResolved();
            request.setUsername(name);
            if (!resolved) {
                Log.d(TAG, "registeredNameFound: TrustRequest resolved " + name);
                setChanged();
                ServiceEvent event = new ServiceEvent(ServiceEvent.EventType.INCOMING_TRUST_REQUEST);
                event.addEventInput(ServiceEvent.EventInput.ACCOUNT_ID, accountId);
                event.addEventInput(ServiceEvent.EventInput.FROM, request.getContactId());
                notifyObservers(event);
            }
        }
    }
    setChanged();
    ServiceEvent event = new ServiceEvent(ServiceEvent.EventType.REGISTERED_NAME_FOUND);
    event.addEventInput(ServiceEvent.EventInput.ACCOUNT_ID, accountId);
    event.addEventInput(ServiceEvent.EventInput.STATE, state);
    event.addEventInput(ServiceEvent.EventInput.ADDRESS, address);
    event.addEventInput(ServiceEvent.EventInput.NAME, name);
    notifyObservers(event);
}
Also used : Account(cx.ring.model.Account) ServiceEvent(cx.ring.model.ServiceEvent) TrustRequest(cx.ring.model.TrustRequest) CallContact(cx.ring.model.CallContact)

Aggregations

Account (cx.ring.model.Account)39 ServiceEvent (cx.ring.model.ServiceEvent)13 CallContact (cx.ring.model.CallContact)7 Uri (cx.ring.model.Uri)6 StringMap (cx.ring.daemon.StringMap)5 ArrayList (java.util.ArrayList)5 Conversation (cx.ring.model.Conversation)4 TrustRequest (cx.ring.model.TrustRequest)4 HashMap (java.util.HashMap)3 List (java.util.List)3 Map (java.util.Map)3 Conference (cx.ring.model.Conference)2 SecureSipCall (cx.ring.model.SecureSipCall)2 SipCall (cx.ring.model.SipCall)2 NameLookupInputHandler (cx.ring.utils.NameLookupInputHandler)2 Drawable (android.graphics.drawable.Drawable)1 LayoutInflater (android.view.LayoutInflater)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1