Do not change our nick if we send a presence to a non-joined channel

fix #3378
This commit is contained in:
louiz’
2018-09-17 22:36:59 +02:00
parent 08085d862f
commit 88fe1783bf
+6 -1
View File
@@ -185,9 +185,14 @@ void BiboumiComponent::handle_presence(const Stanza& stanza)
} }
bridge->join_irc_channel(iid, to.resource, password ? password->get_inner(): "", bridge->join_irc_channel(iid, to.resource, password ? password->get_inner(): "",
from.resource, history_limit, x != nullptr); from.resource, history_limit, x != nullptr);
if (!own_nick.empty() && own_nick != to.resource) const IrcClient* irc = bridge->find_irc_client(iid.get_server());
if (irc)
{
const auto chan = irc->find_channel(iid.get_local());
if (chan->joined)
bridge->send_irc_nick_change(iid, to.resource, from.resource); bridge->send_irc_nick_change(iid, to.resource, from.resource);
} }
}
else if (type == "unavailable") else if (type == "unavailable")
{ {
const XmlNode* status = stanza.get_child("status", COMPONENT_NS); const XmlNode* status = stanza.get_child("status", COMPONENT_NS);