aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/entities
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/eu/siacs/conversations/entities')
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Account.java2
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Bookmark.java1
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Conversation.java16
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Message.java1
-rw-r--r--src/main/java/eu/siacs/conversations/entities/MucOptions.java3
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Presence.java1
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Presences.java4
-rw-r--r--src/main/java/eu/siacs/conversations/entities/ServiceDiscoveryResult.java9
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Transferable.java81
9 files changed, 86 insertions, 32 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/Account.java b/src/main/java/eu/siacs/conversations/entities/Account.java
index 3e79fccd9..dec3bd1a4 100644
--- a/src/main/java/eu/siacs/conversations/entities/Account.java
+++ b/src/main/java/eu/siacs/conversations/entities/Account.java
@@ -5,7 +5,6 @@ import android.database.Cursor;
import android.os.SystemClock;
import android.util.Pair;
-import eu.siacs.conversations.crypto.PgpDecryptionService;
import net.java.otr4j.crypto.OtrCryptoEngineImpl;
import net.java.otr4j.crypto.OtrCryptoException;
@@ -23,6 +22,7 @@ import java.util.concurrent.CopyOnWriteArraySet;
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
import eu.siacs.conversations.crypto.OtrService;
+import eu.siacs.conversations.crypto.PgpDecryptionService;
import eu.siacs.conversations.crypto.axolotl.AxolotlService;
import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.xmpp.XmppConnection;
diff --git a/src/main/java/eu/siacs/conversations/entities/Bookmark.java b/src/main/java/eu/siacs/conversations/entities/Bookmark.java
index c5c4ff5dd..7c2f73b36 100644
--- a/src/main/java/eu/siacs/conversations/entities/Bookmark.java
+++ b/src/main/java/eu/siacs/conversations/entities/Bookmark.java
@@ -6,7 +6,6 @@ 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;
diff --git a/src/main/java/eu/siacs/conversations/entities/Conversation.java b/src/main/java/eu/siacs/conversations/entities/Conversation.java
index 017a85f51..c194ad7d2 100644
--- a/src/main/java/eu/siacs/conversations/entities/Conversation.java
+++ b/src/main/java/eu/siacs/conversations/entities/Conversation.java
@@ -447,6 +447,19 @@ public class Conversation extends AbstractEntity implements Blockable {
return this.getContact().getDisplayName();
}
}
+
+ public String getParticipants() {
+ if (getMode() == MODE_MULTI) {
+ String generatedName = getMucOptions().createNameFromParticipants();
+ if (generatedName != null) {
+ return generatedName;
+ } else {
+ return null;
+ }
+ } else {
+ return null;
+ }
+ }
public String getAccountUuid() {
return this.accountUuid;
@@ -682,7 +695,8 @@ public class Conversation extends AbstractEntity implements Blockable {
&& mode == MODE_SINGLE
&& axolotlService.isConversationAxolotlCapable(this)
&& getAccount().getSelfContact().getPresences().allOrNonSupport(AxolotlService.PEP_DEVICE_LIST_NOTIFY)
- && getContact().getPresences().allOrNonSupport(AxolotlService.PEP_DEVICE_LIST_NOTIFY)) {
+ && getContact().getPresences().allOrNonSupport(AxolotlService.PEP_DEVICE_LIST_NOTIFY)
+ && Config.AlwayUseOMEMO){
return Message.ENCRYPTION_AXOLOTL;
} else {
next = this.getMostRecentlyUsedIncomingEncryption();
diff --git a/src/main/java/eu/siacs/conversations/entities/Message.java b/src/main/java/eu/siacs/conversations/entities/Message.java
index 21837386d..3c871dc79 100644
--- a/src/main/java/eu/siacs/conversations/entities/Message.java
+++ b/src/main/java/eu/siacs/conversations/entities/Message.java
@@ -5,7 +5,6 @@ import android.database.Cursor;
import java.net.MalformedURLException;
import java.net.URL;
-import java.util.Arrays;
import eu.siacs.conversations.Config;
import eu.siacs.conversations.crypto.axolotl.XmppAxolotlSession;
diff --git a/src/main/java/eu/siacs/conversations/entities/MucOptions.java b/src/main/java/eu/siacs/conversations/entities/MucOptions.java
index d08483703..043bc03d0 100644
--- a/src/main/java/eu/siacs/conversations/entities/MucOptions.java
+++ b/src/main/java/eu/siacs/conversations/entities/MucOptions.java
@@ -3,7 +3,6 @@ package eu.siacs.conversations.entities;
import android.annotation.SuppressLint;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -554,7 +553,7 @@ public class MucOptions {
}
public String createNameFromParticipants() {
- if (getUserCount() >= 2) {
+ if (users.size() >= 1) {
List<String> names = new ArrayList<>();
for (User user : getUsers(5)) {
Contact contact = user.getContact();
diff --git a/src/main/java/eu/siacs/conversations/entities/Presence.java b/src/main/java/eu/siacs/conversations/entities/Presence.java
index e9f6d0d16..eefe73fc0 100644
--- a/src/main/java/eu/siacs/conversations/entities/Presence.java
+++ b/src/main/java/eu/siacs/conversations/entities/Presence.java
@@ -1,6 +1,5 @@
package eu.siacs.conversations.entities;
-import java.lang.Comparable;
import java.util.Locale;
import eu.siacs.conversations.xml.Element;
diff --git a/src/main/java/eu/siacs/conversations/entities/Presences.java b/src/main/java/eu/siacs/conversations/entities/Presences.java
index 9e94ff2b3..b3e8966a7 100644
--- a/src/main/java/eu/siacs/conversations/entities/Presences.java
+++ b/src/main/java/eu/siacs/conversations/entities/Presences.java
@@ -3,11 +3,7 @@ package eu.siacs.conversations.entities;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Hashtable;
-import java.util.Iterator;
import java.util.List;
-import java.util.Map;
-
-import eu.siacs.conversations.xml.Element;
public class Presences {
private final Hashtable<String, Presence> presences = new Hashtable<>();
diff --git a/src/main/java/eu/siacs/conversations/entities/ServiceDiscoveryResult.java b/src/main/java/eu/siacs/conversations/entities/ServiceDiscoveryResult.java
index 9ee1d180e..4de7c7e7a 100644
--- a/src/main/java/eu/siacs/conversations/entities/ServiceDiscoveryResult.java
+++ b/src/main/java/eu/siacs/conversations/entities/ServiceDiscoveryResult.java
@@ -3,17 +3,18 @@ package eu.siacs.conversations.entities;
import android.content.ContentValues;
import android.database.Cursor;
import android.util.Base64;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
import java.io.UnsupportedEncodingException;
-import java.lang.Comparable;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
import eu.siacs.conversations.xml.Element;
import eu.siacs.conversations.xmpp.forms.Data;
diff --git a/src/main/java/eu/siacs/conversations/entities/Transferable.java b/src/main/java/eu/siacs/conversations/entities/Transferable.java
index 5a47c4512..1ce4d8ccf 100644
--- a/src/main/java/eu/siacs/conversations/entities/Transferable.java
+++ b/src/main/java/eu/siacs/conversations/entities/Transferable.java
@@ -4,28 +4,75 @@ import java.util.Arrays;
import java.util.List;
public interface Transferable {
+ List<String> VALID_IMAGE_EXTENSIONS = Arrays.asList(
+ "webp",
+ "jpeg",
+ "jpg",
+ "png",
+ "jpe",
+ "gif",
+ "tif"
+ );
+ List<String> VALID_CRYPTO_EXTENSIONS = Arrays.asList(
+ "pgp",
+ "gpg",
+ "otr"
+ );
+ List<String> WELL_KNOWN_EXTENSIONS = Arrays.asList(
+ //documents
+ "pdf",
+ "doc",
+ "docx",
+ "txt",
+ //audio
+ "m4a",
+ "m4b",
+ "mp3",
+ "mp2",
+ "wav",
+ "aac",
+ "aif",
+ "aiff",
+ "aifc",
+ "mid",
+ "midi",
+ "3gpp",
+ //video
+ "avi",
+ "mp4",
+ "mpeg",
+ "mpg",
+ "mpe",
+ "mov",
+ "3gp",
+ //applications
+ "apk",
+ //contact
+ "vcf",
+ //calendar
+ "ics",
+ //compressed
+ "zip",
+ "rar"
+ );
- List<String> VALID_IMAGE_EXTENSIONS = Arrays.asList("webp", "jpeg", "jpg", "png", "jpe");
- List<String> VALID_CRYPTO_EXTENSIONS = Arrays.asList("pgp", "gpg", "otr");
- List<String> WELL_KNOWN_EXTENSIONS = Arrays.asList("pdf","m4a","mp4","3gp","aac","amr","mp3");
+ int STATUS_UNKNOWN = 0x200;
+ int STATUS_CHECKING = 0x201;
+ int STATUS_FAILED = 0x202;
+ int STATUS_OFFER = 0x203;
+ int STATUS_DOWNLOADING = 0x204;
+ int STATUS_DELETED = 0x205;
+ int STATUS_OFFER_CHECK_FILESIZE = 0x206;
+ int STATUS_UPLOADING = 0x207;
- int STATUS_UNKNOWN = 0x200;
- int STATUS_CHECKING = 0x201;
- int STATUS_FAILED = 0x202;
- int STATUS_OFFER = 0x203;
- int STATUS_DOWNLOADING = 0x204;
- int STATUS_DELETED = 0x205;
- int STATUS_OFFER_CHECK_FILESIZE = 0x206;
- int STATUS_UPLOADING = 0x207;
+ boolean start();
- boolean start();
+ int getStatus();
- int getStatus();
+ long getFileSize();
- long getFileSize();
+ int getProgress();
- int getProgress();
-
- void cancel();
+ void cancel();
}