Software /
code /
verse
Annotate
plugins/vcard.lua @ 216:3aac084855e6
plugins.pep: Reuse the pubsub plugin.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 08 Sep 2011 18:03:07 +0200 |
parent | 195:dc61684e8dbf |
child | 228:c5a4f82e2fd6 |
rev | line source |
---|---|
195
dc61684e8dbf
plugins.vcard: Get and set vcard-temp info.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
1 local xmlns_vcard = "vcard-temp"; |
dc61684e8dbf
plugins.vcard: Get and set vcard-temp info.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
2 |
dc61684e8dbf
plugins.vcard: Get and set vcard-temp info.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
3 -- TODO Should this plugin perhaps convert to/from some non-stanza format? |
dc61684e8dbf
plugins.vcard: Get and set vcard-temp info.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
4 -- { |
dc61684e8dbf
plugins.vcard: Get and set vcard-temp info.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
5 -- FN = "Kim Alvefur"; |
dc61684e8dbf
plugins.vcard: Get and set vcard-temp info.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
6 -- NICKNAME = "Zash"; |
dc61684e8dbf
plugins.vcard: Get and set vcard-temp info.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
7 -- } |
dc61684e8dbf
plugins.vcard: Get and set vcard-temp info.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
8 |
dc61684e8dbf
plugins.vcard: Get and set vcard-temp info.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
9 function verse.plugins.vcard(stream) |
dc61684e8dbf
plugins.vcard: Get and set vcard-temp info.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
10 function stream:get_vcard(jid, callback) --jid = nil for self |
dc61684e8dbf
plugins.vcard: Get and set vcard-temp info.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
11 stream:send_iq(verse.iq({to = jid, type="get"}) |
dc61684e8dbf
plugins.vcard: Get and set vcard-temp info.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
12 :tag("vCard", {xmlns=xmlns_vcard}), callback); |
dc61684e8dbf
plugins.vcard: Get and set vcard-temp info.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
13 end -- FIXME This should pick out the vCard element |
dc61684e8dbf
plugins.vcard: Get and set vcard-temp info.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
14 |
dc61684e8dbf
plugins.vcard: Get and set vcard-temp info.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
15 function stream:set_vcard(vCard, callback) |
dc61684e8dbf
plugins.vcard: Get and set vcard-temp info.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
16 stream:send_iq(verse.iq({type="set"}) |
dc61684e8dbf
plugins.vcard: Get and set vcard-temp info.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
17 :tag("vCard", {xmlns=xmlns_vcard}) |
dc61684e8dbf
plugins.vcard: Get and set vcard-temp info.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
18 :add_child(vCard), callback); |
dc61684e8dbf
plugins.vcard: Get and set vcard-temp info.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
19 end |
dc61684e8dbf
plugins.vcard: Get and set vcard-temp info.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
20 end |