use of de.pixart.messenger.crypto.axolotl.AxolotlService in project Pix-Art-Messenger by kriztan.
the class XmppConnectionService method verifyFingerprints.
public boolean verifyFingerprints(Contact contact, List<XmppUri.Fingerprint> fingerprints) {
boolean needsRosterWrite = false;
boolean performedVerification = false;
final AxolotlService axolotlService = contact.getAccount().getAxolotlService();
for (XmppUri.Fingerprint fp : fingerprints) {
if (fp.type == XmppUri.FingerprintType.OTR) {
performedVerification |= contact.addOtrFingerprint(fp.fingerprint);
needsRosterWrite |= performedVerification;
} else if (fp.type == XmppUri.FingerprintType.OMEMO) {
String fingerprint = "05" + fp.fingerprint.replaceAll("\\s", "");
FingerprintStatus fingerprintStatus = axolotlService.getFingerprintTrust(fingerprint);
if (fingerprintStatus != null) {
if (!fingerprintStatus.isVerified()) {
performedVerification = true;
axolotlService.setFingerprintTrust(fingerprint, fingerprintStatus.toVerified());
}
} else {
axolotlService.preVerifyFingerprint(contact, fingerprint);
}
}
}
if (needsRosterWrite) {
syncRosterToDisk(contact.getAccount());
}
return performedVerification;
}
use of de.pixart.messenger.crypto.axolotl.AxolotlService in project Pix-Art-Messenger by kriztan.
the class XmppConnectionService method reconnectAccount.
private void reconnectAccount(final Account account, final boolean force, final boolean interactive) {
synchronized (account) {
XmppConnection connection = account.getXmppConnection();
if (connection == null) {
connection = createConnection(account);
account.setXmppConnection(connection);
}
boolean hasInternet = hasInternetConnection();
if (account.isEnabled() && hasInternet) {
if (!force) {
disconnect(account, false);
}
Thread thread = new Thread(connection);
connection.setInteractive(interactive);
connection.prepareNewConnection();
connection.interrupt();
thread.start();
scheduleWakeUpCall(Config.CONNECT_DISCO_TIMEOUT, account.getUuid().hashCode());
} else {
disconnect(account, force || account.getTrueStatus().isError() || !hasInternet);
account.getRoster().clearPresences();
connection.resetEverything();
final AxolotlService axolotlService = account.getAxolotlService();
if (axolotlService != null) {
axolotlService.resetBrokenness();
}
if (!hasInternet) {
account.setStatus(Account.State.NO_INTERNET);
}
}
}
}
Aggregations