print available stream features / mechanisms on incompat server
This commit is contained in:
parent
ef09b0ab1a
commit
bebce313b2
|
@ -358,7 +358,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
|
|||
final boolean groupChat = mConversation != null && mConversation.isPrivateAndNonAnonymous();
|
||||
getMenuInflater().inflate(R.menu.muc_details, menu);
|
||||
final MenuItem share = menu.findItem(R.id.action_share);
|
||||
share.setVisible(groupChat);
|
||||
share.setVisible(!groupChat);
|
||||
final MenuItem destroy = menu.findItem(R.id.action_destroy_room);
|
||||
destroy.setTitle(groupChat ? R.string.destroy_room : R.string.destroy_channel);
|
||||
AccountUtils.showHideMenuItems(menu);
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package eu.siacs.conversations.utils;
|
||||
|
||||
import eu.siacs.conversations.xml.Element;
|
||||
|
||||
public class XmlHelper {
|
||||
public static String encodeEntities(String content) {
|
||||
content = content.replace("&", "&");
|
||||
|
@ -10,4 +12,19 @@ public class XmlHelper {
|
|||
content = content.replaceAll("[\\p{Cntrl}&&[^\n\t\r]]", "");
|
||||
return content;
|
||||
}
|
||||
|
||||
public static String printElementNames(final Element element) {
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
builder.append('[');
|
||||
if (element != null) {
|
||||
for (Element child : element.getChildren()) {
|
||||
if (builder.length() != 1) {
|
||||
builder.append(',');
|
||||
}
|
||||
builder.append(child.getName());
|
||||
}
|
||||
}
|
||||
builder.append(']');
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,6 +78,7 @@ import eu.siacs.conversations.utils.Patterns;
|
|||
import eu.siacs.conversations.utils.Resolver;
|
||||
import eu.siacs.conversations.utils.SSLSocketHelper;
|
||||
import eu.siacs.conversations.utils.SocksSocketFactory;
|
||||
import eu.siacs.conversations.utils.XmlHelper;
|
||||
import eu.siacs.conversations.xml.Element;
|
||||
import eu.siacs.conversations.xml.Namespace;
|
||||
import eu.siacs.conversations.xml.Tag;
|
||||
|
@ -847,6 +848,7 @@ public class XmppConnection implements Runnable {
|
|||
if (isSecure) {
|
||||
sendRegistryRequest();
|
||||
} else {
|
||||
Log.d(Config.LOGTAG,account.getJid().asBareJid()+": unable to find STARTTLS for registration process "+ XmlHelper.printElementNames(this.streamFeatures));
|
||||
throw new StateChangingException(Account.State.INCOMPATIBLE_SERVER);
|
||||
}
|
||||
} else if (!this.streamFeatures.hasChild("register") && account.isOptionSet(Account.OPTION_REGISTER)) {
|
||||
|
@ -865,6 +867,7 @@ public class XmppConnection implements Runnable {
|
|||
if (this.streamFeatures.hasChild("bind") && isSecure) {
|
||||
sendBindRequest();
|
||||
} else {
|
||||
Log.d(Config.LOGTAG,account.getJid().asBareJid()+": unable to find bind feature "+ XmlHelper.printElementNames(this.streamFeatures));
|
||||
throw new StateChangingException(Account.State.INCOMPATIBLE_SERVER);
|
||||
}
|
||||
}
|
||||
|
@ -903,6 +906,7 @@ public class XmppConnection implements Runnable {
|
|||
}
|
||||
tagWriter.writeElement(auth);
|
||||
} else {
|
||||
Log.d(Config.LOGTAG,account.getJid().asBareJid()+": unable to find SASL mechanism "+ saslMechanism.toString());
|
||||
throw new StateChangingException(Account.State.INCOMPATIBLE_SERVER);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue