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

Uses voice as default number detail, if no type is available.

This commit is contained in:
damencho 2015-12-05 23:17:22 -06:00 committed by Florian Schmaus
parent 035bbea837
commit db72917bb4

View file

@ -18,6 +18,7 @@ package org.jivesoftware.smackx.vcardtemp.provider;
import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smackx.vcardtemp.packet.VCard; import org.jivesoftware.smackx.vcardtemp.packet.VCard;
import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserException;
@ -172,7 +173,12 @@ public class VCardProvider extends IQProvider<VCard> {
isWork = false; isWork = false;
} }
else { else {
if (telLabel != null && "NUMBER".equals(name)) { if ("NUMBER".equals(name)) {
if (StringUtils.isNullOrEmpty(telLabel)) {
// RFC 2426 § 3.3.1:
// "The default type is 'voice'"
telLabel = "VOICE";
}
if (isWork) { if (isWork) {
vCard.setPhoneWork(telLabel, parser.nextText()); vCard.setPhoneWork(telLabel, parser.nextText());
} }