aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2016-01-22 20:21:45 +0100
committerDaniel Gultsch <daniel@gultsch.de>2016-01-22 20:21:45 +0100
commita47430c2f73714f832c5a4d75668044425e0d606 (patch)
treeca898cb3d48f724996611d89b458429126797c38 /src/main/java/eu
parent40005cec1b1a864c529ead082a6e41a1471c874c (diff)
added convenience method to extract account from intent
Diffstat (limited to 'src/main/java/eu')
-rw-r--r--src/main/java/eu/siacs/conversations/ui/XmppActivity.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
index 55d4a5f6..3e4d51c8 100644
--- a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
@@ -95,6 +95,8 @@ public abstract class XmppActivity extends Activity {
protected static final int REQUEST_CHOOSE_PGP_ID = 0x0103;
protected static final int REQUEST_BATTERY_OP = 0x13849ff;
+ public static final String ACCOUNT_EXTRA = "account";
+
public XmppConnectionService xmppConnectionService;
public boolean xmppConnectionServiceBound = false;
protected boolean registeredListeners = false;
@@ -977,7 +979,7 @@ public abstract class XmppActivity extends Activity {
@Override
public NdefMessage createNdefMessage(NfcEvent nfcEvent) {
return new NdefMessage(new NdefRecord[]{
- NdefRecord.createUri(getShareableUri()),
+ NdefRecord.createUri(getShareableUri()),
NdefRecord.createApplicationRecord("eu.siacs.conversations")
});
}
@@ -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 {
private String uuid;
private List<Jid> jids = new ArrayList<>();