summaryrefslogtreecommitdiff
path: root/tls.c
diff options
context:
space:
mode:
Diffstat (limited to 'tls.c')
-rw-r--r--tls.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/tls.c b/tls.c
index 314a889..a3f3200 100644
--- a/tls.c
+++ b/tls.c
@@ -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