From 10ffbc08df3df9a3c3a0fa21fbe99c72caa8bb39 Mon Sep 17 00:00:00 2001 From: Mujtaba Roohani Date: Mon, 10 Oct 2022 16:26:11 +0500 Subject: [PATCH] Added opt module for mod_push_offline --- mod_push_offline/src/mod_push_offline.erl | 2 +- mod_push_offline/src/mod_push_offline_opt.erl | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 mod_push_offline/src/mod_push_offline_opt.erl diff --git a/mod_push_offline/src/mod_push_offline.erl b/mod_push_offline/src/mod_push_offline.erl index cb2bf3a..735c34d 100644 --- a/mod_push_offline/src/mod_push_offline.erl +++ b/mod_push_offline/src/mod_push_offline.erl @@ -106,7 +106,7 @@ notify(#jid{lserver = LServer} = To, Pkt) -> UnWrappedPkt = unwrap_message(Pkt), DelayedPkt = add_delay_info(UnWrappedPkt, LServer, undefined), Id = p1_rand:get_string(), - PushServer = mod_push_modified_opt:host(LServer), + PushServer = mod_push_offline_opt:host(LServer), WrappedPacket = wrap(DelayedPkt, <<"urn:xmpp:push:nodes:messages">>, Id), ejabberd_router:route(xmpp:set_from_to(WrappedPacket, To, jid:make(PushServer))). diff --git a/mod_push_offline/src/mod_push_offline_opt.erl b/mod_push_offline/src/mod_push_offline_opt.erl new file mode 100644 index 0000000..824ffa4 --- /dev/null +++ b/mod_push_offline/src/mod_push_offline_opt.erl @@ -0,0 +1,9 @@ +-module(mod_push_offline_opt). + +-export([host/1]). + +-spec host(gen_mod:opts() | global | binary()) -> binary(). +host(Opts) when is_map(Opts) -> + gen_mod:get_opt(host, Opts); +host(Host) -> + gen_mod:get_module_opt(Host, mod_push_offline, host).