sigildocs

(sigil irc identity)

(sigil irc identity) - Per-server qualified IRC identity

Identity in sigil-irc is <nick>@<server-domain>. This is a federation readiness constraint: future Enclave / CrafterNet sovereign-per-server federation requires identity to be qualified from day one. Storage and protocol handlers use the canonical form; clients may strip the suffix for local display.

The qualified form does NOT travel on the IRC wire as-is. IRC user prefixes use nick!user@host; the host is the user's connection host, not the server they live on. The server-domain in irc-identity is the home server's identity (e.g. enclave.example) and is supplied by the server that knows its own domain. Clients construct identities from their own home-server context.

(define alice (make-irc-identity "alice" "enclave.example"))
(irc-identity-nick alice)            ; => "alice"
(irc-identity-server alice)          ; => "enclave.example"
(irc-identity->canonical alice)      ; => "alice@enclave.example"
(irc-identity->display alice)        ; => "alice"
(irc-identity->display alice show-server?: #t)
                                      ; => "alice@enclave.example"

(parse-irc-identity "alice@enclave.example")
; => #<irc-identity nick: "alice" server: "enclave.example">

(irc-identity=? a b)                  ; => case-insensitive nick match
                                      ;    plus exact server match

Exports

irc-identityprocedure

A fully-qualified user identity: nick + home server-domain.

Both fields are strings. The server-domain should be the canonical lowercase domain of the user's home server (e.g. "enclave.example").

irc-identity?procedure

Test if a value is a irc-identity struct.

Get the nick field of a irc-identity struct.

Get the server field of a irc-identity struct.

Construct an irc-identity from a nick and server-domain.

Both arguments are required and must be non-empty strings. The server-domain is normalized to lowercase (per IRC convention; the nick is preserved as-is for display, with case-insensitive equality).

(make-irc-identity "Alice" "Enclave.Example")
; => #<irc-identity nick: "Alice" server: "enclave.example">

Canonical wire form: "<nick>@<server>".

(irc-identity->canonical (make-irc-identity "alice" "enclave.example"))
; => "alice@enclave.example"

Display form: just the nick by default. Pass show-server?: #t to force the qualified form (useful when displaying federated peers alongside local users).

(irc-identity->display alice)                  ; => "alice"
(irc-identity->display alice show-server?: #t) ; => "alice@enclave.example"

Equality on identity: case-insensitive nick (per RFC 2812 string equality on nicknames, simplified to ASCII case-fold) + exact server-domain match.

(irc-identity=? (make-irc-identity "Alice" "enclave.example")
                (make-irc-identity "alice" "enclave.example"))
; => #t

Parse a canonical "nick@server" string into an irc-identity.

Returns #f if the input is malformed (no @, empty nick, empty server, or multiple @ characters).

(parse-irc-identity "alice@enclave.example")
; => #<irc-identity nick: "alice" server: "enclave.example">

(parse-irc-identity "alice")           ; => #f
(parse-irc-identity "@enclave.example"); => #f

Build an irc-identity from an IRC message prefix's nick and a server-domain context.

IRC prefixes are nick!user@host (the host is the connection host, not the home server). To qualify the identity, the consumer must supply the server-domain context (typically: the local server's domain for a server-side handler, or the connected server's domain for a client-side handler).

(irc-identity-from-prefix "alice" "enclave.example")
; => #<irc-identity nick: "alice" server: "enclave.example">

Strip the @server suffix from a string, if present. Useful for client display when you have a canonical identity string but want the bare nick. Returns the original string unchanged if no @.

(irc-display-strip-server "alice@enclave.example")  ; => "alice"
(irc-display-strip-server "alice")                  ; => "alice"