]> granicus.if.org Git - ejabberd/commitdiff
* src/mod_pubsub/node_pep.erl: Complain if mod_caps disabled and
authorBadlop <badlop@process-one.net>
Sun, 29 Jun 2008 11:34:30 +0000 (11:34 +0000)
committerBadlop <badlop@process-one.net>
Sun, 29 Jun 2008 11:34:30 +0000 (11:34 +0000)
mod_pubsub has PEP plugin enabled (EJAB-677)

SVN Revision: 1386

ChangeLog
src/mod_pubsub/node_pep.erl

index 5d661e0435aba0da73180503d01623f6e8a641ec..7f14754c4092c9ec6793c313ed3c8874034dec8b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-06-29  Badlop  <badlop@process-one.net>
+
+       * src/mod_pubsub/node_pep.erl: Complain if mod_caps disabled and
+       mod_pubsub has PEP plugin enabled (EJAB-677)
+
 2008-06-21  Badlop  <badlop@process-one.net>
 
        * doc/guide.tex: Explain that S2S outgoing first tries IPv4 and if
index 29f11a539df554d6b7f7a78d24080beaf041119e..a242021b6d822869dbf6998582e1f4f75305479b 100644 (file)
@@ -29,6 +29,7 @@
 -module(node_pep).
 -author('christophe.romain@process-one.net').
 
+-include("ejabberd.hrl").
 -include("pubsub.hrl").
 -include("jlib.hrl").
 
@@ -64,6 +65,7 @@
 
 init(Host, ServerHost, Opts) ->
     node_default:init(Host, ServerHost, Opts),
+    complain_if_modcaps_disabled(ServerHost),
     ok.
 
 terminate(Host, ServerHost) ->
@@ -204,3 +206,24 @@ get_item(Host, Node, ItemId) ->
 
 set_item(Item) ->
     node_default:set_item(Item).
+
+%%%
+%%% 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.