# IRC Services Technical Reference Manual

## Appendix B. Function index

Note: This index does not include functions defined in modules.

A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z

Table of Contents

Function name and file | Parameters | Return value | Purpose
--- | --- | --- | ---
A
actions_cleanup (actions.c) | — | — | Performs cleanup actions for the high-level action routines.
actions_init (actions.c) | `int ac`: Command-line argument count. `char **av`: Command-line argument vector. | `int`: Nonzero on success, zero on failure. | Performs initialization actions for the high-level action routines.
add_callback (modules.h) | `Module *module`: Handle of the module for the callback, or `NULL` for a core callback. `const char *name`: Callback name. `callback_t callback`: Callback function to add. | `int`: Nonzero on success, zero on error. | Adds a callback function to the specified callback in the specified module. Equivalent to `add_callback_pri()` with a priority of zero.

add_callback_pri
(modules.h)

`Module *module`: Handle of the module for the callback, or `NULL` for a core callback.

`const char *name`: Callback name.

`callback_t callback`: Callback function to add.

`int priority`: Priority at which function is to be added.

`int`: Nonzero on success, zero on error.

Adds a callback function to the specified callback in the specified module, with a certain priority (higher priority values cause the function to be called earlier).

_add_callback_pri
(modules.c)

`Module *module`: Handle of the module for the callback, or `NULL` for a core callback.

`const char *name`: Callback name.

`callback_t callback`: Callback function to add.

`int priority`: Priority at which function is to be added.

`const Module *caller`: Handle of the calling module.

`int`: Nonzero on success, zero on error.

Implements the `add_callback()` and `add_callback_pri()` macros.

add_channel (channel.c) | `Channel *channel`: Channel to add. | — | Adds the given channel to the hash table.

add_mode_with_params
(actions.c)

`struct modedata *md`: Channel mode data being modified.

`char mode`: Mode character to append.

`int is_add`: Nonzero if the mode is being added, zero if it is being removed.

`int params`: Number of parameters in `parambuf`.

`const char *parambuf`: Space-separated parameters for the mode.

`int len`: Length of `parambuf`.

—

Called by `set_cmode()` to append a mode character that takes parameters to the accumulated mode changes for a channel. Flushes out the accumulated mode changes if no space is available to append the mode or its parameters.

add_server (servers.c) | `Server *server`: Server to add. | — | Adds the given server to the hash table.
add_timeout (timeout.c) | `int delay`: Delay in seconds. `void (*code)(Timeout *)`: Function to call when timeout expires. `int repeat`: Nonzero to make the timeout repeating. | `Timeout *`: New timeout handle. | Creates a new timeout that expires in `delay` seconds. If `repeat` is nonzero, the timeout will be restarted after the timeout function is called, otherwise the timeout will be deleted.
add_timeout_ms (timeout.c) | `uint32 delay`: Delay in milliseconds. `void (*code)(Timeout *)`: Function to call when timeout expires. `int repeat`: Nonzero to make the timeout repeating. | `Timeout *`: New timeout handle. | Creates a new timeout that expires in `delay` milliseconds. Otherwise identical to `add_timeout()`.
add_user (users.c) | `User *user`: User to add. | — | Adds the given user to the hash table.
addstring (language.c) | `const char *name`: Identifier for the new string. | `int`: Index for the new string (nonnegative), or -1 on failure. | Adds a new string identifier to the language tables. The string is set to empty in all languages.

atolsafe
(misc.c)

`const char *s`: String to convert.

`long min`: Minimum acceptable value.

`long max`: Maximum acceptable value.

`long`: Converted value, or `min-1` on error.

Converts a base 10 numeric string to a `long` value, ensuring that the string contains no invalid characters and that it is within the inclusive range `min` through `max`. Sets `errno` to `EINVAL` if the string contains invalid characters, and to `ERANGE` if the converted value is outside the specified range.

auspice_load_admin (tools/convert-sirv.c) | `const char *dir`: Directory from which to load data. | — | Loads the Auspice `admin.db` data file.
B

bad_password
(actions.c)

`const char *service`: Nickname of relevant pseudoclient.

`User *u`: User that sent the bad password.

`const char *what`: What the bad password was for (used in the kill message).

`int`: 2 if the user was killed, 1 if the user will be killed on the next bad password, else 0.

Sends a "password incorrect" notice from the given pseudoclient to the user, and checks the user's bad password count against the `BadPassLimit` setting, killing or warning the user as appropriate.

bolivia_load_gline (tools/convert-sirv.c) | `const char *dir`: Directory from which to load data. | — | Loads the Bolivia `gline.db` data file.
bolivia_load_qline (tools/convert-sirv.c) | `const char *dir`: Directory from which to load data. | — | Loads the Bolivia `qline.db` data file.
bolivia_load_zline (tools/convert-sirv.c) | `const char *dir`: Directory from which to load data. | — | Loads the Bolivia `zline.db` data file.
buffered_write (sockets.c) | `Socket *s`: Socket to send data on. `const char *buf`: Data to send. `int len`: Length of data to send. | `int`: Number of bytes sent or buffered, or -1 on error. | Writes the given data to the given socket, buffering any data that cannot be sent immediately.
C
call_callback (modules.h) | `int id`: ID of the callback to call. | `int`: The value returned by the first callback function to return a nonzero value; zero if all callback functions returned zero; or -1 on error. | Calls a module callback with no arguments.
call_callback_1 (modules.h) | `int id`: ID of the callback to call. `void *arg1`: Callback function parameter. | `int`: The value returned by the first callback function to return a nonzero value; zero if all callback functions returned zero; or -1 on error. | Calls a module callback with one argument.
call_callback_2 (modules.h) | `int id`: ID of the callback to call. `void *arg1`: First callback function parameter. `void *arg2`: Second callback function parameter. | `int`: The value returned by the first callback function to return a nonzero value; zero if all callback functions returned zero; or -1 on error. | Calls a module callback with two arguments.

call_callback_3
(modules.h)

`int id`: ID of the callback to call.

`void *arg1`: First callback function parameter.

`void *arg2`: Second callback function parameter.

`void *arg3`: Third callback function parameter.

`int`: The value returned by the first callback function to return a nonzero value; zero if all callback functions returned zero; or -1 on error.

Calls a module callback with three arguments.

call_callback_4
(modules.h)

`int id`: ID of the callback to call.

`void *arg1`: First callback function parameter.

`void *arg2`: Second callback function parameter.

`void *arg3`: Third callback function parameter.

`void *arg4`: Fourth callback function parameter.

`int`: The value returned by the first callback function to return a nonzero value; zero if all callback functions returned zero; or -1 on error.

Calls a module callback with four arguments.

call_callback_5
(modules.h)

`int id`: ID of the callback to call.

`void *arg1`: First callback function parameter.

`void *arg2`: Second callback function parameter.

`void *arg3`: Third callback function parameter.

`void *arg4`: Fourth callback function parameter.

`void *arg5`: Fifth callback function parameter.

`int`: The value returned by the first callback function to return a nonzero value; zero if all callback functions returned zero; or -1 on error.

Calls a module callback with five arguments.

_call_callback_5
(modules.c)

`Module *module`: Handle for the calling module.

`int id`: ID of the callback to call.

`void *arg1`: First callback function parameter.

`void *arg2`: Second callback function parameter.

`void *arg3`: Third callback function parameter.

`void *arg4`: Fourth callback function parameter.

`void *arg5`: Fifth callback function parameter.

`int`: The value returned by the first callback function to return a nonzero value; zero if all callback functions returned zero; or -1 on error.

Implements the `call_callback()` and `call_callback_N()` macros.

chan_adduser (channels.c) | `User *user`: User to add to channel. `const char *chan`: Channel to add user to. `int32 modes`: Initial channel user modes for the user. | `Channel *`: The channel record for the channel. | Adds a user to a channel, creating the channel record if it does not exist.
chan_deluser (channels.c) | `User *user`: User to remove from channel. `Channel *c`: Channel to remove user from. | — | Removes a user from a channel, deleting the channel record if the channel becomes empty.
chan_has_ban (channels.c) | `const char *chan`: Name of channel to check. `const char *ban`: Ban mask to look for. | `int`: Nonzero if the given mask is found on the channel's ban list, else zero. | Returns whether the channel's ban list contains the given mask (searched for case-insensitively).
change_user_nick (users.c) | `User *user`: User whose nickname is changing. `const char *nick`: New nickname. | — | Changes a user's nickname.
channel_cleanup (channels.c) | — | — | Performs cleanup actions for the channel management subsystem.
channel_init (channels.c) | `int ac`: Command-line argument count. `char **av`: Command-line argument vector. | `int`: Nonzero on success, zero on error. | Performs initialization actions for the channel management subsystem.
check_auspice (tools/convert-sirv.c) | `const char *dir`: Directory from which to load data. | `const char *`: String describing database type, or `NULL` if no database was found. | Checks for the presence of Auspice databases.
check_bolivia (tools/convert-sirv.c) | `const char *dir`: Directory from which to load data. | `const char *`: String describing database type, or `NULL` if no database was found. | Checks for the presence of Bolivia databases.
check_cygnus (tools/convert-cygnus.c) | `const char *dir`: Directory from which to load data. | `const char *`: String describing database type, or `NULL` if no database was found. | Checks for the presence of Cygnus databases.
check_daylight (tools/convert-ver8.c) | `const char *dir`: Directory from which to load data. | `const char *`: String describing database type, or `NULL` if no database was found. | Checks for the presence of Daylight databases.
check_epona (tools/convert-epona.c) | `const char *dir`: Directory from which to load data. | `const char *`: String describing database type, or `NULL` if no database was found. | Checks for the presence of Epona/Anope databases.
check_hybserv (tools/convert-hybserv.c) | `const char *dir`: Directory from which to load data. | `const char *`: String describing database type, or `NULL` if no database was found. | Checks for the presence of HybServ databases.
check_ircs_1_2 (tools/convert-ver8.c) | `const char *dir`: Directory from which to load data. | `const char *`: String describing database type, or `NULL` if no database was found. | Checks for the presence of IRCS 1.2 databases.
check_log_rotate (log.c) | — | — | Checks whether the log file needs to be rotated, and does so if necessary. Used internally by logging routines.
check_magick_14b2 (tools/convert-magick.c) | `const char *dir`: Directory from which to load data. | `const char *`: String describing database type, or `NULL` if no database was found. | Checks for the presence of Magick 1.4 databases.

check_module_symbol
(modules.c)

`Module *module`: Handle of the module in which symbol is to be looked up, or `NULL` for any module.

`const char *symname`: Symbol to look up.

`void **resultptr`: Location in which the symbol's value is to be stored on success (may be `NULL` if the symbol's value is not required).

`const char **errorptr`: Location in which an error message is to be stored on failure (may be `NULL` if the error message is not required).

`int`: Nonzero if the symbol was found, zero otherwise.

Looks up a symbol in a given (or any) module. If the symbol is found (the return value is nonzero), the symbol's value is stored in the location pointed to by `resultptr`; otherwise, an error message is stored in the location pointed to by `errorptr`.

check_password (encrypt.c) | `const char *plaintext`: Plaintext password to check. `const Password *password`: Encrypted password to check against. | `int`: 1 if the password matches; 0 if the password does not match; -1 if an error occurs during checking. | Checks a user-entered plaintext string against an encrypted password.
check_ptlink (tools/convert-ptlink.c) | `const char *dir`: Directory from which to load data. | `const char *`: String describing database type, or `NULL` if no database was found. | Checks for the presence of PTlink databases.
check_sirv (tools/convert-sirv.c) | `const char *dir`: Directory from which to load data. | `const char *`: String describing database type, or `NULL` if no database was found. | Checks for the presence of Sirv databases.
check_sockets (sockets.c) | — | — | Checks all open sockets for activity, taking appropriate action for any pending socket events..
check_timeouts (timeout.c) | — | — | Checks for expired timeouts.
check_trircd (tools/convert-trircd.c) | `const char *dir`: Directory from which to load data. | `const char *`: String describing database type, or `NULL` if no database was found. | Checks for the presence of trircd databases.
check_wrecked_1_2 (tools/convert-magick.c) | `const char *dir`: Directory from which to load data. | `const char *`: String describing database type, or `NULL` if no database was found. | Checks for the presence of Wrecked 1.2 databases.
cleanup (init.c) | — | — | Performs program cleanup.
clear_bans (actions.c) | `const char *sender`: Sender name to use with mode changes. `Channel *chan`: Channel to operate on. `User *u`: The user to clear matching bans against, or `NULL` to clear all bans on the channel. | — | Called by `clear_channel()` to clear bans on a channel.
clear_channel (actions.c) | `Channel *chan`: Channel to operate on. `int what`: Operation to perform (`CLEAR_*`). `const void *param`: Parameter for operation. | — | Clears modes and/or users from a channel.
clear_modes (actions.c) | `const char *sender`: Sender name to use with mode changes. `Channel *chan`: Channel to operate on. | — | Called by `clear_channel()` to clear all binary modes from the given channel.
clear_password (encrypt.c) | `Password *password`: `Password` structure to clear. | — | Clears data from a Password structure, returning it to its original, initialized state.
clear_password (tools/convert-db.c) | `Password *password`: `Password` structure to clear. | — | Clears data from a Password structure. Analogous to `clear_password()` in `encrypt.c`.
clear_umodes (actions.c) | `const char *sender`: Sender name to use with mode changes. `Channel *chan`: Channel to operate on. `int32 modes`: Mode flags to clear. | — | Called by `clear_channel()` to clear some or all channel user modes from the given channel.
clear_users (actions.c) | `const char *sender`: Sender name to use for `KICK` messages. `Channel *chan`: Channel to operate on. `const char *reason`: Reason to use in `KICK` messages. | — | Called by `clear_channel()` to remove all users from the given channel.
close_listener (sockets.c) | `Socket *s`: Listener socket to close. | `int`: Zero on success, -1 on error. | Closes a listener socket, returning the socket to an unused state.
close_log (log.c) | — | — | Closes any open log file.
config_error (conffile.c) | `const char *filename`: Name of file being processed. `int linenum`: Line number being processed. `const char *message`: Warning/error message (a `printf()`-like format string). `...`: Format arguments. | — | Logs a warning or error message that occurs during configuration file processing.
configure (conffile.c) | `const char *modulename`: Name of module to process, or `NULL` when handling core configuration directives. `ConfigDirective *directives`: Configuration directive array. `int action`: `CONFIGURE_READ` and/or `CONFIGURE_SET`. | `int`: Nonzero on success, zero on error. | Reads in a configuration file.

