aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_vcard_legacy.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-09-01 23:45:58 +0200
committerKim Alvefur <zash@zash.se>2018-09-01 23:45:58 +0200
commitd1258d3a174b2eebfd76037b3459b124df0b8ec7 (patch)
tree7eb67e1398239bd88d1a57a849a89377705004ad /plugins/mod_vcard_legacy.lua
parent4b787a63a5e801e53542f7f4eb9391afb3b05121 (diff)
downloadprosody-d1258d3a174b2eebfd76037b3459b124df0b8ec7.tar.gz
prosody-d1258d3a174b2eebfd76037b3459b124df0b8ec7.zip
mod_vcard_legacy: Add translation of email field
Diffstat (limited to 'plugins/mod_vcard_legacy.lua')
-rw-r--r--plugins/mod_vcard_legacy.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/plugins/mod_vcard_legacy.lua b/plugins/mod_vcard_legacy.lua
index 7bc09638..81d35309 100644
--- a/plugins/mod_vcard_legacy.lua
+++ b/plugins/mod_vcard_legacy.lua
@@ -46,6 +46,19 @@ module:hook("iq-get/bare/vcard-temp:vCard", function (event)
if text then
vcard_temp:text_tag(tag.name:upper(), text);
end
+ elseif tag.name == "email" then
+ local text = tag:get_child_text("text");
+ if text then
+ vcard_temp:tag("EMAIL")
+ :text_tag("USERID", text)
+ :tag("INTERNET"):up();
+ if tag:find"parameters/type/text#" == "home" then
+ vcard_temp:tag("HOME"):up();
+ elseif tag:find"parameters/type/text#" == "work" then
+ vcard_temp:tag("WORK"):up();
+ end
+ vcard_temp:up();
+ end
end
end
end