aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2016-05-30 21:12:04 +0200
committerDaniel Gultsch <daniel@gultsch.de>2016-05-30 21:12:04 +0200
commit9321ccc775776abeba764371a3d3102b16ff18b8 (patch)
tree1e7a6ddeff99abae0c90c17048f3999e5a20f4a8 /src/main/java/eu
parent8eb1640a265628e47e437d0ff75ceea5b83c4a38 (diff)
handle app links for conferences
Diffstat (limited to 'src/main/java/eu')
-rw-r--r--src/main/java/eu/siacs/conversations/services/XmppConnectionService.java10
-rw-r--r--src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java21
-rw-r--r--src/main/java/eu/siacs/conversations/utils/XmppUri.java1
3 files changed, 26 insertions, 6 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
index 7eebe069..757e29b5 100644
--- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
@@ -3124,6 +3124,16 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
return contacts;
}
+ public Conversation findFirstMuc(Jid jid) {
+ for(Conversation conversation : getConversations()) {
+ if (conversation.getJid().toBareJid().equals(jid.toBareJid())
+ && conversation.getMode() == Conversation.MODE_MULTI) {
+ return conversation;
+ }
+ }
+ return null;
+ }
+
public NotificationService getNotificationService() {
return this.mNotificationService;
}
diff --git a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java
index 548682df..17f9944f 100644
--- a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java
@@ -846,7 +846,16 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
private boolean handleJid(Invite invite) {
List<Contact> contacts = xmppConnectionService.findContacts(invite.getJid());
- if (contacts.size() == 0) {
+ if (invite.isMuc()) {
+ Conversation muc = xmppConnectionService.findFirstMuc(invite.getJid());
+ if (muc != null) {
+ switchToConversation(muc);
+ return true;
+ } else {
+ showJoinConferenceDialog(invite.getJid().toBareJid().toString());
+ return false;
+ }
+ } else if (contacts.size() == 0) {
showCreateContactDialog(invite.getJid().toString(),invite.getFingerprint());
return false;
} else if (contacts.size() == 1) {
@@ -1020,13 +1029,13 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
boolean invite() {
if (jid != null) {
- if (muc) {
- showJoinConferenceDialog(jid);
- } else {
- return handleJid(this);
- }
+ return handleJid(this);
}
return false;
}
+
+ public boolean isMuc() {
+ return muc;
+ }
}
}
diff --git a/src/main/java/eu/siacs/conversations/utils/XmppUri.java b/src/main/java/eu/siacs/conversations/utils/XmppUri.java
index 7a56d38f..15a6c9a1 100644
--- a/src/main/java/eu/siacs/conversations/utils/XmppUri.java
+++ b/src/main/java/eu/siacs/conversations/utils/XmppUri.java
@@ -47,6 +47,7 @@ public class XmppUri {
// sample : https://conversations.im/i/foo/bar.com
jid = segments.get(1) + "@" + segments.get(2);
}
+ muc = segments.size() > 1 && "j".equalsIgnoreCase(segments.get(0));
} else if ("xmpp".equalsIgnoreCase(scheme)) {
// sample: xmpp:foo@bar.com
muc = "join".equalsIgnoreCase(uri.getQuery());