Skip to content

Add XFLAG Exemption List Channel Mode +X - #273

Open
Jazzzzz-hub wants to merge 1 commit into
DALnet:masterfrom
Jazzzzz-hub:xflag-exempt-list
Open

Jazzzzz-hub wants to merge 1 commit into
DALnet:masterfrom
Jazzzzz-hub:xflag-exempt-list

Conversation

@Jazzzzz-hub

@Jazzzzz-hub Jazzzzz-hub commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR adds a new channel mode +X which works as a mask-based exemption list for XFLAG restrictions.

It works similar to +e and +I, but instead of exempting from bans or invites, it allows specific nick!user@host masks to bypass the existing XFLAG exemption checks.

Closes #272.

Usage

Examples:

MODE #channel +X Nick*!*@*
MODE #channel +X *!userid@*
MODE #channel +X *!*@irccloud.example
MODE #channel +X *!*@192.0.2.0/24

The mask can match nick, userid, host, IP or a combination of them.

What was added

  • New Type A channel mode +X
  • Add, remove and list support
  • Maximum 100 entries per channel
  • Real host matching
  • IP host matching
  • CIDR matching
  • Masked host support under USER_HOSTMASKING
  • Integration with is_xflags_exempted()
  • Server netburst propagation
  • Services SVSMODE -X <nick> cleanup
  • Channel cleanup and memory accounting
  • CHANMODES and MAXLIST advertisement
  • New list numerics 355 and 356
  • Compile-time guard XFLAG_EXEMPT_LISTS

I also changed the old JOIN_CONNECT_TIME rejection label from +X to JOIN_CONNECT_TIME because +X is now being used as an actual channel mode.

XFLAG behaviour

A matching +X mask uses the existing is_xflags_exempted() path.

This covers the existing behavioural XFLAG restrictions such as:

  • JOIN_CONNECT_TIME
  • TALK_CONNECT_TIME
  • TALK_JOIN_TIME
  • MAX_MSG_TIME
  • NO_NOTICE
  • NO_CTCP
  • NO_UTF8
  • NO_NICK_CHANGE
  • NO_PART_MSG
  • NO_QUIT_MSG

Administrative XFLAG settings such as HIDE_MODE_LISTS, MAX_BANS, MAX_INVITES, SJR, verbose settings and GREETMSG are not changed by this PR.

Testing

Tested on isolated Bahamut 2.2.4 servers.

Tested successfully:

  • +X add, remove and list
  • empty list query
  • 100 entry limit
  • duplicate entries
  • real host matching
  • IP matching
  • CIDR matching
  • JOIN_CONNECT_TIME exemption
  • removing +X restores XFLAG enforcement
  • channel destruction and recreation
  • Services cleanup
  • multiple matching masks
  • batched MODE removals
  • two-server netburst
  • 12 +X entries across multiple MODE batches
  • +e, +X and +I together during netburst
  • live A -> B +X add/remove propagation
  • build with XFLAG_EXEMPT_LISTS enabled
  • build with XFLAG_EXEMPT_LISTS disabled
  • git diff --check

The masked-host matching code follows the same USER_HOSTMASKING approach already used by the existing channel ban/exempt code.

Live B -> A MODE propagation was not separately runtime-tested.

Design choices

For the open questions in #272, this implementation currently uses:

  • Channel mode +X
  • Existing is_xflags_exempted() scope rather than per-XFLAG exemptions
  • MAXXFLAGEXEMPTLIST = 100
  • Numerics 355 and 356
  • XFLAG_EXEMPT_LISTS enabled by default

Notes

Numerics 355 and 356 were unused in the current Bahamut source, so they are used for the +X list and end-of-list replies.

Because older servers do not know about the new +X channel mode, the network should be running a compatible version before this mode is used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ability to exempt nick!user@host masks from XFLAG enforcement

1 participant