AmendHub

Download

jcs

/

subtext

/

board.h

 

(View History)

jcs   board: constify fields Latest amendment: 275 on 2022-11-11

1 /*
2 * Copyright (c) 2022 joshua stein <jcs@jcs.org>
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17 #ifndef __BOARD_H__
18 #define __BOARD_H__
19
20 #include <stddef.h>
21 #include "session.h"
22 #include "settings.h"
23
24 struct board {
25 unsigned long id;
26 #define BOARD_NAME_LENGTH 32
27 char name[BOARD_NAME_LENGTH];
28 #define BOARD_DESCR_LENGTH 100
29 char description[BOARD_DESCR_LENGTH];
30 bool restricted_posting;
31 bool restricted_viewing;
32 unsigned short retention_days;
33 unsigned long last_post_at;
34 unsigned long post_count;
35
36 struct bile *bile;
37 };
38
39 extern const struct struct_field board_fields[];
40 extern const size_t nboard_fields;
41 extern const struct bile_object_field board_object_fields[];
42 extern const size_t nboard_object_fields;
43
44 struct board_post {
45 unsigned long id;
46 unsigned long thread_id;
47 time_t time;
48 unsigned long sender_user_id;
49 size_t body_size;
50 char *body;
51 unsigned long parent_post_id;
52 char via[10];
53 };
54 extern const struct bile_object_field board_post_object_fields[];
55 extern const size_t nboard_post_object_fields;
56
57 struct board_thread {
58 unsigned long thread_id;
59 time_t last_post_at;
60 size_t subject_size;
61 char *subject;
62 unsigned long nposts;
63 unsigned long *post_ids;
64 unsigned long *parent_post_ids;
65 };
66 extern const struct bile_object_field board_thread_object_fields[];
67 extern const size_t nboard_thread_object_fields;
68
69 void board_show(struct session *s, short id);
70
71 #endif