I use Smack 2.1.0 with WildFire 2.4.0 and Psi 0.9.3. VCards, published by Psi, do not recognized by VCardProvider correctly. For my purposes i have made following changes:
- setupPhones() method now works with
published by Psi:
private void setupPhones() {
NodeList allPhones = document.getElementsByTagName(“TEL”);
for (int i = 0; i < allPhones.getLength(); i++) {
NodeList nodes = allPhones.item(i).getChildNodes();
String type = null;
String code = null;
String value = null;
for (int j = 0; j < nodes.getLength(); j++) {
Node node = nodes.item(j);
if (node.getNodeType() != Node.ELEMENT_NODE) continue;
if (“NUMBER”.equals(node.getNodeName())) {
value = getTextContent(node);
} else if (“HOME”.equals(node.getNodeName())
|| “WORK”.equals(node.getNodeName())) {
type = node.getNodeName();
} else {
code = node.getNodeName();
}
}
if (code == null || value == null) continue;
if (“HOME”.equals(type)) {
vCard.setPhoneHome(code, value);
} else if (“WORK”.equals(type)) {
vCard.setPhoneWork(code, value);
}
}
}
- in initializeFields() method instead of
setupPhones(“WORK”, true);
setupPhones(“HOME”, false);
now just
setupPhones();
I think, the same can be done with setupAddress(…)
- Also I need “FN” field, therefore I have commented line:
if (“FN”.equals(element.getNodeName())) continue;
in setupSimpleFields() method. Why this field is skiped?
If you interested in such fixes, I can send you my sources.
Respectfully
Alexander