# HG changeset patch # User Emmanuel Gil Peyrot # Date 1328062430 -3600 # Node ID e25dfe389dabf6623f5855d41127af60fd68a759 # Parent a118a7822410d890ffcffa557abcfaa6d3530305 Fix vCard-temp plugin. diff --git a/plugins/vcard.js b/plugins/vcard.js --- a/plugins/vcard.js +++ b/plugins/vcard.js @@ -19,24 +19,26 @@ ///////// //vCard// ///////// -Lightstring.NS.vcard = 'vcard-temp'; -Lightstring.stanza.vcard = { - 'get': function(aTo) { - if(aTo) - return ""; - else - return ""; +Lightstring.plugins['vcard'] = { + namespaces: { + vcard: 'vcard-temp' + }, + stanzas: { + get: function(aTo) { + if (aTo) + return ""; + else + return ""; + } + }, + //FIXME: we should return a proper vcard, not an XMPP one + methods: { + get function(aTo, aResult, aError) { + this.send(Lightstring.stanzas['vcard'].get(aTo), function(stanza) { + var vcard = stanza.DOM.firstChild; + if (vcard) + aCallback(vcard); + }, aError); + } } }; -//FIXME we should return a proper vcard, not an XMPP one -Lightstring.getVcard = function(aConnection, aTo, aCallback) { - aConnection.send(Lightstring.stanza.vcard.get(aTo), function(stanza, err){ - if(stanza) { - var vcard = stanza.DOM.querySelector('vCard'); - if(vcard) - aCallback(vcard); - } - else - aCallback(null); - }); -}