Tip of the day: If you still have users on plaintext port 6667, consider enabling Strict Transport Security to gently move users to SSL/TLS on port 6697.

Dev:Callback API

From UnrealIRCd documentation wiki
Jump to navigation Jump to search

Callbacks are (pratically) only used for cloaking (if you want to create your own cloaking algorithm). If you are reading this page then most likely you are looking for Hooks instead.

Registering a Callback

Callbacks provide a way for a module to be notified when a command is executed - it is a way for modules to patch into core operations of the IRCd without having to use command overrides or EFuncs, both of which require total implementation of logic for a command, so make it difficult to simply add additional logic for a given event.

The difference between Callbacks and Hooks is more in how they are used than anything else, Hooks are used for non-command events and even between modules, whereas Callbacks as always sent from the core of the IRCd and used by modules, and only handle commands and extremely specific events, whereas hooks are more widespread and varied in their usage.

CallbackAddEx

Callback* CallbackAddEx(module, cbtype, func)
  • module - Module to associated callback with
  • cbtype - Type of callback
  • func - Function to be called when callback is invoked, of form: int (*intfunc)()

Adds a callback to be executed for specified type of callback invocation - you should always use these functions, and not the CallbackAdd functions - they should always have the Ex suffix.

CallbackAddVoidEx

Callback* CallbackAddVoidEx(module, cbtype, func)
  • module - Module to associated callback with
  • cbtype - Type of callback
  • func - Function to be called when callback is invoked, of form: void (*voidfunc)()

Adds a callback to be executed for specified type of callback invocation - you should always use these functions, and not the CallbackAdd functions - they should always have the Ex suffix.

CallbackAddPCharEx

Callback* CallbackAddPCharEx(module, cbtype, func)
  • module - Module to associated callback with
  • cbtype - Type of callback
  • func - Function to be called when callback is invoked, of form: char *(*pcharfunc)()

Adds a callback to be executed for specified type of callback invocation - you should always use these functions, and not the CallbackAdd functions - they should always have the Ex suffix.

CallbackDel

CallbackDel(Callback *cb)
  • cb - Callback to be removed

Removes a given callback, Callback object passed in must have previously been added by a CallbackAdd..Ex call.