Add temporary skip of parsing global patterns and add irc timestamp fallback in case if not present

This commit is contained in:
Alex D. 2020-10-08 20:26:44 +02:00
parent bb8276a16f
commit 7bd0d0ed2b
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
2 changed files with 9 additions and 2 deletions

View File

@ -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)) {

View File

@ -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;