sasl: Use the nick from the presence if the ad-hoc one is not set

fix #3450
This commit is contained in:
louiz’
2021-01-15 12:33:18 +01:00
parent 1b1b03b21b
commit a4512cd3ae
2 changed files with 31 additions and 3 deletions
+2 -1
View File
@@ -1371,7 +1371,8 @@ void IrcClient::on_authenticate(const IrcMessage &)
auto options = Database::get_irc_server_options(this->bridge.get_bare_jid(),
this->get_hostname());
const auto auth_string = '\0' + options.col<Database::Nick>() + '\0' + options.col<Database::SaslPassword>();
const auto& nick = !options.col<Database::Nick>().empty() ? options.col<Database::Nick>() : this->get_own_nick();
const auto auth_string = '\0' + nick + '\0' + options.col<Database::SaslPassword>();
const auto base64_auth_string = base64::encode(auth_string);
this->send_message({"AUTHENTICATE", {base64_auth_string}});
}