diff options
Diffstat (limited to 'client_network.c')
-rw-r--r-- | client_network.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/client_network.c b/client_network.c index 3ddad6e..fe03eba 100644 --- a/client_network.c +++ b/client_network.c @@ -533,3 +533,35 @@ int initclientnetwork(void) { return 0; } + +#if LOGALL +ssize_t SENDCLIENT(struct string msg) { + if (!msg.len) + return 0; + + static char printprefix = 1; + if (printprefix) { +#if COLORIZE + WRITES(1, STRING("\x1b[31m[Us->Client] \x1b[32m")); +#else + WRITES(1, STRING("[Us->Client] ")); +#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 WRITES(client_fd, msg); +} +#endif |