Skip to content

Commit 99e7ff2

Browse files
committed
Add support for WebAdmin Menu System
1 parent 466b5ab commit 99e7ff2

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

mod_muc_log_http/src/mod_muc_log_http.erl

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
-export([process/2]).
1616

17+
-export([web_menu_system/3]).
18+
1719
-include_lib("xmpp/include/xmpp.hrl").
1820
-include("ejabberd_http.hrl").
1921
-include("mod_muc_room.hrl").
@@ -236,7 +238,7 @@ last_modified(FileName) ->
236238
%%%----------------------------------------------------------------------
237239

238240
start(_Host, _Opts) ->
239-
ok.
241+
{ok, [{hook, webadmin_menu_system_post, web_menu_system, 1000-$m, global}]}.
240242

241243
stop(_Host) ->
242244
ok.
@@ -281,3 +283,11 @@ find_handler_port_path(Tls, Module) ->
281283
end;
282284
(_) -> false
283285
end, ets:tab2list(ejabberd_listener)).
286+
287+
%%----------------------------------------------------------------------
288+
%% WebAdmin
289+
%%----------------------------------------------------------------------
290+
291+
web_menu_system(Result, _Request, _Level) ->
292+
Els = ejabberd_web_admin:make_menu_system(?MODULE, "💬", "MUC Log", ""),
293+
Els ++ Result.

mod_webpresence/src/mod_webpresence.erl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
%% API
3333
-export([start_link/0]).
3434

35+
-export([web_menu_system/3]).
36+
3537
-include_lib("xmpp/include/xmpp.hrl").
3638
-include("logger.hrl").
3739
-include("translate.hrl").
@@ -51,6 +53,7 @@ start_link() ->
5153
gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).
5254

5355
start(Host, Opts) ->
56+
ejabberd_hooks:add(webadmin_menu_system_post, global, ?MODULE, web_menu_system, 1000-$p),
5457
Dir = case gen_mod:get_opt(pixmaps_path, Opts) of
5558
auto ->
5659
Package = atom_to_list(?MODULE),
@@ -71,6 +74,7 @@ start(Host, Opts) ->
7174
end.
7275

7376
stop(Host) ->
77+
ejabberd_hooks:delete(webadmin_menu_system_post, global, ?MODULE, web_menu_system, 1000-$p),
7478
Proc = gen_mod:get_module_proc(Host, ?MODULE),
7579
gen_server:call(Proc, stop),
7680
gen_mod:stop_child(?MODULE, Host),
@@ -960,8 +964,12 @@ serve_web_presence(TypeURL, User, Server, Tail, #request{lang = Lang1, q = Q}) -
960964
%%%% Web Admin
961965
%%%% ---------------------
962966

967+
web_menu_system(Result, _Request, _Level) ->
968+
Els = ejabberd_web_admin:make_menu_system(?MODULE, "👁️", "Presence Web", ""),
969+
Els ++ Result.
970+
963971
web_menu_host(Acc, _Host, Lang) ->
964-
[{<<"webpresence">>, translate:translate(Lang, ?T("Web Presence"))} | Acc].
972+
[{<<"webpresence">>, translate:translate(Lang, ?T("Presence Web"))} | Acc].
965973

966974
web_page_host(_, _Host,
967975
#request{path = [<<"webpresence">>],

0 commit comments

Comments
 (0)