aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-09-27 19:50:14 +0200
committerChristian Schneppe <christian@pix-art.de>2018-09-27 19:50:14 +0200
commit0623a7d785d291da89241933b078e96a2f33a1c9 (patch)
tree55916c9c799ecbca81941ae384bc740d1457a3a4 /src
parentf47e244675ee459e1495212ace602c43ac174728 (diff)
catch jabber.pix-art.de invite urls directly in fragment
Diffstat (limited to 'src')
-rw-r--r--src/main/java/de/pixart/messenger/Config.java1
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java2
-rw-r--r--src/main/java/de/pixart/messenger/ui/text/FixedURLSpan.java6
3 files changed, 7 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/Config.java b/src/main/java/de/pixart/messenger/Config.java
index e2914f9d3..147bb6873 100644
--- a/src/main/java/de/pixart/messenger/Config.java
+++ b/src/main/java/de/pixart/messenger/Config.java
@@ -45,6 +45,7 @@ public final class Config {
public static final String inviteUserURL = "https://jabber.pix-art.de/i/";
public static final String inviteMUCURL = "https://jabber.pix-art.de/j/";
+ public static final String inviteHostURL = "jabber.pix-art.de"; // without http(s)
public static final String CHANGELOG_URL = "https://github.com/kriztan/Pix-Art-Messenger/blob/master/CHANGELOG.md";
public static final String XMPP_IP = null; //BuildConfig.XMPP_IP; // set to null means disable
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
index a32f591a6..41d029d12 100644
--- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
+++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
@@ -3800,7 +3800,7 @@ public class XmppConnectionService extends Service {
public Conversation findUniqueConversationByJid(XmppUri xmppUri) {
List<Conversation> findings = new ArrayList<>();
for (Conversation c : getConversations()) {
- if (c.getJid().asBareJid().equals(xmppUri.getJid()) && ((c.getMode() == Conversational.MODE_MULTI) == xmppUri.isAction(XmppUri.ACTION_JOIN))) {
+ if (c.getAccount().isEnabled() && c.getJid().asBareJid().equals(xmppUri.getJid()) && ((c.getMode() == Conversational.MODE_MULTI) == xmppUri.isAction(XmppUri.ACTION_JOIN))) {
findings.add(c);
}
}
diff --git a/src/main/java/de/pixart/messenger/ui/text/FixedURLSpan.java b/src/main/java/de/pixart/messenger/ui/text/FixedURLSpan.java
index 353887054..67232462c 100644
--- a/src/main/java/de/pixart/messenger/ui/text/FixedURLSpan.java
+++ b/src/main/java/de/pixart/messenger/ui/text/FixedURLSpan.java
@@ -41,6 +41,9 @@ import android.text.style.URLSpan;
import android.view.View;
import android.widget.Toast;
+import java.util.Arrays;
+
+import de.pixart.messenger.Config;
import de.pixart.messenger.R;
import de.pixart.messenger.ui.ConversationsActivity;
@@ -64,7 +67,8 @@ public class FixedURLSpan extends URLSpan {
public void onClick(View widget) {
final Uri uri = Uri.parse(getURL());
final Context context = widget.getContext();
- if (uri.getScheme().equals("xmpp") && context instanceof ConversationsActivity) {
+ final boolean candidateToProcessDirecty = "xmpp".equals(uri.getScheme()) || ("https".equals(uri.getScheme()) && Config.inviteHostURL.equals(uri.getHost()) && uri.getPathSegments().size() > 1 && Arrays.asList("j", "i").contains(uri.getPathSegments().get(0)));
+ if (candidateToProcessDirecty && context instanceof ConversationsActivity) {
if (((ConversationsActivity) context).onXmppUriClicked(uri)) {
widget.playSoundEffect(0);
return;