conn
(sockets.c)

`Socket *s`: Socket to connect (must be in an unused state).

`const char *host`: Hostname or IP address of host to connect to.

`int port`: TCP port on remote host to connect to.

`const char *lhost`: Hostname or IP address to use as the socket's local address, or `NULL` to let the system choose an address.

`int lport`: TCP port to use as the socket's local port number, or `NULL` to let the system choose an address.

`int`: Zero on success, -1 on error.

Establishes a connection to a remote host.

connect_callback (main.c) | `Socket *s`: Connecting socket. `void *param_unused`: Parameter (unused). | — | Callback for server socket connection.
convert_acclev (tools/convert-db.c) | `int16 old`: Old access level. | `int16`: New access level. | Converts channel access levels from values used in Services 4.5 and earlier to values used in current Services versions.
copy_password (encrypt.c) | `Password *to`: Destination `Password` structure. `const Password *from`: Source `Password` structure. | — | Copies the contents of one `Password` structure to another.
create_mask (users.c) | `User *u`: User to create the mask for. `int use_fakehost`: Nonzero to use the user's fake hostname, if available; zero to always use the user's real hostname. | `char *`: A `malloc()`ed string containing the resulting mask. | Creates a mask which can be expected to match the user in most cases.
cumode_prefix_to_flag (modes.c) | `char c`: Channel user mode prefix. | `int32`: Mode flag corresponding to prefix character, or 0 if no such mode exists. | Returns the mode flag corresponding to a channel user mode prefix character, such as the "`@`" that indicates a channel operator.
cyg_load_chan (tools/convert-cygnus.c) | `const char *dir`: Directory from which to load data. | — | Loads the Cygnus `chanserv.db` data file.
cyg_load_nick (tools/convert-cygnus.c) | `const char *dir`: Directory from which to load data. | — | Loads the Cygnus `nickserv.db` data file.
cyg_load_root (tools/convert-cygnus.c) | `const char *dir`: Directory from which to load data. | — | Loads the Cygnus `rootserv.db` data file.
cyg_strtok_remaining (tools/convert-cygnus.c) | — | `char *`: Remaining text in the buffer. | Returns any text remaining in the last string buffer passed to `strtok()`, like `strtok(NULL, "")`, with any leading and trailing whitespace stripped. Similar to `strtok_remaining()` in `misc.c`.
D
database_cleanup (databases.c) | — | — | Performs cleanup actions for the database subsystem.
database_init (databases.c) | `int ac`: Command-line argument count. `char **av`: Command-line argument vector. | `int`: Nonzero on success, zero on failure. | Performs initialization actions for the database subsystem.
decode_base64 (misc.c) | `const char *in`: Input base64 string. `void *out`: Output buffer, or `NULL` if only the return value is needed. `int outsize`: Output buffer size (ignored if `out` is `NULL`). | `int`: Required output buffer size. | Decodes a base64 string.
deconfigure (conffile.c) | `ConfigDirective *directives`: Configuration directive array. | — | Restores all configuration variables to their original values.
decrypt_password (encrypt.c) | `const Password *password`: Password to decrypt. `char *dest`: Buffer to store plaintext password in. `int size`: Size of `dest`, in bytes. | `int`: 0 on success; >0 (required buffer size) if the provided plaintext buffer is too small; -2 if the cipher in use does not allow decryption; -1 on other error. | Decrypts a password, if possible.
default_check_password (encrypt.c) | `const char *plaintext`: Plaintext password to check. `const char *password`: Encrypted password to check against. | `int`: 1 if the password matches; 0 if the password does not match; -1 if an error occurs during checking. | Default implementation of `check_password()`; simply performs a `strcmp()`.

default_decrypt
(encrypt.c)

`const char *src`: Password to decrypt.

`char *dest`: Buffer to store plaintext password in.

`int size`: Size of `dest`, in bytes.

`int`: 0 on success; >0 (required buffer size) if the provided plaintext buffer is too small; -2 if the cipher in use does not allow decryption; -1 on other error.

Default implementation of `decrypt_password()`; simply copies the password to the output buffer.

default_encrypt
(encrypt.c)

`const char *src`: Plaintext password to encrypt.

`int len`: Length of password.

`char *dest`: Destination buffer.

`int size`: Size of destination buffer.

`int`: 0 on success; >0 (required buffer size) if the destination buffer is too small; -1 on error.

Default implementation of `encrypt_password()`. Simply copies the source to the destination, without encryption.

del_channel (channel.c) | `Channel *channel`: Channel to remove. | — | Removes the given channel from the hash table.
del_commandlist (commands.c) | `Module *id`: ID of command list to delete. | `int`: Nonzero on success, zero on failure. | Deletes a command list. The list must be empty (all commands unregistered) before it can be deleted.
del_server (servers.c) | `Server *server`: Server to remove. | — | Removes the given server from the hash table.
del_timeout (timeout.c) | `Timeout *t`: Timeout to delete. | — | Deletes the given timeout.
del_user (users.c) | `User *user`: User to remove. | — | Removes the given user from the hash table.
delete_server (servers.c) | `Server *server`: Server record to delete. | — | Deletes the given server record, removing it from the hash table and freeing all resources used by the record.
delete_user (users.c) | `User *user`: User record to delete. | — | Deletes a user record, removing it from the hash table and server's user list and freeing all resources used by the record.
disable_signals (signals.c) | — | — | Disables processing of `SIGTERM`/`SIGHUP`/`SIGUSR2` signals.
disconn (sockets.c) | `Socket *s`: Socket to disconnect. | `int`: Zero on success, -1 on error. | Disconnects an active connection, returning the socket to an unused state.
disconnect_callback (main.c) | `Socket *s`: Disconnecting socket. `void *param`: Disconnection type. | — | Callback for server socket disconnection.
do_accept (sockets.c) | `Socket *s`: Socket on which event occurred. | — | Handles an incoming connection event on a listener socket, accepting the connection and calling the socket's `SCB_ACCEPT` callback as appropriate.
do_all_directives (conffile.c) | `int action`: `ACTION_COPYNEW` or `ACTION_RESTORESAVED`. `ConfigDirective *directives`: Configuration directive array. | — | Copies new (temporary) or old (saved) values to configuration variables.

do_callback
(sockets.c)

`Socket *s`: Socket for which callback is being called. If `NULL`, the routine does nothing.

`SocketCallback cb`: Callback function to call. If `NULL`, the routine does nothing.

`void *param`: Parameter to callback function.

`int`: 0 if the socket was disconnected, else 1.

Calls a callback function for a socket, handling delayed disconnection after the callback function returns.

do_cmode (channels.c) | `const char *source`: Message source. `int ac`: Message parameter count. `char **av`: Message parameter vector. | — | Processes a `MODE` message (for a channel target) from the remote server.
do_cumode (channels.c) | `const char *source`: Message source. `Channel *chan`: Channel on which to operate. `int32 flag`: Mode flag to change. `int add`: Nonzero to add the mode, zero to remove it. `const char *nick`: Nickname whose modes are to be changed. | — | Changes the channel user mode for a user on a channel.
do_DefTimeZone (init.c) | `const char *filename`: Name of configuration file being processed. `int linenum`: Line number in configuration file. `char *param`: Parameters to configuration directive. | `int`: Nonzero on success, zero on error. | Handles the `DefTimeZone` option in `ircservices.conf`.
do_disconn (sockets.c) | `Socket *s`: Socket being disconnected. `void *code`: Disconnection code (`DISCONN_*`). | `int`: -1 on error, else 0. | Performs internal handling for a socket being disconnected.
do_IgnoreThreshold (init.c) | `const char *filename`: Name of configuration file being processed. `int linenum`: Line number in configuration file. `char *param`: Parameters to configuration directive. | `int`: Nonzero on success, zero on error. | Handles the `IgnoreThreshold` option in `ircservices.conf`.
do_join (users.c) | `const char *source`: Message source. `int ac`: Message parameter count. `char **av`: Message parameter vector. | — | Processes a `JOIN` message from the remote server.
do_kick (users.c) | `const char *source`: Message source. `int ac`: Message parameter count. `char **av`: Message parameter vector. | — | Processes a `KICK` message from the remote server.
do_kill (users.c) | `const char *source`: Message source. `int ac`: Message parameter count. `char **av`: Message parameter vector. | — | Processes a `KILL` message from the remote server.

do_LoadLanguageText
(init.c)

`const char *filename`: Name of configuration file being processed.

`int linenum`: Line number in configuration file.

`char *param`: Parameters to configuration directive.

`int`: Nonzero on success, zero on error.

Handles the `LoadLanguageText` option in `ircservices.conf`. Filenames given are gathered in the `LoadLanguageText` array in the order they are encountered.

do_load_module (send.c) | `Module *mod`: Handle of newly-loaded module. `const char *name`: Name of newly-loaded module. | `int`: Zero. | Watches for newly-loaded protocol modules, to ensure that the protocol module sets up the message sending interfaces correctly.
do_LoadModule (init.c) | `const char *filename`: Name of configuration file being processed. `int linenum`: Line number in configuration file. `char *param`: Parameters to configuration directive. | `int`: Nonzero on success, zero on error. | Handles the `LoadModule` option in `ircservices.conf`. Filenames given are gathered in the `LoadModule` array in the order they are encountered.

do_log
(log.c)

`int debuglevel`: Minimum debug level at which this message should be written.

`int do_perror`: Nonzero if a system error message should be appended.

`const char *modulename`: The name of the module writing the log message; `NULL` for log messages from the core.

`const char *fmt`: The `printf()`-style log message format string.

`...`: Format arguments

—

Internal routine that implements all of the logging functions.

do_match_wild (misc.c) | `const char *pattern`: Pattern to match against. `const char *str`: String to check. `int docase`: Whether case should be considered (nonzero) or not (zero). | `int`: Nonzero if the string matches the pattern, else zero. | Internal function implementing `match_wild()` and `match_wild_nocase`.
do_nick (users.c) | `const char *source`: Message source. `int ac`: Message parameter count. `char **av`: Message parameter vector. | — | Processes a `NICK` message from the remote server.
do_part (users.c) | `const char *source`: Message source. `int ac`: Message parameter count. `char **av`: Message parameter vector. | — | Processes a `PART` message from the remote server.
do_quit (users.c) | `const char *source`: Message source. `int ac`: Message parameter count. `char **av`: Message parameter vector. | — | Processes a `QUIT` message from the remote server.

do_read_config_file
(conffile.c)

`const char *modulename`: Name of module to process, or `NULL` when handling core configuration directives.

`ConfigDirective *directives`: Configuration directive array.

`FILE *f`: File to read from.

`const char *filename`: Name of file being read.

`int recursion_level`: Recursion depth (increases by one for each recursive call).

`int`: Nonzero on success, zero on failure.

Reads and parses a configuration file.

