# HG changeset patch # User Sonny Piers # Date 1334846986 -7200 # Node ID 26d372c9e270060f9a1ba4ad55f8cdd1b4a5c166 # Parent b211a00efa7f170e346bb0bf163bb20d6eb1644c fix the vcard plugin diff --git a/plugins/vcard.js b/plugins/vcard.js --- a/plugins/vcard.js +++ b/plugins/vcard.js @@ -26,18 +26,33 @@ Lightstring.plugins['vcard'] = { stanzas: { get: function(aTo) { if (aTo) - return ""; + return ""; else - return ""; + return ""; + }, + set: function(aTo) { + if (aTo) + return ""; + else + return ""; } }, - //FIXME: we should return a proper vcard, not an XMPP one + //FIXME: we should return a JSON vcard, not an XML one methods: { - get function(aTo, aResult, aError) { + get: function(aTo, aOnSuccess, aOnError) { this.send(Lightstring.stanzas['vcard'].get(aTo), function(stanza) { - var vcard = stanza.DOM.firstChild; - if (vcard) - aCallback(vcard); + var fields = stanza.DOM.firstChild.childNodes; + if (aOnSuccess && fields) + aOnSuccess(fields); + }, aOnError); + }, + set: function(aTo, aFields, aOnSuccess, aOnError) { + this.send(Lightstring.stanzas['vcard'].set(aTo, aFields), function(stanza) { + if (aOnSuccess) + aOnSuccess(); + //~ var vcard = stanza.DOM.firstChild; + //~ if (vcard) + //~ aResult(vcard); }, aError); } }