1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:38:11 +00:00

IRCClient: Add ShowNickChangeMessages/ShowJoinPartMessages conf options

Allow IRCClient to hide nick change spam and join/part spam
This commit is contained in:
Brendan Coles 2020-04-10 10:59:13 +00:00 committed by Andreas Kling
parent a3edeb5868
commit df7b617ba1
4 changed files with 22 additions and 4 deletions

View file

@ -78,6 +78,10 @@ IRCClient::IRCClient()
m_nickname = m_config->read_entry("User", "Nickname", String::format("%s_seren1ty", user_pw->pw_name));
m_hostname = m_config->read_entry("Connection", "Server", "");
m_port = m_config->read_num_entry("Connection", "Port", 6667);
m_show_join_part_messages = m_config->read_bool_entry("Messaging", "ShowJoinPartMessages", 1);
m_show_nick_change_messages = m_config->read_bool_entry("Messaging", "ShowNickChangeMessages", 1);
m_ctcp_version_reply = m_config->read_entry("CTCP", "VersionReply", "IRC Client [x86] / Serenity OS");
m_ctcp_userinfo_reply = m_config->read_entry("CTCP", "UserInfoReply", user_pw->pw_name);
m_ctcp_finger_reply = m_config->read_entry("CTCP", "FingerReply", user_pw->pw_name);
@ -620,7 +624,8 @@ void IRCClient::handle_nick(const Message& msg)
auto& new_nick = msg.arguments[0];
if (old_nick == m_nickname)
m_nickname = new_nick;
add_server_message(String::format("~ %s changed nickname to %s", old_nick.characters(), new_nick.characters()));
if (m_show_nick_change_messages)
add_server_message(String::format("~ %s changed nickname to %s", old_nick.characters(), new_nick.characters()));
if (on_nickname_changed)
on_nickname_changed(new_nick);
for (auto& it : m_channels) {