[[pluginconf]]
= Plugin Configuration
:author: Artur Hefczyc <artur.hefczyc@tigase.net>
:version: v2.1 September 2017. Reformatted for v8.0.0.

:toc:
:numbered:
:website: http://tigase.net/

Plugin configuration is straightforward.

Tell the Tigase server to load or not to load the plugins via the `config.tdsl` file.
Plugins fall within the `'sess-man'` container.  To activate a plugin, simply list it among the sess-man plugins.

If you do not wish to use this method to find out what plugins are running, there are two ways you can identify if a plugin is running.
One is the log file: logs/tigase-console.log. If you look inside you can find following output:

[source,bash]
-----
Loading plugin: jabber:iq:register ...
Loading plugin: jabber:iq:auth ...
Loading plugin: urn:ietf:params:xml:ns:xmpp-sasl ...
Loading plugin: urn:ietf:params:xml:ns:xmpp-bind ...
Loading plugin: urn:ietf:params:xml:ns:xmpp-session ...
Loading plugin: roster-presence ...
Loading plugin: jabber:iq:privacy ...
Loading plugin: jabber:iq:version ...
Loading plugin: http://jabber.org/protocol/stats ...
Loading plugin: starttls ...
Loading plugin: vcard-temp ...
Loading plugin: http://jabber.org/protocol/commands ...
Loading plugin: jabber:iq:private ...
Loading plugin: urn:xmpp:ping ...
-----

and this is a list of plugins which are loaded in your installation.

Another way is to look inside the session manager source code which has the default list hardcoded:

[source,java]
-----
private static final String[] PLUGINS_FULL_PROP_VAL =
  {"jabber:iq:register", "jabber:iq:auth", "urn:ietf:params:xml:ns:xmpp-sasl",
   "urn:ietf:params:xml:ns:xmpp-bind", "urn:ietf:params:xml:ns:xmpp-session",
   "roster-presence", "jabber:iq:privacy", "jabber:iq:version",
   "http://jabber.org/protocol/stats", "starttls", "msgoffline",
   "vcard-temp", "http://jabber.org/protocol/commands", "jabber:iq:private",
   "urn:xmpp:ping", "basic-filter", "domain-filter"};
-----


In you wish to load a plugin outside these defaults, you have to edit the list and add your plugin IDs as a value to the plugin list under 'sess-man'. Let's say our plugin ID is *message* as in our all examples:

[source,bash]
-----
'sess-man' () {
    'jabber:iq:register' () {}
    'jabber:iq:auth' () {}
    message () {}
}
-----

Assuming your plugin class is in the classpath it will be loaded and used at the runtime.  You may specify class by adding `class: class.implementing.plugin` within the parenthesis of the plugin.

NOTE: If your plugin name has any special characters (-,:\|/.) it needs to be encapsulated in single quotation marks.

There is another part of the plugin configuration though. If you looked at the xref:writePluginCode[Writing Plugin Code] guide you can remember the *Map settings* processing parameter. This is a map of properties you can set in the configuration file and these setting will be passed to the plugin at the processing time.

Again *config.tdsl* is the place to put the stuff. These kind of properties start under your *plugin ID* and each key and value will be a child underneath:

[source,dsl]
-----
'sess-man' () {
    pluginID {
      key1 = 'val1'
      key2 = 'val2'
      key3 = 'val3'
    }
}
-----

NOTE: From v8.0.0 you will no longer be able to specify one value for multiple keys, you must set each one individually.

Last but not least - in case you have *omitted plugin ID*:

[source,bash]
-----
'sess-man' () {
    key1 = 'val1'
}
-----
then the configured key-value pair will be a global/common plugin setting available to all loaded plugins.
