do not enable encryption for bug reports

This commit is contained in:
Daniel Gultsch 2018-03-07 20:21:13 +01:00
parent 94bb7c423c
commit 52135625d8
6 changed files with 16 additions and 52 deletions

View File

@ -3,6 +3,7 @@ package eu.siacs.conversations;
import android.graphics.Bitmap;
import eu.siacs.conversations.xmpp.chatstate.ChatState;
import rocks.xmpp.addr.Jid;
public final class Config {
@ -22,10 +23,6 @@ public final class Config {
return (ENCRYPTION_MASK & OPENPGP) != 0;
}
public static boolean supportOtr() {
return (ENCRYPTION_MASK & OTR) != 0;
}
public static boolean supportOmemo() {
return (ENCRYPTION_MASK & OMEMO) != 0;
}
@ -36,7 +33,7 @@ public final class Config {
public static final String LOGTAG = "conversations";
public static final String BUG_REPORTS = "bugs@conversations.im";
public static final Jid BUG_REPORTS = Jid.of("bugs@conversations.im");
public static final String DOMAIN_LOCK = null; //only allow account creation for this domain

View File

@ -600,7 +600,9 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
public int getNextEncryption() {
final int defaultEncryption;
AxolotlService axolotlService = account.getAxolotlService();
if (axolotlService != null && axolotlService.isConversationAxolotlCapable(this)) {
if (contactJid.asBareJid().equals(Config.BUG_REPORTS)) {
defaultEncryption = Message.ENCRYPTION_NONE;
} else if (axolotlService != null && axolotlService.isConversationAxolotlCapable(this)) {
defaultEncryption = Message.ENCRYPTION_AXOLOTL;
} else {
defaultEncryption = Message.ENCRYPTION_NONE;
@ -882,16 +884,4 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
&& !getContact().showInRoster()
&& sentMessagesCount() == 0;
}
public class Smp {
public static final int STATUS_NONE = 0;
public static final int STATUS_CONTACT_REQUESTED = 1;
public static final int STATUS_WE_REQUESTED = 2;
public static final int STATUS_FAILED = 3;
public static final int STATUS_VERIFIED = 4;
public String secret = null;
public String hint = null;
public int status = 0;
}
}

View File

@ -564,7 +564,7 @@ public class Message extends AbstractEntity {
((this.axolotlFingerprint == null && message.axolotlFingerprint == null) || this.axolotlFingerprint.equals(message.getFingerprint())) &&
UIHelper.sameDay(message.getTimeSent(),this.getTimeSent()) &&
this.getReadByMarkers().equals(message.getReadByMarkers()) &&
!this.conversation.getJid().asBareJid().toString().equals(Config.BUG_REPORTS)
!this.conversation.getJid().asBareJid().equals(Config.BUG_REPORTS)
);
}

View File

@ -2,8 +2,6 @@ package eu.siacs.conversations.utils;
import android.support.v7.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;
@ -28,7 +26,6 @@ import eu.siacs.conversations.entities.Conversation;
import eu.siacs.conversations.entities.Message;
import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.ui.XmppActivity;
import rocks.xmpp.addr.Jid;
public class ExceptionHelper {
@ -94,35 +91,14 @@ public class ExceptionHelper {
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle(activity.getString(R.string.crash_report_title));
builder.setMessage(activity.getText(R.string.crash_report_message));
builder.setPositiveButton(activity.getText(R.string.send_now),
new OnClickListener() {
builder.setPositiveButton(activity.getText(R.string.send_now), (dialog, which) -> {
@Override
public void onClick(DialogInterface dialog, int which) {
Log.d(Config.LOGTAG, "using account="
+ finalAccount.getJid().asBareJid()
+ " to send in stack trace");
Conversation conversation = null;
try {
conversation = service.findOrCreateConversation(finalAccount,
Jid.of(Config.BUG_REPORTS), false, true);
} catch (final IllegalArgumentException ignored) {
}
Message message = new Message(conversation, report
.toString(), Message.ENCRYPTION_NONE);
service.sendMessage(message);
}
});
builder.setNegativeButton(activity.getText(R.string.send_never),
new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
preferences.edit().putBoolean("never_send", true)
.apply();
}
});
Log.d(Config.LOGTAG, "using account=" + finalAccount.getJid().asBareJid() + " to send in stack trace");
Conversation conversation = service.findOrCreateConversation(finalAccount, Config.BUG_REPORTS, false, true);
Message message = new Message(conversation, report.toString(), Message.ENCRYPTION_NONE);
service.sendMessage(message);
});
builder.setNegativeButton(activity.getText(R.string.send_never), (dialog, which) -> preferences.edit().putBoolean("never_send", true).apply());
builder.create().show();
return true;
} catch (final IOException ignored) {
@ -130,7 +106,7 @@ public class ExceptionHelper {
}
}
public static void writeToStacktraceFile(Context context, String msg) {
static void writeToStacktraceFile(Context context, String msg) {
try {
OutputStream os = context.openFileOutput(FILENAME, Context.MODE_PRIVATE);
os.write(msg.getBytes());

View File

@ -14,6 +14,7 @@
<color name="white12">#1fffffff</color>
<color name="grey50">#fffafafa</color>
<color name="grey200">#ffeeeeee</color>
<color name="grey300">#ffe0e0e0</color>
<color name="grey500">#ff9e9e9e</color>
<color name="grey800">#ff424242</color>
<color name="grey900">#ff282828</color>

View File

@ -161,7 +161,7 @@
</style>
<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
<item name="colorPrimaryDark">@color/grey50</item>
<item name="colorPrimaryDark">@color/grey300</item>
<item name="android:windowBackground">@drawable/background</item>
</style>
</resources>