25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

fix EJAB-1054 (thanks to Evgeniy Khramtsov)

SVN Revision: 2633
This commit is contained in:
Christophe Romain 2009-09-25 12:48:10 +00:00
parent 2f5211ab74
commit 24afead423

View File

@ -140,15 +140,8 @@ get_user_resources(U, S) ->
%% information. Host is the host that asks, From is the full JID that %% information. Host is the host that asks, From is the full JID that
%% sent the caps packet, and Caps is what read_caps returned. %% sent the caps packet, and Caps is what read_caps returned.
note_caps(Host, From, Caps) -> note_caps(Host, From, Caps) ->
case Caps of
nothing ->
BJID = exmpp_jid:to_binary(From),
catch mnesia:dirty_delete({user_caps, BJID}),
ok;
_ ->
Proc = gen_mod:get_module_proc(Host, ?PROCNAME), Proc = gen_mod:get_module_proc(Host, ?PROCNAME),
gen_server:cast(Proc, {note_caps, From, Caps}) gen_server:cast(Proc, {note_caps, From, Caps}).
end.
%% wait_caps should be called just before note_caps %% wait_caps should be called just before note_caps
%% it allows to lock get_caps usage for code using presence_probe %% it allows to lock get_caps usage for code using presence_probe
@ -310,6 +303,10 @@ handle_call({get_features, Caps}, From, State) ->
handle_call(stop, _From, State) -> handle_call(stop, _From, State) ->
{stop, normal, ok, State}. {stop, normal, ok, State}.
handle_cast({note_caps, From, nothing}, State) ->
BJID = exmpp_jid:to_binary(From),
catch mnesia:dirty_delete({user_caps, BJID}),
{noreply, State};
handle_cast({note_caps, From, handle_cast({note_caps, From,
#caps{node = Node, version = Version, exts = Exts} = Caps}, #caps{node = Node, version = Version, exts = Exts} = Caps},
#state{host = Host, disco_requests = Requests} = State) -> #state{host = Host, disco_requests = Requests} = State) ->