jcs
/subtext
/amendments
/408
board: Use FTN terminology
jcs made amendment 408 about 1 year ago
--- board.c Mon Mar 13 22:41:54 2023
+++ board.c Tue Mar 14 10:53:46 2023
@@ -53,9 +53,9 @@ const struct struct_field board_fields[] = {
{ "Days of Retention", CONFIG_TYPE_SHORT,
offsetof(struct board, retention_days),
0, USHRT_MAX },
- { "FidoNet Area Name", CONFIG_TYPE_STRING,
- offsetof(struct board, fidonet_area),
- 0, member_size(struct board, description) },
+ { "FTN Area Name", CONFIG_TYPE_STRING,
+ offsetof(struct board, ftn_area),
+ 0, member_size(struct board, ftn_area) },
};
const size_t nboard_fields = nitems(board_fields);
@@ -76,8 +76,8 @@ const struct bile_object_field board_object_fields[] =
member_size(struct board, last_post_at), -1 },
{ offsetof(struct board, post_count),
member_size(struct board, post_count), -1 },
- { offsetof(struct board, fidonet_area),
- member_size(struct board, fidonet_area), -1 },
+ { offsetof(struct board, ftn_area),
+ member_size(struct board, ftn_area), -1 },
};
const size_t nboard_object_fields = nitems(board_object_fields);
@@ -101,32 +101,32 @@ const struct bile_object_field board_post_object_field
};
const size_t nboard_post_object_fields = nitems(board_post_object_fields);
-const struct bile_object_field board_fidonet_post_object_fields[] = {
- { offsetof(struct board_fidonet_post, id),
- member_size(struct board_fidonet_post, id), -1 },
- { offsetof(struct board_fidonet_post, msgid),
- member_size(struct board_fidonet_post, msgid), -1 },
- { offsetof(struct board_fidonet_post, time),
- member_size(struct board_fidonet_post, time), -1 },
- { offsetof(struct board_fidonet_post, from),
- member_size(struct board_fidonet_post, from), -1 },
- { offsetof(struct board_fidonet_post, subject),
- member_size(struct board_fidonet_post, subject), -1 },
- { offsetof(struct board_fidonet_post, msgid_orig),
- member_size(struct board_fidonet_post, msgid_orig), -1 },
- { offsetof(struct board_fidonet_post, origin),
- member_size(struct board_fidonet_post, origin), -1 },
- { offsetof(struct board_fidonet_post, reply),
- member_size(struct board_fidonet_post, reply), -1 },
- { offsetof(struct board_fidonet_post, to),
- member_size(struct board_fidonet_post, to), -1 },
- { offsetof(struct board_fidonet_post, body_size),
- member_size(struct board_fidonet_post, body_size), -1 },
- { offsetof(struct board_fidonet_post, body),
- -1, offsetof(struct board_fidonet_post, body_size) },
+const struct bile_object_field board_ftn_post_object_fields[] = {
+ { offsetof(struct board_ftn_post, id),
+ member_size(struct board_ftn_post, id), -1 },
+ { offsetof(struct board_ftn_post, msgid),
+ member_size(struct board_ftn_post, msgid), -1 },
+ { offsetof(struct board_ftn_post, time),
+ member_size(struct board_ftn_post, time), -1 },
+ { offsetof(struct board_ftn_post, from),
+ member_size(struct board_ftn_post, from), -1 },
+ { offsetof(struct board_ftn_post, subject),
+ member_size(struct board_ftn_post, subject), -1 },
+ { offsetof(struct board_ftn_post, msgid_orig),
+ member_size(struct board_ftn_post, msgid_orig), -1 },
+ { offsetof(struct board_ftn_post, origin),
+ member_size(struct board_ftn_post, origin), -1 },
+ { offsetof(struct board_ftn_post, reply),
+ member_size(struct board_ftn_post, reply), -1 },
+ { offsetof(struct board_ftn_post, to),
+ member_size(struct board_ftn_post, to), -1 },
+ { offsetof(struct board_ftn_post, body_size),
+ member_size(struct board_ftn_post, body_size), -1 },
+ { offsetof(struct board_ftn_post, body),
+ -1, offsetof(struct board_ftn_post, body_size) },
};
-const size_t nboard_fidonet_post_object_fields =
- nitems(board_fidonet_post_object_fields);
+const size_t nboard_ftn_post_object_fields =
+ nitems(board_ftn_post_object_fields);
const struct bile_object_field board_thread_object_fields[] = {
{ offsetof(struct board_thread, thread_id),
@@ -148,10 +148,10 @@ const size_t nboard_thread_object_fields = nitems(boar
unsigned long board_compose(struct session *s, struct board *board,
struct board_thread *thread, struct board_post *parent_post,
- struct board_fidonet_post *fidonet_parent_post, char *initial_subject,
+ struct board_ftn_post *ftn_parent_post, char *initial_subject,
char *initial_body);
short board_post_create(struct board *board, struct board_thread *thread,
- struct board_fidonet_post *fidonet_parent_post, struct board_post *post);
+ struct board_ftn_post *ftn_parent_post, struct board_post *post);
void board_list_posts(struct session *s, struct board *board,
size_t npost_Ids, unsigned long *post_ids, size_t page, size_t pages);
short board_post_read(struct session *s, struct board *board,
@@ -161,20 +161,31 @@ size_t board_find_post_ids(struct session *s, struct b
size_t limit);
void
-board_list_fidonet_boards(struct session *s)
+board_list_ftn_areas(struct session *s)
{
- static const struct session_menu_option opts[] = {
- { '#', "#", "Enter board to read" },
- { 'l', "Ll", "List FidoNet boards" },
+ static struct session_menu_option opts[] = {
+ { '#', "#", "Enter area number to read" },
+ { 'l', "Ll", "..." },
{ 'q', "QqXx", "Return to main menu" },
{ '?', "?", "List menu options" },
};
struct board *fboards = NULL, tboard;
+ struct fidopkt_address our_address;
size_t nfboards;
- char title[40];
+ char title[50];
char c;
- short bn, n, i, j;
+ short an, n, i, j;
bool done, show_list, show_help;
+
+ if (!fidopkt_parse_address(db->config.ftn_node_addr, &our_address)) {
+ session_printf(s, "{{B}}Error:{{/B}} FTN Areas are not supported "
+ "on this system.\r\n");
+ session_flush(s);
+ return;
+ }
+
+ snprintf(opts[1].title, sizeof(opts[1].title), "List %s Areas",
+ db->config.ftn_network);
fboards = xcalloc(sizeof(struct board), db->nboards);
if (fboards == NULL)
@@ -182,7 +193,7 @@ board_list_fidonet_boards(struct session *s)
nfboards = 0;
for (n = 0; n < db->nboards; n++) {
- if (db->boards[n].fidonet_area[0]) {
+ if (db->boards[n].ftn_area[0]) {
memcpy(&fboards[nfboards], &db->boards[n],
sizeof(struct board));
nfboards++;
@@ -192,8 +203,8 @@ board_list_fidonet_boards(struct session *s)
/* sort by area name */
for (i = 0; i < nfboards; i++) {
for (j = 0; j < nfboards - i - 1; j++) {
- if (strcmp(fboards[j].fidonet_area,
- fboards[j + 1].fidonet_area) > 0) {
+ if (strcmp(fboards[j].ftn_area,
+ fboards[j + 1].ftn_area) > 0) {
tboard = fboards[j];
fboards[j] = fboards[j + 1];
fboards[j + 1] = tboard;
@@ -205,20 +216,20 @@ board_list_fidonet_boards(struct session *s)
show_help = false;
done = false;
- snprintf(title, sizeof(title), "%s Boards",
- db->config.fidonet_network);
+ snprintf(title, sizeof(title), "%s Areas (Local Node %s)",
+ db->config.ftn_network, db->config.ftn_node_addr);
while (!done && !s->ending) {
if (show_list) {
session_printf(s, "{{B}}%s{{/B}}\r\n", title);
- session_printf(s, "%s# Name Description%s\r\n",
+ session_printf(s, "%s# Area Description%s\r\n",
ansi(s, ANSI_BOLD, ANSI_END), ansi(s, ANSI_RESET, ANSI_END));
session_flush(s);
for (n = 0; n < nfboards; n++) {
- session_printf(s, "%2d %- 10.10s %s\r\n",
+ session_printf(s, "%2d %- 13.13s %s\r\n",
n + 1,
- fboards[n].fidonet_area,
+ fboards[n].ftn_area,
fboards[n].description);
}
session_flush(s);
@@ -226,8 +237,8 @@ board_list_fidonet_boards(struct session *s)
show_list = false;
}
- c = session_menu(s, title, db->config.fidonet_network, opts,
- nitems(opts), show_help, "Board #", &bn);
+ c = session_menu(s, title, db->config.ftn_network, opts,
+ nitems(opts), show_help, "Area #", &an);
show_help = false;
switch (c) {
@@ -235,12 +246,12 @@ board_list_fidonet_boards(struct session *s)
show_list = true;
break;
case '#':
- if (bn < 1 || bn > nfboards) {
- session_printf(s, "Invalid board\r\n");
+ if (an < 1 || an > nfboards) {
+ session_printf(s, "Invalid area\r\n");
session_flush(s);
break;
}
- board_show(s, fboards[bn - 1].id, db->config.fidonet_network);
+ board_show(s, fboards[an - 1].id, db->config.ftn_network);
break;
case '?':
show_help = true;
@@ -412,7 +423,7 @@ board_list_posts(struct session *s, struct board *boar
struct username_cache *user;
struct board_thread thread = { 0 };
struct board_post post;
- struct board_fidonet_post fpost;
+ struct board_ftn_post fpost;
short indent, j, k, ret;
char *data;
@@ -429,13 +440,12 @@ board_list_posts(struct session *s, struct board *boar
}
for (n = 0; n < npost_ids; n++) {
- if (board->fidonet_area[0]) {
- size = bile_read_alloc(board->bile, BOARD_FIDONET_POST_RTYPE,
+ if (board->ftn_area[0]) {
+ size = bile_read_alloc(board->bile, BOARD_FTN_POST_RTYPE,
post_ids[n], &data);
ret = bile_unmarshall_object(board->bile,
- board_fidonet_post_object_fields,
- nboard_fidonet_post_object_fields, data, size, &fpost,
- sizeof(fpost), false);
+ board_ftn_post_object_fields, nboard_ftn_post_object_fields,
+ data, size, &fpost, sizeof(fpost), false);
xfree(&data);
if (ret == BILE_ERR_NO_MEMORY)
break;
@@ -538,7 +548,7 @@ board_list_posts(struct session *s, struct board *boar
unsigned long
board_compose(struct session *s, struct board *board,
struct board_thread *thread, struct board_post *parent_post,
- struct board_fidonet_post *fidonet_parent_post, char *initial_subject,
+ struct board_ftn_post *ftn_parent_post, char *initial_subject,
char *initial_body)
{
struct board_post post = { 0 };
@@ -586,10 +596,10 @@ post_compose_start:
session_printf(s, "{{B}}Subject:{{/B}}{{#}} Re: %s\r\n",
thread->subject);
session_flush(s);
- } else if (fidonet_parent_post) {
+ } else if (ftn_parent_post) {
session_printf(s, "{{B}}Subject:{{/B}}{{#}} %s%s\r\n",
- strncmp("Re:", fidonet_parent_post->subject, 3) == 1 ?
- "" : "Re: ", fidonet_parent_post->subject);
+ strncmp("Re:", ftn_parent_post->subject, 3) == 1 ?
+ "" : "Re: ", ftn_parent_post->subject);
session_flush(s);
} else {
if (initial_subject && !thread->subject) {
@@ -674,7 +684,7 @@ post_compose_start:
session_printf(s, "Posting message... ");
session_flush(s);
- if (board_post_create(board, thread, fidonet_parent_post,
+ if (board_post_create(board, thread, ftn_parent_post,
&post) == 0) {
session_logf(s, "Posted message %ld to %s", post.id,
board->name);
@@ -731,7 +741,7 @@ board_post_read(struct session *s, struct board *board
char time[32], prompt[7 + member_size(struct board, name) + 8];
struct board_thread thread;
struct board_post post;
- struct board_fidonet_post fpost;
+ struct board_ftn_post fpost;
struct username_cache *sender;
struct session_menu_option *dopts = NULL;
size_t size;
@@ -746,17 +756,16 @@ board_post_read(struct session *s, struct board *board
return 0;
memcpy(dopts, opts, sizeof(opts));
- if (board->fidonet_area[0]) {
- size = bile_read_alloc(board->bile, BOARD_FIDONET_POST_RTYPE, id,
+ if (board->ftn_area[0]) {
+ size = bile_read_alloc(board->bile, BOARD_FTN_POST_RTYPE, id,
&data);
if (size == 0)
panic("failed fetching message %ld: %d", id,
bile_error(board->bile));
ret = bile_unmarshall_object(board->bile,
- board_fidonet_post_object_fields,
- nboard_fidonet_post_object_fields, data, size, &fpost,
- sizeof(fpost), true);
+ board_ftn_post_object_fields, nboard_ftn_post_object_fields,
+ data, size, &fpost, sizeof(fpost), true);
xfree(&data);
if (ret == BILE_ERR_NO_MEMORY)
goto done_reading;
@@ -831,7 +840,7 @@ board_post_read(struct session *s, struct board *board
snprintf(prompt, sizeof(prompt), "%s:%d", prompt_prefix, idx);
- if (board->fidonet_area[0])
+ if (board->ftn_area[0])
subject = fpost.subject;
else
subject = thread.subject;
@@ -859,10 +868,10 @@ board_post_read(struct session *s, struct board *board
session_printf(s, "%c\r\n", cc);
session_flush(s);
- if (board->fidonet_area[0]) {
- board_delete_fidonet_post(s, board, &fpost);
- session_logf(s, "Deleted FidoNet post %ld",
- post.id);
+ if (board->ftn_area[0]) {
+ board_delete_ftn_post(s, board, &fpost);
+ session_logf(s, "Deleted %s post %ld",
+ db->config.ftn_network, post.id);
} else {
board_delete_post(s, board, &post, &thread);
session_logf(s, "Deleted post %ld (thread %ld)",
@@ -879,7 +888,7 @@ board_post_read(struct session *s, struct board *board
}
break;
case 'r':
- if (board->fidonet_area[0])
+ if (board->ftn_area[0])
bcret = board_compose(s, board, NULL, NULL, &fpost, NULL,
NULL);
else
@@ -912,7 +921,7 @@ board_post_read(struct session *s, struct board *board
done_reading:
xfree(&dopts);
- if (board->fidonet_area[0]) {
+ if (board->ftn_area[0]) {
if (fpost.body != NULL)
xfree(&fpost.body);
} else {
@@ -976,9 +985,9 @@ board_find_post_ids(struct session *s, struct board *b
short
board_post_create(struct board *board, struct board_thread *thread,
- struct board_fidonet_post *fidonet_parent_post, struct board_post *post)
+ struct board_ftn_post *ftn_parent_post, struct board_post *post)
{
- struct board_fidonet_post fidonet_post = { 0 };
+ struct board_ftn_post ftn_post = { 0 };
struct fidopkt_message fidomsg = { 0 };
struct username_cache *user;
struct fidopkt_address our_address, hub_address;
@@ -989,44 +998,44 @@ board_post_create(struct board *board, struct board_th
ssize_t n, j;
unsigned long *post_ids, *parent_post_ids;
- if (board->fidonet_area[0]) {
- post->id = bile_next_id(board->bile, BOARD_FIDONET_POST_RTYPE);
+ if (board->ftn_area[0]) {
+ post->id = bile_next_id(board->bile, BOARD_FTN_POST_RTYPE);
if (!post->time)
post->time = Time;
- if (!fidopkt_parse_address(db->config.fidonet_node_addr,
+ if (!fidopkt_parse_address(db->config.ftn_node_addr,
&our_address)) {
- logger_printf("[board] invalid fidonet address, can't "
+ logger_printf("[board] invalid FTN local node address, can't "
"create board post");
post->id = 0;
goto done;
}
- if (!fidopkt_parse_address(db->config.fidonet_hub_addr,
+ if (!fidopkt_parse_address(db->config.ftn_hub_addr,
&hub_address)) {
- logger_printf("[board] invalid fidonet hub address, can't "
+ logger_printf("[board] invalid FTN hub address, can't "
"create board post");
post->id = 0;
goto done;
}
- fidonet_post.id = post->id;
- fidonet_post.time = post->time;
+ ftn_post.id = post->id;
+ ftn_post.time = post->time;
- if (fidonet_parent_post) {
- snprintf(fidonet_post.subject, sizeof(fidonet_post.subject),
+ if (ftn_parent_post) {
+ snprintf(ftn_post.subject, sizeof(ftn_post.subject),
"%s%s",
- strncmp("Re:", fidonet_parent_post->subject, 3) == 1 ?
+ strncmp("Re:", ftn_parent_post->subject, 3) == 1 ?
"" : "Re: ",
- fidonet_parent_post->subject);
- strlcpy(fidonet_post.reply, fidonet_parent_post->msgid_orig,
- sizeof(fidonet_post.reply));
- strlcpy(fidonet_post.to, fidonet_parent_post->from,
- sizeof(fidonet_post.to));
+ ftn_parent_post->subject);
+ strlcpy(ftn_post.reply, ftn_parent_post->msgid_orig,
+ sizeof(ftn_post.reply));
+ strlcpy(ftn_post.to, ftn_parent_post->from,
+ sizeof(ftn_post.to));
} else {
- strlcpy(fidonet_post.subject, thread->subject,
- sizeof(fidonet_post.subject));
- strlcpy(fidonet_post.to, "All", sizeof(fidonet_post.to));
+ strlcpy(ftn_post.subject, thread->subject,
+ sizeof(ftn_post.subject));
+ strlcpy(ftn_post.to, "All", sizeof(ftn_post.to));
}
user = user_username(post->sender_user_id);
@@ -1035,59 +1044,56 @@ board_post_create(struct board *board, struct board_th
post->id = 0;
goto done;
}
- strlcpy(fidonet_post.from, user->username,
- sizeof(fidonet_post.from));
+ strlcpy(ftn_post.from, user->username, sizeof(ftn_post.from));
- fidonet_post.body = post->body;
- fidonet_post.body_size = post->body_size;
+ ftn_post.body = post->body;
+ ftn_post.body_size = post->body_size;
/* make each board's posts have ids unique to our zone/net/node */
- fidonet_post.msgid.id = 0x10000000 |
+ ftn_post.msgid.id = 0x10000000 |
((unsigned long)our_address.node << 24) |
((unsigned long)(board->id) << 16) | post->id;
- fidonet_post.msgid.zone = our_address.zone;
- fidonet_post.msgid.net = our_address.net;
- fidonet_post.msgid.node = our_address.node;
- fidonet_post.msgid.point = our_address.point;
+ ftn_post.msgid.zone = our_address.zone;
+ ftn_post.msgid.net = our_address.net;
+ ftn_post.msgid.node = our_address.node;
+ ftn_post.msgid.point = our_address.point;
- snprintf(fidonet_post.origin, sizeof(fidonet_post.origin),
+ snprintf(ftn_post.origin, sizeof(ftn_post.origin),
"%s | %s (%s)",
db->config.name, db->config.hostname,
- db->config.fidonet_node_addr);
+ db->config.ftn_node_addr);
- fidomsg.time = fidonet_post.time;
+ fidomsg.time = ftn_post.time;
memcpy(&fidomsg.header.orig, &our_address,
sizeof(fidomsg.header.orig));
memcpy(&fidomsg.header.dest, &hub_address,
sizeof(fidomsg.header.dest));
- strlcpy(fidomsg.area, board->fidonet_area, sizeof(fidomsg.area));
- strlcpy(fidomsg.to, fidonet_post.to, sizeof(fidomsg.to));
- strlcpy(fidomsg.from, fidonet_post.from, sizeof(fidomsg.from));
- strlcpy(fidomsg.subject, fidonet_post.subject,
- sizeof(fidomsg.subject));
- fidomsg.body = fidonet_post.body;
- fidomsg.body_len = fidonet_post.body_size - 1;
- strlcpy(fidomsg.reply, fidonet_post.reply, sizeof(fidomsg.reply));
- memcpy(&fidomsg.msgid, &fidonet_post.msgid, sizeof(fidomsg.msgid));
- strlcpy(fidomsg.origin, fidonet_post.origin,
- sizeof(fidomsg.origin));
+ strlcpy(fidomsg.area, board->ftn_area, sizeof(fidomsg.area));
+ strlcpy(fidomsg.to, ftn_post.to, sizeof(fidomsg.to));
+ strlcpy(fidomsg.from, ftn_post.from, sizeof(fidomsg.from));
+ strlcpy(fidomsg.subject, ftn_post.subject, sizeof(fidomsg.subject));
+ fidomsg.body = ftn_post.body;
+ fidomsg.body_len = ftn_post.body_size - 1;
+ strlcpy(fidomsg.reply, ftn_post.reply, sizeof(fidomsg.reply));
+ memcpy(&fidomsg.msgid, &ftn_post.msgid, sizeof(fidomsg.msgid));
+ strlcpy(fidomsg.origin, ftn_post.origin, sizeof(fidomsg.origin));
- if (!binkp_store_outbound_message(&fidomsg)) {
- warn("failed storing outbound fidopkt");
+ if (!binkp_scan_message(&fidomsg)) {
+ warn("failed scanning fidopkt");
post->id = 0;
goto done;
}
ret = bile_marshall_object(board->bile,
- board_fidonet_post_object_fields,
- nboard_fidonet_post_object_fields, &fidonet_post, &data, &size);
+ board_ftn_post_object_fields, nboard_ftn_post_object_fields,
+ &ftn_post, &data, &size);
if (ret != 0 || size == 0) {
- warn("failed to marshall new fidonet post object");
+ warn("failed to marshall new FTN post object");
post->id = 0;
goto done;
}
- if (bile_write(board->bile, BOARD_FIDONET_POST_RTYPE,
- fidonet_post.id, data, size) != size) {
+ if (bile_write(board->bile, BOARD_FTN_POST_RTYPE, ftn_post.id,
+ data, size) != size) {
warn("bile_write of new post failed! %d",
bile_error(board->bile));
post->id = 0;
@@ -1313,13 +1319,13 @@ board_delete_post(struct session *s, struct board *boa
}
void
-board_delete_fidonet_post(struct session *s, struct board *board,
- struct board_fidonet_post *post)
+board_delete_ftn_post(struct session *s, struct board *board,
+ struct board_ftn_post *post)
{
size_t size, npost_ids, n;
unsigned long *post_ids;
- bile_delete(board->bile, BOARD_FIDONET_POST_RTYPE, post->id,
+ bile_delete(board->bile, BOARD_FTN_POST_RTYPE, post->id,
BILE_DELETE_FLAG_PURGE);
size = bile_read_alloc(board->bile, BOARD_SORTED_IDS_RTYPE, 1,
@@ -1351,15 +1357,15 @@ board_index_sorted_post_ids(struct board *board,
time_t time;
size_t nposts;
};
- struct board_fidonet_post fpost;
+ struct board_ftn_post fpost;
struct board_thread thread;
size_t ret, size, i, j, n, npost_ids, nthread_ids;
unsigned long *post_ids, *thread_ids;
struct board_id_time_map *id_map, *thread_map, tmp_map;
char *data;
- if (board->fidonet_area[0]) {
- npost_ids = bile_ids_by_type(board->bile, BOARD_FIDONET_POST_RTYPE,
+ if (board->ftn_area[0]) {
+ npost_ids = bile_ids_by_type(board->bile, BOARD_FTN_POST_RTYPE,
&post_ids);
if (npost_ids == 0)
goto write_out;
@@ -1370,10 +1376,10 @@ board_index_sorted_post_ids(struct board *board,
for (n = 0; n < npost_ids; n++) {
/* only read as far as the time */
- ret = bile_read(board->bile, BOARD_FIDONET_POST_RTYPE,
+ ret = bile_read(board->bile, BOARD_FTN_POST_RTYPE,
post_ids[n], &fpost,
- offsetof(struct board_fidonet_post, time) +
- member_size(struct board_fidonet_post, time));
+ offsetof(struct board_ftn_post, time) +
+ member_size(struct board_ftn_post, time));
if (ret == 0)
goto write_out;
@@ -1488,15 +1494,15 @@ write_out:
}
short
-board_ingest_fidopkt_message(struct board *board,
+board_toss_ftn_message(struct board *board,
struct fidopkt_message *fidomsg)
{
- struct board_fidonet_msgid_cache {
+ struct board_ftn_msgid_cache {
unsigned long id;
struct fidopkt_msgid msgid;
} *msgid_cache = NULL;
struct bile_object *o;
- struct board_fidonet_post post;
+ struct board_ftn_post post;
struct fidopkt_msgid msgid;
unsigned long *post_ids;
char *pdata;
@@ -1506,10 +1512,10 @@ board_ingest_fidopkt_message(struct board *board,
msgid = fidomsg->msgid;
- o = bile_find(board->bile, BOARD_FIDONET_MSGID_CACHE_RTYPE, 1);
+ o = bile_find(board->bile, BOARD_FTN_MSGID_CACHE_RTYPE, 1);
if (o) {
/* allocate its size plus one entry that we may add */
- asize = o->size + sizeof(struct board_fidonet_msgid_cache);
+ asize = o->size + sizeof(struct board_ftn_msgid_cache);
msgid_cache = xmalloc(asize);
if (msgid_cache == NULL) {
logger_printf("[board] board_ingest_fidopkt: malloc(%ld) failed",
@@ -1517,12 +1523,12 @@ board_ingest_fidopkt_message(struct board *board,
return -1;
}
bile_read(board->bile, o->type, o->id, msgid_cache, o->size);
- npost_ids = o->size / sizeof(struct board_fidonet_msgid_cache);
+ npost_ids = o->size / sizeof(struct board_ftn_msgid_cache);
xfree(&o);
} else {
- npost_ids = bile_ids_by_type(board->bile, BOARD_FIDONET_POST_RTYPE,
+ npost_ids = bile_ids_by_type(board->bile, BOARD_FTN_POST_RTYPE,
&post_ids);
- msgid_cache = xcalloc(sizeof(struct board_fidonet_msgid_cache),
+ msgid_cache = xcalloc(sizeof(struct board_ftn_msgid_cache),
npost_ids + 1);
if (msgid_cache == NULL) {
logger_printf("[board] board_ingest_fidopkt: calloc failed");
@@ -1530,9 +1536,9 @@ board_ingest_fidopkt_message(struct board *board,
}
for (n = 0; n < npost_ids; n++) {
/* only read as far as we have to */
- bile_read(board->bile, BOARD_FIDONET_POST_RTYPE, post_ids[n],
- &post, offsetof(struct board_fidonet_post, msgid) +
- member_size(struct board_fidonet_post, msgid));
+ bile_read(board->bile, BOARD_FTN_POST_RTYPE, post_ids[n],
+ &post, offsetof(struct board_ftn_post, msgid) +
+ member_size(struct board_ftn_post, msgid));
msgid_cache[n].id = post.id;
memcpy(&msgid_cache[n].msgid, &post.msgid,
@@ -1545,9 +1551,9 @@ board_ingest_fidopkt_message(struct board *board,
for (n = 0; n < npost_ids; n++) {
if (memcmp(&msgid_cache[n].msgid, &msgid, sizeof(msgid)) == 0) {
- logger_printf("[board] already have fidonet msg %s in %s "
- "(%ld), skipping", fidomsg->msgid_orig, board->name,
- msgid_cache[n].id);
+ logger_printf("[board] already have %s EchoMail %s in %s "
+ "(%ld), skipping", db->config.ftn_network,
+ fidomsg->msgid_orig, board->name, msgid_cache[n].id);
ret = 0;
goto done;
}
@@ -1565,7 +1571,7 @@ board_ingest_fidopkt_message(struct board *board,
strlcpy(post.msgid_orig, fidomsg->msgid_orig, sizeof(post.msgid_orig));
post.msgid = msgid;
- post.id = bile_next_id(board->bile, BOARD_FIDONET_POST_RTYPE);
+ post.id = bile_next_id(board->bile, BOARD_FTN_POST_RTYPE);
if (!post.id) {
logger_printf("[board] failed get next id for %s", board->name);
ret = -1;
@@ -1573,7 +1579,7 @@ board_ingest_fidopkt_message(struct board *board,
}
bret = bile_marshall_object(board->bile,
- board_fidonet_post_object_fields, nboard_fidonet_post_object_fields,
+ board_ftn_post_object_fields, nboard_ftn_post_object_fields,
&post, &pdata, &psize);
if (bret != 0 || psize == 0) {
logger_printf("[board] failed to marshall new post %s %s",
@@ -1581,7 +1587,7 @@ board_ingest_fidopkt_message(struct board *board,
ret = -1;
goto done;
}
- if (bile_write(board->bile, BOARD_FIDONET_POST_RTYPE, post.id, pdata,
+ if (bile_write(board->bile, BOARD_FTN_POST_RTYPE, post.id, pdata,
psize) != psize) {
logger_printf("[fidopkt] failed to save new post %s %s: %d",
fidomsg->area, fidomsg->msgid_orig, bile_error(board->bile));
@@ -1603,14 +1609,14 @@ board_ingest_fidopkt_message(struct board *board,
bile_delete(board->bile, BOARD_SORTED_IDS_RTYPE, 1,
BILE_DELETE_FLAG_PURGE);
- logger_printf("[board] imported %s %s as %ld",
+ logger_printf("[board] tossed %s EchoMail %s as %ld",
fidomsg->area, fidomsg->msgid_orig, post.id);
uthread_yield();
done:
if (dirty_cache) {
- cache_size = npost_ids * sizeof(struct board_fidonet_msgid_cache);
- if (bile_write(board->bile, BOARD_FIDONET_MSGID_CACHE_RTYPE, 1,
+ cache_size = npost_ids * sizeof(struct board_ftn_msgid_cache);
+ if (bile_write(board->bile, BOARD_FTN_MSGID_CACHE_RTYPE, 1,
msgid_cache, cache_size) != cache_size) {
logger_printf("[board] failed to save msgid cache for %s: %d",
fidomsg->area, bile_error(board->bile));
--- board.h Mon Mar 13 10:24:21 2023
+++ board.h Mon Mar 13 23:40:31 2023
@@ -31,7 +31,7 @@ struct board {
unsigned short retention_days;
unsigned long last_post_at;
unsigned long post_count;
- char fidonet_area[32];
+ char ftn_area[32];
struct bile *bile;
};
@@ -54,7 +54,7 @@ struct board_post {
extern const struct bile_object_field board_post_object_fields[];
extern const size_t nboard_post_object_fields;
-struct board_fidonet_post {
+struct board_ftn_post {
unsigned long id;
struct fidopkt_msgid msgid;
time_t time;
@@ -67,8 +67,8 @@ struct board_fidonet_post {
size_t body_size;
char *body;
};
-extern const struct bile_object_field board_fidonet_post_object_fields[];
-extern const size_t nboard_fidonet_post_object_fields;
+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;
@@ -82,15 +82,15 @@ struct board_thread {
extern const struct bile_object_field board_thread_object_fields[];
extern const size_t nboard_thread_object_fields;
-void board_list_fidonet_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 session *s, struct board *board,
struct board_post *post, struct board_thread *thread);
-void board_delete_fidonet_post(struct session *s, struct board *board,
- struct board_fidonet_post *post);
+void board_delete_ftn_post(struct session *s, struct board *board,
+ struct board_ftn_post *post);
size_t board_index_sorted_post_ids(struct board *board,
unsigned long **sorted_ids);
-short board_ingest_fidopkt_message(struct board *board,
+short board_toss_ftn_message(struct board *board,
struct fidopkt_message *fidomsg);
#endif