diff options
author | Test_User <hax@andrewyu.org> | 2023-08-10 01:12:30 -0400 |
---|---|---|
committer | Test_User <hax@andrewyu.org> | 2023-08-10 01:12:30 -0400 |
commit | 031d6a3d88c714cd11884e73248f0c24090d50e1 (patch) | |
tree | e7e90ba77dea37ccee34cd7f2e0838e2dec8e956 /tls.c | |
parent | ffc06e4614772a681114d4059a072f599ee378f8 (diff) | |
download | coupserv-031d6a3d88c714cd11884e73248f0c24090d50e1.tar.gz coupserv-031d6a3d88c714cd11884e73248f0c24090d50e1.zip |
Log-related stuff
Diffstat (limited to '')
-rw-r--r-- | tls.c | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -90,3 +90,31 @@ int connect_tls(void) { } extern inline size_t RECV(char *buf, size_t buflen, char *timeout); // Should force it to get compiled into tls.o + +#if LOGALL +ssize_t SEND(struct string msg) { + static char printprefix = 1; + if (printprefix) { +#if COLORIZE + WRITES(1, STRING("\x1b[33m[Us->Server] \x1b[34m")); +#else + WRITES(1, STRING("[Us->Server] ")); +#endif + + printprefix = 0; + } + + WRITES(1, msg); + + if (msg.data[msg.len - 1] == '\n') { + printprefix = 1; +#if COLORIZE + WRITES(1, STRING("\x1b[0m\n")); +#else + WRITES(1, STRING("\n")); +#endif + } + + return gnutls_record_send(session, msg.data, msg.len); +} +#endif |