From e353a1c109f68f212c9fbf76c5186be97c835628 Mon Sep 17 00:00:00 2001 From: iNPUTmice Date: Thu, 12 Jun 2014 09:54:19 +0200 Subject: made muc join easier if muc server is known. added room to key words --- src/eu/siacs/conversations/entities/Contact.java | 1 + src/eu/siacs/conversations/ui/ContactsActivity.java | 16 +++++++++++++++- src/eu/siacs/conversations/xmpp/XmppConnection.java | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/eu/siacs/conversations/entities/Contact.java b/src/eu/siacs/conversations/entities/Contact.java index 58f1f135..4ce20782 100644 --- a/src/eu/siacs/conversations/entities/Contact.java +++ b/src/eu/siacs/conversations/entities/Contact.java @@ -139,6 +139,7 @@ public class Contact { } else { return (domainParts[0].equals("conf") || domainParts[0].equals("conference") + || domainParts[0].equals("room") || domainParts[0].equals("muc") || domainParts[0].equals("sala") || domainParts[0] .equals("salas")); diff --git a/src/eu/siacs/conversations/ui/ContactsActivity.java b/src/eu/siacs/conversations/ui/ContactsActivity.java index f4c8ef0b..9e9952bc 100644 --- a/src/eu/siacs/conversations/ui/ContactsActivity.java +++ b/src/eu/siacs/conversations/ui/ContactsActivity.java @@ -18,6 +18,7 @@ import android.os.Bundle; import android.preference.PreferenceManager; import android.text.Editable; import android.text.TextWatcher; +import android.util.Log; import android.util.SparseBooleanArray; import android.view.ActionMode; import android.view.LayoutInflater; @@ -433,7 +434,9 @@ public class ContactsActivity extends XmppActivity { } public void showIsMucDialogIfNeeded(final Contact clickedContact) { - if (clickedContact.couldBeMuc()) { + if (isMuc(clickedContact)) { + startConversation(clickedContact,clickedContact.getAccount(), true); + } else if (clickedContact.couldBeMuc()) { AlertDialog.Builder dialog = new AlertDialog.Builder(this); dialog.setTitle(getString(R.string.multi_user_conference)); dialog.setMessage(getString(R.string.trying_join_conference)); @@ -459,6 +462,17 @@ public class ContactsActivity extends XmppActivity { false); } } + + private boolean isMuc(Contact contact) { + ArrayList mucServers = new ArrayList(); + for(Account account : accounts) { + if (account.getXmppConnection()!=null) { + mucServers.add(account.getXmppConnection().getMucServer()); + } + } + String server = contact.getJid().split("@")[1]; + return mucServers.contains(server); + } public void startConversation(Contact contact, Account account, boolean muc) { if (!contact.getOption(Contact.Options.IN_ROSTER)&&(!muc)) { diff --git a/src/eu/siacs/conversations/xmpp/XmppConnection.java b/src/eu/siacs/conversations/xmpp/XmppConnection.java index 74639d42..4ac61ca7 100644 --- a/src/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/eu/siacs/conversations/xmpp/XmppConnection.java @@ -936,7 +936,7 @@ public class XmppConnection implements Runnable { .iterator(); while (it.hasNext()) { Entry> pairs = it.next(); - if (pairs.getValue().contains(feature)) { + if (pairs.getValue().contains(feature)&&pairs.getValue().size()==1) { return pairs.getKey(); } it.remove(); -- cgit v1.2.3