./ct_report/coverage/mod_event_pusher_push_plugin_enhanced.COVER.html

1 %%==============================================================================
2 %% Copyright 2020 Erlang Solutions Ltd.
3 %%
4 %% Licensed under the Apache License, Version 2.0 (the "License");
5 %% you may not use this file except in compliance with the License.
6 %% You may obtain a copy of the License at
7 %%
8 %% http://www.apache.org/licenses/LICENSE-2.0
9 %%
10 %% Unless required by applicable law or agreed to in writing, software
11 %% distributed under the License is distributed on an "AS IS" BASIS,
12 %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 %% See the License for the specific language governing permissions and
14 %% limitations under the License.
15 %%==============================================================================
16 -module(mod_event_pusher_push_plugin_enhanced).
17 -behavior(mod_event_pusher_push_plugin).
18
19 -include("mod_event_pusher_events.hrl").
20
21 %% API
22 -export([should_publish/3]).
23
24 %%--------------------------------------------------------------------
25 %% mod_event_pusher_push_plugin callbacks
26 %%--------------------------------------------------------------------
27 -spec should_publish(Acc :: mongoose_acc:t(),
28 Event :: mod_event_pusher:event(),
29 Services :: [mod_event_pusher_push:publish_service()]) ->
30 [mod_event_pusher_push:publish_service()].
31 should_publish(Acc, #unack_msg_event{to = Jid}, _Services) ->
32
:-(
PublishedServices = mongoose_acc:get(event_pusher, published_services, [], Acc),
33
:-(
case ejabberd_sm:get_info(Jid, publish_service) of
34
:-(
{ok, Service} -> [Service] -- PublishedServices;
35
:-(
{error, _} -> []
36 end;
37 should_publish(Acc, Event, Services) ->
38
:-(
mod_event_pusher_push_plugin_defaults:should_publish(Acc, Event, Services).
Line Hits Source