-
Notifications
You must be signed in to change notification settings - Fork 140
add mod_unified_push #363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add mod_unified_push #363
Conversation
|
Hi! This is a first list of ideas:
|
| -include_lib("xmpp/include/xmpp.hrl"). |
ejabberd-contrib has automatic tests to ensure the modules compile correctly and pass some static analysis (with tools xref and dialyzer). Right now those results show a lot of errors, but most are related to p1_xmpp, and will disappear when this gets fixed.
Solution: replace with
-include_lib("xmpp/include/xmpp.hrl").
If you want to support both paths ("p1_xmpp" and "xmpp"), I guess we can look for some conditional compilation directive...
url: "[email protected]:itd/mod_unified_push.git"
This should be the URL where the source code is published.
Notice that the URL for most modules is
url: "[email protected]:processone/ejabberd-contrib.git"
There is one exception: spec files located in the extra/ directory can contain URLs from other git repositories, and then ejabberd takes care to download from those remote locations.
Unfortunately, as you can see in https://github.com/processone/ejabberd-contrib/tree/master/extra right now all the modules mentioned in that directory are not maintained anymore, so the files were renamed to "broken" to prevent ejabberd using them.
In summary, if the source code is expected to be published in ejabberd-contrib, then replace with
url: "[email protected]:processone/ejabberd-contrib.git"
You can add a paragraph in README.md explaining that the module was previously published in url XXX.
|
Hi, thanks for the review and the feedback! Hope you don't mind me adding my two cents.
Indeed. The include is inspired / guided / ... by a Debian patch.
Sounds interesting. Only for this module or in general?
(I'd be happy to see the source move here.)
(Either, adding or omitting something like this, would work for me.) Regards PS: Thanks erebion for creating this pull request. |
✔️
✔️
✔️ Did what I feel competent to do. The remaining two points will require someone else, as I have not looked at Erlang code before I opened this Merge Request, so I have no competence for this yet (but give me tip on learning Erlang and I might be able to contribute in the future, I'd like to understand more of how ejabberd works).
and
for which I'll not change the path until you both have finished talking about how this should done. Maybe @itd0 would be fine looking at this change, it seems to be a small change after all. :) |
To keep things simple (and consistent), I'd suggest to use |
I've amended the Merge Request as suggested. Then it is just one point left:
|
Ah sorry, you're right: both the source code and the documentation instruct to use README.txt in plaintext. As ejabberd's README is in markdown, and some modules already included markdown, three years ago I converted all working modules to markdown too:
I've now updated the source code and documentation ;)
I was also curious about how exactly could it be implemented, and wrote a quick and dirty patch... Example usage: $ ./configure --with-rebar=rebar3
$ make
===> Compiling src/ext_mod.erl failed
src/ext_mod.erl:{54,14}: can't find include lib "path_in_non_debian_system.hrl"
$ ./configure --enable-debian --with-rebar=rebar3
$ make
===> Compiling src/ext_mod.erl failed
src/ext_mod.erl:{58,14}: can't find include lib "path_in_debian_system.hrl"Patch to ejabberd (and dummy test in a random file, for example ext_mod.erl): diff --git a/configure.ac b/configure.ac
index 12e3ae463..1b64a7f8f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -301,6 +301,14 @@ AC_ARG_ENABLE(zlib,
*) AC_MSG_ERROR(bad value ${enableval} for --enable-zlib) ;;
esac],[if test "x$zlib" = "x"; then zlib=true; fi])
+AC_ARG_ENABLE(debian,
+[AS_HELP_STRING([--enable-debian],[use Debian specific include paths (default: no)])],
+[case "${enableval}" in
+ yes) debian=true ;;
+ no) debian=false ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-debian) ;;
+esac],[if test "x$debian" = "x"; then debian=false; fi])
+
case "`uname`" in
"Darwin")
# Darwin (macos) erlang-sqlite is built using amalgamated lib, so no external dependency
@@ -334,6 +342,7 @@ AC_SUBST(stun)
AC_SUBST(sip)
AC_SUBST(debug)
AC_SUBST(lua)
+AC_SUBST(debian)
AC_SUBST(tools)
AC_SUBST(latest_deps)
AC_SUBST(system_deps)
diff --git a/rebar.config b/rebar.config
index 97b2f2805..b0a5f9de9 100644
--- a/rebar.config
+++ b/rebar.config
@@ -141,6 +141,7 @@
{if_version_below, "26", {d, 'OTP_BELOW_26'}},
{if_version_below, "27", {d, 'OTP_BELOW_27'}},
{if_version_below, "28", {d, 'OTP_BELOW_28'}},
+ {if_var_true, debian, {d, 'DEBIAN_SYSTEM'}},
{if_var_false, debug, no_debug_info},
{if_var_true, debug, debug_info},
{if_var_true, elixir, {d, 'ELIXIR_ENABLED'}},
diff --git a/src/ext_mod.erl b/src/ext_mod.erl
index 2d34a91f9..0b4d111f8 100644
--- a/src/ext_mod.erl
+++ b/src/ext_mod.erl
@@ -50,6 +50,14 @@
-include("translate.hrl").
-include_lib("xmpp/include/xmpp.hrl").
+-ifndef(DEBIAN_SYSTEM).
+-include_lib("path_in_non_debian_system.hrl").
+-endif.
+
+-ifdef(DEBIAN_SYSTEM).
+-include_lib("path_in_debian_system.hrl").
+-endif.
+
-define(REPOS, "[email protected]:processone/ejabberd-contrib.git").
-record(state, {}).
diff --git a/vars.config.in b/vars.config.in
index ded059b3e..1901aed24 100644
--- a/vars.config.in
+++ b/vars.config.in
@@ -24,6 +24,7 @@
{debug, @debug@}.
{new_sql_schema, @new_sql_schema@}.
+{debian, @debian@}.
{tools, @tools@}.
%% DependenciesBut later, thinking more carefully, I've found a better solution: this can be implemented in ext_mod.erl more easily, and it is now committed in processone/ejabberd@8855a30 If anybody is able to test it in a real debian system, please comment your results. |
|
The test actions are failing with different errors, some of them are probably related to ejabberd using an xmpp library that doesn't yet include the required improvements. Let's wait until xmpp gets the patch, then ejabberd gets updated to use it, then those tests use it, and the new test results will be the ones to really review. |
Could try the build from CI. Can I go back to 25.04 if anything breaks? EDIT: Once the patch is there and the CI no longer fails and so on |
I think yes, because looking at the git commits in ejabberd master branch since 25.04, I see no changes in the mnesia or SQL database schemas, so I see no problem in switching from 25.04 to and from git master. Regarding the overall tasks:
The three records -include_lib("xmpp/include/xmpp.hrl").Solution: you can remove those records definitions in lines 86-101. |
It should also be safe to remove lines 354-868 (see Edit (2025-06-23): This (untested) commit should do the trick. |
done
done |
Remove it or include the changed version? |
|
With your latest improvements, I noticed there's a problem in ejabberd-contrib testing CI; and I've solved it with commit cf0c7a8. Please rebase your branch to master, to benefit from that small commit. Additionally, I've solved other problems that were detected by CI testing, and have submitted a PR to your branch: erebion#1 |
…ibraries that are included
d194bc2 to
2e0594c
Compare
done
Re-basing the branch on latest master created merge conflicts over there. |
…e xmpp erlang library
Several fixes for compilation, dialyzer, documentation and "make options"
|
It's finally merged 😀 |
This PR adds mod_unified_push from https://codeberg.org/itd/mod_unified_push
The author plans to archive the original repo if this PR gets accepted: https://codeberg.org/itd/mod_unified_push/issues/1
I've been using this module for a couple weeks now and it seems to work just fine.
As I couldn't find any info on what's required for contributions, kindly let me know what might be missing for this PR to get accepted.