1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:37:37 +00:00

IRCClient: Set nick and userinfo to OS username when not set in config

This commit is contained in:
Brendan Coles 2020-04-09 14:03:31 +00:00 committed by Andreas Kling
parent c06a6c67d5
commit d95362d8cd

View file

@ -39,6 +39,7 @@
#include <netinet/in.h> #include <netinet/in.h>
#include <stdio.h> #include <stdio.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <pwd.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
@ -71,13 +72,14 @@ IRCClient::IRCClient()
, m_log(IRCLogBuffer::create()) , m_log(IRCLogBuffer::create())
, m_config(Core::ConfigFile::get_for_app("IRCClient")) , m_config(Core::ConfigFile::get_for_app("IRCClient"))
{ {
struct passwd* user_pw = getpwuid(getuid());
m_socket = Core::TCPSocket::construct(this); m_socket = Core::TCPSocket::construct(this);
m_nickname = m_config->read_entry("User", "Nickname", "seren1ty"); 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_hostname = m_config->read_entry("Connection", "Server", "");
m_port = m_config->read_num_entry("Connection", "Port", 6667); m_port = m_config->read_num_entry("Connection", "Port", 6667);
m_ctcp_version_reply = m_config->read_entry("CTCP", "VersionReply", "IRC Client [x86] / Serenity OS"); 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", "anon"); m_ctcp_userinfo_reply = m_config->read_entry("CTCP", "UserInfoReply", user_pw->pw_name);
m_ctcp_finger_reply = m_config->read_entry("CTCP", "FingerReply", "anon"); m_ctcp_finger_reply = m_config->read_entry("CTCP", "FingerReply", user_pw->pw_name);
} }
IRCClient::~IRCClient() IRCClient::~IRCClient()