aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/conversations/java/eu/siacs/conversations/ui/MagicCreateActivity.java4
-rw-r--r--src/conversations/java/eu/siacs/conversations/ui/WelcomeActivity.java2
-rw-r--r--src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java8
-rw-r--r--src/main/java/eu/siacs/conversations/ui/UriHandlerActivity.java10
-rw-r--r--src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java1
5 files changed, 24 insertions, 1 deletions
diff --git a/src/conversations/java/eu/siacs/conversations/ui/MagicCreateActivity.java b/src/conversations/java/eu/siacs/conversations/ui/MagicCreateActivity.java
index 2c2ece9..4c34ad1 100644
--- a/src/conversations/java/eu/siacs/conversations/ui/MagicCreateActivity.java
+++ b/src/conversations/java/eu/siacs/conversations/ui/MagicCreateActivity.java
@@ -6,6 +6,7 @@ import android.os.Bundle;
import android.text.Editable;
import android.text.Html;
import android.text.TextWatcher;
+import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
@@ -49,6 +50,8 @@ public class MagicCreateActivity extends XmppActivity implements TextWatcher {
final Intent intent = getIntent();
XmppUri xmppUri = null;
+ Log.d(Config.LOGTAG, "Magic: " + intent.getStringExtra(WelcomeActivity.EXTRA_INVITE_URI));
+
if (intent != null && intent.getStringExtra(WelcomeActivity.EXTRA_INVITE_URI) != null) {
xmppUri = new XmppUri(intent.getStringExtra(WelcomeActivity.EXTRA_INVITE_URI));
}
@@ -111,6 +114,7 @@ public class MagicCreateActivity extends XmppActivity implements TextWatcher {
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
Toast.makeText(MagicCreateActivity.this, R.string.secure_password_generated, Toast.LENGTH_SHORT).show();
StartConversationActivity.addInviteUri(intent, getIntent());
+ intent.putExtra(StartConversationActivity.EXTRA_INVITE_URI, this.xmppUri.toString());
startActivity(intent);
}
} catch (IllegalArgumentException e) {
diff --git a/src/conversations/java/eu/siacs/conversations/ui/WelcomeActivity.java b/src/conversations/java/eu/siacs/conversations/ui/WelcomeActivity.java
index 3d29b90..0c92c15 100644
--- a/src/conversations/java/eu/siacs/conversations/ui/WelcomeActivity.java
+++ b/src/conversations/java/eu/siacs/conversations/ui/WelcomeActivity.java
@@ -7,12 +7,14 @@ import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
+import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;
import java.util.List;
+import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
import eu.siacs.conversations.databinding.ActivityWelcomeBinding;
import eu.siacs.conversations.entities.Account;
diff --git a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java
index 89c86f8..2e78bf0 100644
--- a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java
@@ -261,6 +261,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
jid.getDomain().equals(mInviteUri.getJid().getDomain());
if (mAccount != null) {
+ Log.d(Config.LOGTAG, "EditAccountActivity: Account already created");
if (mAccount.isOptionSet(Account.OPTION_MAGIC_CREATE)) {
mAccount.setOption(Account.OPTION_MAGIC_CREATE, mAccount.getPassword().contains(password));
}
@@ -271,6 +272,8 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
mAccount.setPassword(password);
mAccount.setOption(Account.OPTION_REGISTER, registerNewAccount);
+ //Log.d(Config.LOGTAG, "EditAccountActivity: inviteUri: " + mInviteUri.toString());
+
if (usePreAuth) {
mAccount.setPreAuthToken(mInviteUri.getPreAuthToken());
} else {
@@ -282,6 +285,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
return;
}
} else {
+ Log.d(Config.LOGTAG, "EditAccountActivity: New account created");
if (xmppConnectionService.findAccountByJid(jid) != null) {
binding.accountJidLayout.setError(getString(R.string.account_already_exists));
removeErrorsOnAllBut(binding.accountJidLayout);
@@ -704,7 +708,11 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
Log.d(Config.LOGTAG,"extras "+intent.getExtras());
this.mForceRegister = intent.hasExtra(EXTRA_FORCE_REGISTER) ? intent.getBooleanExtra(EXTRA_FORCE_REGISTER,false) : null;
Log.d(Config.LOGTAG,"force register="+mForceRegister);
+ Log.d(Config.LOGTAG, "EditAccountAcitivty: intent = " + intent.getStringExtra(StartConversationActivity.EXTRA_INVITE_URI));
this.mInitMode = init || this.jidToEdit == null;
+ if (intent.getStringExtra(StartConversationActivity.EXTRA_INVITE_URI) != null) {
+ this.mInviteUri = new XmppUri(intent.getStringExtra(StartConversationActivity.EXTRA_INVITE_URI));
+ }
this.messageFingerprint = intent.getStringExtra("fingerprint");
if (!mInitMode) {
this.binding.accountRegisterNew.setVisibility(View.GONE);
diff --git a/src/main/java/eu/siacs/conversations/ui/UriHandlerActivity.java b/src/main/java/eu/siacs/conversations/ui/UriHandlerActivity.java
index 95f179c..0ac1de5 100644
--- a/src/main/java/eu/siacs/conversations/ui/UriHandlerActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/UriHandlerActivity.java
@@ -9,12 +9,14 @@ import android.os.Build;
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
+import android.util.Log;
import android.widget.Toast;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
import eu.siacs.conversations.persistance.DatabaseBackend;
import eu.siacs.conversations.utils.SignupUtils;
@@ -87,8 +89,14 @@ public class UriHandlerActivity extends AppCompatActivity {
final XmppUri xmppUri = new XmppUri(uri);
final List<Jid> accounts = DatabaseBackend.getInstance(this).getAccountJids(true);
+ Log.d(Config.LOGTAG, uri.toString());
+
if (accounts.size() == 0) {
- if (xmppUri.isJidValid()) {
+ if (xmppUri.allowsIbr()) {
+ intent = new Intent(this, MagicCreateActivity.class);
+ intent.putExtra(WelcomeActivity.EXTRA_INVITE_URI, xmppUri.toString());
+ startActivity(intent);
+ } else if (xmppUri.isJidValid()) {
intent = SignupUtils.getSignUpIntent(this);
startActivity(intent);
} else {
diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java
index d97ec36..4cad210 100644
--- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java
+++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java
@@ -847,6 +847,7 @@ public class XmppConnection implements Runnable {
sendStartTLS();
} else if (this.streamFeatures.hasChild("register") && account.isOptionSet(Account.OPTION_REGISTER)) {
if (isSecure) {
+ Log.d(Config.LOGTAG, "account;preAuthToken: " + account.getPreAuthToken());
if (account.getPreAuthToken() != null) {
sendPreAuthRegistryRequest();
} else {