is_last_item_cache_enabled({_, ServerHost, _}) ->
is_last_item_cache_enabled(ServerHost);
is_last_item_cache_enabled(Host) ->
- case ets:lookup(gen_mod:get_module_proc(Host, config), last_item_cache) of
+ case catch ets:lookup(gen_mod:get_module_proc(Host, config), last_item_cache) of
[{last_item_cache, true}] -> true;
_ -> false
end.
get_cached_item(Host, NodeId) ->
case is_last_item_cache_enabled(Host) of
true ->
- case ets:lookup(gen_mod:get_module_proc(Host, last_items), NodeId) of
+ case catch ets:lookup(gen_mod:get_module_proc(Host, last_items), NodeId) of
[{NodeId, {ItemId, Payload}}] ->
#pubsub_item{itemid = {ItemId, NodeId}, payload = Payload};
_ ->
%%%% plugin handling
plugins(Host) ->
- case ets:lookup(gen_mod:get_module_proc(Host, config), plugins) of
+ case catch ets:lookup(gen_mod:get_module_proc(Host, config), plugins) of
[{plugins, []}] -> [?STDNODE];
[{plugins, PL}] -> PL;
_ -> [?STDNODE]
select_type(ServerHost, Host, Node, Type)->
SelectedType = case Host of
{_User, _Server, _Resource} ->
- case ets:lookup(gen_mod:get_module_proc(ServerHost, config), pep_mapping) of
+ case catch ets:lookup(gen_mod:get_module_proc(ServerHost, config), pep_mapping) of
[{pep_mapping, PM}] -> proplists:get_value(Node, PM, ?PEPNODE);
_ -> ?PEPNODE
end;
tree_call(Server, Function, Args);
tree_call(Host, Function, Args) ->
?DEBUG("tree_call ~p ~p ~p",[Host, Function, Args]),
- Module = case ets:lookup(gen_mod:get_module_proc(Host, config), nodetree) of
+ Module = case catch ets:lookup(gen_mod:get_module_proc(Host, config), nodetree) of
[{nodetree, N}] -> N;
_ -> list_to_atom(?TREE_PREFIX ++ ?STDTREE)
end,
SubKey = jlib:jid_tolower(Owner),
GenKey = jlib:jid_remove_resource(SubKey),
States = mnesia:match_object(#pubsub_state{stateid = {GenKey, '_'}, _ = '_'}),
- NodeTree = case ets:lookup(gen_mod:get_module_proc(Host, config), nodetree) of
+ NodeTree = case catch ets:lookup(gen_mod:get_module_proc(Host, config), nodetree) of
[{nodetree, N}] -> N;
_ -> nodetree_tree
end,
++ mnesia:match_object(
#pubsub_state{stateid = {SubKey, '_'}, _ = '_'})
end,
- NodeTree = case ets:lookup(gen_mod:get_module_proc(Host, config), nodetree) of
+ NodeTree = case catch ets:lookup(gen_mod:get_module_proc(Host, config), nodetree) of
[{nodetree, N}] -> N;
_ -> nodetree_tree
end,
affiliation = owner,
_ = '_'}),
NodeIDs = [ID || #pubsub_state{stateid = {_, ID}} <- States],
- NodeTree = case ets:lookup(gen_mod:get_module_proc(Host, config), nodetree) of
+ NodeTree = case catch ets:lookup(gen_mod:get_module_proc(Host, config), nodetree) of
[{nodetree, N}] -> N;
_ -> nodetree_tree
end,
SubKey = jlib:jid_tolower(Owner),
GenKey = jlib:jid_remove_resource(SubKey),
States = mnesia:match_object(#pubsub_state{stateid = {GenKey, '_'}, _ = '_'}),
- NodeTree = case ets:lookup(gen_mod:get_module_proc(D, config), nodetree) of
+ NodeTree = case catch ets:lookup(gen_mod:get_module_proc(D, config), nodetree) of
[{nodetree, N}] -> N;
_ -> nodetree_tree
end,
++ mnesia:match_object(
#pubsub_state{stateid = {SubKey, '_'}, _ = '_'})
end,
- NodeTree = case ets:lookup(gen_mod:get_module_proc(D, config), nodetree) of
+ NodeTree = case catch ets:lookup(gen_mod:get_module_proc(D, config), nodetree) of
[{nodetree, N}] -> N;
_ -> nodetree_tree
end,