use of eu.siacs.conversations.entities.Contact in project Conversations by siacs.
the class VerifyOTRActivity method verifyWithUri.
protected boolean verifyWithUri(XmppUri uri) {
Contact contact = mConversation.getContact();
if (this.mConversation.getContact().getJid().equals(uri.getJid()) && uri.hasFingerprints()) {
xmppConnectionService.verifyFingerprints(contact, uri.getFingerprints());
Toast.makeText(this, R.string.verified, Toast.LENGTH_SHORT).show();
updateView();
return true;
} else {
Toast.makeText(this, R.string.could_not_verify_fingerprint, Toast.LENGTH_SHORT).show();
return false;
}
}
use of eu.siacs.conversations.entities.Contact in project Conversations by siacs.
the class XmppActivity method selectPresence.
public void selectPresence(final Conversation conversation, final OnPresenceSelected listener) {
final Contact contact = conversation.getContact();
if (conversation.hasValidOtrSession()) {
SessionID id = conversation.getOtrSession().getSessionID();
Jid jid;
try {
jid = Jid.fromString(id.getAccountID() + "/" + id.getUserID());
} catch (InvalidJidException e) {
jid = null;
}
conversation.setNextCounterpart(jid);
listener.onPresenceSelected();
} else if (!contact.showInRoster()) {
showAddToRosterDialog(conversation);
} else {
final Presences presences = contact.getPresences();
if (presences.size() == 0) {
if (!contact.getOption(Contact.Options.TO) && !contact.getOption(Contact.Options.ASKING) && contact.getAccount().getStatus() == Account.State.ONLINE) {
showAskForPresenceDialog(contact);
} else if (!contact.getOption(Contact.Options.TO) || !contact.getOption(Contact.Options.FROM)) {
warnMutalPresenceSubscription(conversation, listener);
} else {
conversation.setNextCounterpart(null);
listener.onPresenceSelected();
}
} else if (presences.size() == 1) {
String presence = presences.toResourceArray()[0];
try {
conversation.setNextCounterpart(Jid.fromParts(contact.getJid().getLocalpart(), contact.getJid().getDomainpart(), presence));
} catch (InvalidJidException e) {
conversation.setNextCounterpart(null);
}
listener.onPresenceSelected();
} else {
showPresenceSelectionDialog(presences, conversation, listener);
}
}
}
Aggregations