changed behaviour of expecption handler to check if accounts are working before removing the stacktrace
This commit is contained in:
parent
298c7adcd1
commit
ba0bedc5fa
|
@ -34,6 +34,18 @@ public class ExceptionHelper {
|
||||||
if (neverSend) {
|
if (neverSend) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
List<Account> accounts = service.getAccounts();
|
||||||
|
Account account = null;
|
||||||
|
for(int i = 0; i < accounts.size(); ++i) {
|
||||||
|
if (!accounts.get(i).isOptionSet(Account.OPTION_DISABLED)) {
|
||||||
|
account = accounts.get(i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (account==null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final Account finalAccount = account;
|
||||||
FileInputStream file = context.openFileInput("stacktrace.txt");
|
FileInputStream file = context.openFileInput("stacktrace.txt");
|
||||||
InputStreamReader inputStreamReader = new InputStreamReader(
|
InputStreamReader inputStreamReader = new InputStreamReader(
|
||||||
file);
|
file);
|
||||||
|
@ -54,21 +66,12 @@ public class ExceptionHelper {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
List<Account> accounts = service.getAccounts();
|
|
||||||
Account account = null;
|
Log.d("xmppService","using account="+finalAccount.getJid()+" to send in stack trace");
|
||||||
for(int i = 0; i < accounts.size(); ++i) {
|
Conversation conversation = service.findOrCreateConversation(finalAccount, "bugs@siacs.eu", false);
|
||||||
if (!accounts.get(i).isOptionSet(Account.OPTION_DISABLED)) {
|
|
||||||
account = accounts.get(i);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (account!=null) {
|
|
||||||
Log.d("xmppService","using account="+account.getJid()+" to send in stack trace");
|
|
||||||
Conversation conversation = service.findOrCreateConversation(account, "bugs@siacs.eu", false);
|
|
||||||
Message message = new Message(conversation, stacktrace.toString(), Message.ENCRYPTION_NONE);
|
Message message = new Message(conversation, stacktrace.toString(), Message.ENCRYPTION_NONE);
|
||||||
service.sendMessage(message, null);
|
service.sendMessage(message, null);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
builder.setNegativeButton(context.getText(R.string.send_never),new OnClickListener() {
|
builder.setNegativeButton(context.getText(R.string.send_never),new OnClickListener() {
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue