From 7bd0d0ed2bf9ade0a66ec6beae5fc2406cb38a5e Mon Sep 17 00:00:00 2001 From: Alex Denes Date: Thu, 8 Oct 2020 20:26:44 +0200 Subject: [PATCH] Add temporary skip of parsing global patterns and add irc timestamp fallback in case if not present --- src/filesystem.c | 6 ++++-- src/main.c | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/filesystem.c b/src/filesystem.c index 6b91282..e18d4b9 100644 --- a/src/filesystem.c +++ b/src/filesystem.c @@ -137,11 +137,13 @@ signed int prepare_log_path(IRC_Message* message, PathBuf* pathbuffer, Connectio elements[1].isdir = false; } else if (ISCMD(PRIVMSG) || ISCMD(NOTICE)) { if (message->args[0] == NULL) return -2; - if (*message->args[0] != '#' && *message->args[0] != '&' && *message->args[0] != '+' && *message->args[0] != '!' && message->name.nick != NULL) { + if (strcmp(conn->names.nick, message->args[0]) == 0 && message->name.nick != NULL) { elements[0].name = reused_strings[1]; strncpy(temp, message->name.nick, sizeof(temp)); - } else + } else if (*message->args[0] == '#' || *message->args[0] == '&' || *message->args[0] == '+' || *message->args[0] == '!') { strncpy(temp, message->args[0], sizeof(temp)); + } else + return 0; // TODO: Parse patterns as well cleanup_path_names(temp); elements[1].name = temp; } else if (ISCMD(RPL_TOPIC) || ISCMD(RPL_NOTOPIC)) { diff --git a/src/main.c b/src/main.c index 847c85f..96b7c7a 100644 --- a/src/main.c +++ b/src/main.c @@ -257,6 +257,11 @@ int run_main(Connection* conn, char* quitmsg, unsigned int timeout) memset((void*)&buffer, '\0', sizeof(IRC_Message)); if ((len = get_buffer_line(recvbuf.buffer, &buffer)) > 0) { conn->lastmessage = ctime; + char datebuf[25]; + if (buffer.tags.time.value == NULL) { + Assm_tag_timestamp(datebuf, sizeof(datebuf), ctime); + buffer.tags.time.value = datebuf; + } if (set_path_elem("global", 1, true, &filebuf) > 0 && set_path_elem("out", 2, false, &filebuf) > 0) { LOG(LOG_DEBUG, "Writing message to global path %s.", filebuf.buf); signed long temp;