AmendHub

Download:

jcs

/

subtext

/

amendments

/

393

binkp: Claim binkp/1.0, not 1.1 (yet?), convert times to local


jcs made amendment 393 about 1 year ago
--- binkp.c Thu Mar 9 10:15:04 2023 +++ binkp.c Thu Mar 9 21:53:21 2023 @@ -29,7 +29,7 @@ /* #define BINKP_DEBUG */ -static struct fidopkt_address *binkp_our_address; +static struct fidopkt_address binkp_our_address = { 0 }; static struct binkp_connection *binkpc = NULL; static Str255 binkp_inbox_dir, binkp_done_dir, binkp_outbox_dir; static short binkp_fidopkt_skipped, binkp_fidopkt_imported; @@ -448,6 +448,13 @@ binkp_read_frame(void) if (strncmp(binkpc->buf + 1, "SYS ", 4) == 0) logger_printf("[binkp] connected to %s", binkpc->buf + 1 + 4); + else if (strncmp(binkpc->buf + 1, "TIME ", 5) == 0) { + /* + * TODO: try to parse timezone and pass to fidopkt, so + * any packets without a TZUTC line can use the hub's + * timezone. + */ + } break; case BINKP_COMMAND_M_FILE: if (binkpc->cur_incoming_file.filename[0]) { @@ -590,7 +597,7 @@ binkp_login(void) if (!binkp_send_frame(BINKP_COMMAND_M_NUL, command, len)) return false; - len = snprintf(command, sizeof(command), "VER Subtext/%s binkp/1.1", + len = snprintf(command, sizeof(command), "VER Subtext/%s binkp/1.0", get_version(false)); if (!binkp_send_frame(BINKP_COMMAND_M_NUL, command, len)) return false; @@ -769,6 +776,13 @@ binkp_fidopkt_processor(char *filename, unsigned char fidopkt = fidopkt_parse(filename, (char *)data, size); if (fidopkt == NULL) return; + + if (fidopkt->time) + /* convert to local time zone */ + fidopkt->time += + (((long)db->config.timezone_utcoff * 60 * 60) / 100); + else + fidopkt->time = Time; if (fidopkt->area[0]) { for (n = 0; n < db->nboards; n++) {