do_RunGroup (init.c) | `const char *filename`: Name of configuration file being processed. `int linenum`: Line number in configuration file. `char *param`: Parameters to configuration directive. | `int`: Nonzero on success, zero on error. | Handles the `RunGroup` option in `ircservices.conf`.
do_server (servers.c) | `const char *source`: Message source. `int ac`: Message parameter count. `char **av`: Message parameter vector. | — | Processes a `SERVER` message from the remote server.
do_ServiceUser (init.c) | `const char *filename`: Name of configuration file being processed. `int linenum`: Line number in configuration file. `char *param`: Parameters to configuration directive. | `int`: Nonzero on success, zero on error. | Handles the `ServiceUser` option in `ircservices.conf`.
do_sigsetjmp (signals.c) | `void *bufptr`: Pointer to a `sigjmp_buf`. | — | Initializes the error trap.
do_squit (servers.c) | `const char *source`: Message source. `int ac`: Message parameter count. `char **av`: Message parameter vector. | — | Processes an `SQUIT` message from the remote server.
do_topic (channels.c) | `const char *source`: Message source. `int ac`: Message parameter count. `char **av`: Message parameter vector. | — | Processes a `TOPIC` message from the remote server.
do_Umask (init.c) | `const char *filename`: Name of configuration file being processed. `int linenum`: Line number in configuration file. `char *param`: Parameters to configuration directive. | `int`: Nonzero on success, zero on error. | Handles the `Umask` option in `ircservices.conf`.
do_umode (users.c) | `const char *source`: Message source. `int ac`: Message parameter count. `char **av`: Message parameter vector. | — | Processes a `MODE` message (for a user target) from the remote server.
do_unload_module (databases.c) | `const Module *module`: Module being unloaded. | `int`: Callback return value (always 0). | Checks that modules being unloaded have not forgotten to unregister database tables.
dotime (misc.c) | `const char *s`: String to process. | `int`: Equivalent number of seconds, or -1 if the string is not a valid time string. | Converts a time string (a string such as "`2d`" or "`1h30m`") to a number of seconds. Recognized time units are "`s`" for seconds, "`m`" for minutes, "`h`" for hours, and "`d`" for days.
E
enable_signals (signals.c) | — | — | Enables processing of `SIGTERM`/`SIGHUP`/`SIGUSR2` signals.
encode_base64 (misc.c) | `const void *in`: Input buffer. `int insize`: Input buffer size. `char *out`: Output buffer, or `NULL` if only the return value is needed. `int outsize`: Output buffer size (ignored if `out` is `NULL`). | `int`: Required output buffer size. | Encodes a buffer containing arbitrary data into a base64 string, truncated at `outsize-1` bytes and null-terminated.
encrypt_password (encrypt.c) | `const char *plaintext`: Plaintext password to encrypt. `int len`: Length of password. `Password *password`: Destination `Password` structure. | `int`: 0 on success; >0 (required buffer size) if the destination buffer is too small; -1 on error. | Encrypts a password.
epona_load_chan (tools/convert-epona.c) | `const char *dir`: Directory from which to load data. | — | Loads the Epona/Anope `chan.db` data file.
epona_load_exception (tools/convert-epona.c) | `const char *dir`: Directory from which to load data. | — | Loads the Epona/Anope `exception.db` data file.
epona_load_news (tools/convert-epona.c) | `const char *dir`: Directory from which to load data. | — | Loads the Epona/Anope `news.db` data file.
epona_load_nick (tools/convert-epona.c) | `const char *dir`: Directory from which to load data. | — | Loads the Epona/Anope `nick.db` data file.
epona_load_oper (tools/convert-epona.c) | `const char *dir`: Directory from which to load data. | — | Loads the Epona/Anope `oper.db` data file.
expires_in_lang (language.c) | `char *buf`: Destination buffer. `int size`: Size of destination buffer in bytes `const NickGroupInfo *ngi`: Nickname group record for user to which message will be sent, or `NULL` if none. `time_t expires`: Expiration timestamp (0 for no expiration). | — | Generates a string of the form "expires in X days/hours/minutes" in the user's selected language.
F
fatal (log.c) | `const char *fmt`: `printf()`-style log message format string. `...`: Format arguments. | — | Writes a message to the log file; sends a wallops to the server if connected; and exits the program.
fatal_perror (log.c) | `const char *fmt`: `printf()`-style log message format string. `...`: Format arguments. | — | Writes a message to the log file, appending a system error string; sends a wallops to the server if connected; and exits the program.
fill_read_buffer (sockets.c) | `Socket *s`: Socket whose read buffer should be filled. | `int`: Number of bytes read (nonzero), or -1 on error. | Fills the read buffer of a socket with any pending received data.
fill32 (memory.c) | `void *ptr`: Address to fill from. `uint32 value`: Value to fill with. `long size`: Size to fill, in bytes. | — | Internal function to fill a memory region with a 32-bit value. If the given size is not a multiple of 4, the last `size%4` bytes are a copy of the first bytes of the given value as stored in memory.
find_ban (channels.c) | `const Channel *chan`: Channel to search in. `const char *ban`: Ban to search for. | `int`: Index of ban in channel's ban list, or -1 if not found. | Internal function to search for a given mask in a channel's ban list.
find_callback (modules.c) | `Module *module`: Handle of module to search. `const char *name`: Callback name to search for. | `CallbackList *`: Callback function list for the given callback, or `NULL` if the callback was not found. | Looks up a callback name for a specified module.
find_message (messages.c) | `const char *name`: Message name to search for. | `Message *`: The `Message` structure for the message, or `NULL` if the message is not found. | Retrieves the handler for a given IRC message name. If multiple tables have handlers for the message, the one in the most recently registered table is used.
find_module (modules.c) | `const char *modulename`: Name of module to search for. | `Module *`: Module handle, or `NULL` if the given module is not found. | Searches for a loaded module with the given name and returns its handle.
finish_cumode (channels.c) | `const char *source`: Mode change message source. `Channel *chan`: Channel on which modes are being changed. | — | Calls the "`channel umode change`" callback for each set of accumulated channel user mode changes.
first_channel (channels.c) | — | `Channel *`: The first stored channel record, or `NULL` if no records exist. | Initializes the channel record iterator, and returns the first channel record stored in the hash table.
first_channelinfo (tools/convert-db.c) | — | `ChannelInfo *`: The first stored `ChannelInfo` record, or `NULL` if no records exist. | Initializes the `ChannelInfo` iterator and returns the first stored `ChannelInfo` record.
first_maskdata (tools/convert-db.c) | `uint8 type`: The `MaskData` type to retrieve. | `MaskData *`: The first stored `MaskData` record of the given type, or `NULL` if no records exist. | Initializes the `MaskData` iterator and returns the first stored `MaskData` record for the given type. Each type has a separate iterator.
first_news (tools/convert-db.c) | — | `NewsItem *`: The first stored `NewsItem` record, or `NULL` if no records exist. | Initializes the `NewsItem` iterator and returns the first stored `NewsItem` record.
first_nickgroupinfo (tools/convert-db.c) | — | `NickGroupInfo *`: The first stored `NickGroupInfo` record, or `NULL` if no records exist. | Initializes the `NickGroupInfo` iterator and returns the first stored `NickGroupInfo` record.
first_nickinfo (tools/convert-db.c) | — | `NickInfo *`: The first stored `NickInfo` record, or `NULL` if no records exist. | Initializes the `NickInfo` iterator and returns the first stored `NickInfo` record.
first_server (servers.c) | — | `Server *`: The first stored server record, or `NULL` if no records exist. | Initializes the server record iterator and returns the first server record stored in the hash table.
first_serverstats (tools/convert-db.c) | — | `ServerStats *`: The first stored `ServerStats` record, or `NULL` if no records exist. | Initializes the `ServerStats` iterator and returns the first stored `ServerStats` record.
first_user (users.c) | — | `User *`: The first stored user record, or `NULL` if no records exist. | Initializes the user record iterator and returns the first user record stored in the hash table.
flush_cmode (actions.c) | `struct modedata *md`: Channel mode data to flush. | — | Called by `set_cmode()` and related functions to flush out accumulated mode changes to the network.
flush_write_buffer (sockets.c) | `Socket *s`: Socket whose write buffer should be flushed. | `int`: Number of bytes written (possibly zero) on success; -1 on error; -2 if the socket got disconnected. | Tries to flush data from the given socket's write buffer by sending as much data as will fit in a single `send()` system call.
fput32 (lang/langcomp.c) | `long val`: Value to write. `FILE *f`: File to write value to. | `int`: 0 on success, -1 on error. | Writes a big-endian 32-bit value to a file.
free_password (encrypt.c) | `Password *password`: Password structure to free. | — | Frees a `Password` structure allocated with `new_password()`.
G
gen_log_filename (log.c) | — | `char *`: Generated log filename. | Internal function to generate the current log file name based on the format string given in the `LogFilename` configuration directive.
get_channel (channels.c) | `const char *name`: Name of channel to retrieve. | `Channel *`: The channel's channel record, or `NULL` if the record is not found. | Retrieves the record for the given channel from the hash table.
get_channel_stats (channels.c) | `long *nrec`: Variable into which the number of channel records in the hash table is written. `long *memuse`: Variable into which the number of bytes used by the subsystem is written. | — | Retrieves memory usage statistics for the channel management subsystem.
get_channelinfo (tools/convert-db.c) | `const char *channel`: The name of the channel to look up. | `ChannelInfo *`: The channel's `ChannelInfo` structure, or `NULL` if the channel is not found. | Looks up and returns the `ChannelInfo` structure corresponding to the given channel name.
get_dbfield (databases.c) | `const void *record`: Record to retrieve value from. `const DBField *field`: Field to retrieve value from. `void *buffer`: Buffer to store retrieved value in. | — | Retrieves the value of a field in a database record.
get_module_name (modules.c) | `const Module *module`: Module handle. | `const char *`: Name of module. | Returns the name of the given module.

get_module_symbol
(modules.h)

`Module *module`: Handle of the module in which symbol is to be looked up, or `NULL` for any module.

`const char *symname`: Symbol to look up.

