21 function stream:set_vcard(aCard, callback) |
21 function stream:set_vcard(aCard, callback) |
22 local xCard; |
22 local xCard; |
23 if type(aCard) == "table" and aCard.name then |
23 if type(aCard) == "table" and aCard.name then |
24 xCard = aCard; |
24 xCard = aCard; |
25 elseif type(aCard) == "string" then |
25 elseif type(aCard) == "string" then |
26 xCard = vcard.from_text(aCard)[1]; |
26 xCard = vcard.to_xep54(vcard.from_text(aCard)[1]); |
27 elseif type(aCard) == "table" then |
27 elseif type(aCard) == "table" then |
28 xCard = vcard.to_xep54(aCard); |
28 xCard = vcard.to_xep54(aCard); |
29 error("Converting a table to vCard not implemented") |
29 error("Converting a table to vCard not implemented") |
30 end |
30 end |
31 if not xCard then return false end |
31 if not xCard then return false end |