aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/entities/Contact.java
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-09-07 23:08:40 +0200
committeriNPUTmice <daniel@gultsch.de>2014-09-07 23:08:40 +0200
commit449c2a544b48a2b9adf0df094eb1ac0d49531ebe (patch)
tree958a9c6421028e08d7ae84059d0b26bc0ed39ed0 /src/eu/siacs/conversations/entities/Contact.java
parent90947597e5a89e2adc6c75d52c8458ee153ee163 (diff)
fixed #321 - delete otr fingerprints
Diffstat (limited to 'src/eu/siacs/conversations/entities/Contact.java')
-rw-r--r--src/eu/siacs/conversations/entities/Contact.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/eu/siacs/conversations/entities/Contact.java b/src/eu/siacs/conversations/entities/Contact.java
index 8a6fd99c..dfd6c059 100644
--- a/src/eu/siacs/conversations/entities/Contact.java
+++ b/src/eu/siacs/conversations/entities/Contact.java
@@ -351,4 +351,26 @@ public class Contact implements ListItem {
return true;
}
}
+
+ public boolean deleteOtrFingerprint(String fingerprint) {
+ boolean success = false;
+ try {
+ if (this.keys.has("otr_fingerprints")) {
+ JSONArray newPrints = new JSONArray();
+ JSONArray oldPrints = this.keys
+ .getJSONArray("otr_fingerprints");
+ for (int i = 0; i < oldPrints.length(); ++i) {
+ if (!oldPrints.getString(i).equals(fingerprint)) {
+ newPrints.put(oldPrints.getString(i));
+ } else {
+ success = true;
+ }
+ }
+ this.keys.put("otr_fingerprints", newPrints);
+ }
+ return success;
+ } catch (JSONException e) {
+ return false;
+ }
+ }
}