diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2015-11-24 06:52:24 +0100 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2015-11-24 06:52:24 +0100 |
commit | fbb7cb99f72a7941a65759f0c4a1b2aa9e6a04db (patch) | |
tree | d74428a4dd3e5df647e6e24f77dbaa97c773a97a /src/main/java/eu/siacs/conversations/entities/Account.java | |
parent | 8a1c4fe69ea1095ceef306554c7d5686796cccdb (diff) | |
parent | c7a519498a88235488bb3a35d6220c64f7d88d0a (diff) |
Merge pull request #1558 from fiaxh/pgp_api_9.0
Use OpenPGP-API 9.0
Diffstat (limited to '')
-rw-r--r-- | src/main/java/eu/siacs/conversations/entities/Account.java | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/Account.java b/src/main/java/eu/siacs/conversations/entities/Account.java index fbee5b8a0..abf0a2a52 100644 --- a/src/main/java/eu/siacs/conversations/entities/Account.java +++ b/src/main/java/eu/siacs/conversations/entities/Account.java @@ -127,6 +127,10 @@ public class Account extends AbstractEntity { public List<Conversation> pendingConferenceJoins = new CopyOnWriteArrayList<>(); public List<Conversation> pendingConferenceLeaves = new CopyOnWriteArrayList<>(); + + private static final String KEY_PGP_SIGNATURE = "pgp_signature"; + private static final String KEY_PGP_ID = "pgp_id"; + protected Jid jid; protected String password; protected int options = 0; @@ -371,9 +375,9 @@ public class Account extends AbstractEntity { } public String getPgpSignature() { - if (keys.has("pgp_signature")) { + if (keys.has(KEY_PGP_SIGNATURE)) { try { - return keys.getString("pgp_signature"); + return keys.getString(KEY_PGP_SIGNATURE); } catch (final JSONException e) { return null; } @@ -382,6 +386,36 @@ public class Account extends AbstractEntity { } } + public boolean setPgpSignature(String signature) { + try { + keys.put(KEY_PGP_SIGNATURE, signature); + } catch (JSONException e) { + return false; + } + return true; + } + + public long getPgpId() { + if (keys.has(KEY_PGP_ID)) { + try { + return keys.getLong(KEY_PGP_ID); + } catch (JSONException e) { + return -1; + } + } else { + return -1; + } + } + + public boolean setPgpSignId(long pgpID) { + try { + keys.put(KEY_PGP_ID, pgpID); + } catch (JSONException e) { + return false; + } + return true; + } + public Roster getRoster() { return this.roster; } |