AmendHub

Download:

jcs

/

subtext

/

amendments

/

397

board: Add fidonet_network setting, show instead of hard-coded FidoNet


jcs made amendment 397 about 1 year ago
--- board.c Fri Mar 10 22:05:01 2023 +++ board.c Sat Mar 11 20:43:53 2023 @@ -171,7 +171,7 @@ board_list_fidonet_boards(struct session *s) }; struct board *fboards = NULL, tboard; size_t nfboards; - char prompt[] = "FidoNet"; + char title[40]; char c; short bn, n, i, j; bool done, show_list, show_help; @@ -205,9 +205,12 @@ board_list_fidonet_boards(struct session *s) show_help = false; done = false; + snprintf(title, sizeof(title), "%s Boards (%s)", + db->config.fidonet_network, db->config.fidonet_node_addr); + while (!done && !s->ending) { if (show_list) { - session_printf(s, "{{B}}FidoNet Boards{{/B}}\r\n"); + session_printf(s, "{{B}}%s{{/B}}\r\n", title); session_printf(s, "%s# Name Description%s\r\n", ansi(s, ANSI_BOLD, ANSI_END), ansi(s, ANSI_RESET, ANSI_END)); session_flush(s); @@ -223,7 +226,7 @@ board_list_fidonet_boards(struct session *s) show_list = false; } - c = session_menu(s, "FidoNet Boards", prompt, opts, + c = session_menu(s, title, db->config.fidonet_network, opts, nitems(opts), show_help, "Board #", &bn); show_help = false; @@ -237,7 +240,7 @@ board_list_fidonet_boards(struct session *s) session_flush(s); break; } - board_show(s, fboards[bn - 1].id, prompt); + board_show(s, fboards[bn - 1].id, db->config.fidonet_network); break; case '?': show_help = true; --- db.c Fri Mar 10 21:15:58 2023 +++ db.c Sat Mar 11 14:57:03 2023 @@ -93,6 +93,9 @@ struct struct_field config_fields[] = { offsetof(struct config, session_log_days), 1, USHRT_MAX }, + { "FidoNet Network Name", CONFIG_TYPE_STRING, + offsetof(struct config, fidonet_network), + 0, member_size(struct config, fidonet_network) }, { "FidoNet Local Node Address", CONFIG_TYPE_STRING, offsetof(struct config, fidonet_node_addr), 0, member_size(struct config, fidonet_node_addr) }, @@ -589,6 +592,7 @@ db_migrate(struct db *tdb, short is_new, Str255 fullpa bile_read(tdb->bile, DB_CONFIG_RTYPE, 1, (char *)&new_config, sizeof(new_config)); + new_config.fidonet_network[0] = '\0'; new_config.fidonet_node_addr[0] = '\0'; new_config.fidonet_hub_addr[0] = '\0'; new_config.fidonet_pkt_password[0] = '\0'; --- db.h Fri Mar 10 20:55:05 2023 +++ db.h Sat Mar 11 14:36:42 2023 @@ -19,36 +19,36 @@ #include <time.h> -#define DB_CUR_VERS 16 +#define DB_CUR_VERS 16 -#define SUBTEXT_CREATOR 'SUBT' -#define DB_TYPE 'STDB' +#define SUBTEXT_CREATOR 'SUBT' +#define DB_TYPE 'STDB' -#define DB_TRUE 0x100 -#define DB_FALSE 0x000 +#define DB_TRUE 0x100 +#define DB_FALSE 0x000 -#define DB_CONFIG_RTYPE 'CONF' -#define DB_USER_RTYPE 'USER' -#define DB_BOARD_RTYPE 'BORD' -#define DB_FOLDER_RTYPE 'FOLD' -#define DB_VERS_RTYPE 'VERS' -#define DB_MOTD_RTYPE 'MOTD' +#define DB_CONFIG_RTYPE 'CONF' +#define DB_USER_RTYPE 'USER' +#define DB_BOARD_RTYPE 'BORD' +#define DB_FOLDER_RTYPE 'FOLD' +#define DB_VERS_RTYPE 'VERS' +#define DB_MOTD_RTYPE 'MOTD' -#define DB_TEXT_TYPE 'TEXT' -#define DB_TEXT_MENU_ID 1 -#define DB_TEXT_SHORTMENU_ID 2 -#define DB_TEXT_ISSUE_ID 3 -#define DB_TEXT_SIGNUP_ID 4 -#define DB_TEXT_PAGE_SYSOP_ID 5 -#define DB_TEXT_NO_FREE_NODES_ID 6 -#define DB_TEXT_SIGNOFF_ID 7 -#define DB_TEXT_MENU_OPTIONS_ID 8 +#define DB_TEXT_TYPE 'TEXT' +#define DB_TEXT_MENU_ID 1 +#define DB_TEXT_SHORTMENU_ID 2 +#define DB_TEXT_ISSUE_ID 3 +#define DB_TEXT_SIGNUP_ID 4 +#define DB_TEXT_PAGE_SYSOP_ID 5 +#define DB_TEXT_NO_FREE_NODES_ID 6 +#define DB_TEXT_SIGNOFF_ID 7 +#define DB_TEXT_MENU_OPTIONS_ID 8 -#define DB_USERNAME_LENGTH 16 +#define DB_USERNAME_LENGTH 16 -#define SL_TYPE 'STSL' -#define SL_LOG_RTYPE 'SLOG' -#define SL_TALLY_RTYPE 'STLY' +#define SL_TYPE 'STSL' +#define SL_LOG_RTYPE 'SLOG' +#define SL_TALLY_RTYPE 'STLY' #define BOARD_FILENAME_EXT "brd" #define BOARD_THREAD_RTYPE 'BDTH' @@ -99,6 +99,7 @@ struct config { unsigned long binkp_interval_seconds; short binkp_delete_done; short timezone_utcoff; + char fidonet_network[16]; }; extern struct struct_field config_fields[];