summaryrefslogtreecommitdiff
path: root/include/hybbx/messages.h
blob: d1c73450a7748e8e0cdedbe5e28b52e81ff7db56 (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
#ifndef HYBBX_MESSAGES_H
#define HYBBX_MESSAGES_H

#include "hybbx/types.h"

#ifdef __cplusplus
extern "C" {
#endif

struct hybbx_session;

/** Automatic system notices (login, mail, timeouts, conference status, …). */
#define HYBBX_MSG_PREFIX_SYSTEM "*** "

/** Sysop / granted manual system-wide notices (`/broadcast`, `/announce`). */
#define HYBBX_MSG_PREFIX_SYSOP "+++ "

/** Private directed messages (system or Sysop+granted); v1 half-stub. */
#define HYBBX_MSG_PREFIX_PRIVATE "### "

/**
 * Format a system line: `*** <body>`
 */
hybbx_result_t hybbx_msg_format_system(char *out, size_t out_len,
                                     const char *body);

/**
 * Format a Sysop/granted system-wide line: `+++ <from>: <body>`
 * @p from_label may be NULL → `+++ <body>`
 */
hybbx_result_t hybbx_msg_format_sysop(char *out, size_t out_len,
                                      const char *from_label,
                                      const char *body);

/**
 * Format a private line: `### <from>: <body>` or `### <body>` when @p from_label is NULL.
 */
hybbx_result_t hybbx_msg_format_private(char *out, size_t out_len,
                                        const char *from_label,
                                        const char *body);

hybbx_result_t hybbx_msg_send_system(struct hybbx_session *session,
                                     const char *body);

hybbx_result_t hybbx_msg_send_sysop(struct hybbx_session *session,
                                    const char *from_label,
                                    const char *body);

/** Half-stub: directed private message to one session. */
hybbx_result_t hybbx_msg_send_private(struct hybbx_session *session,
                                      const char *from_label,
                                      const char *body);

#ifdef __cplusplus
}
#endif

#endif /* HYBBX_MESSAGES_H */
git clone -b <branch> https://cgit.mode42.com/<repo>.git
git clone -b <branch> git://cgit.mode42.com/<repo>.git

info@mode42.com