`void *`: Value of the symbol (usually the address of the symbol's object), or `NULL` if the symbol is not found.

Looks up a symbol in a given (or any) module, logging a warning message if the symbol is not found. (To look up a symbol whose value may legitimately be `NULL`, use `check_module_symbol()` instead.)

_get_module_symbol (modules.c) | `Module *module`: Handle of the module in which symbol is to be looked up, or `NULL` for any module. `const char *symname`: Symbol to look up. `const Module *caller`: Handle of the calling module. | `void *`: Value of the symbol (usually the address of the symbol's object), or `NULL` if the symbol is not found. | Implements the `get_module_symbol()` macro.
get_nickgroupinfo (tools/convert-db.c) | `uint32 id`: ID value of the nickname group to look up. | `NickGroupInfo *`: The nickname group's `NickGroupInfo` structure, or `NULL` if the nickname group is not found. | Looks up and returns the `NickGroupInfo` structure corresponding to the given nickname group ID.
get_nickgroupinfo_by_nick (tools/convert-db.c) | `const char *nick`: The nickname to look up. | `NickGroupInfo *`: The `NickGroupInfo` structure of the nickname group containing the given nickname, or `NULL` if the nickname is not found or does not have a nickname group. | Looks up and returns the `NickGroupInfo` structure corresponding to the nickname group containing the given nickname.
get_nickinfo (tools/convert-db.c) | `const char *nick`: The nickname to look up. | `NickInfo *`: The nickname's `NickInfo` structure, or `NULL` if the nickname is not found. | Looks up and returns the `NickInfo` corresponding to the given nickname.
get_operserv_data (tools/convert-db.c) | `int what`: The type of data to retrieve. `void *ptr`: A pointer to where the data should be stored. | `int`: Success (nonzero) or failure (zero). | Retrieves the selected type of OperServ-related data and stores it at the address indicated by the given pointer.
get_server (servers.c) | `const char *name`: Name of server to retrieve. | `Server *`: The server's server record, or `NULL` if the record is not found. | Retrieves the record for the given server from the hash table.
get_server_stats (servers.c) | `long *nservers`: Variable into which the number of server records in the hash table is written. `long *memuse`: Variable into which the number of bytes used by the subsystem is written. | — | Retrieves memory usage statistics for the server management subsystem.
get_user (users.c) | `const char *nick`: Nickname of user to retrieve. | `User *`: The user's user record, or `NULL` if the record is not found. | Retrieves the record for the given user from the hash table.
get_user_stats (users.c) | `long *nusers`: Variable into which the number of user records in the hash table is written. `long *memuse`: Variable into which the number of bytes used by the subsystem is written. | — | Retrieves memory usage statistics for the user management subsystem.
getline (lang/langcomp.c) | `FILE *f`: File to read from. | `char *`: Line read in, in a static buffer, or `NULL` at end of file. | Reads in a (non-blank, non-comment) line of text, and updates the global line counter `linenum`.
getstring (language.c) | `const NickGroupInfo *ngi`: Nickname group record for user to which message will be sent, or `NULL` if none. `int index`: String index. | `const char *`: Text string, or `NULL` if the string index is out of range. | Returns the text string corresponding to the selected string index in the user's selected language.
getstring_lang (language.c) | `int language`: Language index. `int index`: String index. | `const char *`: Text string, or `NULL` if the string index is out of range. | Returns the text string corresponding to the selected string index in the selected language.
H
have_language (language.c) | `int language`: Language index. | `int`: Nonzero if the language is available, else zero. | Returns whether the given language is available.
help_cmd (commands.c) | `const char *service`: Service name (sender name to use for help messages). `User *u`: Target user. `Module *id`: Command list ID. `char *cmd`: Command name. | — | Sends the given user a help message for the given command. If the command is not found or no help messages are specified, a "help not available" message is sent to the user.
hstrerror (compat.c) | `int h_errnum`: Value of `h_errno`. | `const char *`: String describing the given error number. | Compatibility function.
hyb_load_chan (tools/convert-hybserv.c) | `const char *dir`: Directory from which to load data. | — | Loads the HybServ `chan.db` data file.
hyb_load_memo (tools/convert-hybserv.c) | `const char *dir`: Directory from which to load data. | — | Loads the HybServ `memo.db` data file.
hyb_load_nick (tools/convert-hybserv.c) | `const char *dir`: Directory from which to load data. | — | Loads the HybServ `nick.db` data file.
hyb_load_stat (tools/convert-hybserv.c) | `const char *dir`: Directory from which to load data. | — | Loads the HybServ `stat.db` data file.
I
ignore_init (ignore.c) | `User *u`: User to initialize ignore data for. | — | Initializes the ignore data for the given user.
ignore_update (ignore.c) | `User *u`: User to update ignore data for. `uint32 msec`: Number of milliseconds spent processing the user's last request. | — | Updates the ignore value for the given user. `msec` may be specified as zero to update the value without adding to it.
init (init.c) | `int ac`: Argument count, passed from `main()`. `char **av`: Argument vector, passed from `main()`. | `int`: 0 on success, -1 on failure. | Performs overall program initialization. Never fails after forking and closing standard file descriptors.
init_memory (memory.c) | — | — | Initializes the memory checking subsystem.
init_message_list (messages.c) | — | — | Initializes the internal message list from the list of registered message tables.
init_password (encrypt.c) | `Password *password`: `Password` structure to initialize. | — | Initializes a new `Password` structure.
init_password (tools/convert-db.c) | `Password *password`: `Password` structure to initialize. | — | Initializes a new `Password` structure. Analogous to `init_password()` in `encrypt.c`.
init_signals (signals.c) | — | — | Initializes signal handling.
internal_init_module (modules.c) | `Module *module`: Module handle. | `int`: The module's `init_module()` return value, or nonzero if the module does not have an `init_module()` function. | Calls the given module's `init_module()` function.
internal_load_module (modules.c) | `const char *modulename`: Name of module to load. | `Module *`: Module handle on success, `NULL` on error. | Loads the given module into memory and creates a `Module` structure for it..
internal_unload_module (modules.c) | `Module *module`: Handle for module to unload. `int shutdown`: Nonzero if the module is being unloaded due to Services shutting down, else zero. | `int`: Nonzero on success, zero on error. | Unloads the given module.
introduce_user (init.c) | `const char *user`: Nickname of pseudoclient to introduce, or `NULL` to introduce all pseudoclients. | `int`: Nonzero if a pseudoclient was introduced or `user` was `NULL`, else zero. | Introduces pseudoclients to the network.
irc_stricmp (misc.c) | `const char *s1`: First string. `const char *s2`: Second string. | `int`: The result of a case-insensitive comparison of `s1` with `s2` (-1, 0, or 1, like `strcmp()`). | Compares two strings case-insensitively, using IRC protocol case transformation rules.
irc_strnicmp (misc.c) | `const char *s1`: First string. `const char *s2`: Second string. `int max`: Maximum number of characters to compare. | `int`: The result of a case-insensitive comparison of up to `max` characters of `s1` with `s2` (-1, 0, or 1, like `strncmp()`). | Compares two strings case-insensitively, using IRC protocol case transformation rules.
irc_tolower (misc.c) | `char c`: Character to convert. | `unsigned char`: Converted character. | Converts a character to lowercase, using IRC protocol case transformation rules.
ircs_load_gline (tools/convert-ver8.c) | `const char *dir`: Directory from which to load data. | — | Loads the IRCS `gline.db` data file.
is_chanop (users.c) | `const User *user`: User to check. `const char *chan`: Channel to check on. | `int`: Nonzero if the user is a channel operator on the given channel, else zero. | Returns whether the user is a channel operator on the given channel.
is_data_locked (main.c) | — | `int`: 1 if locked, 0 if not, -1 if an error occurred while checking. | Checks whether the data directory is locked.
is_guest_nick (users.c) | `const char *nick`: Nickname to check. | `int`: Nonzero if the nickname is a guest nickname, else zero. | Returns whether the nickname is a guest nickname.
is_on_chan (users.c) | `const User *user`: User to check. `const char *chan`: Channel to check. | `Channel *`: Nonzero if the user is on the given channel, else zero. | Returns whether the user is on the given channel.
is_oper (users.c) | `const User *user`: User to check. | `int`: Nonzero if the user is an IRC operator, else zero. | Returns whether the user is an IRC operator.
is_voiced (users.c) | `const User *user`: User to check. `const char *chan`: Channel to check on. | `int`: Nonzero if the user is voiced on the given channel, else zero. | Returns whether the user is voiced on the given channel.
J
join_channel (users.c) | `User *user`: User to join. `const char *channel`: Channel to join to. `int32 modes`: Initial channel user modes for the user. | `Channel *`: Channel record for the channel. | Joins a user to a channel, creating the channel if necessary and updating the user's list of joined channels.
K
kill_user (actions.c) | `const char *source`: Source for the `KILL` message. `const char *user`: Nickname of user to kill. `const char *reason`: Reason to use in the `KILL` message. | — | Sends a `KILL` message for a user.
L
lang_cleanup (language.c) | — | — | Performs cleanup actions for the multilingual support subsystem.
lang_init (language.c) | — | `int`: Nonzero on success, zero on failure. | Performs initialization actions for the multilingual support subsystem.
load_auspice (tools/convert-sirv.c) | `const char *dir`: Directory from which to load data. `int verbose`: Verbosity flag (nonzero = verbose). `int ac`: Number of command-line arguments in `av[]`. `char **av`: command-line arguments (excluding arguments processed by `main()`). | — | Loads Auspice data files.
load_bolivia (tools/convert-sirv.c) | `const char *dir`: Directory from which to load data. `int verbose`: Verbosity flag (nonzero = verbose). `int ac`: Number of command-line arguments in `av[]`. `char **av`: command-line arguments (excluding arguments processed by `main()`). | — | Loads Bolivia data files.
load_cygnus (tools/convert-cygnus.c) | `const char *dir`: Directory from which to load data. `int verbose`: Verbosity flag (nonzero = verbose). `int ac`: Number of command-line arguments in `av[]`. `char **av`: command-line arguments (excluding arguments processed by `main()`). | — | Loads Cygnus data files.
load_daylight (tools/convert-ver8.c) | `const char *dir`: Directory from which to load data. `int verbose`: Verbosity flag (nonzero = verbose). `int ac`: Number of command-line arguments in `av[]`. `char **av`: command-line arguments (excluding arguments processed by `main()`). | — | Loads Daylight data files.
load_epona (tools/convert-epona.c) | `const char *dir`: Directory from which to load data. `int verbose`: Verbosity flag (nonzero = verbose). `int ac`: Number of command-line arguments in `av[]`. `char **av`: command-line arguments (excluding arguments processed by `main()`). | — | Loads Epona data files.
load_ext_lang (language.c) | `const char *filename`: Pathname of file to read strings from. | `int`: Nonzero on success, zero on failure. | Loads an external language file.
load_hybserv (tools/convert-hybserv.c) | `const char *dir`: Directory from which to load data. `int verbose`: Verbosity flag (nonzero = verbose). `int ac`: Number of command-line arguments in `av[]`. `char **av`: command-line arguments (excluding arguments processed by `main()`). | — | Loads HybServ data files.
load_ircs_1_2 (tools/convert-ver8.c) | `const char *dir`: Directory from which to load data. `int verbose`: Verbosity flag (nonzero = verbose). `int ac`: Number of command-line arguments in `av[]`. `char **av`: command-line arguments (excluding arguments processed by `main()`). | — | Loads IRCS data files.
load_lang (language.c) | `int index`: Language index. `const char *filename`: Pathname of file to read data from. | — | Loads a precompiled language data file.
load_magick_14b2 (tools/convert-magick.c) | `const char *dir`: Directory from which to load data. `int verbose`: Verbosity flag (nonzero = verbose). `int ac`: Number of command-line arguments in `av[]`. `char **av`: command-line arguments (excluding arguments processed by `main()`). | — | Loads Magick 1.4 data files.
load_module (modules.c) | `const char *modulename`: Name of module to load. | `Module *`: Module handle on success, `NULL` on error. | Loads and initializes the given module.
load_ptlink (tools/convert-ptlink.c) | `const char *dir`: Directory from which to load data. `int verbose`: Verbosity flag (nonzero = verbose). `int ac`: Number of command-line arguments in `av[]`. `char **av`: command-line arguments (excluding arguments processed by `main()`). | — | Loads PTlink data files.
load_sirv (tools/convert-sirv.c) | `const char *dir`: Directory from which to load data. `int verbose`: Verbosity flag (nonzero = verbose). `int ac`: Number of command-line arguments in `av[]`. `char **av`: command-line arguments (excluding arguments processed by `main()`). | — | Loads Sirv data files.
load_trircd (tools/convert-trircd.c) | `const char *dir`: Directory from which to load data. `int verbose`: Verbosity flag (nonzero = verbose). `int ac`: Number of command-line arguments in `av[]`. `char **av`: command-line arguments (excluding arguments processed by `main()`). | — | Loads trircd data files.
load_wrecked_1_2 (tools/convert-magick.c) | `const char *dir`: Directory from which to load data. `int verbose`: Verbosity flag (nonzero = verbose). `int ac`: Number of command-line arguments in `av[]`. `char **av`: command-line arguments (excluding arguments processed by `main()`). | — | Loads Wrecked 1.2 data files.
lock_data (main.c) | — | `int`: Nonzero on success, zero on error. | Locks the data directory.
log (log.c) | `const char *fmt`: `printf()`-style log message format string. `...`: Format arguments. | — | Writes a message to the log file.
log_debug (log.c) | `int debuglevel`: Minimum debug level at which to write message. `const char *fmt`: `printf()`-style log message format string. `...`: Format arguments. | — | Writes a debug message to the log file at a certain debug level.
log_is_open (log.c) | — | `int`: Nonzero if a log file is open. | Returns whether a log file is currently open.
log_perror (log.c) | `const char *fmt`: `printf()`-style log message format string. `...`: Format arguments. | — | Writes a message to the log file, appending a system error string.
log_perror_debug (log.c) | `int debuglevel`: Minimum debug level at which to write message. `const char *fmt`: `printf()`-style log message format string. `...`: Format arguments. | — | Writes a debug message to the log file at a certain debug level, appending a system error string.
logprintf (log.c) | `const char *fmt`: Format string. `...`: Format arguments. | — | Writes a formatted string to the log file, like `fprintf()`.
logputs (log.c) | `const char *str`: String to write. | — | Writes a string to the log file, like `fputs()` (no trailing newline is added).
lookup_cmd (commands.c) | `Module *id`: Command list ID. `const char *name`: Command name. | `Command *`: Command record, or `NULL` if not found. | Looks up the command record for the given command in the given command list.
lookup_language (language.c) | `const char *name`: Name (identifier string) of language. | `int`: Language index, or -1 if not found. | Returns the language index corresponding to a language name such as "`en_us`".
lookup_string (language.c) | `const char *name`: String identifier. | `int`: String index. | Returns the index corresponding to the given string identifier.
M
m_info (messages.c) | `char *source`: Message source. `int ac`: Message parameter count. `char **av`: Message parameter vector. | — | Default handler for the `INFO` message.
m_join (messages.c) | `char *source`: Message source. `int ac`: Message parameter count. `char **av`: Message parameter vector. | — | Default handler for the `JOIN` message.
m_kick (messages.c) | `char *source`: Message source. `int ac`: Message parameter count. `char **av`: Message parameter vector. | — | Default handler for the `KICK` message.
m_kill (messages.c) | `char *source`: Message source. `int ac`: Message parameter count. `char **av`: Message parameter vector. | — | Default handler for the `KILL` message.
m_mode (messages.c) | `char *source`: Message source. `int ac`: Message parameter count. `char **av`: Message parameter vector. | — | Default handler for the `MODE` message.
m_motd (messages.c) | `char *source`: Message source. `int ac`: Message parameter count. `char **av`: Message parameter vector. | — | Default handler for the `MOTD` message.
m_nickcoll (messages.c) | `char *source`: Message source. `int ac`: Message parameter count. `char **av`: Message parameter vector. | — | Default handler for the nickname collision numeric (436).
m_part (messages.c) | `char *source`: Message source. `int ac`: Message parameter count. `char **av`: Message parameter vector. | — | Default handler for the `PART` message.
m_ping (messages.c) | `char *source`: Message source. `int ac`: Message parameter count. `char **av`: Message parameter vector. | — | Default handler for the `PING` message.
m_privmsg (messages.c) | `char *source`: Message source. `int ac`: Message parameter count. `char **av`: Message parameter vector. | — | Default handler for the `PRIVMSG` message.
m_quit (messages.c) | `char *source`: Message source. `int ac`: Message parameter count. `char **av`: Message parameter vector. | — | Default handler for the `QUIT` message.
m_server (messages.c) | `char *source`: Message source. `int ac`: Message parameter count. `char **av`: Message parameter vector. | — | Default handler for the `SERVER` message.
m_squit (messages.c) | `char *source`: Message source. `int ac`: Message parameter count. `char **av`: Message parameter vector. | — | Default handler for the `SQUIT` message.
m_stats (messages.c) | `char *source`: Message source. `int ac`: Message parameter count. `char **av`: Message parameter vector. | — | Default handler for the `STATS` message.
m_time (messages.c) | `char *source`: Message source. `int ac`: Message parameter count. `char **av`: Message parameter vector. | — | Default handler for the `TIME` message.
m_topic (messages.c) | `char *source`: Message source. `int ac`: Message parameter count. `char **av`: Message parameter vector. | — | Default handler for the `TOPIC` message.
m_version (messages.c) | `char *source`: Message source. `int ac`: Message parameter count. `char **av`: Message parameter vector. | — | Default handler for the `VERSION` message.
m_whois (messages.c) | `char *source`: Message source. `int ac`: Message parameter count. `char **av`: Message parameter vector. | — | Default handler for the `WHOIS` message.
m14_load_akill (tools/convert-magick.c) | `const char *dir`: Directory from which to load data. `int32 version`: File format version (5 for Magick 1.4, 6 for Wrecked 1.2). | — | Loads the Magick/Wrecked `akill.db` data file.
m14_load_chan (tools/convert-magick.c) | `const char *dir`: Directory from which to load data. `int32 version`: File format version (5 for Magick 1.4, 6 for Wrecked 1.2). | — | Loads the Magick/Wrecked `chan.db` data file.
m14_load_clone (tools/convert-magick.c) | `const char *dir`: Directory from which to load data. `int32 version`: File format version (5 for Magick 1.4, 6 for Wrecked 1.2). | — | Loads the Magick/Wrecked `clone.db` data file.
m14_load_memo (tools/convert-magick.c) | `const char *dir`: Directory from which to load data. `int32 version`: File format version (5 for Magick 1.4, 6 for Wrecked 1.2). | — | Loads the Magick/Wrecked `memo.db` data file.
m14_load_message (tools/convert-magick.c) | `const char *dir`: Directory from which to load data. `int32 version`: File format version (5 for Magick 1.4, 6 for Wrecked 1.2). | — | Loads the Magick/Wrecked `message.db` data file.
m14_load_nick (tools/convert-magick.c) | `const char *dir`: Directory from which to load data. `int32 version`: File format version (5 for Magick 1.4, 6 for Wrecked 1.2). | — | Loads the Magick/Wrecked `nick.db` data file.
m14_load_sop (tools/convert-magick.c) | `const char *dir`: Directory from which to load data. `int32 version`: File format version (5 for Magick 1.4, 6 for Wrecked 1.2). | — | Loads the Magick/Wrecked `sop.db` data file.
magick_convert_level (tools/convert-magick.c) | `int16 lev`: Old access level. | `int16`: New access level. | Converts channel access levels from values used in Magick 1.4 to values used in current Services versions.
main (main.c) | `int ac`: Command-line argument count. `char **av`: Command-line argument vector. `char **envp`: Environment pointer. | `int`: Program exit code (0 on success, 1 on failure). | Main routine for `ircservices`.
main (lang/langcomp.c) | `int ac`: Command-line argument count. `char **av`: Command-line argument vector. | `int`: Program exit code (0 on success, 1 on failure). | Main routine for `langcomp`.
main (tools/convert-db.c) | `int ac`: Command-line argument count. `char **av`: Command-line argument vector. | `int`: Program exit code (0 on success, 1 on failure). | Main routine for `convert-db`.
make_guest_nick (users.c) | — | `char *`: New guest nickname. | Generates a new guest nickname.
makechan (tools/convert-db.c) | `const char *name`: Name of channel to create. | `ChannelInfo *`: The newly-created `ChannelInfo`. | Creates a new `ChannelInfo` structure for the given channel name and adds it to the loaded channel list. Aborts `convert-db` on failure.

makenick
(tools/convert-db.c)

`const char *nick`: Nickname to create.

`NickGroupInfo **nickgroup_ret`: Pointer to a variable to receive the newly-created `NickGroupInfo` structure; if `NULL`, no nickname group is created.

`NickInfo *`: The newly-created `NickInfo`.

Creates a new `NickInfo` structure for the given nickname and adds it to the loaded nickname list. If `nickgroup_ret` is not `NULL`, a nickname group is created for the nickname as well; otherwise the nickname's group ID is set to zero.

maketime (language.c) | `const NickGroupInfo *ngi`: Nickname group record for user to which message will be sent, or `NULL` if none. `time_t time`: Time duration, in seconds. `int flags`: Zero or more `MT_*` flags. | `char *`: String describing time duration. | Returns a string (like "5 hours" or "2 minutes, 20 seconds") describing the given duration of time.
mapstring (language.c) | `int old`: String index to remap. `int new`: New string index. | `int`: Previous mapping (string index) of `old`. | Remaps a string index, so that requests for string `old` return string `new` instead.
match_usermask (users.c) | `const char *mask`: Mask to match against. `const User *user`: User to check. | `int`: Nonzero if the user matches the mask, else zero. | Returns whether the user matches the given user/host wildcard mask. The fake hostname and IP address are also checked if available.
match_wild (misc.c) | `const char *pattern`: Pattern to match against. `const char *str`: String to check. | `int`: Nonzero if the string matches the pattern, else zero. | Checks whether a string matches a wildcard pattern.
match_wild_nocase (misc.c) | `const char *pattern`: Pattern to match against. `const char *str`: String to check. | `int`: Nonzero if the string matches the pattern, else zero. | Checks whether a string matches a wildcard pattern, case-insensitively.
MCcalloc (memory.c) | `long els`: Number of size units to allocate. `long elsize`: Size of a single unit for allocation. `const char *file`: Caller's source file name. `int line`: Caller's source line number. | `void *`: Allocated memory, or `NULL` if allocation fails. | Memory-checking wrapper for `calloc()`.
MCfree (memory.c) | `void *ptr`: Memory to be released. `const char *file`: Caller's source file name. `int line`: Caller's source line number. | — | Memory-checking wrapper for `free()`.
MCmalloc (memory.c) | `long size`: Size of memory to allocate, in bytes. `const char *file`: Caller's source file name. `int line`: Caller's source line number. | `void *`: Allocated memory, or `NULL` if allocation fails. | Memory-checking wrapper for `malloc()`.
MCrealloc (memory.c) | `void *oldptr`: Memory to be reallocated. `long newsize`: New size of memory region. `const char *file`: Caller's source file name. `int line`: Caller's source line number. | `void *`: New memory region, or `NULL` if reallocation fails. | Memory-checking wrapper for `realloc()`.
MCstrdup (memory.c) | `const char *s`: String to duplicate. `const char *file`: Caller's source file name. `int line`: Caller's source line number. | `char *`: Duplicated string, or `NULL` if duplication fails. | Memory-checking wrapper for `strdup()`.
merge_args (misc.c) | `int argc`: Argument count. `char **argv`: Argument array. | `char *`: Result string (stored in a static buffer). | Joins the given arguments with spaces to form a single string, and returns that string.
messages_cleanup (messages.c) | — | — | Performs cleanup actions for the message handling subsystem.
messages_init (messages.c) | `int ac`: Command-line argument count. `char **av`: Command-line argument vector. | `int`: Nonzero on success, zero on failure. | Performs initialization actions for the message handling subsystem.
mode_char_to_flag (modes.c) | `char c`: Mode character to convert. `int which`: Mode type (`MODE_USER`, etc.) | `int32`: Equivalent mode flag, 0 if the mode character is not recognized, or `MODE_INVALID` if the mode character is recognized but has no equivalent flag. | Converts a mode character to a mode flag value.
mode_char_to_params (modes.c) | `char c`: Mode character. `int which`: Mode type (`MODE_USER`, etc.) | `int`: The number of parameters used by the mode, or -1 if the mode is not recognized. | Returns the number of parameters used when adding or removing the mode. The number of parameters for `+c` is returned in bits 8-15, and the number of parameters for `-c` is returned in bits 0-7.
mode_flag_to_char (modes.c) | `int32 f`: Mode flag to convert. `int which`: Mode type (`MODE_USER`, etc.) | `char`: Equivalent mode character, or `MODE_INVALID` if the flag is not recognized. | Converts a mode flag value to a mode character. If more than one flag bit is set in `f`, the highest one (the one with the greatest value) is used.
mode_flags_to_string (modes.c) | `int32 flags`: Mode flags to convert. `int which`: Mode type (`MODE_USER`, etc.) | `char *`: Equivalent mode string, stored in a static buffer. | Converts a set of mode flags into a string. Unrecognized flags are ignored.
mode_setup (modes.c) | — | — | Initializes internal tables based on the global `usermodes[]`, `chanmodes[]`, and `chanusermodes[]` arrays. Must be called after changing any of the arrays.

mode_string_to_flags
(modes.c)

`const char *s`: Mode string to convert.

`int which`: Mode type (`MODE_USER`, etc.), possibly or'd with `MODE_NOERROR`.

`int32`: Equivalent mode flags, or `MODE_INVALID` or'd with the first invalid character if an invalid mode character is found.

Converts a string of mode characters to a set of flags. If `MODE_NOERROR` is specified in the `which` parameter, unrecognized mode characters are ignored.

module_log (log.c) | `const char *fmt`: `printf()`-style log message format string. `...`: Format arguments. | — | Writes a message to the log file, including the calling module's name. For use by modules.
module_log_debug (log.c) | `int debuglevel`: Minimum debug level at which to write message. `const char *fmt`: `printf()`-style log message format string. `...`: Format arguments. | — | Writes a debug message to the log file at a certain debug level, including the calling module's name. For use by modules.
module_log_perror (log.c) | `const char *fmt`: `printf()`-style log message format string. `...`: Format arguments. | — | Writes a message to the log file, appending a system error string and including the calling module's name. For use by modules.
module_log_perror_debug (log.c) | `int debuglevel`: Minimum debug level at which to write message. `const char *fmt`: `printf()`-style log message format string. `...`: Format arguments. | — | Writes a debug message to the log file at a certain debug level, appending a system error string and including the calling module's name. For use by modules.
modules_cleanup (modules.c) | — | — | Performs cleanup actions for the module subsystem.
modules_init (modules.c) | `int ac`: Command-line argument count. `char **av`: Command-line argument vector. | `int`: Nonzero on success, zero on failure. | Performs initialization actions for the module subsystem.
my_dlclose (modules.c) | `void *handle`: Shared object handle to close. | — | Closes the given shared object.
my_dlerror (modules.c) | — | `const char *`: Error message, or `NULL` if no error has occurred since the last call to `my_dlerror()`. | Returns the error message for the last error that occurred in a `my_dlopen()`, `my_dlclose()`, or `my_dlsym()` call.
my_dlopen (modules.c) | `const char *name`: Module name. | `void *`: Shared object handle on success, `NULL` on error. | Opens the shared object corresponding to the given module name.

my_dlsym
(modules.c)

`void *handle`: Shared object handle.

`const char *symname`: Name of symbol to look up.

`void *`: Symbol value, or `NULL` on error.

Looks up a symbol in a shared object, returning its value. (As with the system `dlsym()` call, `NULL` could mean either an error or a symbol with that value, and `my_dlerror()` must be used to tell the difference. See the `dlsym()` documentation on systems which support it.)

my_snprintf
(vsnprintf.c)

`char *string`: String buffer into which the formatted string is stored.

`size_t size`: Size of the buffer, in bytes.

`const char *format`: Format string.

`...`: Format arguments.

`int`: Number of bytes written to `string`, not including the trailing null.

Writes a formatted string into a string buffer. No more than `size` bytes are written, including the terminating null character (`'\0'`). The format arguments are passed as additional parameters to the function.

my_vsnprintf
(vsnprintf.c)

`char *string`: String buffer into which the formatted string is stored.

`size_t size`: Size of the buffer, in bytes.

`const char *format`: Format string.

`va_list args`: Format argument list.

`int`: Number of bytes written to `string`, not including the trailing null.

Writes a formatted string into a string buffer. No more than `size` bytes are written, including the terminating null character (`'\0'`). The format arguments are passed as a `va_list`.

N
new_commandlist (commands.c) | `Module *id`: ID to associate with new command list. | `int`: Nonzero on success, zero on failure. | Creates a new command list with the specified ID. Fails if a command list with the same ID already exists.
new_password (encrypt.c) | — | `extern Password *`: New `Password` structure. | Allocates and initializes a new `Password` structure.
new_server (servers.c) | `const char *servername`: Server to create a record for. | `Server *`: The new server record. | Creates a new server record for the given server name and adds it to the hash table.
new_user (users.c) | `const char *nick`: Nickname to create a record for. | `User *`: The new user record. | Creates a new user record for the given nickname and adds it to the hash table.
next_channel (channels.c) | — | `Channel *`: The next stored channel record, or `NULL` if no more records exist. | Returns the next channel record stored in the hash table.
next_channelinfo (tools/convert-db.c) | — | `ChannelInfo *`: The next stored `ChannelInfo` record, or `NULL` if no more records exist. | Returns the next stored `ChannelInfo` record.
next_maskdata (tools/convert-db.c) | `uint8 type`: The `MaskData` type to retrieve. | `MaskData *`: The next stored `MaskData` structure of the given type, or `NULL` if no more records exist. | Returns the next stored `MaskData` record of the given type.
next_news (tools/convert-db.c) | — | `NewsItem *`: The next stored `NewsItem` record, or `NULL` if no more records exist. | Returns the next stored `NewsItem` record.
next_nickgroupinfo (tools/convert-db.c) | — | `NickGroupInfo *`: The next stored `NickGroupInfo` record, or `NULL` if no more records exist. | Returns the next stored `NickGroupInfo` record.
next_nickinfo (tools/convert-db.c) | — | `NickInfo *`: The next stored `NickInfo` record, or `NULL` if no more records exist. | Returns the next stored `NickInfo` record.
next_server (servers.c) | — | `Server *`: The next stored server record, or `NULL` if no more records exist. | Returns the next server record stored in the hash table.
next_serverstats (tools/convert-db.c) | — | `ServerStats *`: The next stored `ServerStats` record, or `NULL` if no more records exist. | Returns the next stored `ServerStats` record.
next_token (tools/convert-hybserv.c) | `char *s`: String to begin parsing; `NULL` to continue parsing the last string passed in. | `char *`: The next token in the string, or `NULL` if no tokens remain. | Returns the next token in a line of a HybServ database. Analogous to `strtok(s, " \r\n")`, but handles multiword parameters (parameters with a leading colon) as well.
next_user (users.c) | — | `User *`: The next stored user record, or `NULL` if no more records exist. | Returns the next user record stored in the hash table.
next_wmap (sockets.c) | `Socket *s`: Socket to operate on. | — | Frees the first entry in the given socket's write-map list, advancing to the next one. If the freed entry references a mapped data block, the data is unmapped.
notice (send.c) | `const char *source`: Source name. `const char *dest`: Destination nickname. `const char *fmt`: Format string, as for `printf()`. `...`: Format arguments. | — | Sends a `NOTICE` to the given nickname.
notice_all (send.c) | `const char *source`: Source name. `const char *fmt`: Format string, as for `printf()`. `...`: Format arguments. | — | Sends a `NOTICE` to all users on the network. Implemented by the protocol module.
notice_help (send.c) | `const char *source`: Source name. `const User *dest`: Destination user. `int message`: Language string index of string to send. `...`: Format arguments. | — | Sends a `NOTICE` to the given user, with language translation and with "`%S`" in the string replaced by the source nickname.
notice_lang (send.c) | `const char *source`: Source name. `const User *dest`: Destination user. `int message`: Language string index of string to send. `...`: Format arguments. | — | Sends a `NOTICE` to the given user, with language translation.
notice_list (send.c) | `const char *source`: Source name. `const char *dest`: Destination nickname. `const char **text`: Array of strings to send, terminated by `NULL`. | — | Sends a series of `NOTICE` messages to the given nickname.
O

open_db_ver
(tools/convert-db.c)

`const char *dir`: Directory from which to load data.

`const char *name`: Filename to open.

`int32 min_version`: Minimum acceptable version.

`int32 max_version`: Maximum acceptable version.

`int32 *version_ret`: Pointer to a variable to receive the version number read from the file.

`dbFILE *`: Database file pointer for the opened file, positioned immediately after the read-in version number.

Opens the specified database file, reads a 32-bit (big-endian) version number from the file, and verifies that the version number is within the specified limits. If the file cannot be opened or the version is outside the range given, the function prints an error message and aborts `convert-db`.

open_listener
(sockets.c)

`Socket *s`: Socket to use for accepting connections (must be in an unused state).

`const char *host`: Hostname or IP address to accept connections on, or `NULL` to accept connections on any address.

`int port`: TCP port to accept connections on.

`int backlog`: Maximum backlog of unaccepted connections (passed directly to the `listen()` system call).

`int`: 0 on success, -1 on error.

Sets up a socket for accepting incoming connections.

open_log (log.c) | — | `int`: Nonzero on success, zero on error. | Opens the log file given by the `LogFilename` configuration directive.
open_memory_log (log.c) | — | `int`: Nonzero (always succeeds). | Opens an in-memory log file, whose contents will be written to the real log file when `open_log()` is called.
P
pack_ip (misc.c) | `const char *ipaddr`: IPv4 address string. | `uint8 *`: Packed IPv4 address (stored in a static buffer), or `NULL` if the string is not a valid IPv4 address. | Packs an IPv4 address string into a binary address.
pack_ip6 (misc.c) | `const char *ipaddr`: IPv6 address string. | `uint8 *`: Packed IPv6 address (stored in a static buffer), or `NULL` if the string is not a valid IPv6 address. | Packs an IPv6 address string into a binary address.
parse_config_line (conffile.c) | `const char *filename`: Name of file being processed. `int linenum`: Line number in file being processed. `char *buf`: Line to process. `ConfigDirective *directives`: Configuration directive array. | `int`: Nonzero on success, zero on failure. | Parse and process a single line of a configuration file.

parse_options
(init.c)

`int ac`: Argument count, from `main()`.

`char **av`: Argument vector, from `main()`.

`int call_modules`: Indicates whether to process basic options or module options.

`int`: -1 on option error; 0 on success; 1 to indicate that the program should exit (successfully).

Parses and processes command-line options. If `call_modules` is zero, basic options (those handled by Services itself) are processed, and unrecognized options are ignored; if nonzero, basic options are ignored and other options are passed to modules via the "`command line`" callback, with unrecognized options resulting in an error. Note that if the "`-h`" or "`--help`" options are found, the program will be terminated with `exit(0)` after a usage message is printed to standard error.

part_all_channels (users.c) | `User *user`: User parting channels. | — | Parts the user from all joined channels.
part_channel (users.c) | `User *user`: Parting user. `const char *channel`: Channel to be parted. `int callback`: ID of callback to call on parting. `const char *param`: Third parameter to pass to callback. `const char *source`: Message source. | `int`: Nonzero if the user was in the channel, else zero. | Parts a user from a channel.

part_channel_uc
(users.c)

`User *user`: Parting user.

`struct u_chanlist *uc`: Record in user's joined channel list indicating channel to be parted

`int callback`: ID of callback to call on parting.

`const char *param`: Third parameter to pass to callback.

`const char *source`: Message source.

—

Parts a user from a channel, given the `struct u_chanlist` entry in the user record for the channel.

_pfmt (vsnprintf.c) | `const char *format`: Format string. `va_list args`: Format argument list. `_pfmt_writefunc_t writefunc`: Function to write characters with. `void *arg1`: Third argument to `writefunc()`. `void *arg2`: Fourth argument to `writefunc()`. | `int`: Number of bytes written. | Performs `printf()`-style formatting, using the given function to write the resulting string.

possibly_remove_mode
(actions.c)

`struct modedata *md`: Channel mode data being modified.

`char mode`: Mode character to possibly remove.

`const char *user`: User to match against, for channel user modes.

—

Called by `set_cmode()` to remove a mode change cancelled by a later change, if such a change exists. For example, if "`-ov Nick1 Nick2`" has been accumulated and "`+o Nick1`" is set, "`-o Nick1`" will be removed, leaving "`-v Nick2`".

privmsg (send.c) | `const char *source`: Source name. `const char *dest`: Destination nickname. `const char *fmt`: Format string, as for `printf()`. `...`: Format arguments. | — | Sends a `PRIVMSG` to the given nickname.
process (process.c) | — | — | Processes the message stored in the global variable `inbuf`.
process_cleanup (process.c) | — | — | Performs cleanup actions for the message processing code.
process_init (process.c) | `int ac`: Command-line argument count. `char **av`: Command-line argument vector. | `int`: Nonzero on success, zero on failure. | Performs initialization actions for the message processing code.

process_numlist
(misc.c)

`const char *numstr`: Number list to process.

`int *count_ret`: Variable to receive the number of times the callback was called, or `NULL` if not needed.

`range_callback_t callback`: The function to call for each value.

`User *u`: A `User` parameter to pass to the callback function.

`...`: Additional parameters to the callback function.

`int`: Sum of all values returned from the callback function.

Processes a list of numbers, calling the specified function for each value contained in the list. Aborts processing if the callback function returns -1.

ptlink_load_akill (tools/convert-ptlink.c) | `const char *dir`: Directory from which to load data. | — | Loads the PTlink `akill.db` data file.
ptlink_load_chan (tools/convert-ptlink.c) | `const char *dir`: Directory from which to load data. | — | Loads the PTlink `chan.db` data file.
ptlink_load_news (tools/convert-ptlink.c) | `const char *dir`: Directory from which to load data. | — | Loads the PTlink `news.db` data file.
ptlink_load_nick (tools/convert-ptlink.c) | `const char *dir`: Directory from which to load data. | — | Loads the PTlink `nick.db` data file.
ptlink_load_oper (tools/convert-ptlink.c) | `const char *dir`: Directory from which to load data. | — | Loads the PTlink `oper.db` data file.
ptlink_load_sqline (tools/convert-ptlink.c) | `const char *dir`: Directory from which to load data. | — | Loads the PTlink `sqline.db` data file.
ptlink_load_sxline (tools/convert-ptlink.c) | `const char *dir`: Directory from which to load data. | — | Loads the PTlink `sxline.db` data file.
put_dbfield (databases.c) | `void *record`: Record to store value into. `const DBField *field`: Field to store value into. `const void *value`: Buffer containing value to store. | — | Stores a value into a field in a database record.
Q
quit_user (users.c) | `User *user`: Quitting user. `const char *quitmsg`: User's quit message. `int is_kill`: Nonzero if the quit is due to a klll, else zero. | — | Handles a disconnecting user, whether due to `QUIT` or `KILL`.
R
read_buffer_len (sockets.c) | `const Socket *s`: Socket. | `uint32`: Number of bytes in the socket's read buffer. | Returns the length of the data in the socket's read buffer.
read_config (init.c) | — | `int`: Nonzero on success, zero on failure. | Reads in the core configuration file and performs sanity checks on the configuration settings.
read_config_file (conffile.c) | `const char *modulename`: Name of module to process, or `NULL` when handling core configuration directives. `ConfigDirective *directives`: Configuration directive array. | `int`: Nonzero on success, zero on failure. | Read in configuration data.
read_index_file (lang/langcomp.c) | — | `int`: 0 on success, -1 on failure. | Reads in the list of strings from the `index` file.
read_int32 (language.c) | `int32 *ptr`: Pointer in which to store read value. `FILE *f`: File to read value from. | `int`: 0 on success, -1 on error. | Internal helper function to read a big-endian `int32` value from a file.
read_uint32 (language.c) | `uint32 *ptr`: Pointer in which to store read value. `FILE *f`: File to read value from. | `int`: 0 on success, -1 on error. | Internal helper function to read a big-endian `uint32` value from a file.
readfirstline_callback (main.c) | `Socket *s`: Socket on which data is available. `void *param_unused`: Parameter (unused). | — | Reads and processes the first line from the server socket.
readline_callback (main.c) | `Socket *s`: Socket on which data is available. `void *param_unused`: Parameter (unused). | — | Reads and processes the second and subsequent lines from the server socket.
reclaim_buffer_space (sockets.c) | — | `int`: Nonzero if some buffer space was reclaimed, else zero. | Attempts to reclaim resources from all sockets' buffers by shrinking the buffers to the minimum size necessary to hold all buffered data.
reclaim_buffer_space_one (sockets.c) | `Socket *s`: Socket to operate on. | `int`: Nonzero if buffer space was reclaimed from the socket, else zero. | Attempts to reclaim resources from the given socket's buffers by shrinking the buffers to the minimum size necessary to hold all buffered data.
reconfigure (init.c) | — | `int`: Nonzero on success, zero on error. | Rereads the configuration files.
reconfigure_modules (modules.c) | — | `int`: Nonzero on success, zero on failure. | Performs reconfiguration actions for all modules. If the function fails, no modules' configurations will have been modified.
recursive_squit (servers.c) | `Server *parent`: The server whose child servers should be deleted. `const char *reason`: The `SQUIT` reason string. | — | Recursively deletes all child servers of a quitting server.
register_callback (modules.h) | `const char *name`: Name for the new callback. | `int`: Callback ID (nonnegative) on success, -1 on failure. | Registers a new callback for the calling module.
_register_callback (modules.c) | `Module *module`: Handle of the calling module. `const char *name`: Name for the new callback. | `int`: Callback ID (nonnegative) on success, -1 on failure. | Implements the `register_callback()` macro.
register_cipher (encrypt.c) | `CipherInfo *ci`: Cipher to register. | — | Registers an encryption cipher.
register_commands (commands.c) | `Module *id`: Command list ID. `Command *array`: Array of commands to register, terminated by an entry with `.name==NULL`. | `int`: Nonzero on success, zero on failure. | Registers an array of commands with the given command list.
register_dbmodule (databases.c) | `DBModule *module`: Module description structure. | `int`: Nonzero on success, zero on failure. | Registers a database module with the core interface.
register_dbtable (databases.c) | `DBTable *table`: Data table to register. | `int`: Nonzero on success, zero on failure. | Registers a database table, and loads the table's contents from persistent storage.
register_messages (messages.c) | `Message *table`: Message table to register. | `int`: Nonzero on success, zero on failure. | Registers a new message table.
remove_callback (modules.h) | `Module *module`: Handle of the module for the callback, or `NULL` for a core callback. `const char *name`: Callback name. `callback_t callback`: Callback function to remove. | `int`: Nonzero on success, zero on failure. | Removes a callback function from the specified callback in the specified module.
_remove_callback (modules.c) | `Module *module`: Handle of the module for the callback, or `NULL` for a core callback. `const char *name`: Callback name. `callback_t callback`: Callback function to remove. `const Module *caller`: Handle of the calling module. | `int`: Nonzero on success, zero on failure. | Implements the `remove_callback()` macro.
remove_pidfile (init.c) | — | — | Removes the file containing the PID of the Services process.
reopen_log (log.c) | — | `int`: Nonzero on success, zero on error. | Closes and immediately reopens the log file.
reset_ext_lang (language.c) | — | — | Resets all modifications made to the default language strings.

resize_buf
(sockets.c)

`char **p_buf`: Pointer to the socket's `rbuf` or `wbuf` field.

`char **p_ptr`: Pointer to the socket's `rptr` or `wptr` field.

`char **p_end`: Pointer to the socket's `rend` or `wend` field.

`char **p_top`: Pointer to the socket's `rtop` or `wtop` field.

`uint32 newsize`: New size of the buffer, in bytes. Must be no smaller than the size necessary to hold all data currently in the buffer.

`int`: Nonzero on success, zero on failure.

Resizes a socket's read or write buffer (as determined by the socket field references) to the given size.

resize_how_much
(sockets.c)

`const Socket *s`: Socket whose read or write buffer is to be expanded.

`uint32 current_size`: Current size of the buffer to be expanded.

`int *errp`: On failure, set to 1 if the per-connection buffer size limit would be exceeded, or 0 if the total buffer size limit would be exceeded.

`uint32`: Amount by which the buffer should be expanded, or zero if attempting to expand the buffer would exceed either the per-connection or total buffer size limit.

Determines the size by which a socket's buffer should be expanded, given the buffer's current size.

resize_rbuf (sockets.c) | `Socket *s`: Socket whose read buffer is to be resized. `uint32 size`: New size for the read buffer. Must be no smaller than the size necessary to hold the data currently in the read buffer. | `int`: Nonzero on success, zero on failure. | Resizes a socket's read buffer.
resize_wbuf (sockets.c) | `Socket *s`: Socket whose write buffer is to be resized. `uint32 size`: New size for the write buffer. Must be no smaller than the size necessary to hold the data currently in the write buffer. | `int`: Nonzero on success, zero on failure. | Resizes a socket's write buffer.
run_cmd (commands.c) | `const char *service`: Service name (sender name to use for error messages). `User *u`: User executing the command. `Module *id`: Command list ID. `const char *cmd`: Command name. | — | Runs the routine for the given command, sending an error message to the user if the command is not found or the user does not have appropriate privileges.
S
sanity_check_channels (tools/convert-db.c) | — | — | Checks for and corrects inconsistencies in channel data.
sanity_check_maskdata (tools/convert-db.c) | — | — | Checks for and corrects inconsistencies in `MaskData` records.
sanity_check_nickgroups (tools/convert-db.c) | — | — | Checks for and corrects inconsistencies in nickname group data.
sanity_check_nicks (tools/convert-db.c) | — | — | Checks for and corrects inconsistencies in nickname data.
sanity_checks (tools/convert-db.c) | — | — | Performs sanity checks on data loaded from files, and corrects data as necessary..
save_all_dbtables (databases.c) | — | `int`: 1 if all tables were successfully saved (or no are registered), 0 if some tables failed but some succeeded, -1 if all tables failed. | Saves all registered database tables to persistent storage.
save_data_now (main.c) | — | — | Saves the databases to persistent storage.
scalloc (memory.c) | `long els`: Number of size units to allocate. `long elsize`: Size of a single unit for allocation. | `void *`: Allocated memory. | Allocates `els*elsize` bytes of cleared memory using `calloc()`. Raises an out-of-memory signal if the allocation fails.
scalloc (tools/convert-db.h) | `long els`: Number of size units to allocate. `long elsize`: Size of a single unit for allocation. | `void *`: Allocated memory. | Allocates `els*elsize` bytes of cleared memory using `calloc()`. Aborts `convert-db` if the allocation fails.
send_cleanup (send.c) | — | — | Performs cleanup actions for the message sending subsystem.
send_cmd (send.c) | `const char *source`: Source name, or `NULL` for none. `const char *fmt`: Message format string, as for `printf()`. `...`: Format arguments. | — | Sends a generic message (command) to the remote server.
send_channel_cmd (send.c) | `const char *source`: Source name. Depending on the protocol in use, this name may or may not be used. `const char *fmt`: Message format string, as for `printf()`. `...`: Format arguments. | — | Sends a message that affects the status of a channel. Implemented by the protocol module.
send_cmode_cmd (send.c) | `const char *source`: Source name, as for `send_channel_cmd()`. `const char *channel`: Channel name. `const char *fmt`: Message format string (as for `printf()`), starting with the mode string. `...`: Format arguments. | — | Sends a `MODE` message to change channel modes.
send_error (send.c) | `const char *fmt`: Error message format, as for `printf()`. `...`: Format arguments. | — | Sends an `ERROR` message to the remote server, then disconnects from the server.
send_init (send.c) | `int ac`: Command-line argument count. `char **av`: Command-line argument vector. | `int`: Nonzero on success, zero on failure. | Performs initialization actions for the message sending subsystem.
send_namechange (send.c) | `const char *nick`: Nickname. `const char *newname`: New real name (GECOS). | — | Changes the "real name" (GECOS) of a client. Implemented by the protocol module; this may be a no-op if the protocol does not support name changing.
send_nick (send.c) | `const char *nick`: Nickname. `const char *user`: Username. `const char *host`: Hostname. `const char *server`: Client's server name. `const char *name`: "Real name" (GECOS). `const char *modes`: Initial mode string, or empty if no modes are to be set. | — | Sends messages necessary to introduce a new local client to the network. Implemented by the protocol module.
send_nickchange (send.c) | `const char *nick`: Nickname to change. `const char *newnick`: New nickname. | — | Changes the nickname of a client. Implemented by the protocol module.
send_nickchange_remote (send.c) | `const char *nick`: Nickname to change. `const char *newnick`: New nickname. | — | Sends a message to remotely change the nickname of another server's client. Implemented by the protocol module; this may be a no-op if the protocol does not support remote nickname changing.
send_pseudo_nick (send.c) | `const char *nick`: Nickname. `const char *realname`: "Real name" (GECOS). `int flags`: Operator/invisible flags (`PSEUDO_*`). | — | Introduces a pseudoclient to the network.
send_server (send.c) | — | — | Sends messages to introduce Services as a server to the network. Implemented by the protocol module.
send_server_remote (send.c) | `const char *server`: New server name. `const char *desc`: Description for server. | — | Introduces a (fake) remote server to the network. Implemented by the protocol module.
send_timeout_list (timeout.c) | `User *u`: Target user. | — | Debugging function to send the timeout list as `NOTICE` messages to a user.
server_cleanup (servers.c) | — | — | Performs cleanup actions for the server management subsystem.
server_init (servers.c) | `int ac`: Command-line argument count. `char **av`: Command-line argument vector. | `int`: Nonzero on success, zero on failure. | Performs initialization actions for the server management subsystem.
set_clear_channel_sender (actions.c) | `const char *newsender`: The new name, `NULL` to use the server name, or `PTR_INVALID` to leave the name unchanged. | `const char *`: The old name, or the empty string if no name was set, in a static buffer. | Sets the sender name to use with messages generated by `clear_channel()`, or retrieves the name currently in use.

set_cmode
(actions.c)

`const char *sender`: Sender name to use with mode changes, or `NULL` to flush out mode changes for the specified channel (`channel==NULL`: all channels)..

`Channel *channel`: Channel to operate on.

`...`: Mode change string, followed by the proper number of parameters (all as strings).

—

Sets modes on a channel, accumulating mode changes to minimize the number of mode change messages sent to the network.

set_os_priv (tools/convert-db.c) | `const char *nick`: Nickname to set privilege level for. `int16 level`: Privilege level to set. | — | Sets the OperServ privilege level (`NickGroupInfo.os_priv`) for the specified nickname's group.
set_password (encrypt.c) | `Password *password`: `Password` structure into which data will be stored. `const char password_buf[PASSMAX]`: Encrypted password buffer. `const char *cipher`: Cipher used to encrypt password (`NULL` if none). | — | Sets the contents of a `Password` structure to specific values.
set_topic (actions.c) | `const char *source`: Sender name to use for `TOPIC` message, or `NULL` to use the server name. `Channel *c`: Channel to operate on. `const char *topic`: New topic to set. `const char *setter`: Nickname to use for topic setter. `time_t t`: Timestamp to use for topic. | — | Sets the topic on a channel.
setstring (language.c) | `int language`: Language index. `int index`: String index. `const char *text`: New text for string. | `int`: Nonzero on success, zero on error. | Sets the text for the given string in the given language.
sgetc (sockets.c) | `Socket *s`: Socket to read from. | `int`: The character read from the socket, or `EOF` if no data is available. | Reads a single character (byte) from a socket.
sgets (sockets.c) | `char *buf`: Buffer into which data is to be read. `int32 len`: Size of buffer. `Socket *s`: Socket to read from. | `char *`: `buf` on success, `NULL` on failure or when there are no complete lines available in the read buffer. | Reads a line of text from a socket and stores it in the given buffer.
sgets2 (sockets.c) | `char *buf`: Buffer into which data is to be read. `int32 len`: Size of buffer. `Socket *s`: Socket to read from. | `char *`: `buf` on success, `NULL` on failure or when there are no complete lines available in the read buffer. | Reads a line of text from a socket, strips any trailing CR, LF, or CRLF, and stores the line in the given buffer.
show_leaks (memory.c) | — | — | Internal routine to log a notice about any leaked memory.
sighup_handler (signals.c) | `int sig_unused`: Signal number (unused). | — | Handler for the `SIGHUP` signal.
sigterm_handler (signals.c) | `int sig_unused`: Signal number (unused). | — | Handler for the `SIGTERM` signal.
sigusr2_handler (signals.c) | `int sig_unused`: Signal number (unused) | — | Handler for the `SIGUSR2` signal.
sirv_load_akill (tools/convert-sirv.c) | `const char *dir`: Directory from which to load data. `int type`: File format type (one of the `TYPE_*` constants from `convert-sirv.c`). | — | Loads the Sirv/Auspice/Bolivia `akill.db` data file.
sirv_load_chan (tools/convert-sirv.c) | `const char *dir`: Directory from which to load data. `int type`: File format type (one of the `TYPE_*` constants from `convert-sirv.c`). | — | Loads the Sirv/Auspice/Bolivia `chan.db` data file.
sirv_load_memo (tools/convert-sirv.c) | `const char *dir`: Directory from which to load data. `int type`: File format type (one of the `TYPE_*` constants from `convert-sirv.c`). | — | Loads the Sirv/Auspice/Bolivia `memo.db` data file.
sirv_load_nick (tools/convert-sirv.c) | `const char *dir`: Directory from which to load data. `int type`: File format type (one of the `TYPE_*` constants from `convert-sirv.c`). | — | Loads the Sirv/Auspice/Bolivia `nick.db` data file.
sirv_load_os_sa (tools/convert-sirv.c) | `const char *dir`: Directory from which to load data. | — | Loads the Sirv `os_sa.db` data file.
sirv_load_os_sop (tools/convert-sirv.c) | `const char *dir`: Directory from which to load data. | — | Loads the Sirv `os_sop.db` data file.
sirv_load_trigger (tools/convert-sirv.c) | `const char *dir`: Directory from which to load data. `int type`: File format type (one of the `TYPE_*` constants from `convert-sirv.c`). | — | Loads the Sirv/Auspice/Bolivia `trigger.db` data file.
smalloc (memory.c) | `long size`: Size of memory to allocate, in bytes. | `void *`: Allocated memory. | Allocates memory using `malloc()`. Raises an out-of-memory signal if the allocation fails.
smalloc (tools/convert-db.c) | `long size`: Size of memory to allocate, in bytes. | `void *`: Allocated memory. | Allocates memory using `malloc()`. Aborts `convert-db` if the allocation fails.
snprintf (compat.c) | `char *buf`: Buffer to write output into. `size_t len`: Size of buffer. `const char *fmt`: Output format string. `...`: Output arguments. | `int`: Number of bytes written into buffer, excluding trailing null. | Compatibility function.

sock_bufstat
(sockets.c)

`const Socket *s`: Socket to get statistics for. May be `NULL`.

`uint32 *socksize_ret`: Location in which to store the total size used by the given socket's buffers, in bytes. May be `NULL`.

`uint32 *totalsize_ret`: Location in which to store the total size used by all sockets' buffers, in bytes. May be `NULL`.

`int *ratio1_ret`: Location in which to store the ratio of the value stored in `*socksize_ret` to the per-connection buffer size limit (zero if that limit is not set).

`int *ratio2_ret`: Location in which to store the ratio of the value stored in `*totalsize_ret` to the total buffer size limit (zero if that limit is not set).

`int`: The larger of the two ratios stored in `*ratio1_ret` and `*ratio2_ret`.

Return statistics on socket buffer size usage. Both ratios are expressed as percentages rounded up to the nearest integer. If the socket pointer `s` is `NULL`, then `*socksize_ret` is left unchanged, and `*ratio1_ret` is set to zero.

sock_closefd (sockets.c) | `Socket *s`: Socket to operate on. | — | Closes the file descriptor associated with the given socket, and resets the corresponding field in the `Socket` structure.
sock_free (sockets.c) | `Socket *s`: Socket to free. | — | Frees all resources used by the given socket.
sock_get_blocking (sockets.c) | `const Socket *s`: Socket to operate on. | `int`: The socket's blocking status. | Returns whether the socket is set to blocking mode (nonzero) or not (zero).
sock_isconn (sockets.c) | `const Socket *s`: Socket to operate on. | `int`: Nonzero if the socket is currently connected, else zero. | Returns whether the socket is currently connected to a remote host.
sock_mute (sockets.c) | `Socket *s`: Socket to mute. | — | Mutes the given socket, preventing any further actions being taken in response to socket activity.
sock_new (sockets.c) | — | `Socket *`: New socket, or `NULL` on error. | Creates a new socket.

sock_remote
(sockets.c)

`const Socket *s`: Socket whose remote address is to be retrieved.

`struct sockaddr *sa`: `sockaddr` structure into which the address is to be stored.

`int *lenptr`: Length pointer, initialized to the size of the passed-in `sockaddr` structure and set on return to the size of the data stored in that structure.

`int`: 0 on success, -1 on error.

Retrieves the remote address of the given (connected) socket, similar to the `getpeername()` system call.

sock_rwstat
(sockets.c)

`const Socket *s`: Socket to retrieve statistics for.

`uint64 *read_ret`: Location in which to store the number of bytes received during the current connection.

`uint64 *written_ret`: Location in which to store the number of bytes sent during the current connection.

`int`: 0 on success, -1 on error.

Returns the amount of data received and sent over the life of the socket's current connection.

sock_set_blocking (sockets.c) | `Socket *s`: Socket to operate on. `int blocking`: New state (nonzero for blocking, zero for nonblocking). | — | Sets the socket's blocking/nonblocking state.
sock_set_buflimits (sockets.c) | `uint32 per_conn`: Maximum number of bytes to use for a single connection's buffers (zero for unlimited). `uint32 total`: Maximum number of bytes to use for all connections' buffers (zero for unlimited). | — | Sets the global buffer size limits.
sock_set_rto (sockets.c) | `int msec`: Read timeout, in milliseconds. | — | Sets the global read timeout (the timeout used when waiting for socket activity).
sock_set_wto (sockets.c) | `Socket *s`: Socket to operate on. `int seconds`: Write timeout, in seconds. | — | Sets the write timeout for the given socket.
sock_setcb (sockets.c) | `Socket *s`: Socket to operate on. `SocketCallbackID which`: Constant identifying the callback to set. `SocketCallback func`: Callback function for the callback. | — | Sets a callback function for the given socket.
sock_unmute (sockets.c) | `Socket *s`: Socket to unmute. | — | Unmutes a socket, allowing socket activity to be processed as usual.
sockprintf (sockets.c) | `Socket *s`: Socket to write to. `const char *fmt`: Output format string. `...`: Output arguments. | `int`: Number of bytes written to the socket. | Writes a formatted string to the given socket, like `printf()`.

split_buf
(process.c)

`char *buf`: String to split.

`char ***argv_ptr`: Pointer to `char **` variable in which to store field array.

`int colon_special`: Nonzero to treat a leading colon on a field as extending to the end of the line, like RFC 1459.

`int`: Number of fields in the result array.

Splits a string into fields at space characters, optionally treating a leading colon on a field in the RFC 1459 style.

split_usermask (users.c) | `const char *mask`: Mask to split. `char **nick`: Nickname part of mask, or "`*`" if missing. `char **user`: Username part of mask, or "`*`" if missing. `char **host`: Hostname part of mask, or "`*`" if missing. | — | Splits a user/host mask into its consitutuent parts (the original string is not modified). Each of the return strings is allocated with `malloc()`.
sputs (sockets.c) | `const char *str`: String to write. `Socket *s`: Socket to write to. | `int`: Number of bytes written, or -1 on error. | Writes a string to a socket.
squit_server (servers.c) | `Server *server`: The server to delete. `const char *reason`: The `SQUIT` reason string. | — | Deletes the given server and all child servers.
sread (sockets.c) | `Socket *s`: Socket to read from. `char *buf`: Buffer to read into. `int32 len`: Number of bytes to read. | `int32`: Number of bytes read, or -1 on error. | Reads data from the given socket.
srealloc (memory.c) | `void *oldptr`: Memory to be reallocated. `long newsize`: New size of memory region. | `void *`: New memory region. | Reallocates memory using `realloc()`. Raises an out-of-memory signal if the allocation fails.
srealloc (tools/convert-db.c) | `void *ptr`: Memory to be reallocated. `long size`: New size of memory region. | `void *`: New memory region. | Reallocates memory using `realloc()`. Aborts `convert-db` if the reallocation fails.
sstrdup (memory.c) | `const char *s`: String to duplicate. | `char *`: Duplicated string. | Duplicates a string, like `strdup()`. Raises an out-of-memory signal if the duplication fails.
sstrdup (tools/convert-db.c) | `const char *s`: String to duplicate. | `char *`: Duplicated string. | Duplicates a string, like `strdup()`. Aborts `convert-db` if memory allocation fails.
strbcpy (extern.h) | `char *d`: Destination buffer. `const char *s`: Source string. | `char *`: Destination buffer. | A shortcut for copying a string into a character array of fixed size. Equivalent to `strscpy(d, s, sizeof(d))`.
strcspn (compat.c) | `const char *s`: Input string. `const char *reject`: Characters to reject. | `size_t`: Number of characters from the beginning of `s` which are not in `reject`. | Compatibility function.
strdup (compat.c) | `const char *s`: String to duplicate | `char *`: Duplicated string, or `NULL` if duplication fails. | Compatibility function.
strerror (compat.c) | `int errnum`: Value of `errno`. | `char *`: String describing the given error number. | Compatibility function.

strftime_lang
(language.c)

`char *buf`: Destination buffer.

`int size`: Size of destination buffer in bytes.

`const NickGroupInfo *ngi`: Nickname group record for user to which message will be sent, or `NULL` if none.

`int format`: String index for date/time format.

`time_t time`: Timestamp to convert.

`int`: Length of result string if it fits, else 0 (the same as `strftime()`).

Converts the given timestamp to a string, according to the given format string index and the user's selected language.

stricmp (compat.c) | `const char *s1`: First string. `const char *s2`: Second string. | `int`: The result of a case-insensitive comparison of `s1` with `s2` (-1, 0, or 1, like `strcmp()`). | Compatibility function.
stringnum (lang/langcomp.c) | `const char *name`: String name. | `int`: String index. | Returns the string index for a given string name.
stristr (misc.c) | `const char *s1`: String to search. `const char *s2`: Substring to search for. | `char *`: Pointer to the first occurrence of `s2` in `s1`, or `NULL` if `s2` is not found in `s1`. | Searches case-insensitively for one string inside another.
strlower (misc.c) | `char *s`: String to convert. | `char *`: Converted string (`s`). | Converts a string to lowercase.
strmove (misc.c) | `char *d`: Destination buffer. `const char *s`: Source string. | `char *`: Destination buffer. | Copies a string. The destination buffer and source string may overlap.
strnicmp (compat.c) | `const char *s1`: First string. `const char *s2`: Second string. `size_t len`: Maximum number of characters to compare. | `int`: The result of a case-insensitive comparison of up to `len` characters of `s1` with `s2` (-1, 0, or 1, like `strncmp()`). | Compatibility function.
strnrepl (misc.c) | `char *s`: String to operate on. `int32 size`: Maximum size of result, including trailing null. `const char *old`: Substring to replace. `const char *new`: Replacement string. | `char *`: String (`s`). | Replaces all occurrences of `old` with `new` in `s`, stopping if a replacement would cause the result to exceed `size` bytes.
strscpy (misc.c) | `char *d`: Destination buffer. `const char *s`: Source string. `size_t len`: Destination buffer size. | `char *`: Destination buffer. | Copies a string up to a maximum length, like `strncpy()`, except that the string is always null-terminated, and the destination buffer is not padded with nulls if the source string is shorter than `len-1` bytes.
strsignal (compat.c) | `int signum`: Signal number. | `char *`: String describing the given signal number. | Compatibility function.
strspn (compat.c) | `const char *s`: Input string. `const char *accept`: Characters to accept. | `size_t`: Number of characters from the beginning of `s` which are in `accept`. | Compatibility function.
strtok (compat.c) | `char *str`: String to tokenize, or `NULL` to continue tokenizing the current string. `const char *delim`: Token delimiters. | `char *`: Pointer to the next token, or `NULL` if there are no more tokens. | Compatibility function.
strtok_remaining (misc.c) | — | `char *`: Final token in string, or `NULL` if no tokens remain. | Returns the remainder of the string currently being processed by `strtok()`, with any leading or trailing whitespace stripped.
strtotime (misc.c) | `const char *str`: String to convert. `char **endptr`: If not `NULL`, receives a pointer to the first character after the parsed value. | `time_t`: The parsed value. | Converts a string to a `time_t` value, assuming base 10. Sets `errno` to `ERANGE` if the result overflows a `time_t`.
strupper (misc.c) | `char *s`: String to convert. | `char *`: Converted string (`s`) | Converts a string to uppercase.
swrite (sockets.c) | `Socket *s`: Socket to write to. `const char *buf`: Buffer to write from. `int32 len`: Number of bytes to write. | `int32`: Number of bytes written, or -1 on error. | Writes data to the given socket.
swrite_trigger (sockets.c) | `Socket *s`: Socket to set a write trigger on. `void *data`: Data to pass to the write trigger callback function. | `int`: 0 on success, -1 on failure. |

swritemap
(sockets.c)

`Socket *s`: Socket to write to.

`const char *buf`: Mapped buffer to write from.

`int32 len`: Number of bytes to write.

`int32`: Number of bytes (scheduled to be) written, or -1 on error.

Writes data to the given socket from a mapped buffer. The data is only scheduled to be written when this function returns, and the buffer must not be freed by the caller; it will be automatically unmapped when the data has been sent to the remote host (or the connection is closed).

syntax_error (language.c) | `const char *service`: Service name (sender name to use for `NOTICE` messages). `const User *u`: Target user. `const char *command`: Command name. `int msgnum`: Syntax string index. | — | Sends a "syntax error" message to a user for a particular command.
T
time_msec (misc.c) | — | `uint32`: Current time. | Returns the current time in milliseconds, relative to an arbitrary epoch.
trircd_load_ajoin (tools/convert-trircd.c) | `const char *dir`: Directory from which to load data. | — | Loads the trircd `ajoin.db` data file.
trircd_load_akill (tools/convert-trircd.c) | `const char *dir`: Directory from which to load data. | — | Loads the trircd `akill.db` data file.
trircd_load_cforbid (tools/convert-trircd.c) | `const char *dir`: Directory from which to load data. | — | Loads the trircd `cforbid.db` data file.
trircd_load_chan (tools/convert-trircd.c) | `const char *dir`: Directory from which to load data. | — | Loads the trircd `chan.db` data file.
trircd_load_exception (tools/convert-trircd.c) | `const char *dir`: Directory from which to load data. | — | Loads the trircd `exception.db` data file.
trircd_load_exclude (tools/convert-trircd.c) | `const char *dir`: Directory from which to load data. | — | Loads the trircd `exclude.db` data file.
trircd_load_news (tools/convert-trircd.c) | `const char *dir`: Directory from which to load data. | — | Loads the trircd `news.db` data file.
trircd_load_nick (tools/convert-trircd.c) | `const char *dir`: Directory from which to load data. | — | Loads the trircd `nick.db` data file.
trircd_load_oper (tools/convert-trircd.c) | `const char *dir`: Directory from which to load data. | — | Loads the trircd `oper.db` data file.
trircd_load_sline (tools/convert-trircd.c) | `const char *dir`: Directory from which to load data. `const unsigned char type`: Type of data to load, one of `MD_SGLINE`, `MD_SQLINE`, or `MD_SZLINE`. | — | Loads the trircd `sgline.db`, `sqline.db`, or `szline.db` data file, depending on the value of `type`.
U
unimplemented (send.c) | — | — | Default function for module-implemented message sending functions (aborts the program with an error message).
uninit_memory (memory.c) | — | — | Closes down the memory checking subsystem.
unload_all_modules (modules.c) | — | — | Unloads all loaded modules.
unload_module (modules.c) | `Module *module`: Handle for module to unload. | `int`: Nonzero on success, zero on error. | Unloads the given module.
unlock_data (main.c) | — | `int`: 1 on success, 0 on error, -1 if the data directory was not locked in the first place. | Unlocks the data directory.
unpack_ip (misc.c) | `const uint8 *ip`: Packed IPv4 address. | `char *`: IPv4 address string (stored in a static buffer). | Unpacks a binary IPv4 address into an address string.
unpack_ip6 (misc.c) | `const uint8 *ip`: Packed IPv6 address. | `char *`: IPv6 address string (stored in a static buffer). | Unpacks a binary IPv6 address into an address string.
unregister_callback (modules.h) | `int id`: ID of callback to unregister, | `int`: Nonzero on success, zero on failure. | Unregisters the given callback for the calling module.
_unregister_callback (modules.c) | `Module *module`: Handle of the calling module. `int id`: ID of callback to unregister, | `int`: Nonzero on success, zero on failure. | Implements the `unregister_callback()` macro.
unregister_cipher (encrypt.c) | `CipherInfo *ci`: Cipher to unregister. | — | Unregisters an encryption cipher.
unregister_commands (commands.c) | `Module *id`: Command list ID. `Command *array`: Array of commands to register, as passed to `register_commands()`. | `int`: Nonzero on success, zero on failure. | Unregisters an array of commands previously registered with the given command list.
unregister_dbmodule (databases.c) | `DBModule *module`: Module description structure. | — | Unregisters a database module from the core interface.
unregister_dbtable (databases.c) | `DBTable *table`: Data table to unregister. | — | Unregisters a database table. The table's contents are not saved to persistent storage.
unregister_messages (messages.c) | `Message *table`: Message table to unregister. | `int`: Nonzero if the table was found and unregistered, zero if the table was not found. | Unregisters a message table.
unuse_module (modules.h) | `Module *module`: Handle of the module to unlock. | — | Releases the lock on a module previously locked with `use_module()`. `unuse_module()` macro.
_unuse_module (modules.c) | `Module *module`: Handle of the module to release. `const Module *caller`: Handle of the calling module. | — | Implements the `unuse_module()` macro.
use_module (modules.h) | `Module *module`: Handle of the module to lock. | — | Locks the given module into memory, preventing it from being unloaded.
_use_module (modules.c) | `Module *module`: Handle of the module to lock. `const Module *caller`: Handle of the calling module. | — | Implements the `use_module()` macro.
use_module_loopcheck (modules.c) | `const Module *module`: Module intended to be locked. `const Module *check`: Module doing the locking. | `int`: Nonzero if locking the module would cause a cycle of locks, else zero. | Checks whether an attempt to lock a module with `use_module()` would result in a cycle of locks, potentially causing a deadlock.
usage (tools/convert-db.c) | `const char *progname`: Value of `argv[0]`. | — | Prints a usage message for `convert-db` and aborts the program.
user_cleanup (users.c) | — | — | Performs cleanup actions for the user management subsystem.
user_init (users.c) | `int ac`: Command-line argument count. `char **av`: Command-line argument vector. | `int`: Nonzero on success, zero on failure. | Performs initialization actions for the user management subsystem.
V
valid_chan (misc.c) | `const char *str`: String to check. | `int`: Nonzero if the string represents a valid channel name, else zero. | Checks whether a string is a valid channel name.
valid_domain (misc.c) | `const char *str`: String to check. | `int`: Nonzero if the string represents a valid domain name, else zero. | Checks whether a string is a valid domain name by RFC 1035 standards, has at least one character, and does not end with a dot.
valid_email (misc.c) | `const char *str`: String to check. | `int`: Nonzero if the string represents a valid E-mail address, else zero. | Checks whether a string is a valid E-mail address by (somewhat simplified) RFC 822 rules. Addresses in which the domain name contains no dot are rejected.
valid_nick (misc.c) | `const char *str`: String to check. | `int`: Nonzero if the string represents a valid nickname, else zero. | Checks whether a string is a valid nickname.
valid_nickchan (misc.c) | `const char *str`: String to check. `const unsigned char *table`: Character validity table to use. | `int`: Nonzero if the string represents a valid string, else zero. | Internal function implementing `valid_nick()` and `valid_chan()`.
valid_url (misc.c) | `const char *str`: String to check. | `int`: Nonzero if the string represents a valid URL, else zero. | Checks whether a string is a valid URL, in the form `method://domain[:port][/...]` (where `method` is a sequence of one or more letters, and `port` is an integer between 1 and 65535 inclusive).
ver8_load_akill (tools/convert-ver8.c) | `const char *dir`: Directory from which to load data. `int type`: File format type (one of the `TYPE_*` constants from `convert-ver8.c`). | — | Loads the Daylight/IRCS `akill.db` data file.
ver8_load_chan (tools/convert-ver8.c) | `const char *dir`: Directory from which to load data. `int type`: File format type (one of the `TYPE_*` constants from `convert-ver8.c`). | — | Loads the Daylight/IRCS `chan.db` data file.
ver8_load_exception (tools/convert-ver8.c) | `const char *dir`: Directory from which to load data. `int type`: File format type (one of the `TYPE_*` constants from `convert-ver8.c`). | — | Loads the Daylight/IRCS `exception.db` data file.
ver8_load_news (tools/convert-ver8.c) | `const char *dir`: Directory from which to load data. `int type`: File format type (one of the `TYPE_*` constants from `convert-ver8.c`). | — | Loads the Daylight/IRCS `news.db` data file.
ver8_load_nick (tools/convert-ver8.c) | `const char *dir`: Directory from which to load data. `int type`: File format type (one of the `TYPE_*` constants from `convert-ver8.c`). | — | Loads the Daylight/IRCS `nick.db` data file.
ver8_load_oper (tools/convert-ver8.c) | `const char *dir`: Directory from which to load data. `int type`: File format type (one of the `TYPE_*` constants from `convert-ver8.c`). | — | Loads the Daylight/IRCS `oper.db` data file.
vlogprintf (log.c) | `const char *fmt`: Format string. `va_list args`: Format arguments. | — | Writes a formatted string to the log file, like `vfprintf()`.
vsend_cmd (send.c) | `const char *source`: Source name, or `NULL` for none. `const char *fmt`: Message format string, as for `printf()`. `va_list args`: Format arguments. | — | Sends a generic message (command) to the remote server.
vsnprintf (compat.c) | `char *buf`: Buffer to write output into. `size_t len`: Size of buffer. `const char *fmt`: Output format string. `va_list args`: Output arguments. | `int`: Number of bytes written into buffer, excluding trailing null. | Compatibility function.
vsockprintf (sockets.c) | `Socket *s`: Socket to write to. `const char *fmt`: Output format string. `va_list args`: Output arguments. | `int`: Number of bytes written to the socket. | Writes a formatted string to the given socket, like `vprintf()`.
W
wallops (send.c) | `const char *source`: Source name. `const char *fmt`: Format string, as for `printf()`. `...`: Format arguments. | — | Sends a `WALLOPS` to the network. Implemented by the protocol module (which may use a different message type).
weirdsig_handler (signals.c) | `int signum`: Signal number. | — | Handler for `SIGINT`, `SIGQUIT`, and unexpected signals.
wrecked_convert_level (tools/convert-magick.c) | `int16 lev`: Old access level. | `int16`: New access level. | Converts channel access levels from values used in Wrecked 1.2 to values used in current Services versions.
write_pidfile (init.c) | — | `int`: Nonzero on success, zero on failure. | Writes the PID of the Services process to the file specified by the `PIDFilename` configuration directive.
write_time (log.c) | — | — | Writes the current date and time to the log file.
write_buffer_len (sockets.c) | `const Socket *s`: Socket. | `uint32`: Number of bytes in the socket's write buffer. | Returns the length of the data in the socket's write buffer.

writefunc
(vsnprintf.c)

`const char *buf`: Data to write.

`size_t len`: Length of data to write.

`char **string`: Pointer to destination buffer pointer.

`size_t *size`: Pointer to destination buffer size.

`int`: Number of bytes written, or 0 on error.

Write callback for `my_snprintf()` and `my_vsnprintf()`. Modifies the destination buffer pointer and size to reflect the space left after each write.

X
Y
Z

Table of Contents