aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/entities
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-09-06 18:21:31 +0200
committeriNPUTmice <daniel@gultsch.de>2014-09-06 18:21:31 +0200
commit0e5a0a07fd32d185d2d4c43df9494fafcace9208 (patch)
treee51be0fc1b2cf156327274a66589f2709c9f1e09 /src/eu/siacs/conversations/entities
parentdc0213710640911a796880fcd68a75d2b576918d (diff)
made otr a little bit more solid when there is no presence subscription
Diffstat (limited to 'src/eu/siacs/conversations/entities')
-rw-r--r--src/eu/siacs/conversations/entities/Account.java7
-rw-r--r--src/eu/siacs/conversations/entities/Conversation.java15
2 files changed, 12 insertions, 10 deletions
diff --git a/src/eu/siacs/conversations/entities/Account.java b/src/eu/siacs/conversations/entities/Account.java
index 272cf3797..eacd172c6 100644
--- a/src/eu/siacs/conversations/entities/Account.java
+++ b/src/eu/siacs/conversations/entities/Account.java
@@ -14,6 +14,7 @@ import org.json.JSONObject;
import eu.siacs.conversations.R;
import eu.siacs.conversations.crypto.OtrEngine;
import eu.siacs.conversations.persistance.FileBackend;
+import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.utils.UIHelper;
import eu.siacs.conversations.xmpp.XmppConnection;
import android.content.ContentValues;
@@ -230,7 +231,7 @@ public class Account extends AbstractEntity {
cursor.getString(cursor.getColumnIndex(AVATAR)));
}
- public OtrEngine getOtrEngine(Context context) {
+ public OtrEngine getOtrEngine(XmppConnectionService context) {
if (otrEngine == null) {
otrEngine = new OtrEngine(context, this);
}
@@ -283,8 +284,8 @@ public class Account extends AbstractEntity {
this.rosterVersion = version;
}
- public String getOtrFingerprint(Context applicationContext) {
- this.getOtrEngine(applicationContext);
+ public String getOtrFingerprint(XmppConnectionService service) {
+ this.getOtrEngine(service);
return this.getOtrFingerprint();
}
diff --git a/src/eu/siacs/conversations/entities/Conversation.java b/src/eu/siacs/conversations/entities/Conversation.java
index 2097b2a45..9f7ba3aaa 100644
--- a/src/eu/siacs/conversations/entities/Conversation.java
+++ b/src/eu/siacs/conversations/entities/Conversation.java
@@ -4,6 +4,7 @@ import java.security.interfaces.DSAPublicKey;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
+import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.utils.UIHelper;
import net.java.otr4j.OtrException;
@@ -43,7 +44,7 @@ public class Conversation extends AbstractEntity {
private int status;
private long created;
private int mode;
-
+
private long mutedTill = 0;
private String nextPresence;
@@ -223,15 +224,15 @@ public class Conversation extends AbstractEntity {
this.mode = mode;
}
- public SessionImpl startOtrSession(Context context, String presence,
- boolean sendStart) {
+ public SessionImpl startOtrSession(XmppConnectionService service,
+ String presence, boolean sendStart) {
if (this.otrSession != null) {
return this.otrSession;
} else {
- SessionID sessionId = new SessionID(this.getContactJid(), presence,
- "xmpp");
+ SessionID sessionId = new SessionID(
+ this.getContactJid().split("/")[0], presence, "xmpp");
this.otrSession = new SessionImpl(sessionId, getAccount()
- .getOtrEngine(context));
+ .getOtrEngine(service));
try {
if (sendStart) {
this.otrSession.startSession();
@@ -425,7 +426,7 @@ public class Conversation extends AbstractEntity {
public void setMutedTill(long mutedTill) {
this.mutedTill = mutedTill;
}
-
+
public boolean isMuted() {
return SystemClock.elapsedRealtime() < this.mutedTill;
}