aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/entities
diff options
context:
space:
mode:
authorsteckbrief <steckbrief@chefmail.de>2016-02-28 21:48:09 +0100
committersteckbrief <steckbrief@chefmail.de>2016-02-28 21:48:09 +0100
commitcd0c6ce48e2ac36d9524908acbbc79690b193d9a (patch)
treee03621214377147d44a13917485baf16b607a11a /src/main/java/eu/siacs/conversations/entities
parent8fb6204288d55f8af16ae47e32fa6c049284cadd (diff)
parentc393e6089177f31683c4cecfdb359802de1b5e0c (diff)
Merge tag '1.10.1' into trz/merge_1.10.1
Conflicts: README.md build.gradle src/main/java/eu/siacs/conversations/entities/ListItem.java src/main/java/eu/siacs/conversations/parser/MessageParser.java src/main/java/eu/siacs/conversations/services/XmppConnectionService.java src/main/java/eu/siacs/conversations/ui/ConversationFragment.java src/main/res/menu/message_context.xml src/main/res/xml/preferences.xml
Diffstat (limited to 'src/main/java/eu/siacs/conversations/entities')
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Bookmark.java13
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Contact.java19
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Conversation.java10
-rw-r--r--src/main/java/eu/siacs/conversations/entities/ListItem.java12
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Message.java1
-rw-r--r--src/main/java/eu/siacs/conversations/entities/MucOptions.java34
6 files changed, 61 insertions, 28 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/Bookmark.java b/src/main/java/eu/siacs/conversations/entities/Bookmark.java
index d0a951b3..fa30443d 100644
--- a/src/main/java/eu/siacs/conversations/entities/Bookmark.java
+++ b/src/main/java/eu/siacs/conversations/entities/Bookmark.java
@@ -6,6 +6,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
+import eu.siacs.conversations.Config;
import eu.siacs.conversations.utils.UIHelper;
import eu.siacs.conversations.xml.Element;
import eu.siacs.conversations.xmpp.jid.Jid;
@@ -60,6 +61,18 @@ public class Bookmark extends Element implements ListItem {
}
@Override
+ public String getDisplayJid() {
+ Jid jid = getJid();
+ if (Config.LOCK_DOMAINS_IN_CONVERSATIONS && jid != null && jid.getDomainpart().equals(Config.CONFERENCE_DOMAIN_LOCK)) {
+ return jid.getLocalpart();
+ } else if (jid != null) {
+ return jid.toString();
+ } else {
+ return null;
+ }
+ }
+
+ @Override
public Jid getJid() {
return this.getAttributeAsJid("jid");
}
diff --git a/src/main/java/eu/siacs/conversations/entities/Contact.java b/src/main/java/eu/siacs/conversations/entities/Contact.java
index be6325e5..bdde12e3 100644
--- a/src/main/java/eu/siacs/conversations/entities/Contact.java
+++ b/src/main/java/eu/siacs/conversations/entities/Contact.java
@@ -46,7 +46,7 @@ public class Contact implements ListItem, Blockable {
protected String photoUri;
protected JSONObject keys = new JSONObject();
protected JSONArray groups = new JSONArray();
- protected Presences presences = new Presences();
+ protected final Presences presences = new Presences();
protected Account account;
protected Avatar avatar;
@@ -122,6 +122,17 @@ public class Contact implements ListItem, Blockable {
}
}
+ @Override
+ public String getDisplayJid() {
+ if (Config.LOCK_DOMAINS_IN_CONVERSATIONS && jid != null && jid.getDomainpart().equals(Config.DOMAIN_LOCK)) {
+ return jid.getLocalpart();
+ } else if (jid != null) {
+ return jid.toString();
+ } else {
+ return null;
+ }
+ }
+
public String getProfilePhoto() {
return this.photoUri;
}
@@ -228,10 +239,6 @@ public class Contact implements ListItem, Blockable {
return this.presences;
}
- public void setPresences(Presences pres) {
- this.presences = pres;
- }
-
public void updatePresence(final String resource, final Presence presence) {
this.presences.updatePresence(resource, presence);
}
@@ -392,11 +399,13 @@ public class Contact implements ListItem, Blockable {
this.resetOption(Options.TO);
this.setOption(Options.FROM);
this.resetOption(Options.PREEMPTIVE_GRANT);
+ this.resetOption(Options.PENDING_SUBSCRIPTION_REQUEST);
break;
case "both":
this.setOption(Options.TO);
this.setOption(Options.FROM);
this.resetOption(Options.PREEMPTIVE_GRANT);
+ this.resetOption(Options.PENDING_SUBSCRIPTION_REQUEST);
break;
case "none":
this.resetOption(Options.FROM);
diff --git a/src/main/java/eu/siacs/conversations/entities/Conversation.java b/src/main/java/eu/siacs/conversations/entities/Conversation.java
index a99491ae..c3440b3e 100644
--- a/src/main/java/eu/siacs/conversations/entities/Conversation.java
+++ b/src/main/java/eu/siacs/conversations/entities/Conversation.java
@@ -667,11 +667,15 @@ public class Conversation extends AbstractEntity implements Blockable {
next = outgoing;
}
}
- if (Config.FORCE_E2E_ENCRYPTION && mode == MODE_SINGLE && next <= 0) {
- if (axolotlService != null && axolotlService.isContactAxolotlCapable(getContact())) {
+ if (!Config.supportUnencrypted()
+ && (mode == MODE_SINGLE || Config.supportOpenPgpOnly())
+ && next <= 0) {
+ if (Config.supportOmemo() && (axolotlService != null && axolotlService.isContactAxolotlCapable(getContact()) || !Config.multipleEncryptionChoices())) {
return Message.ENCRYPTION_AXOLOTL;
- } else {
+ } else if (Config.supportOtr()) {
return Message.ENCRYPTION_OTR;
+ } else if (Config.supportOpenPgp()) {
+ return Message.ENCRYPTION_PGP;
}
}
return next;
diff --git a/src/main/java/eu/siacs/conversations/entities/ListItem.java b/src/main/java/eu/siacs/conversations/entities/ListItem.java
index aba2aef2..56804fbf 100644
--- a/src/main/java/eu/siacs/conversations/entities/ListItem.java
+++ b/src/main/java/eu/siacs/conversations/entities/ListItem.java
@@ -5,15 +5,17 @@ import java.util.List;
import eu.siacs.conversations.xmpp.jid.Jid;
public interface ListItem extends Comparable<ListItem> {
- public String getDisplayName();
+ String getDisplayName();
- public Jid getJid();
+ String getDisplayJid();
- public List<Tag> getTags();
+ Jid getJid();
public int getStatusColor();
- public final class Tag {
+ List<Tag> getTags();
+
+ final class Tag {
private final String name;
private final int color;
@@ -31,5 +33,5 @@ public interface ListItem extends Comparable<ListItem> {
}
}
- public boolean match(final String needle);
+ boolean match(final String needle);
}
diff --git a/src/main/java/eu/siacs/conversations/entities/Message.java b/src/main/java/eu/siacs/conversations/entities/Message.java
index 47c9c9e2..60f0d267 100644
--- a/src/main/java/eu/siacs/conversations/entities/Message.java
+++ b/src/main/java/eu/siacs/conversations/entities/Message.java
@@ -440,6 +440,7 @@ public class Message extends AbstractEntity {
this.getTransferable() == null &&
message.getTransferable() == null &&
message.getEncryption() != Message.ENCRYPTION_PGP &&
+ message.getEncryption() != Message.ENCRYPTION_DECRYPTION_FAILED &&
this.getType() == message.getType() &&
//this.getStatus() == message.getStatus() &&
isStatusMergeable(this.getStatus(), message.getStatus()) &&
diff --git a/src/main/java/eu/siacs/conversations/entities/MucOptions.java b/src/main/java/eu/siacs/conversations/entities/MucOptions.java
index be9d790d..3567c14f 100644
--- a/src/main/java/eu/siacs/conversations/entities/MucOptions.java
+++ b/src/main/java/eu/siacs/conversations/entities/MucOptions.java
@@ -91,22 +91,26 @@ public class MucOptions {
}
}
- public static final int ERROR_NO_ERROR = 0;
- public static final int ERROR_NICK_IN_USE = 1;
- public static final int ERROR_UNKNOWN = 2;
- public static final int ERROR_PASSWORD_REQUIRED = 3;
- public static final int ERROR_BANNED = 4;
- public static final int ERROR_MEMBERS_ONLY = 5;
- public static final int ERROR_NO_RESPONSE = 6;
-
- public static final int KICKED_FROM_ROOM = 9;
+ public enum Error {
+ NO_RESPONSE,
+ NONE,
+ NICK_IN_USE,
+ PASSWORD_REQUIRED,
+ BANNED,
+ MEMBERS_ONLY,
+ KICKED,
+ SHUTDOWN,
+ UNKNOWN
+ }
public static final String STATUS_CODE_ROOM_CONFIG_CHANGED = "104";
public static final String STATUS_CODE_SELF_PRESENCE = "110";
public static final String STATUS_CODE_BANNED = "301";
public static final String STATUS_CODE_CHANGED_NICK = "303";
public static final String STATUS_CODE_KICKED = "307";
- public static final String STATUS_CODE_LOST_MEMBERSHIP = "321";
+ public static final String STATUS_CODE_AFFILIATION_CHANGE = "321";
+ public static final String STATUS_CODE_LOST_MEMBERSHIP = "322";
+ public static final String STATUS_CODE_SHUTDOWN = "332";
private interface OnEventListener {
void onSuccess();
@@ -245,7 +249,7 @@ public class MucOptions {
private Data form = new Data();
private Conversation conversation;
private boolean isOnline = false;
- private int error = ERROR_NO_RESPONSE;
+ private Error error = Error.NONE;
public OnRenameListener onRenameListener = null;
private User self;
private String subject = null;
@@ -324,8 +328,8 @@ public class MucOptions {
return findUser(name) != null;
}
- public void setError(int error) {
- this.isOnline = isOnline && error == ERROR_NO_ERROR;
+ public void setError(Error error) {
+ this.isOnline = isOnline && error == Error.NONE;
this.error = error;
}
@@ -379,7 +383,7 @@ public class MucOptions {
return this.isOnline;
}
- public int getError() {
+ public Error getError() {
return this.error;
}
@@ -389,7 +393,7 @@ public class MucOptions {
public void setOffline() {
this.users.clear();
- this.error = ERROR_NO_RESPONSE;
+ this.error = Error.NO_RESPONSE;
this.isOnline = false;
}