mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-22 17:28:25 +01:00
Also replace vcard-x-update in direct presences
This commit is contained in:
parent
cb076924cc
commit
db41643bea
@ -31,7 +31,7 @@
|
|||||||
-export([start/2, stop/1, reload/3]).
|
-export([start/2, stop/1, reload/3]).
|
||||||
|
|
||||||
-export([update_presence/1, vcard_set/1, remove_user/2,
|
-export([update_presence/1, vcard_set/1, remove_user/2,
|
||||||
mod_opt_type/1, depends/2]).
|
user_send_packet/1, mod_opt_type/1, depends/2]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
-include("ejabberd.hrl").
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
@ -47,6 +47,8 @@ start(Host, Opts) ->
|
|||||||
init_cache(Host, Opts),
|
init_cache(Host, Opts),
|
||||||
ejabberd_hooks:add(c2s_self_presence, Host, ?MODULE,
|
ejabberd_hooks:add(c2s_self_presence, Host, ?MODULE,
|
||||||
update_presence, 100),
|
update_presence, 100),
|
||||||
|
ejabberd_hooks:add(user_send_packet, Host, ?MODULE,
|
||||||
|
user_send_packet, 50),
|
||||||
ejabberd_hooks:add(vcard_iq_set, Host, ?MODULE, vcard_set,
|
ejabberd_hooks:add(vcard_iq_set, Host, ?MODULE, vcard_set,
|
||||||
90),
|
90),
|
||||||
ejabberd_hooks:add(remove_user, Host, ?MODULE, remove_user, 50).
|
ejabberd_hooks:add(remove_user, Host, ?MODULE, remove_user, 50).
|
||||||
@ -54,6 +56,8 @@ start(Host, Opts) ->
|
|||||||
stop(Host) ->
|
stop(Host) ->
|
||||||
ejabberd_hooks:delete(c2s_self_presence, Host,
|
ejabberd_hooks:delete(c2s_self_presence, Host,
|
||||||
?MODULE, update_presence, 100),
|
?MODULE, update_presence, 100),
|
||||||
|
ejabberd_hooks:delete(user_send_packet, Host, ?MODULE,
|
||||||
|
user_send_packet, 50),
|
||||||
ejabberd_hooks:delete(vcard_iq_set, Host, ?MODULE,
|
ejabberd_hooks:delete(vcard_iq_set, Host, ?MODULE,
|
||||||
vcard_set, 90),
|
vcard_set, 90),
|
||||||
ejabberd_hooks:delete(remove_user, Host, ?MODULE, remove_user, 50).
|
ejabberd_hooks:delete(remove_user, Host, ?MODULE, remove_user, 50).
|
||||||
@ -79,6 +83,18 @@ update_presence({#presence{type = available} = Pres,
|
|||||||
update_presence(Acc) ->
|
update_presence(Acc) ->
|
||||||
Acc.
|
Acc.
|
||||||
|
|
||||||
|
-spec user_send_packet({presence(), ejabberd_c2s:state()})
|
||||||
|
-> {presence(), ejabberd_c2s:state()}.
|
||||||
|
user_send_packet({#presence{type = available,
|
||||||
|
to = #jid{luser = U, lserver = S,
|
||||||
|
lresource = <<"">>}},
|
||||||
|
#{jid := #jid{luser = U, lserver = S}}} = Acc) ->
|
||||||
|
%% This is processed by update_presence/2 explicitly, we don't
|
||||||
|
%% want to call this multiple times for performance reasons
|
||||||
|
Acc;
|
||||||
|
user_send_packet(Acc) ->
|
||||||
|
update_presence(Acc).
|
||||||
|
|
||||||
-spec vcard_set(iq()) -> iq().
|
-spec vcard_set(iq()) -> iq().
|
||||||
vcard_set(#iq{from = #jid{luser = LUser, lserver = LServer}} = IQ) ->
|
vcard_set(#iq{from = #jid{luser = LUser, lserver = LServer}} = IQ) ->
|
||||||
ets_cache:delete(?VCARD_XUPDATE_CACHE, {LUser, LServer}),
|
ets_cache:delete(?VCARD_XUPDATE_CACHE, {LUser, LServer}),
|
||||||
|
Loading…
Reference in New Issue
Block a user