plugins/mod_pep_plus.lua
changeset 8336 2abbb01cd756
parent 8335 e89b57d0d80a
child 8338 9db72349095f
equal deleted inserted replaced
8335:e89b57d0d80a 8336:2abbb01cd756
    41 	return is_contact_subscribed(username, host, recipient_bare);
    41 	return is_contact_subscribed(username, host, recipient_bare);
    42 end
    42 end
    43 
    43 
    44 local function simple_itemstore(username)
    44 local function simple_itemstore(username)
    45 	return function (config, node)
    45 	return function (config, node)
    46 		if config["pubsub#persist_items"] then
    46 		if config["persist_items"] then
    47 			module:log("debug", "Creating new persistent item store for user %s, node %q", username, node);
    47 			module:log("debug", "Creating new persistent item store for user %s, node %q", username, node);
    48 			known_nodes_map:set(username, node, true);
    48 			known_nodes_map:set(username, node, true);
    49 			local archive = module:open_store("pep_"..node, "archive");
    49 			local archive = module:open_store("pep_"..node, "archive");
    50 			return lib_pubsub.archive_itemstore(archive, config, username, node, false);
    50 			return lib_pubsub.archive_itemstore(archive, config, username, node, false);
    51 		else
    51 		else
    52 			module:log("debug", "Creating new ephemeral item store for user %s, node %q", username, node);
    52 			module:log("debug", "Creating new ephemeral item store for user %s, node %q", username, node);
    53 			known_nodes_map:set(username, node, nil);
    53 			known_nodes_map:set(username, node, nil);
    54 			return cache.new(tonumber(config["pubsub#max_items"]));
    54 			return cache.new(tonumber(config["max_items"]));
    55 		end
    55 		end
    56 	end
    56 	end
    57 end
    57 end
    58 
    58 
    59 local function get_broadcaster(username)
    59 local function get_broadcaster(username)
   177 				set_affiliation = true;
   177 				set_affiliation = true;
   178 			};
   178 			};
   179 		};
   179 		};
   180 
   180 
   181 		node_defaults = {
   181 		node_defaults = {
   182 			["pubsub#max_items"] = "1";
   182 			["max_items"] = 1;
   183 			["pubsub#persist_items"] = true;
   183 			["persist_items"] = true;
   184 		};
   184 		};
   185 
   185 
   186 		autocreate_on_publish = true;
   186 		autocreate_on_publish = true;
   187 		autocreate_on_subscribe = true;
   187 		autocreate_on_subscribe = true;
   188 
   188