aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/utils
diff options
context:
space:
mode:
authorAndreas Straub <andy@strb.org>2015-07-20 15:13:14 +0200
committerAndreas Straub <andy@strb.org>2015-07-20 15:13:14 +0200
commitaaa8fe8978ac0513a013a9c77efef663f32eda47 (patch)
tree16cc60f67a4fbded2eeeb7ba1001ebb1b1a004a5 /src/main/java/eu/siacs/conversations/utils
parent9c91b9036aa57c610c26b4cdf52ee295eaa0dc95 (diff)
parent19a0ae42d667644ee3400c92c53ad0ad093c52fe (diff)
Merge branch 'CryptoNextBeta' into development
* CryptoNextBeta: (60 commits) Lock TrustKeys if no trusted keys are available Optimize imports Use MD style for key trust toggle switch Fix set/remove OnUpdateBlocklistListener Fix axolotl database migration Remove device list from EditAccount Add clear devices to overflow menu in EditAccount Ask for key trust when sending messages Encrypt files for HTTP upload in encrypted chats Refactor trust key ui and show in account details Send correct body for HTTP files Handle file transmission properly in axolotl Remove unneccessary code Fix trust status for outgoing messages Don't merge messages with different trust statuses Fix copying of axolotl keys to clipboard Add refresh icon to v21 theme Disable Axolotl option if not usable Show trust status of messages' originating session Add key trust toggle to ContactDetailsActivity ...
Diffstat (limited to 'src/main/java/eu/siacs/conversations/utils')
-rw-r--r--src/main/java/eu/siacs/conversations/utils/CryptoHelper.java9
-rw-r--r--src/main/java/eu/siacs/conversations/utils/DNSHelper.java28
-rw-r--r--src/main/java/eu/siacs/conversations/utils/ExceptionHandler.java4
-rw-r--r--src/main/java/eu/siacs/conversations/utils/ExceptionHelper.java24
-rw-r--r--src/main/java/eu/siacs/conversations/utils/OnPhoneContactsLoadedListener.java4
-rw-r--r--src/main/java/eu/siacs/conversations/utils/PhoneHelper.java7
-rw-r--r--src/main/java/eu/siacs/conversations/utils/UIHelper.java12
7 files changed, 43 insertions, 45 deletions
diff --git a/src/main/java/eu/siacs/conversations/utils/CryptoHelper.java b/src/main/java/eu/siacs/conversations/utils/CryptoHelper.java
index 2dec203d..c7c9ac42 100644
--- a/src/main/java/eu/siacs/conversations/utils/CryptoHelper.java
+++ b/src/main/java/eu/siacs/conversations/utils/CryptoHelper.java
@@ -96,11 +96,10 @@ public final class CryptoHelper {
} else if (fingerprint.length() < 40) {
return fingerprint;
}
- StringBuilder builder = new StringBuilder(fingerprint);
- builder.insert(8, " ");
- builder.insert(17, " ");
- builder.insert(26, " ");
- builder.insert(35, " ");
+ StringBuilder builder = new StringBuilder(fingerprint.replaceAll("\\s",""));
+ for(int i=8;i<builder.length();i+=9) {
+ builder.insert(i, ' ');
+ }
return builder.toString();
}
diff --git a/src/main/java/eu/siacs/conversations/utils/DNSHelper.java b/src/main/java/eu/siacs/conversations/utils/DNSHelper.java
index 5a47bb3c..36d03b30 100644
--- a/src/main/java/eu/siacs/conversations/utils/DNSHelper.java
+++ b/src/main/java/eu/siacs/conversations/utils/DNSHelper.java
@@ -1,17 +1,7 @@
package eu.siacs.conversations.utils;
-import de.measite.minidns.Client;
-import de.measite.minidns.DNSMessage;
-import de.measite.minidns.Record;
-import de.measite.minidns.Record.TYPE;
-import de.measite.minidns.Record.CLASS;
-import de.measite.minidns.record.SRV;
-import de.measite.minidns.record.A;
-import de.measite.minidns.record.AAAA;
-import de.measite.minidns.record.Data;
-import de.measite.minidns.util.NameUtil;
-import eu.siacs.conversations.Config;
-import eu.siacs.conversations.xmpp.jid.Jid;
+import android.os.Bundle;
+import android.util.Log;
import java.io.IOException;
import java.net.InetAddress;
@@ -22,8 +12,18 @@ import java.util.Random;
import java.util.TreeMap;
import java.util.regex.Pattern;
-import android.os.Bundle;
-import android.util.Log;
+import de.measite.minidns.Client;
+import de.measite.minidns.DNSMessage;
+import de.measite.minidns.Record;
+import de.measite.minidns.Record.CLASS;
+import de.measite.minidns.Record.TYPE;
+import de.measite.minidns.record.A;
+import de.measite.minidns.record.AAAA;
+import de.measite.minidns.record.Data;
+import de.measite.minidns.record.SRV;
+import de.measite.minidns.util.NameUtil;
+import eu.siacs.conversations.Config;
+import eu.siacs.conversations.xmpp.jid.Jid;
public class DNSHelper {
diff --git a/src/main/java/eu/siacs/conversations/utils/ExceptionHandler.java b/src/main/java/eu/siacs/conversations/utils/ExceptionHandler.java
index 0ad57fe2..4e3ec236 100644
--- a/src/main/java/eu/siacs/conversations/utils/ExceptionHandler.java
+++ b/src/main/java/eu/siacs/conversations/utils/ExceptionHandler.java
@@ -1,5 +1,7 @@
package eu.siacs.conversations.utils;
+import android.content.Context;
+
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStream;
@@ -8,8 +10,6 @@ import java.io.StringWriter;
import java.io.Writer;
import java.lang.Thread.UncaughtExceptionHandler;
-import android.content.Context;
-
public class ExceptionHandler implements UncaughtExceptionHandler {
private UncaughtExceptionHandler defaultHandler;
diff --git a/src/main/java/eu/siacs/conversations/utils/ExceptionHelper.java b/src/main/java/eu/siacs/conversations/utils/ExceptionHelper.java
index ee3ea3e1..0f182847 100644
--- a/src/main/java/eu/siacs/conversations/utils/ExceptionHelper.java
+++ b/src/main/java/eu/siacs/conversations/utils/ExceptionHelper.java
@@ -1,5 +1,17 @@
package eu.siacs.conversations.utils;
+import android.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.DialogInterface.OnClickListener;
+import android.content.SharedPreferences;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.content.pm.PackageManager.NameNotFoundException;
+import android.preference.PreferenceManager;
+import android.text.format.DateUtils;
+import android.util.Log;
+
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
@@ -15,18 +27,6 @@ import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.xmpp.jid.InvalidJidException;
import eu.siacs.conversations.xmpp.jid.Jid;
-import android.app.AlertDialog;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.SharedPreferences;
-import android.content.DialogInterface.OnClickListener;
-import android.content.pm.PackageInfo;
-import android.content.pm.PackageManager;
-import android.content.pm.PackageManager.NameNotFoundException;
-import android.preference.PreferenceManager;
-import android.text.format.DateUtils;
-import android.util.Log;
-
public class ExceptionHelper {
public static void init(Context context) {
if (!(Thread.getDefaultUncaughtExceptionHandler() instanceof ExceptionHandler)) {
diff --git a/src/main/java/eu/siacs/conversations/utils/OnPhoneContactsLoadedListener.java b/src/main/java/eu/siacs/conversations/utils/OnPhoneContactsLoadedListener.java
index 9a689768..f18a4ed8 100644
--- a/src/main/java/eu/siacs/conversations/utils/OnPhoneContactsLoadedListener.java
+++ b/src/main/java/eu/siacs/conversations/utils/OnPhoneContactsLoadedListener.java
@@ -1,9 +1,9 @@
package eu.siacs.conversations.utils;
-import java.util.List;
-
import android.os.Bundle;
+import java.util.List;
+
public interface OnPhoneContactsLoadedListener {
public void onPhoneContactsLoaded(List<Bundle> phoneContacts);
}
diff --git a/src/main/java/eu/siacs/conversations/utils/PhoneHelper.java b/src/main/java/eu/siacs/conversations/utils/PhoneHelper.java
index 99e8ebb8..b90f06ff 100644
--- a/src/main/java/eu/siacs/conversations/utils/PhoneHelper.java
+++ b/src/main/java/eu/siacs/conversations/utils/PhoneHelper.java
@@ -1,9 +1,5 @@
package eu.siacs.conversations.utils;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.RejectedExecutionException;
-
import android.content.Context;
import android.content.CursorLoader;
import android.content.Loader;
@@ -15,6 +11,9 @@ import android.os.Bundle;
import android.provider.ContactsContract;
import android.provider.ContactsContract.Profile;
+import java.util.List;
+import java.util.concurrent.RejectedExecutionException;
+
public class PhoneHelper {
public static void loadPhoneContacts(Context context,final List<Bundle> phoneContacts, final OnPhoneContactsLoadedListener listener) {
diff --git a/src/main/java/eu/siacs/conversations/utils/UIHelper.java b/src/main/java/eu/siacs/conversations/utils/UIHelper.java
index 2e768ad9..cac23f07 100644
--- a/src/main/java/eu/siacs/conversations/utils/UIHelper.java
+++ b/src/main/java/eu/siacs/conversations/utils/UIHelper.java
@@ -1,5 +1,10 @@
package eu.siacs.conversations.utils;
+import android.content.Context;
+import android.text.format.DateFormat;
+import android.text.format.DateUtils;
+import android.util.Pair;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
@@ -9,15 +14,10 @@ import java.util.Locale;
import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.Contact;
import eu.siacs.conversations.entities.Conversation;
-import eu.siacs.conversations.entities.Transferable;
import eu.siacs.conversations.entities.Message;
+import eu.siacs.conversations.entities.Transferable;
import eu.siacs.conversations.xmpp.jid.Jid;
-import android.content.Context;
-import android.text.format.DateFormat;
-import android.text.format.DateUtils;
-import android.util.Pair;
-
public class UIHelper {
private static String BLACK_HEART_SUIT = "\u2665";