CSA_REGISTER_CALLBACK(3)

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

πŸ’– csa_register_callback β€” the "hey bestie, ping me when stuff happens" call πŸ’–

Okay so real talk: you're in the csa_register_callback page of the library call manual, and this is genuinely one of the most useful little functions in the whole calendar service. Let's get into it 🫢


✨ NAME ✨

csa_register_callback β€” registers the callback functions that get invoked when the specified type of update happens in the calendar. That's it, that's the whole vibe: you tell the service "when this thing goes down, call this function of mine" πŸ’…


🌸 SYNOPSIS 🌸

#include <xcsa.h>
CSA_return_code csa_register_callback(
CSA_session_handle session,
CSA_flags reason,
CSA_callback callback,
CSA_buffer client_data,
CSA_extension *register_callback_extensions);

πŸ¦‹ DESCRIPTION πŸ¦‹

So csa_register_callback adds your callback procedure to the specified callback list for the session. Easy.

The service keeps a whole set of callback lists β€” logically, like, one list per callback activity type per session. And when things change in the state of the service or in its calendars, the service reports it by invoking the appropriate callbacks in sequence β€” either when the client calls csa_call_callbacks, or when that specified callback activity actually occurs. Iconic, honestly.

Heads up bestie: the callback is only active for the duration of the calendar session. No session, no callback. Periodt.

πŸ’œ Session (Session Handle)

An opaque session handle that reps your session with the calendaring service.

Session handles are made by a logon function call and invalidated with a logoff function call. If the session handle is invalid, then the error CSA_E_INVALID_SESSION_HANDLE gets returned. Not negotiable, that's just the rules 😌

πŸŽ€ Reason (Flags)

A bitmask of flags. Unspecified flags should always be passed as 0 β€” like, always, bestie. Undocumented flags are reserved (stay out of their lane, respectfully).

Each flag corresponds to a callback activity, and the procedure you specify gets added to the callback list for that activity type. The flag settings include:

  • CSA_CB_CALENDAR_LOGON β€” If set, the new callback will be invoked when a the calendar is accessed by a user.
  • CSA_CB_CALENDAR_DELETED β€” If set, the new callback will be invoked when a user requests that the calendar be deleted.
  • CSA_CB_CALENDAR_ATTRIBUTE_UPDATED β€” If set, the new callback will be invoked whenever a calendar attribute is updated.
  • CSA_CB_ENTRY_ADDED β€” If set, the new callback will be invoked whenever an entry is added to the calendar.
  • CSA_CB_ENTRY_DELETED β€” If set, the new callback will be invoked whenever an entry is deleted from the calendar.
  • CSA_CB_ENTRY_UPDATED β€” If set, the new callback will be invoked whenever an entry is updated on the calendar. It is implementation specific if the callback function is invoked before or after the specified update type occurs. (iykyk β€” don't count on an order that isn't promised πŸ’€)

🌈 Callback (Callback)

Specifies the client procedure that the service should call to handle the callback activity. This is your function, bestie β€” the main character of this whole operation πŸ‘‘

πŸ“ Client Data (Opaque Data)

A pointer to a data structure that will be passed to the callback function in its client_data argument. You use this to pass along client-specific data that the callback function will need to do its job. It's giving "bring your own context" and we love that for us πŸ’–

⭐ Register Callback Extensions (Extension)

A pointer to an array of CSA_extension structures for this function. That array may contain both input extensions (extra info you're handing to the function) and output extensions (info coming back to you from the function). A value of NULL means the caller isn't using any extensions at all. See the extensions structure for more information ✨


πŸ”₯ RETURN VALUE πŸ”₯

🌸 Register Callback Extensions (Extension)

If output extensions were passed to the function in the extensions list, the results from the service will be available in the extension. See the extensions structure for more information.

And then β€” whether the function succeeded or not, and, if not, why. It may be success or one of the values listed down under ERRORS below. That's the whole tea β˜•


πŸ’€ ERRORS πŸ’€

The csa_register_callback function returns the following error values:

  • CSA_E_FAILURE β€” There was a general failure that does not fit the description of any other error code. The "we don't have a box for this one" error 😭
  • CSA_E_INSUFFICIENT_MEMORY β€” Insufficient memory was available to complete the requested operation.
  • CSA_E_INVALID_FLAG β€” A flag value in the flags argument was invalid.
  • CSA_E_INVALID_FUNCTION_EXT β€” The function extension requested is invalid.
  • CSA_E_INVALID_PARAMETER β€” A function parameter was invalid.
  • CSA_E_INVALID_SESSION_HANDLE β€” The specified Session Handle is invalid or no longer valid (e.g., after logging off). Bestie. You logged off. It's over 😭
  • CSA_E_NO_AUTHORITY β€” The user has insufficient authority for this function.
  • CSA_E_NOT_SUPPORTED β€” The operation requested is not supported by this implementation.
  • CSA_E_SERVICE_UNAVAILABLE β€” The requested calendar service is unavailable.
  • CSA_E_UNSUPPORTED_FLAG β€” The flag requested is not supported.
  • CSA_E_UNSUPPORTED_FUNCTION_EXT β€” The specified function extension is not supported or CSA_EXT_REQUIRED is set.

🧚 SEE ALSO 🧚

csa/csa.h β€” csacsa(5), csa_add_calendar(3), csa_add_entry(3), csa_call_callbacks(3), csa_delete_calendar(3), csa_delete_entry(3), csa_free(3), csa_free_time_search(3), csa_list_calendar_attributes(3), csa_list_calendars(3), csa_list_entries(3), csa_list_entry_attributes(3), csa_list_entry_sequence(3), csa_logoff(3), csa_logon(3), csa_look_up(3), csa_query_configuration(3), csa_read_calendar_attributes(3), csa_read_entry_attributes(3), csa_read_next_reminder(3), csa_unregister_callback(3), csa_update_calendar_attributes(3), csa_update_entry_attributes(3).

Like, go read csa_unregister_callback(3) next before you forget, because registering without unregistering is a whole character flaw and I said what I said 🫢


and that's the page!! this beauty is filed under csa_register_callback(library call) β€” same title up top, same title down at the bottom of the original, no date line given, so we're just repping the manual call section as-is. mwah πŸ’‹βœ¨πŸŽ€

πŸ“¦ where this page comes from