Merge branch 'develop' of https://github.com/cijo7/Conversations into cijo7-develop
This commit is contained in:
commit
75749d7c7b
|
@ -2,6 +2,7 @@ package eu.siacs.conversations.entities;
|
||||||
|
|
||||||
import android.content.ContentValues;
|
import android.content.ContentValues;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
|
||||||
import net.java.otr4j.OtrException;
|
import net.java.otr4j.OtrException;
|
||||||
import net.java.otr4j.crypto.OtrCryptoException;
|
import net.java.otr4j.crypto.OtrCryptoException;
|
||||||
|
@ -15,7 +16,6 @@ import org.json.JSONObject;
|
||||||
|
|
||||||
import java.security.interfaces.DSAPublicKey;
|
import java.security.interfaces.DSAPublicKey;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
@ -37,7 +37,6 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
|
||||||
|
|
||||||
public static final int STATUS_AVAILABLE = 0;
|
public static final int STATUS_AVAILABLE = 0;
|
||||||
public static final int STATUS_ARCHIVED = 1;
|
public static final int STATUS_ARCHIVED = 1;
|
||||||
public static final int STATUS_DELETED = 2;
|
|
||||||
|
|
||||||
public static final int MODE_MULTI = 1;
|
public static final int MODE_MULTI = 1;
|
||||||
public static final int MODE_SINGLE = 0;
|
public static final int MODE_SINGLE = 0;
|
||||||
|
@ -51,13 +50,15 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
|
||||||
public static final String MODE = "mode";
|
public static final String MODE = "mode";
|
||||||
public static final String ATTRIBUTES = "attributes";
|
public static final String ATTRIBUTES = "attributes";
|
||||||
|
|
||||||
public static final String ATTRIBUTE_NEXT_ENCRYPTION = "next_encryption";
|
|
||||||
public static final String ATTRIBUTE_MUC_PASSWORD = "muc_password";
|
|
||||||
public static final String ATTRIBUTE_MUTED_TILL = "muted_till";
|
public static final String ATTRIBUTE_MUTED_TILL = "muted_till";
|
||||||
public static final String ATTRIBUTE_ALWAYS_NOTIFY = "always_notify";
|
public static final String ATTRIBUTE_ALWAYS_NOTIFY = "always_notify";
|
||||||
public static final String ATTRIBUTE_CRYPTO_TARGETS = "crypto_targets";
|
|
||||||
public static final String ATTRIBUTE_LAST_CLEAR_HISTORY = "last_clear_history";
|
public static final String ATTRIBUTE_LAST_CLEAR_HISTORY = "last_clear_history";
|
||||||
|
|
||||||
|
private static final String ATTRIBUTE_CRYPTO_TARGETS = "crypto_targets";
|
||||||
|
|
||||||
|
private static final String ATTRIBUTE_NEXT_ENCRYPTION = "next_encryption";
|
||||||
|
static final String ATTRIBUTE_MUC_PASSWORD = "muc_password";
|
||||||
|
|
||||||
private String draftMessage;
|
private String draftMessage;
|
||||||
private String name;
|
private String name;
|
||||||
private String contactUuid;
|
private String contactUuid;
|
||||||
|
@ -347,7 +348,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
|
||||||
|
|
||||||
public List<Jid> getAcceptedCryptoTargets() {
|
public List<Jid> getAcceptedCryptoTargets() {
|
||||||
if (mode == MODE_SINGLE) {
|
if (mode == MODE_SINGLE) {
|
||||||
return Arrays.asList(getJid().toBareJid());
|
return Collections.singletonList(getJid().toBareJid());
|
||||||
} else {
|
} else {
|
||||||
return getJidListAttribute(ATTRIBUTE_CRYPTO_TARGETS);
|
return getJidListAttribute(ATTRIBUTE_CRYPTO_TARGETS);
|
||||||
}
|
}
|
||||||
|
@ -371,7 +372,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(Conversation another) {
|
public int compareTo(@NonNull Conversation another) {
|
||||||
final Message left = getLatestMessage();
|
final Message left = getLatestMessage();
|
||||||
final Message right = another.getLatestMessage();
|
final Message right = another.getLatestMessage();
|
||||||
if (left.getTimeSent() > right.getTimeSent()) {
|
if (left.getTimeSent() > right.getTimeSent()) {
|
||||||
|
@ -871,7 +872,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Jid> getJidListAttribute(String key) {
|
private List<Jid> getJidListAttribute(String key) {
|
||||||
ArrayList<Jid> list = new ArrayList<>();
|
ArrayList<Jid> list = new ArrayList<>();
|
||||||
synchronized (this.attributes) {
|
synchronized (this.attributes) {
|
||||||
try {
|
try {
|
||||||
|
@ -890,7 +891,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getIntAttribute(String key, int defaultValue) {
|
private int getIntAttribute(String key, int defaultValue) {
|
||||||
String value = this.getAttribute(key);
|
String value = this.getAttribute(key);
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
|
@ -916,7 +917,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getBooleanAttribute(String key, boolean defaultValue) {
|
private boolean getBooleanAttribute(String key, boolean defaultValue) {
|
||||||
String value = this.getAttribute(key);
|
String value = this.getAttribute(key);
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package eu.siacs.conversations.parser;
|
package eu.siacs.conversations.parser;
|
||||||
|
|
||||||
|
import android.os.Build;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.Pair;
|
import android.util.Pair;
|
||||||
|
@ -116,7 +117,11 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
|
||||||
}
|
}
|
||||||
if (clientMightSendHtml(conversation.getAccount(), from)) {
|
if (clientMightSendHtml(conversation.getAccount(), from)) {
|
||||||
Log.d(Config.LOGTAG,conversation.getAccount().getJid().toBareJid()+": received OTR message from bad behaving client. escaping HTML…");
|
Log.d(Config.LOGTAG,conversation.getAccount().getJid().toBareJid()+": received OTR message from bad behaving client. escaping HTML…");
|
||||||
body = Html.fromHtml(body).toString();
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
|
body = Html.fromHtml(body,Html.FROM_HTML_MODE_LEGACY).toString();
|
||||||
|
} else {
|
||||||
|
body = Html.fromHtml(body).toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final OtrService otrService = conversation.getAccount().getOtrService();
|
final OtrService otrService = conversation.getAccount().getOtrService();
|
||||||
|
|
|
@ -1487,7 +1487,7 @@ public class ConversationActivity extends XmppActivity
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setNeverAskForBatteryOptimizationsAgain() {
|
private void setNeverAskForBatteryOptimizationsAgain() {
|
||||||
getPreferences().edit().putBoolean("show_battery_optimization", false).commit();
|
getPreferences().edit().putBoolean("show_battery_optimization", false).apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void openBatteryOptimizationDialogIfNeeded() {
|
private void openBatteryOptimizationDialogIfNeeded() {
|
||||||
|
|
Loading…
Reference in New Issue