Search in sources :

Example 11 with Conversation

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

the class ConversationFacade method parseHistoryCalls.

private void parseHistoryCalls(List<HistoryCall> historyCalls, boolean acceptAllMessages) {
    for (HistoryCall call : historyCalls) {
        CallContact contact = mContactService.findContact(call.getContactID(), call.getContactKey(), new Uri(call.getNumber()));
        String key = contact.getIds().get(0);
        String phone = contact.getPhones().get(0).getNumber().getRawUriString();
        if (mConversationMap.containsKey(key) || mConversationMap.containsKey(phone)) {
            mConversationMap.get(key).addHistoryCall(call);
        } else if (acceptAllMessages) {
            Conversation conversation = new Conversation(contact);
            conversation.addHistoryCall(call);
            mConversationMap.put(key, conversation);
        }
    }
}
Also used : Conversation(cx.ring.model.Conversation) Uri(cx.ring.model.Uri) CallContact(cx.ring.model.CallContact) HistoryCall(cx.ring.model.HistoryCall)

Example 12 with Conversation

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

the class ConversationFacade method startConversation.

/**
 * @return the started new conversation
 */
public Conversation startConversation(CallContact contact) {
    Conversation conversation = getConversationByContact(contact);
    if (conversation == null) {
        conversation = new Conversation(contact);
        mConversationMap.put(contact.getIds().get(0), conversation);
        Account account = mAccountService.getCurrentAccount();
        if (account != null && account.isRing()) {
            Uri number = contact.getPhones().get(0).getNumber();
            if (number.isRingId()) {
                mAccountService.lookupAddress(account.getAccountID(), "", number.getRawRingId());
            }
        }
        setChanged();
        ServiceEvent event = new ServiceEvent(ServiceEvent.EventType.CONVERSATIONS_CHANGED);
        notifyObservers(event);
        updateTextNotifications();
    }
    return conversation;
}
Also used : Account(cx.ring.model.Account) ServiceEvent(cx.ring.model.ServiceEvent) Conversation(cx.ring.model.Conversation) Uri(cx.ring.model.Uri)

Aggregations

Conversation (cx.ring.model.Conversation)12 CallContact (cx.ring.model.CallContact)8 Uri (cx.ring.model.Uri)5 Account (cx.ring.model.Account)4 HistoryText (cx.ring.model.HistoryText)3 ServiceEvent (cx.ring.model.ServiceEvent)3 TextMessage (cx.ring.model.TextMessage)3 Conference (cx.ring.model.Conference)2 DataTransfer (cx.ring.model.DataTransfer)2 HistoryCall (cx.ring.model.HistoryCall)2 SecureSipCall (cx.ring.model.SecureSipCall)2 SipCall (cx.ring.model.SipCall)2 ArrayList (java.util.ArrayList)2 Intent (android.content.Intent)1 DataTransferEventCode (cx.ring.model.DataTransferEventCode)1 AccountService (cx.ring.services.AccountService)1 CallService (cx.ring.services.CallService)1 ContactService (cx.ring.services.ContactService)1 HistoryService (cx.ring.services.HistoryService)1 File (java.io.File)1