diff options
Diffstat (limited to 'tls.c')
-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 |