## E.4. Enabling and Disabling Plugins

As described in Chapter 13, Plugins, the user can enable or disable plugins. By default, disabling a plugin means disabling all its triggers, macros, aliases, hooks and timers, and enabling a plugin means enabling all the above items.

Most of the times that is enough, but for some plugins this naive approach may not be appropriate. One such case is when a plugin has some triggers (or any other kind of item) that is not necessarily always enabled, and whose status is set by some other means.

In these cases, you can define two functions named `ENABLE` and `DISABLE`. These will be called when the plugin is being enabled and disabled, respectively, and you can do whatever is necessary in there.

If these functions are defined, then the standard behaviour (enabling or disabling all items) is not done, and you must do whatever is necessary by yourself. Also, no message is printed, so you might want to print some informative message.

The functions should return a true value to indicate success. If for some reason the operation could not be done and the status should not be changed, return a false value and the status of the plugin will not be altered. But use this feature with care.

If the functions are not defined, then the default behavior described above is used. So if your plugin doesn't have special needs, you do not need to define these functions.