mirror of
https://github.com/processone/ejabberd.git
synced 2024-06-22 22:23:42 +02:00
prevent creating badxml when pubsub_state is not accessible
SVN Revision: 2360
This commit is contained in:
parent
0287d50ff4
commit
b31ca0cd36
|
@ -723,8 +723,11 @@ set_subscriptions(NodeId, Owner, Subscriptions) ->
|
||||||
%% ```get_states(NodeId) ->
|
%% ```get_states(NodeId) ->
|
||||||
%% node_default:get_states(NodeId).'''</p>
|
%% node_default:get_states(NodeId).'''</p>
|
||||||
get_states(NodeId) ->
|
get_states(NodeId) ->
|
||||||
States = mnesia:match_object(
|
States = case catch mnesia:match_object(
|
||||||
#pubsub_state{stateid = {'_', NodeId}, _ = '_'}),
|
#pubsub_state{stateid = {'_', NodeId}, _ = '_'}) of
|
||||||
|
List when is_list(List) -> List;
|
||||||
|
_ -> []
|
||||||
|
end,
|
||||||
{result, States}.
|
{result, States}.
|
||||||
|
|
||||||
%% @spec (NodeId, JID) -> [State] | []
|
%% @spec (NodeId, JID) -> [State] | []
|
||||||
|
@ -734,7 +737,7 @@ get_states(NodeId) ->
|
||||||
%% @doc <p>Returns a state (one state list), given its reference.</p>
|
%% @doc <p>Returns a state (one state list), given its reference.</p>
|
||||||
get_state(NodeId, JID) ->
|
get_state(NodeId, JID) ->
|
||||||
StateId = {JID, NodeId},
|
StateId = {JID, NodeId},
|
||||||
case mnesia:read({pubsub_state, StateId}) of
|
case catch mnesia:read({pubsub_state, StateId}) of
|
||||||
[State] when is_record(State, pubsub_state) -> State;
|
[State] when is_record(State, pubsub_state) -> State;
|
||||||
_ -> #pubsub_state{stateid=StateId}
|
_ -> #pubsub_state{stateid=StateId}
|
||||||
end.
|
end.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user