1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-25 15:52:06 +01:00

Merge pull request #287 from ge0rg/4.3

Partially fix boolean parser, 4.3 branch
This commit is contained in:
Florian Schmaus 2018-11-28 13:57:22 +01:00 committed by GitHub
commit b675f49b3d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 4 deletions

View file

@ -141,7 +141,7 @@ public class ParserUtils {
if (valueString == null) if (valueString == null)
return null; return null;
valueString = valueString.toLowerCase(Locale.US); valueString = valueString.toLowerCase(Locale.US);
return valueString.equals("true") || valueString.equals("0"); return valueString.equals("true") || valueString.equals("1");
} }
public static boolean getBooleanAttribute(XmlPullParser parser, String name, public static boolean getBooleanAttribute(XmlPullParser parser, String name,

View file

@ -269,12 +269,12 @@ public class Bookmarks implements PrivateData {
private static BookmarkedConference getConferenceStorage(XmlPullParser parser) throws XmlPullParserException, IOException { private static BookmarkedConference getConferenceStorage(XmlPullParser parser) throws XmlPullParserException, IOException {
String name = parser.getAttributeValue("", "name"); String name = parser.getAttributeValue("", "name");
String autojoin = parser.getAttributeValue("", "autojoin"); boolean autojoin = ParserUtils.getBooleanAttribute(parser, "autojoin", false);
EntityBareJid jid = ParserUtils.getBareJidAttribute(parser); EntityBareJid jid = ParserUtils.getBareJidAttribute(parser);
BookmarkedConference conf = new BookmarkedConference(jid); BookmarkedConference conf = new BookmarkedConference(jid);
conf.setName(name); conf.setName(name);
conf.setAutoJoin(Boolean.valueOf(autojoin)); conf.setAutoJoin(autojoin);
// Check for nickname // Check for nickname
boolean done = false; boolean done = false;

View file

@ -207,7 +207,8 @@ public class RoomInfo {
FormField subjectmodField = form.getField("muc#roominfo_subjectmod"); FormField subjectmodField = form.getField("muc#roominfo_subjectmod");
if (subjectmodField != null && !subjectmodField.getValues().isEmpty()) { if (subjectmodField != null && !subjectmodField.getValues().isEmpty()) {
subjectmod = Boolean.valueOf(subjectmodField.getFirstValue()); String firstValue = subjectmodField.getFirstValue();
subjectmod = ("true".equals(firstValue) || "1".equals(firstValue));
} }
FormField urlField = form.getField("muc#roominfo_logs"); FormField urlField = form.getField("muc#roominfo_logs");