Comparison

mod_vjud/mod_vjud.lua @ 733:dd3b30c0dc8a

mod_vjud: Switch first and last name in results to be correct.
author Kim Alvefur <zash@zash.se>
date Sun, 01 Jul 2012 13:15:40 +0200
parent 732:317e142fe6f1
child 734:81de1e446bfe
comparison
equal deleted inserted replaced
732:317e142fe6f1 733:dd3b30c0dc8a
92 if hostname == module.host and username and usermanager.user_exists(username, hostname) then 92 if hostname == module.host and username and usermanager.user_exists(username, hostname) then
93 local vCard = get_user_vcard(username); 93 local vCard = get_user_vcard(username);
94 if vCard then 94 if vCard then
95 reply:add_child(item_template.apply{ 95 reply:add_child(item_template.apply{
96 jid = username..at_host; 96 jid = username..at_host;
97 first = vCard.N and vCard.N[1] or nil; 97 first = vCard.N and vCard.N[2] or nil;
98 last = vCard.N and vCard.N[2] or nil; 98 last = vCard.N and vCard.N[1] or nil;
99 nick = vCard.NICKNAME and vCard.NICKNAME[1] or username; 99 nick = vCard.NICKNAME and vCard.NICKNAME[1] or username;
100 email = vCard.EMAIL and vCard.EMAIL[1] or nil; 100 email = vCard.EMAIL and vCard.EMAIL[1] or nil;
101 }); 101 });
102 end 102 end
103 else 103 else
108 (vCard.N and vCard.N[1] == last) or 108 (vCard.N and vCard.N[1] == last) or
109 (vCard.NICKNAME and vCard.NICKNAME[1] == nick) or 109 (vCard.NICKNAME and vCard.NICKNAME[1] == nick) or
110 (vCard.EMAIL and vCard.EMAIL[1] == email)) then 110 (vCard.EMAIL and vCard.EMAIL[1] == email)) then
111 reply:add_child(item_template.apply{ 111 reply:add_child(item_template.apply{
112 jid = username..at_host; 112 jid = username..at_host;
113 first = vCard.N and vCard.N[1] or nil; 113 first = vCard.N and vCard.N[2] or nil;
114 last = vCard.N and vCard.N[2] or nil; 114 last = vCard.N and vCard.N[1] or nil;
115 nick = vCard.NICKNAME and vCard.NICKNAME[1] or username; 115 nick = vCard.NICKNAME and vCard.NICKNAME[1] or username;
116 email = vCard.EMAIL and vCard.EMAIL[1] or nil; 116 email = vCard.EMAIL and vCard.EMAIL[1] or nil;
117 }); 117 });
118 end 118 end
119 end 119 end