aboutsummaryrefslogtreecommitdiffstats
path: root/modules
Commit message (Expand)AuthorAgeFilesLines
* Add m_quarantine•••This extension module provides a new usermode (+q) and two commands that allow opers to set/unset that mode. The mode can be set either via ircd.conf (general::default_umodes or auth::umodes) or via the QUARANTINE command. When using the command, a reason is required which will be broadcast to all other opers via the snote. The quarantine will be automatically removed if the target opers up or logs into a services account, and opers and logged in users cannot be quarantined. The UNQUARNTINE command may additionally be used to remove the quarantine status from a user. Users cannot otherwise set or remove this usermode from themselves. The QUARANTINE and UNQUARANTINE commands require a new priv oper:quarantine. To support this, a new account_change hook was added to m_services and m_signon. This hook is fired whenever a user's services account changes (via logging in or logging out) from the SVSLOGIN, SIGNON, LOGIN, or SU services commands. It is **not** fired for SVSLOGIN on unknown (pre-registration) users. Documentation was updated for the new usermode, hook, and commands. Usermode help was alphabetized for consistency, a missing entry for helpops was added, and cloaking was moved to +x (since all modern cloaking modules use that mode instead) since I was touching the file anyway. Gravatar Ryan Schmidt2026-04-292-2/+28
* Unify the preprocessor macro for OpenSSL support•••Commit 9a1ee1b64ed660164197 introduced support for building IRCd with Meson. It defines the "HAVE_OPENSSL" preprocessor macro for both IRCd and librb. While librb does use that macro, IRCd unfortunately uses only the "HAVE_LIBCRYPTO" macro instead, set implicitly by AC_CHECK_LIB from autotools. Make the autotools build system define HAVE_OPENSSL (to unify IRCd with librb) and change IRCd to use that. Gravatar Aaron Jones2026-03-221-3/+3
* Tidy up module loading code•••The existing code had several defects: - Core module file names were hardcoded, while autoloaded non- core module filenames were not. Code that loaded core modules had a different but in some places duplicated structure to the code that loaded autoloaded modules. - Module loading for autoloaded modules happened in dentry order, making it unpredictable from one server to the next, or even across instances of `make install` on the same server. - Module loading for autoloaded modules did not verify that the dentry was a file before trying to load it. - An IRCd start (or a conftest) only printed lines about loading modules mentioned in the configuration file. - The configuration file was parsed before loading core and autoloaded modules, meaning any modules specified in the configuration file would be loaded first. - Once a module was loaded, it was added to the head of the module list, making MODLIST show them in reverse loaded order (newest (re)loaded modules at the top of the list). These are addressed as follows: - We now scan the core and autoload module directories and use this to determine which modules to load. - We now sort the dentries according to their filename before iterating them to load them, making module load order finally deterministic. - We now test if a dentry is actually a file before trying to load it. - We now print a message to the console (if running in foreground or conftest mode) when loading any module, including core and autoloaded modules. - The message printed to the console now has the IRCd module directory prefix stripped from it if it matches. - The configuration file is now parsed after loading core and autoload modules. - The modules are added to the module list in the order that they are loaded. This now makes MODLIST show the order that modules were (re)loaded in. Modifications to two modules are part of this effort: - The autoload module `m_alias` relied upon the alias dict not being NULL when loaded, but this is only the case after the configuration file has been parsed. The module already had a "rehash" hook to destroy all existing aliases and create new ones, so we can just make the module do nothing on load (remove its modinit function) and change it to use the "conf_read_end" hook instead of the "rehash" hook, and it will still create aliases after the configuration file is subsequently parsed. With this modification, there are now no in-tree consumers of the "rehash" hook. - The autoload module `m_services` iterated `service_list` upon loading it, which will now be empty (a no-op) since the module is loaded before configuration file is parsed. This module too handles the configuration file being parsed with a "conf_read_end" hook and takes the appropriate action, so we can just remove this code from its modinit function. All other modules' modinit functions have been audited for behaviour like this; there was nothing of note. Gravatar Aaron Jones2026-03-222-11/+2
* Add no-implicit-names client capability•••This has been recently ratified and suppresses NAMES output during channel joins when enabled, providing for a decent chunk of bandwidth savings. Gravatar Ryan Schmidt2026-03-191-1/+2
* build: add Meson buildsystemGravatar Valentin Lorentz2026-03-171-0/+114
* modules: drop unnecessary link flagGravatar Valentin Lorentz2026-03-171-1/+0
* Remove channel::kick_on_split_riding•••This feature had numerous pitfalls (such as not checking +beI) and services does it better than we can. Remove it and alert opers that the feature no longer exists if they had it configured. Gravatar Ryan Schmidt2026-03-172-46/+0
* Adjust unsigned int -> uint64_t for all caps•••The previous commit addressed the issue with (most) function signatures, but forgot to update the caps themselves to be 64-bit. This fixes that, and finishes the remaining overlooked function signatures. Gravatar Ryan Schmidt2026-03-176-6/+6
* Apply review suggestions•••Also made full use of the Set/Clear macros across the codebase so there's fewer places to touch in the future if changes are needed. Gravatar Ryan Schmidt2026-03-173-9/+9
* Separate client vs server caps•••Instead of overloading the same field in a LocalUser, have separate fields for client caps vs server caps. While only one of these will ever be nonzero, it reduces error by making it explicit which set of caps is being checked. IsCapable and friends have been split as well, to IsClientCapable and IsServerCapable. Finally, both fields have been updated to uint64_t (server caps were approaching the current limit) and all APIs that reference caps updated to uint64_t as well (no more signed/unsigned mismatches). Gravatar Ryan Schmidt2026-03-179-34/+37
* Make TAGMSG behave like NOTICE for errors•••We explicitly do not send error numerics to clients for NOTICE in most cases, instead silently discarding the command. Give this treatment to TAGMSG across the board as well. Previously, this was the case for TAGMSG without tags but was not applied for TAGMSG that had tags but otherwise had issues (e.g. +m channel and the user is not +ov). This prevents spamming users whose clients send automatic TAGMSG with errors they can do nothing about. Gravatar Ryan Schmidt2026-02-121-17/+17
* Add doing_version_confopts hook•••This hook allows modification of the confopts portion of a VERSION response (i.e. the set of flags representing how the ircd was configured). Extension modules can use this hook to display additional confopts without needing to edit m_version or add things to core in order to share state with m_version. Gravatar Ryan Schmidt2026-01-221-16/+37
* Pass msgbuf to PART's privmsg_channel hook and propagate PART tags•••The privmsg_channel hook gained a new msgbuf member which was uninitialized in m_part. Properly pass the msgbuf to that parameter and propagate any tags set by the hook to downstream servers. This requires introducing sendto_server_tags(), and I refactored sendto_server() to call the same helper internal method as sendto_server_tags(). I took the opportunity to update the method to use msgbuf instead of linebuf directly (meaning sendto_server() now calls outbound_msgbuf). Fixes #484 Gravatar Ryan Schmidt2026-01-221-19/+19
* Add doing_info_conf hook and cleanup unused hooks•••doing_info_conf is called during INFO commands after all conf options have been sent to opers. Modules can use this hook to expose any conf options they define by sending relevant RPL_INFO replies to the oper. This addition removes the final barrier to defining new ircd.conf options inside of extension modules rather than requiring core changes for extension configuration. Additionally, some cleanup has been performed for hook definitions that are not called anywhere inside of solanum. Three hooks were declared in hook.h as extern int but were not defined or referenced in any other file: iosend_id, iorecv_id, and iorecvctrl_id. The doing_admin, doing_info, doing_motd, and doing_trace "spy" hooks were defined in the module headers for those modules, however the modules never actually invoked those hooks. All of the lingering declarations for these hooks have now been removed as they weren't doing anything anyway. Gravatar Ryan Schmidt2026-01-214-18/+7
* Fix msgid tags with echo-message•••msgid generation has been moved to the privmsg_user and privmsg_channel hooks, which are called on every normal PRIVMSG/NOTICE/TAGMSG. They are not called when messaging user@server, opers@server, or mass-messages and as such none of those things will have msgid attached. This seems fine as user@server is rejected by solanum and exists solely for messaging pseudoservers, opers@server is turned into a snote, and mass-messages are oper-only and thus unlikely to need anything that keys off msgid in the future. Moving this solves the interaction with msgid and echo-message. Now, we ensure that an echoed message always has a msgid, and that msgid is always the same as the msgid shown to other clients. This requires expanding the hook_data structures for those two hooks. While a core restart is not needed, attempting to reload tag_message_id before reloading m_message may cause crashes. When updating your servers, please reload m_message first. Gravatar Ryan Schmidt2026-01-211-51/+56
* Batch updates•••The extension example_module was extended to introduce a new client-initiated batch type named test. This is primarily done to ease testing of the client-initiated portions of m_batch, but also serves as a useful sketch for how a module can register its own client-initiated batch types. The definition of struct BatchHandler was slightly modified to use a callback function to determine if nesting is allowed. The callback can additionally set a custom error message if desired when returning false. The len and messages list in struct Batch no longer include the start message, so a len of 0 indicates an empty batch. Because the start message is still allocated and saved off, adjust anything that impacts a client's pending_batch_lines by 1 to account for the implicit additional message. Empty batches now trigger the relevant batch handler. If a handler wants to no-op on empty batches, it can do so but this allows additional flexibility for handlers to still do something upon receiving empty client-initiated batches. Gravatar Ryan Schmidt2026-01-211-26/+20
* Avoid making spurious netjoin batches•••If a server being netjoined to us is introducing additional downstream servers from it, those servers won't themselves be sending us bursts. As such, we can safely suppress sending a BATCH to clients for those additional servers. Gravatar Ryan Schmidt2026-01-211-0/+6
* Include AWAY and status MODEs in netjoin batches•••AWAY is burst to away-notify clients and status MODEs (+o and +v) are burst to all clients on the channel. Excluding these from the batch means that clients may opt to process these before the batch completes, then get confused because they have no records of those nicknames existing or being members of the channel. Including both in the netjoin batch solves these concerns, although the netjoin batch spec is silent on whether we're allowed to put non-JOIN commands in that batch. Gravatar Ryan Schmidt2026-01-211-18/+16
* Add batch support•••- Add "batch" client capability - Support sending netsplit/netjoin batches - Support receiving BATCH from clients and remote servers - Support for modules to define supported batch types for incoming batches - Add "message_handler" hook to override the handler for a particular incoming message - Add technical and user-facing documentation for batches - Add some more sendto_* overloads that support tags which were missing from the initial message-tags implementation but turned out to be needed Gravatar Ryan Schmidt2026-01-213-2/+508
* Stop sending ERR_NOTEXTTOSEND on empty TAGMSG (#476)•••Per the message-tags spec, clients are allowed to send tags blocked by CLIENTTAGDENY, and some clients make use of this allowance to send tags that are otherwise stripped out (e.g. +typing if that module is not loaded). If a TAGMSG did not have any client tags after processing, we previously returned ERR_NOTEXTTOSEND (412) however this results in a fair amount of spam in the server buffer of such clients. Make the command silently fail instead. An open question remains on how this interacts with echo-message, as the spec is not well-written to cover what happens during failure/error cases. A strict reading of the spec would require an echo-message on every received PRIVMSG/NOTICE/TAGMSG, including cases where we are already sending an error numeric. This does not seem intended, and would complicate labeled-response by requiring a batch in error cases. A looser reading of the spec seems to permit not sending any echo-message in the case that messages are filtered out (as the portion of the spec allowing "fake messages" is a MAY). Since we currently do not send any echo-message for empty NOTICE (and do not send any numerics either), apply the same treatment for empty TAGMSG: the server silently drops the command and does not echo anything back to the client.Gravatar Ryan Schmidt2026-01-111-3/+0
* Remove duplicate definition message-tags CAP•••It is defined in s_serv.c so it doesn't need to additionally be defined in modules/core/m_message.c. Support for receiving client tags is baked into parse.c and other core files, so the definition in s_serv.c is the right place for it. Gravatar Ryan Schmidt2025-10-101-1/+0
* m_message: Implement message-tags and TAGMSG•••The CAP_STAG server capability and the CAP_TAGS server capability introduced by m_message are redundant, so get rid of CAP_TAGS and update the comment for CAP_STAG to indicate what it is for. Additionally, define the message-tags client capability in m_message. A lot of new sendto_* functions were introduced that take an explicit array of tags to attach to the outgoing message. New functions were preferred over updating existing functions in order to maintain compatibility with non-tags-aware code in both the API and ABI layers. The updated definitions of these functions will be provided in a subsequent patch in this PR; however I felt the declarations would be useful in reviewing the changes to m_message. A TAGMSG with zero client-only tags is rejected with 412 ERR_NOTEXTTOSEND. While the precise message of that numeric is a little bit misleading, it was the closest existing thing and matches what we send off when a PRIVMSG contains no text. The message-tags spec does not specify any particular error when a TAGMSG contains no tags (indeed it has a non-normative example where such a TAGMSG is propgated). The spec also allows for server-side moderation of tags, however, and not propagating completely useless messages is a valid use of those moderation powers. General cleanup of the file was performed as part of this patch. Gravatar Ryan Schmidt2025-10-101-83/+190
* Refactor message_tag hook•••The original hook was defined in the (now-removed) cap_message_tag module. This new hook lives deeper down in parse.c so that it fires on all incoming tags for all incoming messages. The hook was renamed from client_tag_accept to message_tag to denote that it is used for all tags, including tags coming from server connections, and not just tags with a client-only prefix. The hook data contains two non-const fields for the capmask and approval status. Since incoming tags lack a capmask entirely, this allows hook functions that wish to keep the tag around to specify the capmask used for propagating the tag to other clients and servers. The approval status can take one of three forms: approve the tag, drop the tag from the message (but still process other tags and run the command handler), or drop the entire message (not processing any other tags and not running any command handlers). It is expected when a hook function drops the message that they'll send appropriate feedback to the client, however the nature of that feedback will likely vary by hook function so no default message is given to a client if their message is dropped. The incoming_message global defined previously with cap_server_time now holds the MsgBuf with the updated/sanitized list of tags rather than the raw values specified by the client. Additionally, cap_server_time makes use of this new hook to propagate the time tag into function callbacks that support tag propagation. The implicit propagation still exists since the majority of function callbacks do not support explicit tag propagation, and that fact will not change in the course of this patchset. Gravatar Ryan Schmidt2025-10-101-1/+17
* Remove cap_message_tags and reorganize Makefile•••Message tags support is being rolled into core rather than as a loadable module because of the sweeping changes it requires, including at the s2s protocol level for sending since the spec increased the size of the tags portion from 512 bytes to 8191 bytes. Also alphabetized the extensions Makefile to make subsequent patches that add new tags cleaner. Gravatar Ryan Schmidt2025-10-102-85/+0
* message-tags: facility to manipulate client-tags•••It provides for hook facilities to client-only tags: - messages can be dropped silently ; - messages can be edited ; - messages can be stripped from a client-only tag Gravatar Raito Bezarius2025-10-103-12/+86
* m_message: proper tag propagation•••This introduces an handler to accept or not the propagation of a tag. Basic sketch API is provided for modules to hook for providing their own policy for specific tag propagation. Gravatar Raito Bezarius2025-10-101-9/+38
* cap_server_time: data->client can be nullGravatar Ed Kellett2025-10-101-1/+1
* Propagate server-time implicitly (ugh)Gravatar Ed Kellett2025-10-101-0/+7
* cap_server_time: Don't stamp remote-sourced thingsGravatar Ed Kellett2025-10-101-0/+3
* REHASH: Move privilege check for oper:remoteban to appropriate places (#460)•••The current situation is that one needs oper:remoteban privilege in order to send a remote REHASH of any type. Hilariously, this includes re-reading the HELP files, re-reading /etc/resolv.conf, re-reading the MOTD and OMOTD files, or restarting ssld -- things that have nothing to do with banning. In days gone by, servers would be unable to check the privileges of remote opers. This is no longer the case since commit ed3ca2ff16a1dc921d90. I note that the rehash_ssld() function already includes a possibly-remote privilege check for oper:admin since commit fbd3e77eac3889b95855 which pre-dates bursting of operators and their privsets.Gravatar Aaron Jones2025-09-201-6/+35
* modules/m_stats: fix hooks not being called (#458)•••Some modules rely on stats hooks being called (e.g. extensions/helpops). These calls were removed accidentally by commit 4e89f6603d63b2f8dfde. Additionally, the last vestiges of the spy-only doing_stats_p hook were left around. No module has ever used this hook. Remove it.Gravatar Aaron Jones2025-08-181-2/+12
* Add dedicated hook data type for can_create_channel•••hook_data_can_create_channel includes the name of the channel being created, which is necessary for any non-trivial restriction of channel creation as well as sending correct error messages. The new hook data matches the layout of the previous hook data, taking advantage of a disused pointer field in hook_data_client_approval as used by callers of the hook (m_join). Gravatar daemoness2025-05-111-1/+2
* modules: remove unused spy code.Gravatar RealKindOne2024-07-245-146/+1
* m_stats: correct format specifiers and types•••These format specifiers were all wrong. Use the right ones. Musl time_t is always 64 bits, so promote all rb_current_time usage to 64 bits. Fixes #437Gravatar Doug Freed2024-07-241-26/+26
* m_whois: restore original multi-prefix behavior•••The original behavior has existed since before git history, and has no known impact on clients that exist today. This reverts commit 746ced2Gravatar Doug Freed2024-06-121-1/+1
* Revert "Fix WHOIS reply not respecting a lack of the multi-prefix capability"•••A server handling a remote WHOIS cannot safely use IsCapable() to determine if the client has multi-prefix enabled or not. This is because client capabilities are not shared between servers; and the IsCapable() macro dereferences source_p->localClient which will be NULL if source_p is not on this server. Instead rework the commit to always pretend that multi-prefix is not enabled, to still respect the fact that multiple prefixes should not be returned in case a client does not have multi-prefix enabled. This reverts commit 4633665ad62bdfe26529 Gravatar Aaron Jones2024-06-111-1/+1
* Fix WHOIS reply not respecting a lack of the multi-prefix capability•••Prior to this commit, RPL_WHOISCHANNELS always contained all channel membership prefixes, even when the client had not enabled the multi-prefix capability. This behaviour predates available commit history. Other ircds only return the highest prefix, as prescribed by the RFCs. Gravatar JustAnotherArchivist2024-06-111-1/+1
* m_starttls: advertise tls cap only if SSL is possibleGravatar Doug Freed2024-03-121-0/+7
* MODRESTART/MODRELOAD: Defer reloading more quickly•••Commit 41390bfe5fa3895b8dee fixed a bug whereby the processing of a MODRESTART command could result in a crash. The approach taken in this fix was to defer the reloading of all modules so that the call stack does not contain functions located in modules that are being reloaded. It did this by scheduling a one-shot timer event for 1 second in the future, in the absense of any better deferral mechanism at the time. Timers are processed by the event loop, which is core to IRCd and cannot be reloaded. Commit 59ea3c6753e80d051b20 introduced a mechanism to defer the execution of a function until all events have been processed by the event loop, in order to fix a REHASH bug that could result in a crash due to closing and reopening listener sockets with a pending socket connection event to process after the REHASH was completed. Rework commit 41390bfe5fa3895b8dee to use the new deferral mechanism introduced by commit 59ea3c6753e80d051b20 and do the same for module reloads. Gravatar Aaron Jones2023-11-201-2/+2
* extensions/invite_notify: make the NOTICE optional, configurable•••This adds a configuration option that determines whether the NOTICE is sent to clients that do not support the IRCv3 invite-notify capability. Requested by LiberaChat MGM. Gravatar Aaron Jones2023-11-081-0/+5
* client: refactor del_all_accepts to allow skipping own accept list•••This allows reusing this function for other uses that just need to remove this client from others' accept lists on nick change and not have duplicates of this code everywhere Gravatar Doug Freed2023-11-062-17/+5
* modules/m_oper.c: give a better error message for failure to find o:line•••The snotice sent to other opers can be misleading. For example, it will say host mismatch even if the host is correct but the username is wrong, or if the oper name given does not exist in the configuration. Gravatar Aaron Jones2023-11-061-2/+2
* modules/m_challenge.c: give a better error message for failure to find o:line•••The snotice sent to other opers can be misleading. For example, it will say host mismatch even if the host is correct but the username is wrong, or if the oper name given does not exist in the configuration. Gravatar Aaron Jones2023-11-061-2/+2
* modules/m_challenge.c: log correct mechanism•••I suspect this is a copy/paste omission when duplicating the code from modules/m_oper.c when it was created. Gravatar Aaron Jones2023-11-061-5/+5
* Replace RPL_WHOISTEXT(337) with RPL_WHOISSPECIAL(320) (#419)•••Reasons: * 337 conflicts with other IRCds use as RPL_ENDOFINVITELIST * 320 is commonly used for extra human-readable informationGravatar Eric Mertens2023-10-031-5/+5
* Clarify messages when auspex users have hidden their own idle times•••Co-authored-by: Doug Freed <dwfreed@mtu.edu>Gravatar Stephen Bennett2023-07-011-13/+11
* prioritise telling opers that a auspexed target is +IGravatar jesopo2023-07-011-7/+12
* show opers a reasonable message when auspex allows them to see idle timeGravatar jesopo2023-07-011-5/+15
* support RSFNC indicating type of FNC (e.g. FORCE vs REGAIN) (#406)Gravatar Jess Porter2023-07-011-0/+13
* Warn opers about unresponsive serversGravatar David Schultz2023-06-131-0/+5