diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2014-09-28 15:21:56 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2014-09-28 15:21:56 +0200 |
commit | bff23c2e232e8f9a4e64553215130079b7fc5a4f (patch) | |
tree | fec9608b615334ff065399b03fb747c4a7bf4d94 /src/eu/siacs/conversations/entities | |
parent | 1ae9338fc9d5f8e1f6505445f07f4476efd8f139 (diff) |
new notification service. first draft
Diffstat (limited to 'src/eu/siacs/conversations/entities')
-rw-r--r-- | src/eu/siacs/conversations/entities/Conversation.java | 22 | ||||
-rw-r--r-- | src/eu/siacs/conversations/entities/MucOptions.java | 14 |
2 files changed, 19 insertions, 17 deletions
diff --git a/src/eu/siacs/conversations/entities/Conversation.java b/src/eu/siacs/conversations/entities/Conversation.java index b8d375860..fedb0893a 100644 --- a/src/eu/siacs/conversations/entities/Conversation.java +++ b/src/eu/siacs/conversations/entities/Conversation.java @@ -40,7 +40,7 @@ public class Conversation extends AbstractEntity { public static final String CREATED = "created"; public static final String MODE = "mode"; public static final String ATTRIBUTES = "attributes"; - + public static final String ATTRIBUTE_NEXT_ENCRYPTION = "next_encryption"; public static final String ATTRIBUTE_MUC_PASSWORD = "muc_password"; @@ -51,7 +51,7 @@ public class Conversation extends AbstractEntity { private int status; private long created; private int mode; - + private JSONObject attributes = new JSONObject(); private long mutedTill = 0; @@ -81,7 +81,7 @@ public class Conversation extends AbstractEntity { int mode) { this(java.util.UUID.randomUUID().toString(), name, null, account .getUuid(), contactJid, System.currentTimeMillis(), - STATUS_AVAILABLE, mode,""); + STATUS_AVAILABLE, mode, ""); this.account = account; } @@ -97,7 +97,7 @@ public class Conversation extends AbstractEntity { this.status = status; this.mode = mode; try { - if (attributes==null) { + if (attributes == null) { attributes = new String(); } this.attributes = new JSONObject(attributes); @@ -214,7 +214,7 @@ public class Conversation extends AbstractEntity { values.put(CREATED, created); values.put(STATUS, status); values.put(MODE, mode); - values.put(ATTRIBUTES,attributes.toString()); + values.put(ATTRIBUTES, attributes.toString()); return values; } @@ -247,8 +247,8 @@ public class Conversation extends AbstractEntity { if (this.otrSession != null) { return this.otrSession; } else { - SessionID sessionId = new SessionID( - this.getContactJid().split("/",2)[0], presence, "xmpp"); + SessionID sessionId = new SessionID(this.getContactJid().split("/", + 2)[0], presence, "xmpp"); this.otrSession = new SessionImpl(sessionId, getAccount() .getOtrEngine(service)); try { @@ -459,7 +459,7 @@ public class Conversation extends AbstractEntity { public boolean isMuted() { return SystemClock.elapsedRealtime() < this.mutedTill; } - + public boolean setAttribute(String key, String value) { try { this.attributes.put(key, value); @@ -468,7 +468,7 @@ public class Conversation extends AbstractEntity { return false; } } - + public String getAttribute(String key) { try { return this.attributes.getString(key); @@ -476,10 +476,10 @@ public class Conversation extends AbstractEntity { return null; } } - + public int getIntAttribute(String key, int defaultValue) { String value = this.getAttribute(key); - if (value==null) { + if (value == null) { return defaultValue; } else { try { diff --git a/src/eu/siacs/conversations/entities/MucOptions.java b/src/eu/siacs/conversations/entities/MucOptions.java index 91a3d260a..0294c8aae 100644 --- a/src/eu/siacs/conversations/entities/MucOptions.java +++ b/src/eu/siacs/conversations/entities/MucOptions.java @@ -134,7 +134,7 @@ public class MucOptions { } public void processPacket(PresencePacket packet, PgpEngine pgp) { - String[] fromParts = packet.getFrom().split("/",2); + String[] fromParts = packet.getFrom().split("/", 2); if (fromParts.length >= 2) { String name = fromParts[1]; String type = packet.getAttribute("type"); @@ -180,7 +180,7 @@ public class MucOptions { } } } else if (type.equals("unavailable")) { - deleteUser(packet.getAttribute("from").split("/",2)[1]); + deleteUser(packet.getAttribute("from").split("/", 2)[1]); } else if (type.equals("error")) { Element error = packet.findChild("error"); if (error.hasChild("conflict")) { @@ -209,7 +209,7 @@ public class MucOptions { } public String getProposedNick() { - String[] mucParts = conversation.getContactJid().split("/",2); + String[] mucParts = conversation.getContactJid().split("/", 2); if (conversation.getBookmark() != null && conversation.getBookmark().getNick() != null) { return conversation.getBookmark().getNick(); @@ -309,7 +309,7 @@ public class MucOptions { } public String getJoinJid() { - return this.conversation.getContactJid().split("/",2)[0] + "/" + return this.conversation.getContactJid().split("/", 2)[0] + "/" + this.joinnick; } @@ -323,7 +323,8 @@ public class MucOptions { } public String getPassword() { - this.password = conversation.getAttribute(Conversation.ATTRIBUTE_MUC_PASSWORD); + this.password = conversation + .getAttribute(Conversation.ATTRIBUTE_MUC_PASSWORD); if (this.password == null && conversation.getBookmark() != null && conversation.getBookmark().getPassword() != null) { return conversation.getBookmark().getPassword(); @@ -339,7 +340,8 @@ public class MucOptions { } else { this.password = password; } - conversation.setAttribute(Conversation.ATTRIBUTE_MUC_PASSWORD, password); + conversation + .setAttribute(Conversation.ATTRIBUTE_MUC_PASSWORD, password); } public boolean isPasswordChanged() { |