diff options
Diffstat (limited to '')
-rw-r--r-- | src/de/gultsch/chat/entities/Account.java | 9 | ||||
-rw-r--r-- | src/de/gultsch/chat/entities/Contact.java | 20 | ||||
-rw-r--r-- | src/de/gultsch/chat/entities/Message.java | 6 |
3 files changed, 32 insertions, 3 deletions
diff --git a/src/de/gultsch/chat/entities/Account.java b/src/de/gultsch/chat/entities/Account.java index 3ffc75f9..c8f6d063 100644 --- a/src/de/gultsch/chat/entities/Account.java +++ b/src/de/gultsch/chat/entities/Account.java @@ -137,8 +137,13 @@ public class Account extends AbstractEntity{ return keys; } - public void setKey(String keyName, String keyValue) throws JSONException { - this.keys.put(keyName, keyValue); + public boolean setKey(String keyName, String keyValue) { + try { + this.keys.put(keyName, keyValue); + return true; + } catch (JSONException e) { + return false; + } } @Override diff --git a/src/de/gultsch/chat/entities/Contact.java b/src/de/gultsch/chat/entities/Contact.java index a0dbf22f..a8c9fa62 100644 --- a/src/de/gultsch/chat/entities/Contact.java +++ b/src/de/gultsch/chat/entities/Contact.java @@ -221,6 +221,26 @@ public class Contact extends AbstractEntity implements Serializable { } } + public void setPgpKeyId(long keyId) { + try { + this.keys.put("pgp_keyid", keyId); + } catch (JSONException e) { + + } + } + + public long getPgpKeyId() { + if (this.keys.has("pgp_keyid")) { + try { + return this.keys.getLong("pgp_keyid"); + } catch (JSONException e) { + return 0; + } + } else { + return 0; + } + } + public void setSubscriptionOption(int option) { this.subscription |= 1 << option; } diff --git a/src/de/gultsch/chat/entities/Message.java b/src/de/gultsch/chat/entities/Message.java index 9b308c75..58e4ef63 100644 --- a/src/de/gultsch/chat/entities/Message.java +++ b/src/de/gultsch/chat/entities/Message.java @@ -17,6 +17,7 @@ public class Message extends AbstractEntity { public static final int ENCRYPTION_NONE = 0; public static final int ENCRYPTION_PGP = 1; public static final int ENCRYPTION_OTR = 2; + public static final int ENCRYPTION_DECRYPTED = 3; public static String CONVERSATION = "conversationUuid"; public static String COUNTERPART = "counterpart"; @@ -136,5 +137,8 @@ public class Message extends AbstractEntity { public void setEncryption(int encryption) { this.encryption = encryption; } - + + public void setBody(String body) { + this.body = body; + } } |