A conversation counted as on screen while its window was up and no
close was pending, and a text for the conversation on screen is stored
read and not notified. A window is up behind a lock screen too, behind
another application, minimised, with the display off: a text for the
conversation left open there was marked read unseen, and no
notification told of it.
The compositor says of a window whether it counts as the active one and
whether it is ordinarily being repainted: xdg_toplevel's `activated`
state and, from version 6 of xdg_wm_base, `suspended`. The pinned
library dropped both. Crafter.Graphics c006519, one commit on the pin
before, keeps them on the window (Window::activated, suspended) and
fires onToplevelState when a configure changes either.
Now the window is on screen while it is up, no close is pending, and
the compositor counts it active and has not suspended it: both, since
which of the two a lock screen or another window in front changes is
the compositor's choice. When the compositor's word changes the app
does what it does at a close and at a Show: out of sight Sync is told
that no conversation is open, so a text is stored unread and notified;
in sight again the open conversation is read and its notification
withdrawn. Opened waits for it too: a conversation is read once its
window is on screen in this sense, not because the window was made or
the conversation opened in it. A window that is visible beside the
active one counts as not on screen, and its texts notify until it is
the active one. Under --headless the log has the compositor's word at
each change after the window is made.
Tested: on the bench, the build before against this one on KWin 6.8.0,
a text for the open conversation in each state of the window. Behind
KWin's lock screen, behind another application's window, minimised and
with the display off it was stored read with no notification; it is
stored unread and notified, and the notification goes when the window
is on screen again. KWin reports the window not active behind the other
application, suspended with the display off, and both under the lock
and minimised. A conversation opened while the app has no window and
another application is active gets a window KWin makes the active one,
and is read; one opened in a window that is behind another
application's stays unread until that window is active.
The pinned library dropped the compositor's time of every pointer and
touch event, so the app dated them by its own clock at dispatch. Events
queued while the main loop was busy — a List importing a backlog, each
Import an fdatasync — all carried the time the loop came back: a swipe's
backlog read as a few milliseconds' travel and flung the list to its far
end, and a press whose down and up both waited out a stall had them at
one time, a tap where the user held — on a Failed bubble a Retry, an SMS
the user did not ask for. Crafter.Graphics 364d210 keeps the time on the
window (lastInputTime, set before the event fires), one commit on the
master of 2026-11-02, which added the library's review configuration and
no code.
The gesture detector now gets each event's own time, unwrapped past the
wrap at 2^32 into one running clock (an event stamped 0, which the
compositor's time reads for one millisecond in 2^32, gets the host's
clock), and the long-press timer's expiry is the host's elapsed since
the press put on that clock, so a press and its release keep their
distance however late the loop dispatches them — and a release or a move
the detector sees past the long-press time with no timer fired is the
long press itself, at the press, where the press can be one, since the
hold is measured on the events' clock (tests/Gesture pins both). The pin
moves from 3f646ec; the contracts this app relies on are unchanged by
the two commits between.
The pinned library's key repeat counted the compositor's delay as missed
periods: lastFireTime was the press itself and the catch-up loop fired
once per period since it, so the first repeat after the delay was a
burst of floor(delay / period) events — with rate 25 and delay 600 a
held Backspace deleted sixteen characters at the delay mark and a held
letter put fifteen copies in the field, from a hardware keyboard and
from an on-screen keyboard that sends Backspace as key events; a rate
above 1000 made the period zero and the loop endless. Crafter.Graphics
3f646ec lands the first repeat at the delay, keeps the period at a
millisecond or more and caps the catch-up after a stalled frame; the
app's own repeat timer and the frame path's TickKeyRepeats need nothing
more.
The pin moves from 6f471ca to the library's master of 2026-11-01, eight
commits on: the swapchain sized for its present mode and frames in
flight keyed by frame, the font atlas's SDF decoded in atlas pixels and
glyphs that find no room given a cell at the next frame, Win32 linking
and titles and a Win32 test's stand-in dropped, the library's AGENTS
template, the key repeat. One contract changes with a4be6f1: once the
atlas evicts, a glyph item is good for the frame it was shaped for, so
item buffers must be one set per frame in flight (the library's usage
contract since; its HelloUI shows it). The Canvas's layers keep
Window::numFrames sets of their quad, circle and glyph buffers and fill
the one at UIBuildArgs::frameIdx, where one set had served the three
frames paced by frame callbacks — about 3 MB of host-visible memory in
all; the descriptor heap grows to hold their slots. The atlas's contract
changed with the eviction: a glyph that finds no free cell draws blank
and gets one when the next frame begins — a frame this app, drawing on
demand, has to ask for: the layers count the glyphs drawn blank
(FontAtlas::Lookup, not Resident) and Build asks for another frame while
glyphs wait, until the frames in flight plus one have passed without a
cell gained — a cell comes from glyphs not drawn in those frames, so a
screen change needs that many before the cells it displaced come free
(FrameWait in Gesture, beside the fling's frame rule, added with this,
its use — restarted by every redraw request and by each frame of a
fling, which changes what is drawn as a request does — and tested
there). The other contracts this app relies on hold at the new commit:
the disable ends the composition and clears the shown record,
CaptureNextFrame writes its PNG inside the frame that records the copy,
a touch's up precedes the synthesised release, the deletion queue still
wants the app's drain when a window ends (DrainDeletions), libevdev
stays vendored; the licence texts are unchanged.
The pinned library kept its record of the last composing text it had
reported across the app's disable of the text input (only the
compositor's leave cleared it) and reported a later composition only
when it differed from that record or a commit came with it: after
Send's, a tap's or a hide's reset, a first composition equal to the last
word shown, with no commit beside it, never reached the field.
Crafter.Graphics 6f471ca clears the record and the pending flags on the
disable, as the leave does; the app's resets all go through that disable
and need nothing more.
The pin moves from 079b6b0 to the library's master of 2026-10-31, ten
commits on: windows on compositors without xdg-decoration, viewporter or
fractional scale, device features the application asks for (the defaults
serve this one), the descriptor heap's rounding, ray-tracing and Win32
fixes, a WebGPU example's build fix, the library's AGENTS files. The
event orders and contracts this app relies on hold at the new commit;
the vendored code and the licence texts are unchanged. The library ships
consumer notes from this commit on (AGENTS.consumer.md); crafter-build
since 4.0.0 writes them only into an AGENTS.md it generates from an
AGENTS.template.md, and this app has none: its AGENTS.md is written by
hand and no build touches it.
A cross build passes glib's include paths itself, and named only
lib/glib-2.0/include for glibconfig.h, which is where Alpine has it. The
aarch64 Freedesktop Sdk keeps it under
lib/aarch64-linux-gnu/glib-2.0/include, so the path for the target's
architecture is passed as well; clang ignores it in a sysroot that has
no such directory.
A text that arrives while the app is not running waits in imsd until the
app is opened, and nothing notifies. Inside its flatpak the instance now
asks the desktop portal's Background interface when it starts (not for
the --send errand or --headless) to run on with the window closed and to
start `imsd-messages --daemon` at login, the mode that imports and
notifies with no window. The portal keeps the answer and writes the
login entry again at each request it grants, so a deleted entry comes
back while the background permission allows it; set to no, the
permission makes the portal refuse the request, and an entry already
written stays. Outside its own flatpak nothing is asked.
tests/Portal covers the request path the answer arrives on and the
options the request carries.
Crafter.Graphics vendors libevdev since dfb70bc and links it statically:
its gamepad backend compiles against its own copy, which comes first on
the include path, and the executable needs no libevdev.so. The prefix
build-libevdev.sh made, the include and library paths project.cpp added
for libevdev and the executable's rpath into ~/.cache are left with
nothing to do, so they go.
Crafter.Graphics 079b6b0 replaced SaveFrame with CaptureNextFrame, and
the app no longer built against its master. The copy is now recorded
into the next frame before it is presented, where SaveFrame read back
an image already handed to the display (validation reported both the
layout transition and the missing acquire). The capture is armed first,
so the Update that follows draws the frame and writes the file; a file
the library cannot write (it throws from the Update) is logged and ends
the run with exit 1.
project.cpp pins Crafter.Graphics at 079b6b0 and Crafter.DB at bfd0cc2:
a commit of either library must not change a build without a commit
here. --local builds both from the sibling checkouts, now that the input
branch is merged.
The desktop portal's org.freedesktop.appearance settings on the session
bus say whether the system prefers dark (color-scheme 1) and which
accent colour it uses, and a flatpak may read them. Bus:Appearance
subscribes to SettingChanged and reads the namespace in one ReadAll
call, which every portal version has, so a start waits for one answer at
most, 2 s; a portal that gave no colour scheme by then — still starting,
or not on the bus yet — is asked again when its name has an owner,
without waiting, and its answer comes as a change. The canvas gained a
dark palette and takes the accent for the avatars, badges, buttons and
outgoing bubbles, with the text on it dark or light by the accent's
brightness. The app applies the theme to the window at once and keeps it
for the next one; --theme dark|light or IMSD_MESSAGES_THEME (the same
two values: another is refused on the command line and ignored in the
environment) overrides the portal's colour scheme, for benches and
desktops without a portal.
A text message needs several lines and UTF-8, and the library's
InputField is one line edited by byte, so the field is the app's own.
Its state and editing are the core's (ImsdMessages:Edit, tested without
a window): a plain struct, insertion at the cursor, Backspace and Delete
by code point, Home and End within the line, a newline. Ui:Compose turns
the keys into those edits and draws the field one to five lines tall —
as many as half the area under the header and the banner holds, and one
at the least — with the canvas's word wrapper (a longer text shows the
lines that end at the caret's, or the first ones while the caret is
among them), a placeholder when empty, the caret at the cursor, and a
tap placing the cursor at the nearest byte by the widths the glyphs are
drawn at, in the text as it is when the tap lands (an edit since the
last frame only asked for one; a field no frame has laid out yet takes a
tap as one at its text's end; a tap at or past the last line's end asks
for the text's end, where a space the wrapper hung off the line may be).
The bar under a conversation holds the field and Send, enabled only with
text, a sendable status and an address to send to; Send hands the text
to Sync with that address and clears the field (a store that refuses the
text keeps the draft) (Model's SendAddress: as a link gave it, else the
latest message's — the network's form of a received text, the dialled
form of ours — never the key, whose completed country code is a guess
that groups; a conversation with neither has Send off, and so has one
whose address is not international — a national number, a short code;
typed, linked or the message's — and was typed or written under another
SIM's plan than the one known now, which the plan each row and the view
carry tells (the view's is that of the SIM the address was typed under,
which Number's AfterStatus keeps; Number's AnotherPlan, its second
caller)); Sync's StateChanged moves the bubble's caption. Keys reach the
field while a conversation is open (Escape goes back, Ctrl+Enter sends),
a held key repeats through a timer since frames are on demand, and the
caret blinks on one. A text typed and not sent is its conversation's,
not the view's: leaving the conversation (Back, another one opened by a
notification or a link) keeps it by the conversation's key for the run,
and opening the conversation again takes it up (Edit's Drafts: an empty
field keeps nothing and drops nothing; the draft of a typed or linked
address follows imsd's status as the open conversation's key does —
Number's AfterStatus over the address and the plan kept with it — so one
left before the status brought the country code is found under the key
the address makes afterwards; and a second text kept under one key — two
keys that became one — goes after the first on a line of its own).
Tested: tests/Model, the address a text goes to (the typed or linked
one, the latest message's, none for an emptied conversation, none under
another SIM's plan than it was typed or written under — a national
number with or without a trunk prefix under another country's SIM, a
short code under another operator's too, though dialled under the same
operator, the own number read when it was typed or not; a national
number typed before the own number was read, none under another operator
— an international one under any — and a typed address judged by its own
plan, whatever the latest row's); tests/Edit (code points of one to four
bytes, the moves within a line, the edits that change nothing, the first
line shown as the caret moves down a long text; the drafts: kept and
taken up by key with the cursor, taken once, an empty field keeping and
dropping nothing, one per conversation, a second text under one key on a
line of its own; a typed address's following the status — moved when the
code comes, not while texts are stored under its key, not under another
SIM's status, a list conversation's left alone and the store not asked,
the learned plan kept, two keys that became one keeping both texts).
The window library. Loop makes the Wayland display a GSource
(libwayland's prepare_read protocol) so D-Bus and the window are served
from one thread without the library's StartSync, which runs a loop of
its own that serves no GMainContext and would starve the bus; the app
owns its frame callback too — a redraw is a frame request and a bare
commit, the compositor's done runs one Window::Update, and nothing
re-arms unless something is dirty or animating — or the day changes: the
captions name the day and an idle window draws no frame by itself, so a
timer on the wall clock, which wakes at the next local midnight and
whenever that clock is set, asks for one when the local date is another
one (DayWatch); when the compositor's connection breaks the source stops
and says so (App's onDisplayLost), since the process cannot connect its
display again. Canvas initialises the device once per process and holds
the window, the font with a word wrapper and a text width over its
unrounded advances, as DrawText draws them, and four compositing layers
(background, the clipped scrolling content, the chrome, an overlay):
within one fused dispatch all quads composite before all text, so the
layers are separate dispatches in that order. The layers' buffer slots
hand their numbers back to the descriptor heap when they go, so the heap
is declared before them and outlives them. Screens draw the conversation
list (avatars, previews, time captions, unread badges, the
new-conversation button, with room under the last row to scroll clear of
it) and one conversation (day separators, wrapped bubbles, clock and
state captions — only what is in view, the layer's glyph budget being
finite) and record the regions a tap can hit. App wires them to the
store and Sync: mouse events become gestures (the detector's slop and
fling threshold set from the window's scale, the positions being buffer
pixels), a tap is resolved against the last frame's regions (which name
the conversation or message they drew, not a position a reload may
shift), scrolling is by wheel, drag or fling (a press stops a fling; a
screen change stops a fling and cancels the press under it, so the
scroll left behind keeps no velocity for a return to revive and a
release after a link's or a notification's Open is no tap on the new
screen), the window is created on the first Show (when the library
cannot and says so — no display, a compositor without wl_shm,
wl_compositor or xdg_wm_base, no Vulkan driver — Show logs why, Open
opens nothing, and the app runs on without one; a later Show fails at
once, the device's set-up running only once) and torn down in order on
Shutdown. ScreenshotThenQuit renders one frame outside the compositor's
pacing and saves it; a window it creates first waits 600 ms for the
compositor's configure, which sizes it (to the screen, on a phone). A
capture with no window to render it — none could be made, or it went
before the frame — is logged and sets App's exitCode to 1.
project.cpp gains Crafter.Graphics (--local takes the branch worktree with
the Wayland input work until it is merged), the imsd-messages-ui library,
and libevdev from the prefix of packaging/build-libevdev.sh on the
library's include path and the executable's library path (a sysroot
build looks for it in the sysroot instead).
What a finger or a mouse did, decided from raw Down/Move/Up/Cancel
phases over the app's own point type: a short press within the slop is a
tap at the press position, a press held past the long-press time (the
host's timer) a long press, movement past the slop a drag with its
deltas, a fast release a fling with a velocity (the last 100 ms of
movement before it: a finger held still before letting go flings
nothing). With it the scroll physics of a list (clamped offset, a
decaying fling that stops at the edges) and the topmost hit region under
a point.
Tested: tests/Gesture.
The executable now runs the app without its window: it owns the session
name or forwards to the instance that does (an sms: link, --quit; --quit
beside --send is refused, the errand being no instance, and so is a link
that is not UTF-8, which D-Bus does not carry; a name request that fails
or is refused ends the run with the error's words, exit 1, nobody being
shown to run), opens the database (the executable's own Crafter.DB
dependency enters here, with its first use), connects the GDBus client
to Sync and the notifier, and runs the GLib main loop. --daemon is the
resident mode, --headless adds a log line per event for the ssh smoke
test on the phone, --session talks to imsd --session, --data-dir and
--country override the database directory and the default country code
(a country code as the ITU's length rule reads one: a key is made of the
code as it is and read by that rule, so anything else is refused). A
--daemon with no sms: link that finds the name owned ends at once
instead of forwarding an Activate: the running instance already imports
and notifies, and a forwarded Activate asks it for its window;
--headless then exits 1, having run nothing (a link and --quit are
forwarded from a --daemon as from any launch). A Subscribe, a GetStatus
or a List that failed against a present imsd is tried again every 30 s,
and so is a text Sync holds for a store that refused it; that text is
notified all the same (OnUnstored), the notification being where it
shows, and is announced as any import once its row is in.
--send sends one text to the number as dialled (stored under its
normalised key; a NUMBER or TEXT that is not UTF-8 is refused before
anything is stored, exit 2: imsd takes D-Bus strings, and GLib would put
its own text in the place of other bytes and have that sent; an empty
NUMBER is refused there too) and exits on imsd's word for the submission
— sent (0) or failed (1), which reaches it as the message's change (a
status report's word follows sent, imsd's order) — or on its own failure
(1), a store that refuses the text among them; imsd has 60 s to be ready
and to take the text, then 2 (no final state) — once it has taken it the
clock decides nothing, since imsd bounds its submission itself and ends
it with a word, and a clock of the app's would report no final state for
a text imsd goes on to send — as a SIGINT or SIGTERM after the start-up,
before a final state, is 2 (a resident instance ending on either says so
in its log: a session bus closing under it sends SIGTERM too). It is a
client of its own: it takes no instance name, since a launch that finds
the name taken forwards and exits, and it leaves imsd's stored and
signalled texts to the instance that owns the user's store; beside that
instance it needs a --data-dir of its own, the store taking one writer.
It sends once GetStatus has answered, with Sync's Send gaining a force
flag that skips the local readiness check: imsd answers a Send to its
caller, subscribed or not, so a refused or unregistered errand ends with
imsd's own reason. Its rule is Sync's SendErrand, a class over the
listener's events with no GLib in it: one Send once the status is in and
none after an end, latched before the call (Sync announces a status from
inside Send — the store's word on its write — and the loop can dispatch
one after the clock's or a signal's end); one end — the message's final
state, the store's refusal, or none on the clock (which decides until
imsd has taken the text), a signal or the loop's end; the first of them
stands. The shell drives it with its loop, its 60 s source and its log.
Tested: tests/Sync, the errand among its cases (a forced send against an
unregistered status; imsd's words reaching the listener as the message's
changes, as they come), and its rule: one Send across a status announced
from inside Send (the store's recovery, end to end on a store refused
under the file-size limit), 0 on sent, 1 on failed and on the store's
refusal, 2 on the clock before imsd's id and on a signal, the clock
deciding nothing once imsd took the text, a final state given first
standing over the clock and the loop's end after it.
The GLib side of the app. Variant reads imsd's Received dictionary by
key and type as its SmsVariant writes it (`to`, the number the text
arrived for, a tel: URI read like the status's `ppi`; `operator`, the
SIM it arrived under), the GetStatus one with the subscriber's own
number and the SIM's operator in it (`ppi`, a tel: URI as the frozen
interface gives it; `operator`), and maps a GError to the core's error
kinds off GDBus's own mapping. Client is the Sync logic's transport:
asynchronous calls with their continuations as user data — every reply
guarded where it is delivered (OnCallDone), as are the signal handlers
and the name watch's callbacks: a throw is a fault the events hear, not
the end of the process — the calls behind imsd's polkit gate allow
interaction: Subscribe, List and Delete wait two minutes; Send has no
bound of the client's, since imsd sends the text once its prompt lets
the call through, however late, and a Send given up on would be failed
by Sync and be sent all the same; GetStatus ten seconds — (one call: the
Messaging status carries the own number, imsd reading both from one
snapshot; AGENTS.md §1 names both interfaces), the Messaging and
RegistrationChanged signals, and a watch on net.catcrafts.IMS1 whose
appeared callback is where Sync subscribes. Notifier shows one desktop
notification per conversation and replaces it as more texts arrive: one
Notify at a time per conversation, since the id to replace comes with
the answer; its default action asks the app for that conversation; the
body is escaped when the server renders markup (GetCapabilities, asked
once; Plasma and GNOME do), so a text's '<' or '&' shows as typed.
Instance owns net.catcrafts.ImsdMessages and serves
org.freedesktop.Application there, the Desktop Entry Specification's
interface of a running application: Activate, Open and ActivateAction,
each with its platform data — sent empty and not read: nothing in the
app can use an activation token yet — and one action, quit, any other
refused (the object registered before the name is asked for, so a launch
that forwards the moment the name is granted finds it; Own tells a name
another instance holds from a request that failed or was refused, and
keeps the error's words); it forwards a call to the owner. project.cpp
computes the gio flags once for the bus library, the executable and the
Decode test.
Tested: tests/Decode (every key of imsd's Received dictionary, one with
ten of them, GetStatus, the own number, the SIM's operator, the error
kinds, the markup escape, the parameters of the instance's three calls).
imsd keeps a received text it could store until the app deletes it and
sends its signals unicast to subscribers, so the logic is: Subscribe
whenever net.catcrafts.IMS1 appears (imsd's restart empties its list),
then GetStatus, whose answer ends the connecting state, and List, both
at once — a listed or signalled text keys itself by the number it
arrived for (imsd's `to`, the subscriber's own number at receipt) or,
lacking one, by the service centre that delivered it (Model's
MessageFromReceived), so no import waits for a status; import what the
store lacks, keyed by imsd's id (its run's token makes it unique across
imsd's runs, §8.4), and delete imsd's copy — again for a copy still
listed, so a delete that timed out gets another chance. A short message
type 0 (Model's IsType0) is not imported: imsd acknowledged it, and its
copy is deleted like any other. A copy polkit refused to delete is
counted on the banner and tried again at the next List imsd admits (one
polkit action gates List and Delete, so an admitted List means an
admitted Delete) and once imsd has restarted. A Received signal imports
and lists again, because a signal is queued for nobody. The listener is
called through a guard (GuardedListener): a throw out of a handler — a
logging failure, a bad_alloc — is caught and told once, so no handler
can stop Sync's own sequence, whatever the order of a word and the step
after it. A store that refuses a write (its disk full) is on the banner.
A listed text stays imsd's — nothing is deleted — and a signalled one is
held in memory and told through OnUnstored: imsd signals a text its own
store refused too, the signal then its only delivery, so no List may
ever carry it; the held text is tried again whenever a List comes back
with imsd's texts and at each Refresh, which is wanted while one is
held, until its row is in or a List carries it; one imsd did not store
is lost with a process that ends before then. Of the refusal itself the
store tells Sync of a refusal once and once of the next write that got
room (one that grew a file), every write but a Compact passing that one
gate, and the flag stays the store's — read again after the start's
sweep and after imsd's vanish; a send still goes, its own write a try —
refused, it answers kNotStored and the caller keeps the text; through,
it goes to imsd, and imsd's id lands in place (the store keeps it
inline) — a recovery lists at once and the Refresh lists meanwhile, so
the held imports are tried once there is room. A listener's call can
come from inside Sync's own (the store's word on a write, inside Send),
which the listener interface says. A Send stores the message pending
under its conversation key and asks imsd for the address as dialled (the
key groups; a country code completed for it is never dialled), the row
carrying the plan it is dialled under — the country code of the SIM's
own number, never the service centre's stand-in, and its operator, which
imsd's status gives — which a retry under another SIM's plan fails on,
since the address would reach another subscriber or another service
there (Number's AnotherPlan, here with its first caller: the same
operator is the same plan, a side's code known or not; under another
operator a national number means the same while both SIMs' own numbers
have one country code, and a short code is the operator's own; without
both operators the codes decide alone), and the StateChanged for its id
(unique across imsd's runs by the run's token, so it names one message)
moves it on — each word as it comes, imsd giving them in order (the
submission's first, a report's after sent; its AGENTS.md section 8.4) —
and a retry drops the failed attempt's imsd id (a row's id names its
current attempt); a Send's error fails the row and Retry sends the text
again, so the transport's contract (ImsdTransport's comment) is that a
Send is answered by imsd, or because imsd has left the bus, and never by
a clock of the transport's own, since imsd sends what it was asked once
its polkit prompt lets the call through, however late; imsd vanishing
fails what was in flight, and a message still pending from an earlier
run is failed at start, because its answer may have come while the app
was not running. A refused Subscribe or List is the degraded mode: the
banner says so and sending is off — until Refresh is admitted again,
since imsd asks polkit on every gated call and a refusal that held while
the session was inactive lifts when it is active (a List answered ends
it, a refused Subscribe is made again; every refusal is announced, and
RefreshWanted() asks for the Refresh). A Subscribe that fails otherwise,
a GetStatus or a List (one that timed out: the texts imsd holds would
wait for the next signal) is tried again by Refresh too, which
RefreshWanted() asks for — one Subscribe at a time, so a rule that
prompts is not asked again while that Subscribe waits on its prompt; a
registration change reads the status again, since imsd fills in the
subscriber's own number and the service centre's when it registers; the
own number's country code completes a typed national number (a received
one carries its own), the centre's stands in when the network gave no
tel: URI (an MVNO's centre can be abroad); without either a national
number stays as typed, since the store's correspondents do not say where
the subscriber is. The transport is an interface with callbacks, so the
tests' fake can stand in for the bus.
Tested: tests/Sync on a fake transport that records every call and
answers when told, the retries, the second GetStatus, the as-dialled
destination, a retry under another SIM (refused for a national number
under another country's and for a short code under another operator of
the same country; let through under the same operator, its own number
read or not, and for a national number under another operator of its
country), the plan's code the own number's or the constructor's override
and never the centre's, a short message type 0 left out of the store
with imsd's copy deleted, a text signalled before the status's answer
imported at once by the number it arrived for, a listener's throw at a
status — the constructor's among them, over a store that refuses — a log
line and a registration change caught and told, stopping no step, a
Refresh over an unanswered Subscribe sending none, a List that timed out
listed again, the words applied as they come, a retry under a new id,
and a refusal lifted among them; the store's refusal under the file-size
limit (the flag, the Refresh wanted and the log; a send answered
kNotStored with imsd asked nothing; an import refused leaving imsd's
copy with the banner up across imsd's restart; a short text sent through
the refusal, imsd's id landing in place and its `sent` with it, a failed
attempt's id dropped at the retry; then, room again, the send's own
write clearing the flag and the held text imported and deleted at the
List the recovery sends); a signalled text the store refuses that no
List carries (told as unstored once, unread though its conversation is
open, held across a List's answer and a Refresh, stored at the Refresh
after there is room, its delete answered NotFound), one a List does
carry (the copy held here dropped, the text imported by the next List),
and one still held when another write gives the store room (a Refresh
wanted for it alone until the recovery's List is answered); a listed
text the store refuses is not held.
One table without an ordered column: Crafter.DB enforces the order on
every write, and a List() import after a restart can carry an older
stamp than the last row, so a conversation is sorted on read. A row
carries the plan it was written under, the SIM's country code and its
operator, a column each. Messages are looked up by imsd id (unique
across imsd's runs by its run token: an id names one message, and an
empty one — a text imsd has not answered yet — none); read marks and
deletes go per message and per conversation; every write but a Compact
is caught at this one boundary — a store that refuses one (Crafter.DB's
IOError: the disk full, the file system read-only) answers nullopt from
Add, false or a count of 0 (a row appended before its Flush failed is
tombstoned; an in-place write whose Flush failed stays in the row as the
process reads it; SetState's state and imsd's id land in place even when
a reason cannot — the id is inline in the row, 64 bytes as imsd bounds
it, one past that refused rather than thrown), and tells its
onWriteState listener once of the refusal and once of the next write
that got room, which is one that grew a file: Crafter.DB allocates its
extents, so a write that fit the ones it had (an in-place one, a short
row) is no recovery. So a refused write ends no caller's process and the
app's banner can say so. A lock file beside the table, held for the
store's life, makes a second store on the same directory throw
LockedError (the table's own lock sits on an inode a Compact replaces);
it is built on Crafter.DB's File and Os — the directory made 0700 at
every component, the file 0600 and never a symlink, a lock that fails
for any reason but another holder an IOError, not a LockedError. Every
change a call answers as made — a row id, true, a count — is committed
before the call returns, so a row Add returned is on disk. The file's
format is held by the build: static_asserts on the row's size and layout
fingerprint (Crafter.DB's Layout) and on the stored values of Direction
and MessageState, so a column changed without a version bump fails the
build and not a user's open, and an enumerator moved fails it where an
open would misread the stored states without a word.
Tested: tests/Store in a temp directory: the round trip, the sort of a
later-appended older message, the updates, the lookup by imsd id and an
erased row's, an id past imsd's bound refused, the lock from a second
open, persistence across a reopen, Compact, a row kept by a child
process that ends without a flush, the private file modes, and a write
refused under the file-size limit (told once with its reason, the rows
before it standing, an in-place write going through and telling nothing,
a state landing without its refused reason and imsd's id beside it, the
next Add after the limit's lifting telling of the recovery once), and a
Flush failing after its Append (the descriptor pointed at /dev/null for
the one write) tombstoning the row Add refused.
The GLib-free shape of what the app shows: imsd's state words (each
applies as it comes: imsd gives a message's words in order, the
submission's first and a status report's after sent, its AGENTS.md
section 8.4); a received text (the dictionary of imsd's AGENTS.md
section 8.4) becoming a message keyed by the sender's address completed
with the code of the number it arrived for (imsd's `to`, the
subscriber's own number at receipt — the record's: a text imsd kept
across a SIM change would otherwise take the new SIM's code) or, lacking
one, of the service centre that delivered it, the own number's code —
none where the centre's stood in, which names no SIM's country — and the
operator of the SIM it arrived under (imsd's `operator`) its plan
(Number's SimPlan), and whose sort time is the service centre's stamp,
else its arrival; the short message type 0, which a phone acknowledges
and discards (IsType0, TS 23.040 9.2.3.9); the grouping into
conversations newest first, unread counting incoming unread only; and
the one-line banner from what the app knows about imsd: absent,
connecting (GetStatus has not answered since imsd appeared), off,
subscribe refused, unregistered, the store refusing a write (its disk
full: texts wait; a send still goes), subscribe failed otherwise — what
blocks sending before what only costs live updates — messages it may not
delete.
Tested: tests/Model.
Crafter.Graphics shapes one line at a time and drops newlines, so the app
breaks text itself: a greedy wrap with breaks after spaces and hyphens
(a space that itself overflows ends the line after the words that fit,
and opens no line of its own when it ends the text or a newline
follows; one at a line's start is no break at all, nor is a run of
them: a break is recorded only once the line holds a word, and a run of
spaces wider than the line splits like a word, with the same rule at the
text's end and before a newline), hard breaks at
newlines, over-long words split between code points, and
the run of spaces where a line wraps left out of both lines. Results are
cached per (text, width, size). The measure is a function, so the caller
supplies the advances; the tests use a constant ten-pixel advance.
Tested: tests/Wrap on a ten-pixel monospace measure, a leading run of
spaces among the cases.
imsd renders the service centre's time stamp of a text as ISO 8601 with
the centre's offset and adds the arrival epoch; the captions need the
user's local day and clock. The parser is hand-rolled, with the
calendar's own check of the date (a 30th of February is no date); the
civil dates, the weekdays and the month names are std::chrono's calendar
and its formatting; every caption takes the local offset of the instant
as an argument, so nothing here depends on a time zone database and the
tests inject the offsets.
Tested: tests/Time, the KPN bench stamp in five spellings, rejected
garbage and days the month does not have, the day and list captions
around midnight and across a year.
The SMS app for imsd's net.catcrafts.IMS1.Messaging interface starts
here: the licence (GPL-3.0-only), FUNDING.yml, README and AGENTS, a
project.cpp with the three build products (imsd-messages-core: std and
Crafter.DB; imsd-messages-bus: GLib; the imsd-messages executable),
their module units as stubs, the version constant, the bundled Noto Sans
font with its OFL text, and the first test. This commit is the base every
later range is reviewed against.
Tested: crafter-build builds the three products and --version answers,
crafter-build test passes the one test, lint and format --check are clean
on every text rule and on the AST rules for the eleven files without a
global module fragment; the four files that include gio/gio.h are not
parsed by the lint driver's libclang (no C++ standard library on its
include path: 'type_traits' file not found), which is a Crafter.Build
matter.