From: Badlop Date: Sun, 29 Jun 2008 11:34:30 +0000 (+0000) Subject: * src/mod_pubsub/node_pep.erl: Complain if mod_caps disabled and X-Git-Tag: v2.1.0~18^2~677 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5e25cbcaa939be7245b7703c8e87493d217455ca;p=ejabberd * src/mod_pubsub/node_pep.erl: Complain if mod_caps disabled and mod_pubsub has PEP plugin enabled (EJAB-677) SVN Revision: 1386 --- diff --git a/ChangeLog b/ChangeLog index e8e3bc824..b7973e8d0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-06-29 Badlop + + * src/mod_pubsub/node_pep.erl: Complain if mod_caps disabled and + mod_pubsub has PEP plugin enabled (EJAB-677) + 2008-06-28 Badlop * src/mod_muc/mod_muc_room.erl: Allow to store room diff --git a/src/mod_pubsub/node_pep.erl b/src/mod_pubsub/node_pep.erl index 97bf1b2fa..2fceb03ed 100644 --- a/src/mod_pubsub/node_pep.erl +++ b/src/mod_pubsub/node_pep.erl @@ -29,6 +29,7 @@ -module(node_pep). -author('christophe.romain@process-one.net'). +-include("ejabberd.hrl"). -include("pubsub.hrl"). -include("jlib.hrl"). @@ -65,6 +66,7 @@ init(Host, ServerHost, Opts) -> node_default:init(Host, ServerHost, Opts), + complain_if_modcaps_disabled(ServerHost), ok. terminate(Host, ServerHost) -> @@ -208,3 +210,25 @@ set_item(Item) -> get_item_name(Host, Node, Id) -> node_default:get_item_name(Host, Node, Id). + + +%%% +%%% Internal +%%% + +%% @doc Check mod_caps is enabled, otherwise show warning. +%% The PEP plugin for mod_pubsub requires mod_caps to be enabled in the host. +%% Check that the mod_caps module is enabled in that Jabber Host +%% If not, show a warning message in the ejabberd log file. +complain_if_modcaps_disabled(ServerHost) -> + Modules = ejabberd_config:get_local_option({modules, ServerHost}), + ModCaps = [mod_caps_enabled || {mod_caps, _Opts} <- Modules], + case ModCaps of + [] -> + ?WARNING_MSG("The PEP plugin is enabled in mod_pubsub of host ~p. " + "This plugin requires mod_caps to be enabled, " + "but it isn't.", [ServerHost]); + _ -> + ok + end. +