It is most probably because VCard was one of the first classes which I “upgraded” to use XML instead of XMLNode, but there might be some remainders like this.
getNode() returns XMLNode, that is why the casting is incorrect.
I agree. It looks like the problem started with revision 11196 when we started converting from XMLNode to XML, which introduced the typecast problem in question. I’m not entirely sure how to fix this. I have a working version of VCard.as with avatar upload support that predates revision 11196 but I don’t think we want to go that route as it would require re-implementing all of the other changes that have come since, excluding the switch over to XML instead of XMLNode.
Failing that, we need to figure out how to get the contents of vcardExtNode (which is an XML object) into vcardExt (which is an Extension object). I don’t see any obvious or clean ways to do this.
Here’s a temporary fix. I reverted the move to XML, re-implemented saveVCard to handle avatars and some of the code cleanup that had been added. I’ve not exhaustively tested all of the implemented vCard attributes but I have confirmed that both nickname and avatar are working as expected. Attached is the merged source file and a corresponding patch created agains the head.
Well that’s a far better solution. Not sure how I missed sedNode() but after a brief test, it appears to work as expected. Below is a patch containing your proposed change. Please let me know if you see anything I missed.
Seems reasonable to have the dispatch for sent, but I do not grasp the idea why the deletion should be by using bareJID where simply toString has been used othervise?
The spec doesn’t say specifically, though when saving a vCard, no from attribute is specified in the stanza, implying to me that the card is not resource-dependent. Cards returned from the server however, are delivered to the requesting resource. Here’s the published example in the XEP: http://xmpp.org/extensions/xep-0054.html#sect-id327390