mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-26 16:26:24 +01:00
Add announcement of offline feature to service discovery (EJAB-234)
SVN Revision: 2346
This commit is contained in:
parent
ba335346f2
commit
cdac156f2e
@ -35,6 +35,7 @@
|
|||||||
store_packet/3,
|
store_packet/3,
|
||||||
resend_offline_messages/2,
|
resend_offline_messages/2,
|
||||||
pop_offline_messages/3,
|
pop_offline_messages/3,
|
||||||
|
get_sm_features/5,
|
||||||
remove_expired_messages/0,
|
remove_expired_messages/0,
|
||||||
remove_old_messages/1,
|
remove_old_messages/1,
|
||||||
remove_user/2,
|
remove_user/2,
|
||||||
@ -76,6 +77,10 @@ start(Host, Opts) ->
|
|||||||
?MODULE, remove_user, 50),
|
?MODULE, remove_user, 50),
|
||||||
ejabberd_hooks:add(anonymous_purge_hook, HostB,
|
ejabberd_hooks:add(anonymous_purge_hook, HostB,
|
||||||
?MODULE, remove_user, 50),
|
?MODULE, remove_user, 50),
|
||||||
|
ejabberd_hooks:add(disco_sm_features, HostB,
|
||||||
|
?MODULE, get_sm_features, 50),
|
||||||
|
ejabberd_hooks:add(disco_local_features, HostB,
|
||||||
|
?MODULE, get_sm_features, 50),
|
||||||
ejabberd_hooks:add(webadmin_page_host, HostB,
|
ejabberd_hooks:add(webadmin_page_host, HostB,
|
||||||
?MODULE, webadmin_page, 50),
|
?MODULE, webadmin_page, 50),
|
||||||
ejabberd_hooks:add(webadmin_user, HostB,
|
ejabberd_hooks:add(webadmin_user, HostB,
|
||||||
@ -152,6 +157,8 @@ stop(Host) ->
|
|||||||
?MODULE, remove_user, 50),
|
?MODULE, remove_user, 50),
|
||||||
ejabberd_hooks:delete(anonymous_purge_hook, HostB,
|
ejabberd_hooks:delete(anonymous_purge_hook, HostB,
|
||||||
?MODULE, remove_user, 50),
|
?MODULE, remove_user, 50),
|
||||||
|
ejabberd_hooks:delete(disco_sm_features, HostB, ?MODULE, get_sm_features, 50),
|
||||||
|
ejabberd_hooks:delete(disco_local_features, HostB, ?MODULE, get_sm_features, 50),
|
||||||
ejabberd_hooks:delete(webadmin_page_host, HostB,
|
ejabberd_hooks:delete(webadmin_page_host, HostB,
|
||||||
?MODULE, webadmin_page, 50),
|
?MODULE, webadmin_page, 50),
|
||||||
ejabberd_hooks:delete(webadmin_user, HostB,
|
ejabberd_hooks:delete(webadmin_user, HostB,
|
||||||
@ -162,6 +169,21 @@ stop(Host) ->
|
|||||||
exit(whereis(Proc), stop),
|
exit(whereis(Proc), stop),
|
||||||
{wait, Proc}.
|
{wait, Proc}.
|
||||||
|
|
||||||
|
get_sm_features(Acc, _From, _To, "", _Lang) ->
|
||||||
|
Feats = case Acc of
|
||||||
|
{result, I} -> I;
|
||||||
|
_ -> []
|
||||||
|
end,
|
||||||
|
{result, Feats ++ [?NS_FEATURE_MSGOFFLINE]};
|
||||||
|
|
||||||
|
get_sm_features(_Acc, _From, _To, ?NS_FEATURE_MSGOFFLINE, _Lang) ->
|
||||||
|
%% override all lesser features...
|
||||||
|
{result, []};
|
||||||
|
|
||||||
|
get_sm_features(Acc, _From, _To, _Node, _Lang) ->
|
||||||
|
Acc.
|
||||||
|
|
||||||
|
|
||||||
store_packet(From, To, Packet) ->
|
store_packet(From, To, Packet) ->
|
||||||
Type = exmpp_stanza:get_type(Packet),
|
Type = exmpp_stanza:get_type(Packet),
|
||||||
if
|
if
|
||||||
@ -321,6 +343,7 @@ pop_offline_messages(Ls, User, Server)
|
|||||||
Ls
|
Ls
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
||||||
remove_expired_messages() ->
|
remove_expired_messages() ->
|
||||||
TimeStamp = now(),
|
TimeStamp = now(),
|
||||||
F = fun() ->
|
F = fun() ->
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
stop/1,
|
stop/1,
|
||||||
store_packet/3,
|
store_packet/3,
|
||||||
pop_offline_messages/3,
|
pop_offline_messages/3,
|
||||||
|
get_sm_features/5,
|
||||||
remove_user/2,
|
remove_user/2,
|
||||||
webadmin_page/3,
|
webadmin_page/3,
|
||||||
webadmin_user/4,
|
webadmin_user/4,
|
||||||
@ -70,6 +71,10 @@ start(Host, Opts) ->
|
|||||||
?MODULE, remove_user, 50),
|
?MODULE, remove_user, 50),
|
||||||
ejabberd_hooks:add(anonymous_purge_hook, HostB,
|
ejabberd_hooks:add(anonymous_purge_hook, HostB,
|
||||||
?MODULE, remove_user, 50),
|
?MODULE, remove_user, 50),
|
||||||
|
ejabberd_hooks:add(disco_sm_features, HostB,
|
||||||
|
?MODULE, get_sm_features, 50),
|
||||||
|
ejabberd_hooks:add(disco_local_features, HostB,
|
||||||
|
?MODULE, get_sm_features, 50),
|
||||||
ejabberd_hooks:add(webadmin_page_host, HostB,
|
ejabberd_hooks:add(webadmin_page_host, HostB,
|
||||||
?MODULE, webadmin_page, 50),
|
?MODULE, webadmin_page, 50),
|
||||||
ejabberd_hooks:add(webadmin_user, HostB,
|
ejabberd_hooks:add(webadmin_user, HostB,
|
||||||
@ -159,6 +164,8 @@ stop(Host) ->
|
|||||||
?MODULE, remove_user, 50),
|
?MODULE, remove_user, 50),
|
||||||
ejabberd_hooks:delete(anonymous_purge_hook, HostB,
|
ejabberd_hooks:delete(anonymous_purge_hook, HostB,
|
||||||
?MODULE, remove_user, 50),
|
?MODULE, remove_user, 50),
|
||||||
|
ejabberd_hooks:delete(disco_sm_features, HostB, ?MODULE, get_sm_features, 50),
|
||||||
|
ejabberd_hooks:delete(disco_local_features, HostB, ?MODULE, get_sm_features, 50),
|
||||||
ejabberd_hooks:delete(webadmin_page_host, HostB,
|
ejabberd_hooks:delete(webadmin_page_host, HostB,
|
||||||
?MODULE, webadmin_page, 50),
|
?MODULE, webadmin_page, 50),
|
||||||
ejabberd_hooks:delete(webadmin_user, HostB,
|
ejabberd_hooks:delete(webadmin_user, HostB,
|
||||||
@ -169,6 +176,21 @@ stop(Host) ->
|
|||||||
exit(whereis(Proc), stop),
|
exit(whereis(Proc), stop),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
|
get_sm_features(Acc, _From, _To, "", _Lang) ->
|
||||||
|
Feats = case Acc of
|
||||||
|
{result, I} -> I;
|
||||||
|
_ -> []
|
||||||
|
end,
|
||||||
|
{result, Feats ++ [?NS_FEATURE_MSGOFFLINE]};
|
||||||
|
|
||||||
|
get_sm_features(_Acc, _From, _To, ?NS_FEATURE_MSGOFFLINE, _Lang) ->
|
||||||
|
%% override all lesser features...
|
||||||
|
{result, []};
|
||||||
|
|
||||||
|
get_sm_features(Acc, _From, _To, _Node, _Lang) ->
|
||||||
|
Acc.
|
||||||
|
|
||||||
|
|
||||||
store_packet(From, To, Packet) ->
|
store_packet(From, To, Packet) ->
|
||||||
Type = exmpp_stanza:get_type(Packet),
|
Type = exmpp_stanza:get_type(Packet),
|
||||||
if
|
if
|
||||||
|
Loading…
Reference in New Issue
Block a user