Well, that module is two years old, and is not up-to-date with ejabberd modules API requirements, so it isn't an ejabberd module.
I've updated its source code to compile correctly with newest ejabberd. I have not checked it actually works.
Those steps allow to download, fix and install the module:
mkdir -p $HOME/.ejabberd-modules/sources/
cd $HOME/.ejabberd-modules/sources/
git clone https://github.com/k9428/mod_offline_post.git
cd mod_offline_post
Then put here a file called update.patch with this content:
From bb7355f5abf558365e68b91e996b303beeb7576e Mon Sep 17 00:00:00 2001
From: Badlop <[email protected]>
Date: Mon, 5 Oct 2020 18:07:29 +0200
Subject: [PATCH] Update to compile with recent ejabberd
---
src/mod_offline_post.erl | 29 ++++++++++++++++++++++++++---
1 file changed, 26 insertions(+), 3 deletions(-)
diff --git a/src/mod_offline_post.erl b/src/mod_offline_post.erl
index a5e6af8..dccf419 100644
--- a/src/mod_offline_post.erl
+++ b/src/mod_offline_post.erl
@@ -8,11 +8,34 @@
send_notice/1,
getbody/1]).
+-export([mod_options/1, depends/2, mod_opt_type/1, mod_doc/0]).
+
-define(PROCNAME, ?MODULE).
-include("xmpp.hrl").
+-include("translate.hrl").
-include("logger.hrl").
+depends(_Host, _Opts) ->
+ [].
+
+mod_opt_type(post_url) ->
+ econf:binary();
+mod_opt_type(app_id) ->
+ econf:binary();
+mod_opt_type(api_key) ->
+ econf:binary().
+
+mod_options(_Host) ->
+ [{post_url, <<"">>},
+ {app_id, <<"">>},
+ {api_key, <<"">>}
+ ].
+
+mod_doc() ->
+ #{desc =>
+ ?T("This module is for offline post.")}.
+
start(Host, Opts) ->
?INFO_MSG("Starting mod_offline_post", [] ),
register(?PROCNAME,spawn(?MODULE, init, [Host, Opts])),
@@ -50,11 +73,11 @@ send_notice({Action,Packet}) ->
% ToId = binary_to_list(fxml:get_tag_attr_s(list_to_binary("toId"), CustomData)),
% IsPhoto = binary_to_list(fxml:get_tag_attr_s(list_to_binary("isPhoto"), CustomData)),
- PostUrl = gen_mod:get_module_opt(To#jid.lserver, ?MODULE, post_url,fun(S) -> iolist_to_binary(S) end, list_to_binary("")),
+ PostUrl = gen_mod:get_module_opt(To#jid.lserver, ?MODULE, post_url),
%% Configure your own options passed to module
- AppId = gen_mod:get_module_opt(To#jid.lserver, ?MODULE, app_id, fun(S) -> iolist_to_binary(S) end, list_to_binary("")),
- ApiKey = gen_mod:get_module_opt(To#jid.lserver, ?MODULE, api_key, fun(S) -> iolist_to_binary(S) end, list_to_binary("")),
+ AppId = gen_mod:get_module_opt(To#jid.lserver, ?MODULE, app_id),
+ ApiKey = gen_mod:get_module_opt(To#jid.lserver, ?MODULE, api_key),
Data = string:join(["to=", ToUsername, "&from=", FromUsername, "&type=", Type, "&body=", FinalBody], ""),
Request = {binary_to_list(PostUrl), [{"X-Parse-Application-Id", binary_to_list(AppId)}, {"X-Parse-REST-API-Key", binary_to_list(ApiKey)}], "application/x-www-form-urlencoded", Data},
--
2.20.1
And finally, apply the patch, and install the module:
git am -3 update.patch
S'està aplicant: Update to compile with recent ejabberd
ejabberdctl modules_available
mod_offline_post Forwards messages that are sent to offline users through a post request to a configurable url
ejabberdctl module_install mod_offline_post
/home/badlop/.ejabberd-modules/sources/mod_offline_post/src/mod_offline_post.erl:33: Warning: variable 'Action' is unused
/home/badlop/.ejabberd-modules/sources/mod_offline_post/src/mod_offline_post.erl:45: Warning: variable 'El' is unused