plugins/mod_pep.lua
branch0.11
changeset 12089 1d213c6f781b
parent 11570 6e67872bcba4
child 12090 1dc00ca6ee9d
equal deleted inserted replaced
12088:59557bc3c4b8 12089:1d213c6f781b
    34 
    34 
    35 local max_max_items = module:get_option_number("pep_max_items", 256);
    35 local max_max_items = module:get_option_number("pep_max_items", 256);
    36 
    36 
    37 function module.save()
    37 function module.save()
    38 	return {
    38 	return {
    39 		services = services;
       
    40 		recipients = recipients;
    39 		recipients = recipients;
    41 	};
    40 	};
    42 end
    41 end
    43 
    42 
    44 function module.restore(data)
    43 function module.restore(data)
    45 	services = data.services;
       
    46 	recipients = data.recipients;
    44 	recipients = data.recipients;
    47 	for username, service in pairs(services) do
       
    48 		local user_bare = jid_join(username, host);
       
    49 		module:add_item("pep-service", { service = service, jid = user_bare });
       
    50 	end
       
    51 end
    45 end
    52 
    46 
    53 function is_item_stanza(item)
    47 function is_item_stanza(item)
    54 	return st.is_stanza(item) and item.attr.xmlns == xmlns_pubsub and item.name == "item" and #item.tags == 1;
    48 	return st.is_stanza(item) and item.attr.xmlns == xmlns_pubsub and item.name == "item" and #item.tags == 1;
    55 end
    49 end