aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus/crypto
diff options
context:
space:
mode:
authorsteckbrief <steckbrief@chefmail.de>2016-04-18 19:58:40 +0200
committersteckbrief <steckbrief@chefmail.de>2016-04-18 19:58:40 +0200
commitee0264d98c9a348ea29d12796bed25f9ba1494fb (patch)
treecc559348547e504d37a6efa7826ea0120070babe /src/main/java/de/thedevstack/conversationsplus/crypto
parentd94eb9309b4ab3ee1dfd3cee637b47a52223e15b (diff)
parent7df96caedbbb96a28d4f7e07fa2d159c8ca1373f (diff)
Merge branch 'master' into introduce_cplus_database_version
Conflicts: gradle/wrapper/gradle-wrapper.properties src/main/res/values/strings.xml
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/crypto')
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/AxolotlService.java2
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/AxolotlServiceImpl.java17
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/AxolotlServiceStub.java5
3 files changed, 20 insertions, 4 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/AxolotlService.java b/src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/AxolotlService.java
index 49cd6033..52418553 100644
--- a/src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/AxolotlService.java
+++ b/src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/AxolotlService.java
@@ -115,4 +115,6 @@ public interface AxolotlService extends OnAdvancedStreamFeaturesLoaded {
boolean hasPendingKeyFetches(Account account, List<Jid> jids);
void prepareKeyTransportMessage(Conversation conversation, OnMessageCreatedCallback onMessageCreatedCallback);
+
+ void resetBrokenness();
}
diff --git a/src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/AxolotlServiceImpl.java b/src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/AxolotlServiceImpl.java
index 2463a795..f8856f90 100644
--- a/src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/AxolotlServiceImpl.java
+++ b/src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/AxolotlServiceImpl.java
@@ -43,12 +43,13 @@ import de.thedevstack.conversationsplus.services.XmppConnectionService;
import de.thedevstack.conversationsplus.utils.CryptoHelper;
import de.thedevstack.conversationsplus.utils.SerialSingleThreadExecutor;
import de.thedevstack.conversationsplus.xml.Element;
+import de.thedevstack.conversationsplus.xmpp.OnAdvancedStreamFeaturesLoaded;
import de.thedevstack.conversationsplus.xmpp.OnIqPacketReceived;
import de.thedevstack.conversationsplus.xmpp.jid.InvalidJidException;
import de.thedevstack.conversationsplus.xmpp.jid.Jid;
import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket;
-public class AxolotlServiceImpl implements AxolotlService {
+public class AxolotlServiceImpl implements OnAdvancedStreamFeaturesLoaded, AxolotlService {
public static final int publishTriesThreshold = 3;
@@ -223,6 +224,7 @@ public class AxolotlServiceImpl implements AxolotlService {
return axolotlStore.getIdentityKeyPair().getPublicKey().getFingerprint().replaceAll("\\s", "");
}
+ @Override
public Set<IdentityKey> getKeysWithTrust(XmppAxolotlSession.Trust trust) {
return axolotlStore.getContactKeysWithTrust(account.getJid().toBareJid().toString(), trust);
}
@@ -302,6 +304,11 @@ public class AxolotlServiceImpl implements AxolotlService {
return this.pepBroken;
}
+ public void resetBrokenness() {
+ this.pepBroken = false;
+ numPublishTriesOnEmptyPep = 0;
+ }
+
public void regenerateKeys(boolean wipeOther) {
axolotlStore.regenerate();
sessions.clear();
@@ -436,7 +443,8 @@ public class AxolotlServiceImpl implements AxolotlService {
mXmppConnectionService.sendIqPacket(account, publish, new OnIqPacketReceived() {
@Override
public void onIqPacketReceived(Account account, IqPacket packet) {
- if (packet.getType() != IqPacket.TYPE.RESULT) {
+ if (packet.getType() == IqPacket.TYPE.ERROR) {
+ pepBroken = true;
Log.d(Config.LOGTAG, getLogprefix(account) + "Error received while publishing own device id" + packet.findChild("error"));
}
}
@@ -600,7 +608,8 @@ public class AxolotlServiceImpl implements AxolotlService {
Log.d(Config.LOGTAG, getLogprefix(account) + "Announcing device " + getOwnDeviceId());
publishOwnDeviceIdIfNeeded();
}
- } else {
+ } else if (packet.getType() == IqPacket.TYPE.ERROR) {
+ pepBroken = true;
Log.d(Config.LOGTAG, getLogprefix(account) + "Error received while publishing bundle: " + packet.findChild("error"));
}
}
@@ -1037,4 +1046,4 @@ public class AxolotlServiceImpl implements AxolotlService {
}
}
}
-} \ No newline at end of file
+}
diff --git a/src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/AxolotlServiceStub.java b/src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/AxolotlServiceStub.java
index 858cdf08..7db99b75 100644
--- a/src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/AxolotlServiceStub.java
+++ b/src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/AxolotlServiceStub.java
@@ -204,4 +204,9 @@ public class AxolotlServiceStub implements AxolotlService {
public void onAdvancedStreamFeaturesAvailable(Account account) {
}
+
+ @Override
+ public void resetBrokenness() {
+
+ }
}