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
1 changed files with 7 additions and 1 deletions

View File

@ -18,6 +18,7 @@ package org.jivesoftware.smackx.vcardtemp.provider;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smackx.vcardtemp.packet.VCard;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@ -172,7 +173,12 @@ public class VCardProvider extends IQProvider<VCard> {
isWork = false;
}
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) {
vCard.setPhoneWork(telLabel, parser.nextText());
}