feature: Add XMPP JID support with utilities and exception handling - #14
Merged
Conversation
Add the RFC 7622 specification text documenting the XMPP JID address format, including domain, localpart, and resourcepart rules, normalization requirements, security considerations, and conformance guidance. This captures the updated internationalized address standard that supersedes the older stringprep-based format.
Introduce include/xtrpg/utils/String.hpp providing small, header-only string helpers in namespace xtrpg::utils::string: in-place ltrim/rtrim/trim, in-place toLowerCase (uses unsigned char -> std::tolower), and countUtf8CodePoints (counts UTF-8 code points by skipping continuation bytes). These utilities are intended for common string preprocessing tasks.
Adds xtrpg::xmpp::exception::MalformedJid, an invalid_argument subtype for malformed XMPP JIDs. It includes a default 'Malformed JID' message and an overload that accepts a custom error message for callers that need more context.
Introduce xtrpg::xmpp::Jid with parsing and construction from full or component JIDs. Provides accessors (local/domain/resource), bare/full conversions, comparison operators, ostream output, and a std::hash specialization for unordered_map keys. Parsing trims input, lowercases local/domain, enforces UTF-8 codepoint limits, and throws exception::MalformedJid on invalid input. Uses xtrpg::utils::string helpers.
This commit introduces a dedicated xtrpg_xmpp static library for XMPP/JID support and links it into the main server executable. It also renames the config target section for clarity and adds the MSVC UTF-8 compile flag so source strings are emitted correctly in the server binary.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.