made muc join easier if muc server is known. added room to key words
This commit is contained in:
parent
bb90452673
commit
e353a1c109
|
@ -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"));
|
||||
|
|
|
@ -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));
|
||||
|
@ -460,6 +463,17 @@ public class ContactsActivity extends XmppActivity {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean isMuc(Contact contact) {
|
||||
ArrayList<String> mucServers = new ArrayList<String>();
|
||||
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)) {
|
||||
xmppConnectionService.createContact(contact);
|
||||
|
|
|
@ -936,7 +936,7 @@ public class XmppConnection implements Runnable {
|
|||
.iterator();
|
||||
while (it.hasNext()) {
|
||||
Entry<String, List<String>> pairs = it.next();
|
||||
if (pairs.getValue().contains(feature)) {
|
||||
if (pairs.getValue().contains(feature)&&pairs.getValue().size()==1) {
|
||||
return pairs.getKey();
|
||||
}
|
||||
it.remove();
|
||||
|
|
Loading…
Reference in a new issue