diff options
| author | B. Watson <urchlay@slackware.uk> | 2026-03-09 06:36:48 -0400 |
|---|---|---|
| committer | B. Watson <urchlay@slackware.uk> | 2026-03-09 06:36:48 -0400 |
| commit | 17a4ac8d12cff23369b830be656eaa1e6d767798 (patch) | |
| tree | 4b849d1ced96a438dfeee012ac84ad6cb78daf55 /src/cmd.c | |
| parent | 9dba8f52b61b1d56d9cf8e63bd1dde2b31b25a5d (diff) | |
| download | fujinet-chat-17a4ac8d12cff23369b830be656eaa1e6d767798.tar.gz | |
handle CTCP responses, especially PING.
Diffstat (limited to 'src/cmd.c')
| -rw-r--r-- | src/cmd.c | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -13,6 +13,7 @@ char *command, *arg1, *arg2, *arg3; static char *target; static void do_away(void); +static void do_bell(void); static void do_color(void); static void do_ctcp(void); static void do_info(void); @@ -41,6 +42,7 @@ typedef struct { */ cmd_t command_defs[] = { { "AWAY", do_away, 1 }, + { "BELL", do_bell, 1 }, { "COLOR", do_color, 1 }, { "CTCP", do_ctcp, 1 }, { "INFO", do_info, 0 }, @@ -227,9 +229,20 @@ static void send_ctcp(void) { txbuf_send(); } +long read_rtclok(void) { + return (OS.rtclok[0] << 16) | (OS.rtclok[1] << 8) | OS.rtclok[2]; +} + +static void rtclok_to_numbuf(void) { + long r; + r = read_rtclok(); + ltoa(r, numbuf, 10); +} + static void do_ctcp_ping(void) { arg2 = "PING"; - arg3 = "0xdeadbeef"; + rtclok_to_numbuf(); + arg3 = numbuf; send_ctcp(); } @@ -353,6 +366,10 @@ static void do_away(void) { txbuf_send(); } +static void do_bell(void) { + bell_type = *arg1 - '0'; +} + static int cmd_local(void) { arg1 = nextarg(command); |
