summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2015-10-12 16:35:50 +0200
committerFlorent Le Coz <louiz@louiz.org>2015-10-12 16:35:50 +0200
commit6512f830fa2baa85a7c688843ebd42eb528e2ad6 (patch)
tree8f1278ab28f17215ba9cbf99855c155751d2bf60
parent60d340be19aa4370620181b56a6d4ccdcfa014dc (diff)
downloadbiboumi-6512f830fa2baa85a7c688843ebd42eb528e2ad6.tar.gz
biboumi-6512f830fa2baa85a7c688843ebd42eb528e2ad6.tar.bz2
biboumi-6512f830fa2baa85a7c688843ebd42eb528e2ad6.tar.xz
biboumi-6512f830fa2baa85a7c688843ebd42eb528e2ad6.zip
The realname is also saved as an IrcClient member
-rw-r--r--src/irc/irc_client.cpp15
-rw-r--r--src/irc/irc_client.hpp8
2 files changed, 14 insertions, 9 deletions
diff --git a/src/irc/irc_client.cpp b/src/irc/irc_client.cpp
index 00d9f43..4692eef 100644
--- a/src/irc/irc_client.cpp
+++ b/src/irc/irc_client.cpp
@@ -27,6 +27,7 @@ IrcClient::IrcClient(std::shared_ptr<Poller> poller, const std::string& hostname
TCPSocketHandler(poller),
hostname(hostname),
username(username),
+ realname(username),
current_nick(username),
bridge(bridge),
welcomed(false),
@@ -115,18 +116,18 @@ void IrcClient::on_connected()
if (!options.pass.value().empty())
this->send_pass_command(options.pass.value());
#endif
+
this->send_nick_command(this->username);
+
#ifdef USE_DATABASE
- std::string username = this->username;
if (!options.username.value().empty())
- username = options.username.value();
- std::string realname = this->username;
+ this->username = options.username.value();
if (!options.realname.value().empty())
- realname = options.realname.value();
+ this->realname = options.realname.value();
this->send_user_command(username, realname);
-#else
- this->send_user_command(this->username, this->username);
-#endif // USE_DATABASE
+#endif
+ this->send_user_command(this->username, this->realname);
+
this->send_gateway_message("Connected to IRC server"s + (this->use_tls ? " (encrypted)": "") + ".");
this->send_pending_data();
}
diff --git a/src/irc/irc_client.hpp b/src/irc/irc_client.hpp
index 4e61d14..a6b51ce 100644
--- a/src/irc/irc_client.hpp
+++ b/src/irc/irc_client.hpp
@@ -254,9 +254,13 @@ private:
*/
const std::string hostname;
/**
- * The user name used in the USER irc command
+ * The username used in the USER irc command
*/
- const std::string username;
+ std::string username;
+ /**
+ * The realname used in the USER irc command
+ */
+ std::string realname;
/**
* Our current nickname on the server
*/