diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-06-13 13:32:14 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2016-06-14 21:27:06 +0200 |
commit | 3e748bc49a25c2700e6929286f7041e9c571d7f3 (patch) | |
tree | a965a4b18ddebf614ce4f7ef525124fcd336e200 /src/main/java/eu/siacs/conversations/entities/Account.java | |
parent | dd3b9084af4483d6c1d27313d0d582b4e502fb00 (diff) |
refactored pgp decryption
Diffstat (limited to '')
-rw-r--r-- | src/main/java/eu/siacs/conversations/entities/Account.java | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/Account.java b/src/main/java/eu/siacs/conversations/entities/Account.java index dec3bd1a4..33304f5c7 100644 --- a/src/main/java/eu/siacs/conversations/entities/Account.java +++ b/src/main/java/eu/siacs/conversations/entities/Account.java @@ -5,6 +5,8 @@ import android.database.Cursor; import android.os.SystemClock; import android.util.Pair; +import eu.siacs.conversations.crypto.PgpDecryptionService; + import net.java.otr4j.crypto.OtrCryptoEngineImpl; import net.java.otr4j.crypto.OtrCryptoException; @@ -19,7 +21,6 @@ import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArraySet; -import eu.siacs.conversations.Config; import eu.siacs.conversations.R; import eu.siacs.conversations.crypto.OtrService; import eu.siacs.conversations.crypto.PgpDecryptionService; @@ -83,6 +84,14 @@ public class Account extends AbstractEntity { return getRoster().getContact(jid); } + public boolean hasPendingPgpIntent(Conversation conversation) { + return pgpDecryptionService != null && pgpDecryptionService.hasPendingIntent(conversation); + } + + public boolean isPgpDecryptionServiceConnected() { + return pgpDecryptionService != null && pgpDecryptionService.isConnected(); + } + public enum State { DISABLED, OFFLINE, @@ -398,10 +407,10 @@ public class Account extends AbstractEntity { public void initAccountServices(final XmppConnectionService context) { this.mOtrService = new OtrService(context, this); this.axolotlService = new AxolotlService(this, context); + this.pgpDecryptionService = new PgpDecryptionService(context); if (xmppConnection != null) { xmppConnection.addOnAdvancedStreamFeaturesAvailableListener(axolotlService); } - this.pgpDecryptionService = new PgpDecryptionService(context); } public OtrService getOtrService() { @@ -409,7 +418,7 @@ public class Account extends AbstractEntity { } public PgpDecryptionService getPgpDecryptionService() { - return pgpDecryptionService; + return this.pgpDecryptionService; } public XmppConnection getXmppConnection() { |