aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-12-10 21:34:52 +0100
committerChristian Schneppe <christian@pix-art.de>2017-12-10 21:34:52 +0100
commita1e3198deea193cf4392b0a37d724ebfb1ab4d19 (patch)
tree80a82e48f8893af80bc5d0b2e3f53a8a5ae31fca
parent8031e1e521f5e051f11c48ac5ebdda0956837e9c (diff)
show warning when opening invalid jid
Diffstat (limited to '')
-rw-r--r--src/main/java/de/pixart/messenger/ui/StartConversationActivity.java4
-rw-r--r--src/main/java/de/pixart/messenger/utils/XmppUri.java9
2 files changed, 13 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java
index 642296c31..23a0bf011 100644
--- a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java
@@ -1192,6 +1192,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/de/pixart/messenger/utils/XmppUri.java b/src/main/java/de/pixart/messenger/utils/XmppUri.java
index 120f0e88a..24c0b3bff 100644
--- a/src/main/java/de/pixart/messenger/utils/XmppUri.java
+++ b/src/main/java/de/pixart/messenger/utils/XmppUri.java
@@ -156,6 +156,15 @@ public class XmppUri {
}
}
+ public boolean isJidValid() {
+ try {
+ Jid.fromString(jid);
+ return true;
+ } catch (InvalidJidException e) {
+ return false;
+ }
+ }
+
public String getBody() {
return body;
}