Mercurial > eldonilo > lightstring
view plugins/vcard.js @ 52:48e2bd6b1885
Fix roster plugin.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Wed, 01 Feb 2012 03:51:12 +0100 |
parents | e25dfe389dab |
children | 26d372c9e270 |
line wrap: on
line source
'use strict'; /** Copyright (c) 2011, Sonny Piers <sonny at fastmail dot net> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ ///////// //vCard// ///////// Lightstring.plugins['vcard'] = { namespaces: { vcard: 'vcard-temp' }, stanzas: { get: function(aTo) { if (aTo) return "<iq type='get' to='" + aTo + "'><vCard xmlns='" + Lightstring.NS.vcard + "'/></iq>"; else return "<iq type='get'><vCard xmlns='" + Lightstring.NS.vcard + "'/></iq>"; } }, //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); } } };