summaryrefslogtreecommitdiff
path: root/include/hybbx/conference.h
blob: 53baa27e4ab1f916f1a645e2d5fe6f367d15b120 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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 */
git clone -b <branch> https://cgit.mode42.com/<repo>.git
git clone -b <branch> git://cgit.mode42.com/<repo>.git

info@mode42.com