made muc join easier if muc server is known. added room to key words

This commit is contained in:
iNPUTmice 2014-06-12 09:54:19 +02:00
parent bb90452673
commit e353a1c109
3 changed files with 17 additions and 2 deletions

View File

@ -139,6 +139,7 @@ public class Contact {
} else { } else {
return (domainParts[0].equals("conf") return (domainParts[0].equals("conf")
|| domainParts[0].equals("conference") || domainParts[0].equals("conference")
|| domainParts[0].equals("room")
|| domainParts[0].equals("muc") || domainParts[0].equals("muc")
|| domainParts[0].equals("sala") || domainParts[0] || domainParts[0].equals("sala") || domainParts[0]
.equals("salas")); .equals("salas"));

View File

@ -18,6 +18,7 @@ import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.text.Editable; import android.text.Editable;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.util.Log;
import android.util.SparseBooleanArray; import android.util.SparseBooleanArray;
import android.view.ActionMode; import android.view.ActionMode;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -433,7 +434,9 @@ public class ContactsActivity extends XmppActivity {
} }
public void showIsMucDialogIfNeeded(final Contact clickedContact) { 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); AlertDialog.Builder dialog = new AlertDialog.Builder(this);
dialog.setTitle(getString(R.string.multi_user_conference)); dialog.setTitle(getString(R.string.multi_user_conference));
dialog.setMessage(getString(R.string.trying_join_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) { public void startConversation(Contact contact, Account account, boolean muc) {
if (!contact.getOption(Contact.Options.IN_ROSTER)&&(!muc)) { if (!contact.getOption(Contact.Options.IN_ROSTER)&&(!muc)) {
xmppConnectionService.createContact(contact); xmppConnectionService.createContact(contact);

View File

@ -936,7 +936,7 @@ public class XmppConnection implements Runnable {
.iterator(); .iterator();
while (it.hasNext()) { while (it.hasNext()) {
Entry<String, List<String>> pairs = it.next(); Entry<String, List<String>> pairs = it.next();
if (pairs.getValue().contains(feature)) { if (pairs.getValue().contains(feature)&&pairs.getValue().size()==1) {
return pairs.getKey(); return pairs.getKey();
} }
it.remove(); it.remove();