From e138359c7f9153b0e44567f54c8743bd61d2396a Mon Sep 17 00:00:00 2001 From: Badlop Date: Fri, 13 Jul 2018 16:17:59 +0200 Subject: [PATCH] Update modules for ejabberd 18.06 lack of jlib.hrl and ejabberd.hrl (#251) --- mod_cron/src/mod_cron.erl | 3 +-- mod_grafite/src/mod_grafite.erl | 3 +-- mod_logsession/src/mod_logsession.erl | 1 - mod_logxml/src/mod_logxml.erl | 1 - mod_muc_log_http/src/mod_muc_log_http.erl | 3 +-- mod_post_log/src/mod_post_log.erl | 1 - mod_pottymouth/src/mod_pottymouth.erl | 3 +-- mod_s2s_log/src/mod_s2s_log.erl | 1 - mod_shcommands/src/mod_shcommands.erl | 3 +-- mod_statsdx/src/mod_stats2file.erl | 3 +-- mod_statsdx/src/mod_statsdx.erl | 3 +-- mod_webpresence/src/mod_webpresence.erl | 7 +++---- 12 files changed, 10 insertions(+), 22 deletions(-) diff --git a/mod_cron/src/mod_cron.erl b/mod_cron/src/mod_cron.erl index 223319e..777ef90 100644 --- a/mod_cron/src/mod_cron.erl +++ b/mod_cron/src/mod_cron.erl @@ -21,11 +21,10 @@ stop/1]). -include("ejabberd_commands.hrl"). --include("ejabberd.hrl"). -include("ejabberd_http.hrl"). -include("ejabberd_web_admin.hrl"). -include("logger.hrl"). --include("jlib.hrl"). +-include("xmpp.hrl"). -record(task, {taskid, timerref, host, task}). diff --git a/mod_grafite/src/mod_grafite.erl b/mod_grafite/src/mod_grafite.erl index 3ec4945..0aa2c16 100644 --- a/mod_grafite/src/mod_grafite.erl +++ b/mod_grafite/src/mod_grafite.erl @@ -12,9 +12,8 @@ -author('rochacamargothiago@gmail.com'). -behaviour(gen_mod). --include("ejabberd.hrl"). -include("logger.hrl"). --include("jlib.hrl"). +-include("xmpp.hrl"). -define(HOOKS, [offline_message_hook, sm_register_connection_hook, sm_remove_connection_hook, diff --git a/mod_logsession/src/mod_logsession.erl b/mod_logsession/src/mod_logsession.erl index f55bd97..51c6dd0 100644 --- a/mod_logsession/src/mod_logsession.erl +++ b/mod_logsession/src/mod_logsession.erl @@ -38,7 +38,6 @@ forbidden/1 ]). --include("ejabberd.hrl"). -include("xmpp.hrl"). -include("ejabberd_commands.hrl"). diff --git a/mod_logxml/src/mod_logxml.erl b/mod_logxml/src/mod_logxml.erl index 4c66378..b8dff84 100644 --- a/mod_logxml/src/mod_logxml.erl +++ b/mod_logxml/src/mod_logxml.erl @@ -14,7 +14,6 @@ -export([start/2, init/7, stop/1, send_packet/1, receive_packet/1]). --include("ejabberd.hrl"). -include("xmpp.hrl"). -define(PROCNAME, ejabberd_mod_logxml). diff --git a/mod_muc_log_http/src/mod_muc_log_http.erl b/mod_muc_log_http/src/mod_muc_log_http.erl index 38ceb8a..92f4f67 100644 --- a/mod_muc_log_http/src/mod_muc_log_http.erl +++ b/mod_muc_log_http/src/mod_muc_log_http.erl @@ -16,7 +16,6 @@ process/2 ]). --include("ejabberd.hrl"). -include("xmpp.hrl"). -include("ejabberd_http.hrl"). -include("mod_muc_room.hrl"). @@ -101,7 +100,7 @@ get_room_config(Room_pid) -> show_dir_listing(DirName, LocalPath) -> Header = io_lib:format("Name Last modified Size Description~n", []), - Address = io_lib:format("
ejabberd/~s Server
", [?VERSION]), + Address = io_lib:format("
ejabberd/~s Server
", [ejabberd_config:get_version()]), {ok, Listing} = file:list_dir(DirName), Listing2 = lists:sort(Listing), diff --git a/mod_post_log/src/mod_post_log.erl b/mod_post_log/src/mod_post_log.erl index 951eee3..70e472c 100644 --- a/mod_post_log/src/mod_post_log.erl +++ b/mod_post_log/src/mod_post_log.erl @@ -20,7 +20,6 @@ log_user_send/4, post_result/1]). --include("ejabberd.hrl"). -include("xmpp.hrl"). start(Host, _Opts) -> diff --git a/mod_pottymouth/src/mod_pottymouth.erl b/mod_pottymouth/src/mod_pottymouth.erl index f954064..008371d 100644 --- a/mod_pottymouth/src/mod_pottymouth.erl +++ b/mod_pottymouth/src/mod_pottymouth.erl @@ -2,7 +2,6 @@ -behaviour(gen_mod). -% -include("ejabberd.hrl"). -include("logger.hrl"). -include("xmpp.hrl"). @@ -94,4 +93,4 @@ mod_opt_type(_) -> [blacklists, charmaps]. depends(_Host, _Opts) -> []. reload(_Host, _NewOpts, _OldOpts) -> ok. mod_options(_) -> - [{blacklists, []},{charmaps, []}]. \ No newline at end of file + [{blacklists, []},{charmaps, []}]. diff --git a/mod_s2s_log/src/mod_s2s_log.erl b/mod_s2s_log/src/mod_s2s_log.erl index 23bab31..1f04a7f 100644 --- a/mod_s2s_log/src/mod_s2s_log.erl +++ b/mod_s2s_log/src/mod_s2s_log.erl @@ -39,7 +39,6 @@ s2s_out_auth/2, s2s_in_auth/3]). --include("ejabberd.hrl"). -include("logger.hrl"). -define(PROCNAME, ?MODULE). diff --git a/mod_shcommands/src/mod_shcommands.erl b/mod_shcommands/src/mod_shcommands.erl index d53461a..03524cd 100644 --- a/mod_shcommands/src/mod_shcommands.erl +++ b/mod_shcommands/src/mod_shcommands.erl @@ -14,8 +14,7 @@ -export([web_menu_node/3, web_page_node/5, start/2, stop/1]). --include("ejabberd.hrl"). --include("jlib.hrl"). +-include("xmpp.hrl"). -include("ejabberd_http.hrl"). -include("ejabberd_web_admin.hrl"). diff --git a/mod_statsdx/src/mod_stats2file.erl b/mod_statsdx/src/mod_stats2file.erl index d59e799..4582930 100644 --- a/mod_statsdx/src/mod_stats2file.erl +++ b/mod_statsdx/src/mod_stats2file.erl @@ -13,8 +13,7 @@ -export([start/2, loop/5, stop/1]). --include("ejabberd.hrl"). --include("jlib.hrl"). +-include("xmpp.hrl"). -include("mod_roster.hrl"). -define(PROCNAME, ejabberd_mod_stats2file). diff --git a/mod_statsdx/src/mod_statsdx.erl b/mod_statsdx/src/mod_statsdx.erl index 2267d51..26f0e98 100644 --- a/mod_statsdx/src/mod_statsdx.erl +++ b/mod_statsdx/src/mod_statsdx.erl @@ -28,7 +28,6 @@ %%user_logout_sm/3, user_login/1, user_logout/4]). --include("ejabberd.hrl"). -include("ejabberd_commands.hrl"). -include("xmpp.hrl"). -include("logger.hrl"). @@ -1582,7 +1581,7 @@ get_sessions_filtered(Filter, server) -> end end, [], - ?MYHOSTS); + ejabberd_config:get_myhosts()); get_sessions_filtered(Filter, Host) -> Match = case Filter of [{<<"client">>, Client}] -> {{session, '$1'}, jlib:binary_to_atom(Client), '$2', '$3', '$4', '$5', '$6', '$7'}; diff --git a/mod_webpresence/src/mod_webpresence.erl b/mod_webpresence/src/mod_webpresence.erl index af8d4fe..7ad0645 100644 --- a/mod_webpresence/src/mod_webpresence.erl +++ b/mod_webpresence/src/mod_webpresence.erl @@ -31,7 +31,6 @@ %% API -export([start_link/0]). --include("ejabberd.hrl"). -include("xmpp.hrl"). -include("logger.hrl"). -include("ejabberd_web_admin.hrl"). @@ -231,8 +230,8 @@ process_vcard(#iq{type = get, lang = Lang, sub_els = [#vcard_temp{}]} = IQ) -> Desc = translate:translate(Lang, <<"ejabberd Web Presence module">>), xmpp:make_iq_result( IQ, #vcard_temp{fn = <<"ejabberd/mod_webpresence">>, - url = ?EJABBERD_URI, - desc = <>}); + url = ejabberd_config:get_uri(), + desc = Desc}); process_vcard(#iq{type = set, lang = Lang} = IQ) -> Txt = <<"Value 'set' of 'type' attribute is not allowed">>, xmpp:make_error(IQ, xmpp:err_not_allowed(Txt, Lang)); @@ -920,7 +919,7 @@ process2([User, Server | Tail], Request) -> serve_web_presence(TypeURL, User, Server, Tail, #request{lang = Lang1, q = Q}) -> LServer = jlib:nameprep(Server), - true = lists:member(Server, ?MYHOSTS), + true = lists:member(Server, ejabberd_config:get_myhosts()), LUser = jlib:nodeprep(User), WP = get_wp(LUser, LServer), case TypeURL of