use of cx.ring.model.Uri in project ring-client-android by savoirfairelinux.
the class HistoryService method incomingMessage.
public void incomingMessage(String accountId, String callId, String from, StringMap messages) {
String msg = null;
final String textPlainMime = "text/plain";
if (null != messages && messages.has_key(textPlainMime)) {
msg = messages.getRaw(textPlainMime).toJavaString();
}
if (msg == null) {
return;
}
if (!from.contains(CallContact.PREFIX_RING)) {
from = CallContact.PREFIX_RING + from;
}
TextMessage txt = new TextMessage(true, msg, new Uri(from), callId, accountId);
Log.w(TAG, "New text messsage " + txt.getAccount() + " " + txt.getCallId() + " " + txt.getMessage());
insertNewTextMessage(txt);
ServiceEvent event = new ServiceEvent(ServiceEvent.EventType.INCOMING_MESSAGE);
event.addEventInput(ServiceEvent.EventInput.MESSAGE, txt);
setChanged();
notifyObservers(event);
}
use of cx.ring.model.Uri in project ring-client-android by savoirfairelinux.
the class CallService method addCall.
private SipCall addCall(String accountId, String callId, String from, int direction) {
SipCall call = currentCalls.get(callId);
if (call == null) {
call = new SipCall(callId, accountId, new Uri(from), direction);
currentCalls.put(callId, call);
} else {
Log.w(TAG, "Call already existed ! " + callId + " " + from);
}
return call;
}
use of cx.ring.model.Uri in project ring-client-android by savoirfairelinux.
the class SmartListPresenter method parseEventState.
private void parseEventState(String name, String address, int state) {
switch(state) {
case 0:
// on found
if (mLastBlockchainQuery != null && mLastBlockchainQuery.equals(name)) {
mCallContact = CallContact.buildRingContact(new Uri(address), name);
getView().displayContact(mCallContact);
mLastBlockchainQuery = null;
} else {
if (("").equals(name) || ("").equals(address)) {
return;
}
getView().hideSearchRow();
updateContactName(name, address);
}
break;
case 1:
// invalid name
Uri uriName = new Uri(name);
if (uriName.isRingId() && mLastBlockchainQuery != null && mLastBlockchainQuery.equals(name)) {
mCallContact = CallContact.buildUnknown(name, address);
getView().displayContact(mCallContact);
} else {
getView().hideSearchRow();
}
break;
default:
// on error
Uri uriAddress = new Uri(address);
if (uriAddress.isRingId() && mLastBlockchainQuery != null && mLastBlockchainQuery.equals(name)) {
mCallContact = CallContact.buildUnknown(name, address);
getView().displayContact(mCallContact);
} else {
getView().hideSearchRow();
}
break;
}
getView().setLoading(false);
}
use of cx.ring.model.Uri in project ring-client-android by savoirfairelinux.
the class SmartListPresenter method deleteConversation.
public void deleteConversation(SmartListViewModel smartListViewModel) {
CallContact callContact = mContactService.getContact(new Uri(smartListViewModel.getUuid()));
getView().displayDeleteDialog(callContact);
}
use of cx.ring.model.Uri in project ring-client-android by savoirfairelinux.
the class SmartListPresenter method copyNumber.
public void copyNumber(SmartListViewModel smartListViewModel) {
CallContact callContact = mContactService.getContact(new Uri(smartListViewModel.getUuid()));
getView().copyNumber(callContact);
}
Aggregations