TT_PATTERN_CALLBACK_ADD(3)
π tt_pattern_callback_add β ok so this is the one that hooks your callback into a pattern π
Bestie, welcome to the tt_pattern_callback_add(library call) page β yes that's the manual name, no I'm not gonna make you scroll for it. This is a library call in the ToolTalk world, and it is, genuinely, the moment your pattern stops being a shy little wallflower and starts running a function every time the right message shows up. Slay.
β¨ NAME β¨
tt_pattern_callback_add β register a message-matching callback function. That's it, that's the whole vibe: you hand over a function and it gets called when stuff matches. π
πΈ SYNOPSIS πΈ
#include <Tt/tt_c.h>
Tt_status tt_pattern_callback_add(
Tt_pattern m,
Tt_message_callback f);
Literally just two arguments. m is your pattern, f is your callback. Iconic minimalism. π
π¦ DESCRIPTION π¦
Okay so here's what's actually happening: tt_pattern_callback_add registers a callback function that will be automatically invoked by tt_message_receive(3) whenever a message matches the pattern. Like, you don't call it yourself, you just set it up and tt_message_receive(3) does the doorbell-ringing for you. No cap.
The callback is defined in Tt/tt_c.h - Tttt_c(5) β that's where the shape of it lives, go look.
Now the flow, because this part is lowkey the whole plot π«Ά:
- If the callback returns
TT_CALLBACK_CONTINUE, other callbacks will be run. Passing the baton, very generous of it. - If no callback returns
TT_CALLBACK_PROCESSED,tt_message_receive(3)returns the message. So the message still surfaces. Good. - If the callback returns
TT_CALLBACK_PROCESSED, no further callbacks will be invoked for this event, andtt_message_receive(3)does not return the message. You ate it. It's gone. That's the deal. π
The m argument is the opaque handle for the pattern involved in this operation.
The f argument is the message callback to be run.
π₯ RETURN VALUE π₯
Upon successful completion, the tt_pattern_callback_add function returns the status of the operation as one of the following Tt_status values:
TT_OKβ The operation completed successfully. We love a clean win. β¨TT_ERR_NOMPβ Thettsession(1)process is not running and the ToolTalk service cannot restart it. Rude. πTT_ERR_POINTERβ The pointer passed does not point to an object of the correct type for this operation. Wrong shape, wrong energy, vibe check failed. π
π§ SEE ALSO π§
Tt/tt_c.h - Tttt_c(5)tt_pattern_register(3)tt_message_receive(3)
Go read them, they're all part of the same friend group. π
ok bye bestie, go register some callbacks πΈ β that was tt_pattern_callback_add(library call), same title up top and down at the bottom, and yeah the footer's just the manual name again β no extra version or date info hiding in there, so consider this the cute sign-off instead. π
π¦ where this page comes from
- nixos 26.05: cde 2.5.3
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms