mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-25 21:42:07 +01:00
Merge branch 'master' of github.com:igniterealtime/Smack
This commit is contained in:
commit
b83dacc60a
3 changed files with 26 additions and 11 deletions
|
@ -24,5 +24,5 @@ dependencies {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the Android jar to the Eclipse .classpath.
|
// Add the Android jar to the Eclipse .classpath.
|
||||||
compile files(androidBootClasspath)
|
compileOnly files(androidBootClasspath)
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,16 +66,24 @@ public class AbstractError {
|
||||||
* @return the descriptive text or null.
|
* @return the descriptive text or null.
|
||||||
*/
|
*/
|
||||||
public String getDescriptiveText() {
|
public String getDescriptiveText() {
|
||||||
String defaultLocale = Locale.getDefault().getLanguage();
|
if (descriptiveTexts.isEmpty())
|
||||||
String descriptiveText = getDescriptiveText(defaultLocale);
|
return null;
|
||||||
if (descriptiveText == null) {
|
// attempt to obtain the text in the user's locale, the English text, or the "" default
|
||||||
descriptiveText = getDescriptiveText("en");
|
Locale l = Locale.getDefault();
|
||||||
if (descriptiveText == null) {
|
String[] tags = new String[] {
|
||||||
descriptiveText = getDescriptiveText("");
|
l.getLanguage() + "-" + l.getCountry() + "-" + l.getVariant(),
|
||||||
}
|
l.getLanguage() + "-" + l.getCountry(),
|
||||||
}
|
l.getLanguage(),
|
||||||
|
"en",
|
||||||
|
""
|
||||||
|
};
|
||||||
|
for (String tag : tags) {
|
||||||
|
String descriptiveText = getDescriptiveText(tag);
|
||||||
|
if (descriptiveText != null)
|
||||||
return descriptiveText;
|
return descriptiveText;
|
||||||
}
|
}
|
||||||
|
return descriptiveTexts.values().iterator().next();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the descriptive test of this SASLFailure.
|
* Get the descriptive test of this SASLFailure.
|
||||||
|
|
|
@ -51,6 +51,8 @@ public final class StableUniqueStanzaIdManager extends Manager {
|
||||||
|
|
||||||
private static final Map<XMPPConnection, StableUniqueStanzaIdManager> INSTANCES = new WeakHashMap<>();
|
private static final Map<XMPPConnection, StableUniqueStanzaIdManager> INSTANCES = new WeakHashMap<>();
|
||||||
|
|
||||||
|
private static boolean enabledByDefault = true;
|
||||||
|
|
||||||
// Filter for outgoing stanzas.
|
// Filter for outgoing stanzas.
|
||||||
private static final StanzaFilter OUTGOING_FILTER = new AndFilter(
|
private static final StanzaFilter OUTGOING_FILTER = new AndFilter(
|
||||||
MessageTypeFilter.NORMAL_OR_CHAT_OR_HEADLINE,
|
MessageTypeFilter.NORMAL_OR_CHAT_OR_HEADLINE,
|
||||||
|
@ -72,7 +74,9 @@ public final class StableUniqueStanzaIdManager extends Manager {
|
||||||
XMPPConnectionRegistry.addConnectionCreationListener(new ConnectionCreationListener() {
|
XMPPConnectionRegistry.addConnectionCreationListener(new ConnectionCreationListener() {
|
||||||
@Override
|
@Override
|
||||||
public void connectionCreated(XMPPConnection connection) {
|
public void connectionCreated(XMPPConnection connection) {
|
||||||
getInstanceFor(connection);
|
if (enabledByDefault) {
|
||||||
|
getInstanceFor(connection).enable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -83,7 +87,10 @@ public final class StableUniqueStanzaIdManager extends Manager {
|
||||||
*/
|
*/
|
||||||
private StableUniqueStanzaIdManager(XMPPConnection connection) {
|
private StableUniqueStanzaIdManager(XMPPConnection connection) {
|
||||||
super(connection);
|
super(connection);
|
||||||
enable();
|
}
|
||||||
|
|
||||||
|
public static void setEnabledByDefault(boolean enabled) {
|
||||||
|
enabledByDefault = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue