added convenience method to extract account from intent

This commit is contained in:
Daniel Gultsch 2016-01-22 20:21:45 +01:00
parent 40005cec1b
commit a47430c2f7

View file

@ -95,6 +95,8 @@ public abstract class XmppActivity extends Activity {
protected static final int REQUEST_CHOOSE_PGP_ID = 0x0103; protected static final int REQUEST_CHOOSE_PGP_ID = 0x0103;
protected static final int REQUEST_BATTERY_OP = 0x13849ff; protected static final int REQUEST_BATTERY_OP = 0x13849ff;
public static final String ACCOUNT_EXTRA = "account";
public XmppConnectionService xmppConnectionService; public XmppConnectionService xmppConnectionService;
public boolean xmppConnectionServiceBound = false; public boolean xmppConnectionServiceBound = false;
protected boolean registeredListeners = false; protected boolean registeredListeners = false;
@ -1058,6 +1060,16 @@ public abstract class XmppActivity extends Activity {
} }
} }
protected Account extractAccount(Intent intent) {
String jid = intent != null ? intent.getStringExtra(ACCOUNT_EXTRA) : null;
Log.d(Config.LOGTAG,"jid: "+jid);
try {
return jid != null ? xmppConnectionService.findAccountByJid(Jid.fromString(jid)) : null;
} catch (InvalidJidException e) {
return null;
}
}
public static class ConferenceInvite { public static class ConferenceInvite {
private String uuid; private String uuid;
private List<Jid> jids = new ArrayList<>(); private List<Jid> jids = new ArrayList<>();