aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2017-12-05 17:29:05 +0100
committerDaniel Gultsch <daniel@gultsch.de>2017-12-05 17:29:05 +0100
commit5885bc7f252631a5f41ed8dd4c8d354dbfeb922c (patch)
treefca36f526b2261a690c951c86ebdc937996e9707
parentb5fe8789e949b08001a4f29bd2e929f1eae1c664 (diff)
show warning when opening invalid jid
-rw-r--r--src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java4
-rw-r--r--src/main/java/eu/siacs/conversations/utils/XmppUri.java9
2 files changed, 13 insertions, 0 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java
index 765e77b..b246130 100644
--- a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java
@@ -1193,6 +1193,10 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
public String account;
boolean invite() {
+ if (!isJidValid()) {
+ Toast.makeText(StartConversationActivity.this,R.string.invalid_jid,Toast.LENGTH_SHORT).show();
+ return false;
+ }
if (getJid() != null) {
return handleJid(this);
}
diff --git a/src/main/java/eu/siacs/conversations/utils/XmppUri.java b/src/main/java/eu/siacs/conversations/utils/XmppUri.java
index 9e8f611..bfd4b7c 100644
--- a/src/main/java/eu/siacs/conversations/utils/XmppUri.java
+++ b/src/main/java/eu/siacs/conversations/utils/XmppUri.java
@@ -151,6 +151,15 @@ public class XmppUri {
}
}
+ public boolean isJidValid() {
+ try {
+ Jid.fromString(jid);
+ return true;
+ } catch (InvalidJidException e) {
+ return false;
+ }
+ }
+
public String getBody() {
return body;
}