/* * Copyright (c) 2022 joshua stein * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef __BOARD_H__ #define __BOARD_H__ #include #include "fidopkt.h" #include "session.h" #include "settings.h" struct board { unsigned long id; char name[32]; char description[100]; bool restricted_posting; bool restricted_viewing; unsigned short retention_days; unsigned long last_post_at; unsigned long post_count; char ftn_area[32]; struct bile *bile; }; extern const struct struct_field board_fields[]; extern const size_t nboard_fields; extern const struct bile_object_field board_object_fields[]; extern const size_t nboard_object_fields; struct board_post { unsigned long id; unsigned long thread_id; time_t time; unsigned long sender_user_id; size_t body_size; char *body; unsigned long parent_post_id; char via[10]; }; extern const struct bile_object_field board_post_object_fields[]; extern const size_t nboard_post_object_fields; struct board_ftn_post { unsigned long id; struct fidopkt_msgid msgid; time_t time; char from[32]; char subject[80]; char msgid_orig[64]; char origin[64]; char reply[32]; char to[32]; size_t body_size; char *body; }; extern const struct bile_object_field board_ftn_post_object_fields[]; extern const size_t nboard_ftn_post_object_fields; struct board_thread { unsigned long thread_id; time_t last_post_at; size_t subject_size; char *subject; unsigned long nposts; unsigned long *post_ids; unsigned long *parent_post_ids; }; extern const struct bile_object_field board_thread_object_fields[]; extern const size_t nboard_thread_object_fields; struct board_id_time_map { unsigned long id; time_t time; }; void board_list_boards(struct session *s); void board_list_ftn_areas(struct session *s); void board_show(struct session *s, short id, char *prompt_prefix); void board_delete_post(struct board *board, struct board_post *post, struct board_thread *thread); void board_delete_ftn_post(struct board *board, struct board_ftn_post *post); size_t board_index_sorted_post_ids(struct board *board, struct board_id_time_map **sorted_id_map); short board_toss_ftn_message(struct board *board, struct fidopkt_message *fidomsg, bool local); void board_prune_old_posts(struct board *board); #endif