diff options
Diffstat (limited to '')
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/XmppActivity.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java index 0cefe1d2d..ad1cbf905 100644 --- a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java @@ -359,6 +359,9 @@ public abstract class XmppActivity extends Activity { @Override public boolean onOptionsItemSelected(final MenuItem item) { switch (item.getItemId()) { + case R.id.action_invite_user: + inviteUser(); + break; case R.id.action_settings: startActivity(new Intent(this, SettingsActivity.class)); break; @@ -1076,6 +1079,19 @@ public abstract class XmppActivity extends Activity { return null; } + private void inviteUser() { + Account mAccount = xmppConnectionService.getAccounts().get(0); + String user = mAccount.getJid().getLocalpart().toString(); + String domain = mAccount.getJid().getDomainpart().toString(); + String inviteURL = Config.inviteUserURL + user + "/" + domain; + String inviteText = getString(R.string.InviteText, user); + Intent intent = new Intent(android.content.Intent.ACTION_SEND); + intent.setType("text/plain"); + intent.putExtra(Intent.EXTRA_SUBJECT, user + " " + getString(R.string.inviteUser_Subject) + " " + getString(R.string.app_name)); + intent.putExtra(Intent.EXTRA_TEXT, inviteText + "\n\n" + inviteURL); + startActivity(Intent.createChooser(intent, getString(R.string.invite_contact))); + } + @Override public void onResume() { super.onResume(); |