aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/entities
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-03-19 16:16:40 +0100
committerDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-03-19 16:16:40 +0100
commit6be2a08f19f07e9db5da3e644c8d62102fdd27e7 (patch)
tree88a319a2b46dd82ef5b5619605eda0cfe033f13e /src/eu/siacs/conversations/entities
parent389d4db311f22ceb787976a6c6130bb0260610bb (diff)
otr messages are now ignored if conversations isnt 100% sure the message is ours
Diffstat (limited to 'src/eu/siacs/conversations/entities')
-rw-r--r--src/eu/siacs/conversations/entities/Account.java17
-rw-r--r--src/eu/siacs/conversations/entities/Presences.java22
2 files changed, 39 insertions, 0 deletions
diff --git a/src/eu/siacs/conversations/entities/Account.java b/src/eu/siacs/conversations/entities/Account.java
index 41d94fee..3f9510b3 100644
--- a/src/eu/siacs/conversations/entities/Account.java
+++ b/src/eu/siacs/conversations/entities/Account.java
@@ -60,6 +60,7 @@ public class Account extends AbstractEntity{
transient OtrEngine otrEngine = null;
transient XmppConnection xmppConnection = null;
+ transient protected Presences presences = new Presences();
private String otrFingerprint;
@@ -249,4 +250,20 @@ public class Account extends AbstractEntity{
this.getOtrEngine(applicationContext);
return this.getOtrFingerprint();
}
+
+ public void updatePresence(String resource, int status) {
+ this.presences.updatePresence(resource, status);
+ }
+
+ public void removePresence(String resource) {
+ this.presences.removePresence(resource);
+ }
+
+ public void clearPresences() {
+ this.presences = new Presences();
+ }
+
+ public int countPresences() {
+ return this.presences.size();
+ }
}
diff --git a/src/eu/siacs/conversations/entities/Presences.java b/src/eu/siacs/conversations/entities/Presences.java
index af7926a8..9a22e559 100644
--- a/src/eu/siacs/conversations/entities/Presences.java
+++ b/src/eu/siacs/conversations/entities/Presences.java
@@ -8,6 +8,8 @@ import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import eu.siacs.conversations.xml.Element;
+
public class Presences {
public static final int CHAT = -1;
@@ -73,4 +75,24 @@ public class Presences {
}
return presences;
}
+
+ public static int parseShow(Element show) {
+ if (show == null) {
+ return Presences.ONLINE;
+ } else if (show.getContent().equals("away")) {
+ return Presences.AWAY;
+ } else if (show.getContent().equals("xa")) {
+ return Presences.XA;
+ } else if (show.getContent().equals("chat")) {
+ return Presences.CHAT;
+ } else if (show.getContent().equals("dnd")) {
+ return Presences.DND;
+ } else {
+ return Presences.OFFLINE;
+ }
+ }
+
+ public int size() {
+ return presences.size();
+ }
}