Mercurial > eldonilo > lightstring
comparison plugins/vcard.js @ 34:6ce66fba0242
Merging.
author | Sonny Piers <sonny.piers@gmail.com> |
---|---|
date | Sat, 28 Jan 2012 04:39:03 +0100 |
parents | 1506992c33e2 |
children | bdfbd58b4835 |
comparison
equal
deleted
inserted
replaced
29:1e6d2ca2daae | 34:6ce66fba0242 |
---|---|
1 'use strict'; | |
2 | |
3 /** | |
4 Copyright (c) 2011, Sonny Piers <sonny at fastmail dot net> | |
5 | |
6 Permission to use, copy, modify, and/or distribute this software for any | |
7 purpose with or without fee is hereby granted, provided that the above | |
8 copyright notice and this permission notice appear in all copies. | |
9 | |
10 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
11 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
12 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
13 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
17 */ | |
18 | |
19 ///////// | |
20 //vCard// | |
21 ///////// | |
22 Lightstring.NS.vcard = 'vcard-temp'; | |
23 Lightstring.stanza.vcard = { | |
24 'get': function(aTo) { | |
25 if(aTo) | |
26 return "<iq type='get' to='"+aTo+"'><vCard xmlns='"+Lightstring.NS.vcard+"'/></iq>"; | |
27 else | |
28 return "<iq type='get'><vCard xmlns='"+Lightstring.NS.vcard+"'/></iq>"; | |
29 } | |
30 }; | |
31 //FIXME we should return a proper vcard, not an XMPP one | |
32 Lightstring.getVcard = function(aConnection, aTo, aCallback) { | |
33 aConnection.send(Lightstring.stanza.vcard.get(aTo), function(answer, err){ | |
34 if(answer) { | |
35 var vcard = answer.querySelector('vCard'); | |
36 if(vcard) | |
37 aCallback(vcard); | |
38 } | |
39 else | |
40 aCallback(null); | |
41 }); | |
42 } |