TT_SESSION_PROP(3)

πŸ“¦
version 2.5.3 Β· 2 versions
, in nixos 26.05

πŸ’… tt_session_prop

okay so bestie, this one lives in the tt_session_prop(library call) manual β€” that's the whole vibe. it's a library call, it's in the ToolTalk family, and it's here to grab one specific value out of a session property. let's get into it 🫢


✨ NAME ✨

tt_session_prop β€” return the ith value of a session property. that's it, that's the whole job. iconic honestly πŸŽ€


🌸 SYNOPSIS 🌸

#include <Tt/tt_c.h>
char *tt_session_prop(
const char *sessid,
const char *propname,
int i);

look at that signature. three args, one char * coming back at you. chef's kiss πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so the way that tt_session_prop works is: it returns the ith value of the property you specify. lowkey simple, highkey powerful ✨

here's the rundown on the args, bestie:

  • sessid β€” this is the name of the session you joined. and listen, the app can just use the sessid value that came back when tt_default_session was called. no need to go hunting for it, it's right there πŸ’–
  • propname β€” the name of the property you want a value out of. heads up though: the name has to be less than 64 bytes. not 64, less than 64. don't push your luck πŸ™ˆ
  • i β€” the number of the item in the property name list that you want the value for. and okay this is the part people trip on: the list numbering begins with zero. zero-indexed, periodt. πŸ“

πŸ”₯ RETURN VALUE πŸ”₯

when everything goes right, tt_session_prop returns the value of the property you asked for. slay πŸ’…

but if there are i values or fewer β€” meaning you asked for something that isn't there β€” it returns NULL. no drama, just NULL.

and then! the app can use tt_ptr_error(3) to extract one of these Tt_status values out of the returned pointer:

  • TT_OK β€” the operation completed successfully. we love a happy ending πŸ‘‘
  • TT_ERR_NOMP β€” the ttsession(1) process isn't running and the ToolTalk service cannot restart it. it's giving "nobody's home" 😭
  • TT_ERR_NUM β€” the integer value you passed was invalid (out of range). check your i, bestie 🧚
  • TT_ERR_PROPNAME β€” the property name you specified is syntactically invalid. spelling counts fr fr πŸ’€
  • TT_ERR_SESSION β€” the ToolTalk session you specified is out of date or invalid. stale. expired. not the moment 🌈

πŸ’œ APPLICATION USAGE πŸ’œ

real talk: the application should use tt_free(3) to free any data stored in the address returned by the ToolTalk API. don't leave it hanging, that's not main character energy 🫢

and here's a little gotcha you need to know: if the returned value has embedded nulls, it is impossible to determine how long it is. like, genuinely impossible from this call. so if you're dealing with embedded nulls, the app can use tt_session_bprop(3) for values with embedded nulls instead. that's the one that handles it πŸ’–


⭐ SEE ALSO ⭐


and that's the whole page, bestie! πŸŽ€ no cap, every flag and every status value, all accounted for.

signing off from the tt_session_prop(library call) manual β€” that's the source/version, and the page itself doesn't hand us a date, so consider this your very cute, very undated goodnight kiss πŸ’‹βœ¨

πŸ“¦ where this page comes from