mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-22 06:12:05 +01:00
Remove PacketParserutils.getLanguageAttribute(XmlPullParser)
This commit is contained in:
parent
a9e45475ab
commit
6d76e8a1ae
1 changed files with 4 additions and 21 deletions
|
@ -230,7 +230,7 @@ public class PacketParserUtils {
|
||||||
if (typeString != null) {
|
if (typeString != null) {
|
||||||
message.setType(Message.Type.fromString(typeString));
|
message.setType(Message.Type.fromString(typeString));
|
||||||
}
|
}
|
||||||
String language = getLanguageAttribute(parser);
|
String language = ParserUtils.getXmlLang(parser);
|
||||||
message.setLanguage(language);
|
message.setLanguage(language);
|
||||||
|
|
||||||
// Parse sub-elements. We include extra logic to make sure the values
|
// Parse sub-elements. We include extra logic to make sure the values
|
||||||
|
@ -245,7 +245,7 @@ public class PacketParserUtils {
|
||||||
String namespace = parser.getNamespace();
|
String namespace = parser.getNamespace();
|
||||||
switch (elementName) {
|
switch (elementName) {
|
||||||
case "subject":
|
case "subject":
|
||||||
String xmlLangSubject = getLanguageAttribute(parser);
|
String xmlLangSubject = ParserUtils.getXmlLang(parser);
|
||||||
String subject = parseElementText(parser);
|
String subject = parseElementText(parser);
|
||||||
|
|
||||||
if (message.getSubject(xmlLangSubject) == null) {
|
if (message.getSubject(xmlLangSubject) == null) {
|
||||||
|
@ -517,7 +517,7 @@ public class PacketParserUtils {
|
||||||
presence.setFrom(ParserUtils.getJidAttribute(parser, "from"));
|
presence.setFrom(ParserUtils.getJidAttribute(parser, "from"));
|
||||||
presence.setStanzaId(parser.getAttributeValue("", "id"));
|
presence.setStanzaId(parser.getAttributeValue("", "id"));
|
||||||
|
|
||||||
String language = getLanguageAttribute(parser);
|
String language = ParserUtils.getXmlLang(parser);
|
||||||
if (language != null && !"".equals(language.trim())) {
|
if (language != null && !"".equals(language.trim())) {
|
||||||
// CHECKSTYLE:OFF
|
// CHECKSTYLE:OFF
|
||||||
presence.setLanguage(language);
|
presence.setLanguage(language);
|
||||||
|
@ -733,7 +733,7 @@ public class PacketParserUtils {
|
||||||
if (descriptiveTexts == null) {
|
if (descriptiveTexts == null) {
|
||||||
descriptiveTexts = new HashMap<>();
|
descriptiveTexts = new HashMap<>();
|
||||||
}
|
}
|
||||||
String xmllang = getLanguageAttribute(parser);
|
String xmllang = ParserUtils.getXmlLang(parser);
|
||||||
if (xmllang == null) {
|
if (xmllang == null) {
|
||||||
// XMPPError assumes the default locale, 'en', or the empty string.
|
// XMPPError assumes the default locale, 'en', or the empty string.
|
||||||
// Establish the invariant that there is never null as a key.
|
// Establish the invariant that there is never null as a key.
|
||||||
|
@ -977,23 +977,6 @@ public class PacketParserUtils {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Remove this static method and use ParserUtils.getXmlLang(XmlPullParser) instead.
|
|
||||||
private static String getLanguageAttribute(XmlPullParser parser) {
|
|
||||||
// CHECKSTYLE:OFF
|
|
||||||
for (int i = 0; i < parser.getAttributeCount(); i++) {
|
|
||||||
String attributeName = parser.getAttributeName(i);
|
|
||||||
if ( "xml:lang".equals(attributeName) ||
|
|
||||||
// CHECKSTYLE:ON
|
|
||||||
("lang".equals(attributeName) &&
|
|
||||||
"xml".equals(parser.getAttributePrefix(i)))) {
|
|
||||||
// CHECKSTYLE:OFF
|
|
||||||
return parser.getAttributeValue(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
// CHECKSTYLE:ON
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void addPacketExtension(Stanza packet, XmlPullParser parser) throws Exception {
|
public static void addPacketExtension(Stanza packet, XmlPullParser parser) throws Exception {
|
||||||
addExtensionElement(packet, parser);
|
addExtensionElement(packet, parser);
|
||||||
|
|
Loading…
Reference in a new issue