changeset 1452:097c6af98d0a

Merge
author Kim Alvefur <zash@zash.se>
date Wed, 25 Jun 2014 20:46:35 +0200
parents 843769eb40c3 (diff) d31ace5b1175 (current diff)
children 7b53cfc6ba8d
files
diffstat 2 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mod_profile/mod_profile.lua	Tue Jun 24 12:16:44 2014 -0400
+++ b/mod_profile/mod_profile.lua	Wed Jun 25 20:46:35 2014 +0200
@@ -6,6 +6,7 @@
 local vcard = require"util.vcard";
 local base64 = require"util.encodings".base64;
 local sha1 = require"util.hashes".sha1;
+local t_insert, t_remove = table.insert, table.remove;
 
 local pep_plus;
 if module:get_host_type() == "local" and module:get_option_boolean("vcard_to_pep", true) then
@@ -44,10 +45,13 @@
 
 local function update_pep(username, data)
 	local pep = pep_plus.get_pep_service(username.."@"..module.host);
+	local photo, p = get_item(data, "PHOTO");
 	if vcard.to_vcard4 then
+		if p then t_remove(data, p); end
 		pep:purge("urn:xmpp:vcard4", true);
 		pep:publish("urn:xmpp:vcard4", true, "current", st.stanza("item", {id="current"})
 			:add_child(vcard.to_vcard4(data)));
+		if p then t_insert(data, p, photo); end
 	end
 
 	local nickname = get_item(data, "NICKNAME");
@@ -57,7 +61,6 @@
 			:tag("nick", { xmlns="http://jabber.org/protocol/nick" }):text(nickname[1]));
 	end
 
-	local photo = get_item(data, "PHOTO");
 	if photo and photo[1] then
 		local photo_raw = base64.decode(photo[1]);
 		local photo_hash = sha1(photo_raw, true);
--- a/mod_rawdebug/mod_rawdebug.lua	Tue Jun 24 12:16:44 2014 -0400
+++ b/mod_rawdebug/mod_rawdebug.lua	Wed Jun 25 20:46:35 2014 +0200
@@ -1,8 +1,9 @@
+module:set_global();
 
 local tostring = tostring;
 local filters = require "util.filters";
 
-local def_env = module:shared("/*/admin_telnet/env");
+local def_env = module:shared("admin_telnet/env");
 local rawdebug_enabled = module:shared("sessions");
 local full_sessions = prosody.full_sessions;
 local log = module._log;