show warning when opening invalid jid

This commit is contained in:
Daniel Gultsch 2017-12-05 17:29:05 +01:00
parent b5fe8789e9
commit 5885bc7f25
2 changed files with 13 additions and 0 deletions

View file

@ -1193,6 +1193,10 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
public String account; public String account;
boolean invite() { boolean invite() {
if (!isJidValid()) {
Toast.makeText(StartConversationActivity.this,R.string.invalid_jid,Toast.LENGTH_SHORT).show();
return false;
}
if (getJid() != null) { if (getJid() != null) {
return handleJid(this); return handleJid(this);
} }

View file

@ -151,6 +151,15 @@ public class XmppUri {
} }
} }
public boolean isJidValid() {
try {
Jid.fromString(jid);
return true;
} catch (InvalidJidException e) {
return false;
}
}
public String getBody() { public String getBody() {
return body; return body;
} }