From 20cb29c2f8c5c87bc590896854a20b1473ceb358 Mon Sep 17 00:00:00 2001 From: "info@mode42.com" Date: Sat, 8 Aug 2026 03:54:55 +0000 Subject: #2 --- include/hybbx/conference.h | 69 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 include/hybbx/conference.h (limited to 'include/hybbx/conference.h') diff --git a/include/hybbx/conference.h b/include/hybbx/conference.h new file mode 100644 index 0000000..53baa27 --- /dev/null +++ b/include/hybbx/conference.h @@ -0,0 +1,69 @@ +#ifndef HYBBX_CONFERENCE_H +#define HYBBX_CONFERENCE_H + +#include "hybbx/types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct hybbx_service; +struct hybbx_session; + +#define HYBBX_CONFERENCE_TOPIC_MAX 32 + +/** Invite rate limit: max invites per target user within the window. */ +#define HYBBX_CONFERENCE_INVITE_MAX_PER_TARGET 2u + +/** Invite rate limit window (seconds). */ +#define HYBBX_CONFERENCE_INVITE_WINDOW_SEC 1800u + +/** + * Send a conference invite: @p topic to @p partner (login or nickname). + * Partner must accept with y/n or yes/no. Max two invites per target per 30 min. + */ +hybbx_result_t hybbx_conference_start(struct hybbx_service *service, + struct hybbx_session *initiator, + const char *topic, + const char *partner); + +/** + * Monitor/sysop meet: invite @p partner with timeout, or @p force join immediately. + * Topic defaults to "monitor". Status lines go to initiator. + */ +hybbx_result_t hybbx_conference_monitor_meet(struct hybbx_service *service, + struct hybbx_session *initiator, + const char *partner, + int force); + +/** Expire timed-out invites (monitor path). Safe to call every session tick. */ +void hybbx_conference_invite_tick(struct hybbx_service *service, + struct hybbx_session *session); + +/** Non-zero when @p session has a pending conference invite to answer. */ +int hybbx_conference_invite_pending(const struct hybbx_session *session); + +/** + * Handle invite reply line (y/n, yes/no). Call for local input while invite pending. + * Returns HYBBX_OK when consumed. + */ +hybbx_result_t hybbx_conference_reply_invite(struct hybbx_service *service, + struct hybbx_session *session, + const char *line); + +/** Clear pending invites involving @p session (disconnect). */ +void hybbx_conference_session_closed(struct hybbx_session *session); + +/** Deliver a line within an active conference (sender must be in conference area). */ +hybbx_result_t hybbx_conference_post(struct hybbx_service *service, + struct hybbx_session *from, + const char *message); + +/** Tear down conference state when leaving the conference area. */ +void hybbx_conference_area_leaving(struct hybbx_session *session); + +#ifdef __cplusplus +} +#endif + +#endif /* HYBBX_CONFERENCE_H */ -- cgit v1.3.1