Improve filtering and add fallback for private messages

This commit is contained in:
Alex D. 2020-10-05 22:43:07 +02:00
parent 056d633992
commit 774951afaf
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
1 changed files with 11 additions and 3 deletions

View File

@ -124,18 +124,26 @@ signed int prepare_log_path(IRC_Message* message, PathBuf* pathbuffer, Connectio
} elements[] = {{reused_strings[0], true}, {NULL, true}, {"out", false}};
char temp[MAXLINE];
if (ISCMD(JOIN) || ISCMD(PART) || ISCMD(QUIT) || ISCMD(MOTD) || ISCMD(RPL_MOTD) || ISCMD(RPL_MOTDSTART) || ISCMD(RPL_ENDOFMOTD)
|| ISCMD(ERR_NOMOTD)) {
|| ISCMD(ERR_NOMOTD) || ISCMD(PING) || ISCMD(PONG) || ISCMD(RPL_LIST) || ISCMD(RPL_LISTEND)) {
elements[0].name = reused_strings[2];
if (ISCMD(JOIN) || ISCMD(PART) || ISCMD(QUIT))
elements[1].name = "events";
else if (ISCMD(MOTD) || ISCMD(RPL_MOTD) || ISCMD(RPL_MOTDSTART) || ISCMD(RPL_ENDOFMOTD) || ISCMD(ERR_NOMOTD))
elements[1].name = "motd";
else if (ISCMD(PING) || ISCMD(PONG))
elements[1].name = "pings";
else if (ISCMD(RPL_LIST) || ISCMD(RPL_LISTEND))
elements[1].name = "channels";
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] != '!')
if (*message->args[0] != '#' && *message->args[0] != '&' && *message->args[0] != '+' && *message->args[0] != '!') {
elements[0].name = reused_strings[1];
strncpy(temp, message->args[0], sizeof(temp));
strncpy(temp, message->args[0], sizeof(temp));
} else if (message->name.nick != NULL) {
strncpy(temp, message->name.nick, sizeof(temp));
} else
return -2;
cleanup_path_names(temp);
elements[1].name = temp;
} else if (ISCMD(RPL_TOPIC) || ISCMD(RPL_NOTOPIC)) {