summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/irc/core/irc.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/irc/core/irc.c b/src/irc/core/irc.c
index e6b380b2..bf41fbbc 100644
--- a/src/irc/core/irc.c
+++ b/src/irc/core/irc.c
@@ -54,18 +54,25 @@ void irc_send_cmd_full(IRC_SERVER_REC *server, const char *cmd,
len = strlen(cmd);
server->cmdcount++;
- if (send_now)
- rawlog_output(server->rawlog, cmd);
-
if (!raw) {
/* check that we don't send any longer commands
- than 512 bytes. also add the line feed. */
+ than 510 bytes (2 bytes for CR+LF) */
strncpy(str, cmd, 510);
if (len > 510) len = 510;
- str[len++] = 13; str[len++] = 10; str[len] = '\0';
+ str[len] = '\0';
cmd = str;
}
+ if (send_now)
+ rawlog_output(server->rawlog, cmd);
+
+ if (!raw) {
+ /* Add CR+LF to command */
+ str[len++] = 13;
+ str[len++] = 10;
+ str[len] = '\0';
+ }
+
if (send_now) {
if (net_sendbuffer_send(server->handle, cmd, len) == -1) {
/* something bad happened */