Plug-ins

uhub ships with a set of loadable C plug-ins. Enable them in plugins.conf by pointing at the built .so file with an optional configuration string.

On Unix systems, a plug-in is loaded like this:

plugin /var/lib/uhub/mod_logging.so "file=/var/log/uhub/uhub.log"

On Windows, point at the .dll instead:

plugin c:\path\to\mod_logging.dll "file=c:\uhub\uhub.log"

Plug-ins are loaded in the order they are listed, which matters when one builds on another — mod_selfregister needs a storage plug-in above it, and for intercepted events the first plug-in to give a verdict wins. An optional plugin_dir line sets a base directory for any plug-in named without an absolute path:

plugin_dir /usr/lib/uhub
plugin mod_logging.so "file=/var/log/uhub/uhub.log"

Bundled plug-ins

Click a module for its configuration options and commands.

Authentication and accounts

ModuleDescription
mod_auth_sqliteRegistered accounts and persisted bans in a SQLite database.
mod_auth_simpleRegistered accounts from a read-only text file.
mod_selfregisterSelf-service !regme / !passwd commands. 0.8.0

Chat and moderation

ModuleDescription
mod_welcomeSends a welcome message (and rules / MOTD) to users when they log in.
mod_chat_historyProvides a global chat history log.
mod_chat_history_sqliteProvides a global chat history log backed by SQLite.
mod_chat_onlyChat-only hub: disables connection setup, search and results.
mod_chat_is_privilegedRestricts main chat and private messages by credential.
mod_no_guest_downloadsOnly registered users can search and initiate transfers.
mod_floodDisconnects users after repeated hub-detected floods.
mod_topicAdds commands for changing the hub topic (description).

Interface and extensibility

ModuleDescription
mod_ucmdPublishes hub commands as client right-click context menus.
mod_javascriptRuns JavaScript scripts as plug-ins, via an embedded QuickJS engine. 0.8.0
mod_loggingLogs users entering and leaving the hub.
mod_exampleA simple example plug-in to base your own on.

mod_javascript is optional and only built when the hub is configured with -DJAVASCRIPT_SUPPORT=ON; every other module above is built by default.

Example configuration

A typical plugins.conf combining several modules:

plugin /var/lib/uhub/mod_auth_sqlite.so "file=/etc/uhub/users.db"
plugin /var/lib/uhub/mod_selfregister.so
plugin /var/lib/uhub/mod_logging.so "file=/var/log/uhub/uhub.log"
plugin /var/lib/uhub/mod_welcome.so "motd=/etc/uhub/motd.txt rules=/etc/uhub/rules.txt rtf0=true"
plugin /var/lib/uhub/mod_chat_history.so "history_max=200 history_default=10 history_connect=5"
plugin /var/lib/uhub/mod_ucmd.so

Upgrading to 0.8.0? Plug-ins must be rebuilt against plug-in API 8 — the hub refuses to load older ones. The self_register parameter of mod_auth_sqlite was removed in favour of mod_selfregister, and registered accounts no longer live in the ACL file.

Want to write your own? See the plug-in API for C, or the JavaScript plug-in API for scripts.