Save our own host, as reported by the server
This commit is contained in:
@@ -59,6 +59,7 @@ static const std::unordered_map<std::string,
|
|||||||
{"333", {&IrcClient::on_topic_who_time_received, {4, 0}}},
|
{"333", {&IrcClient::on_topic_who_time_received, {4, 0}}},
|
||||||
{"RPL_TOPICWHOTIME", {&IrcClient::on_topic_who_time_received, {4, 0}}},
|
{"RPL_TOPICWHOTIME", {&IrcClient::on_topic_who_time_received, {4, 0}}},
|
||||||
{"366", {&IrcClient::on_channel_completely_joined, {2, 0}}},
|
{"366", {&IrcClient::on_channel_completely_joined, {2, 0}}},
|
||||||
|
{"396", {&IrcClient::on_own_host_received, {2, 0}}},
|
||||||
{"432", {&IrcClient::on_erroneous_nickname, {2, 0}}},
|
{"432", {&IrcClient::on_erroneous_nickname, {2, 0}}},
|
||||||
{"433", {&IrcClient::on_nickname_conflict, {2, 0}}},
|
{"433", {&IrcClient::on_nickname_conflict, {2, 0}}},
|
||||||
{"438", {&IrcClient::on_nickname_change_too_fast, {2, 0}}},
|
{"438", {&IrcClient::on_nickname_change_too_fast, {2, 0}}},
|
||||||
@@ -746,6 +747,18 @@ void IrcClient::on_channel_completely_joined(const IrcMessage& message)
|
|||||||
this->bridge.send_topic(this->hostname, chan_name, channel->topic, channel->topic_author);
|
this->bridge.send_topic(this->hostname, chan_name, channel->topic, channel->topic_author);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IrcClient::on_own_host_received(const IrcMessage& message)
|
||||||
|
{
|
||||||
|
this->own_host = message.arguments[1];
|
||||||
|
const std::string from = message.prefix;
|
||||||
|
if (message.arguments.size() >= 3)
|
||||||
|
this->bridge.send_xmpp_message(this->hostname, from,
|
||||||
|
this->own_host + " " + message.arguments[2]);
|
||||||
|
else
|
||||||
|
this->bridge.send_xmpp_message(this->hostname, from, this->own_host +
|
||||||
|
" is now your displayed host");
|
||||||
|
}
|
||||||
|
|
||||||
void IrcClient::on_erroneous_nickname(const IrcMessage& message)
|
void IrcClient::on_erroneous_nickname(const IrcMessage& message)
|
||||||
{
|
{
|
||||||
const std::string error_msg = message.arguments.size() >= 3 ?
|
const std::string error_msg = message.arguments.size() >= 3 ?
|
||||||
|
|||||||
@@ -217,6 +217,10 @@ public:
|
|||||||
* received etc), send the self presence and topic to the XMPP user.
|
* received etc), send the self presence and topic to the XMPP user.
|
||||||
*/
|
*/
|
||||||
void on_channel_completely_joined(const IrcMessage& message);
|
void on_channel_completely_joined(const IrcMessage& message);
|
||||||
|
/**
|
||||||
|
* Save our own host, as reported by the server
|
||||||
|
*/
|
||||||
|
void on_own_host_received(const IrcMessage& message);
|
||||||
/**
|
/**
|
||||||
* We tried to set an invalid nickname
|
* We tried to set an invalid nickname
|
||||||
*/
|
*/
|
||||||
@@ -283,6 +287,12 @@ private:
|
|||||||
* The hostname of the server we are connected to.
|
* The hostname of the server we are connected to.
|
||||||
*/
|
*/
|
||||||
const std::string hostname;
|
const std::string hostname;
|
||||||
|
/**
|
||||||
|
* Our own host, as reported by the IRC server.
|
||||||
|
* By default (and if it is not overridden by the server), it is a
|
||||||
|
* meaningless string, with the maximum allowed size
|
||||||
|
*/
|
||||||
|
std::string own_host{63, '*'};
|
||||||
/**
|
/**
|
||||||
* The hostname of the user. This is used in the USER and the WEBIRC
|
* The hostname of the user. This is used in the USER and the WEBIRC
|
||||||
* commands, but only the one in WEBIRC will be used by the IRC server.
|
* commands, but only the one in WEBIRC will be used by the IRC server.
|
||||||
|
|||||||
Reference in New Issue
Block a user