Associate a bridge with a bare JID instead of a full JID

ref #2556
This commit is contained in:
louiz’
2016-06-08 01:42:43 +02:00
parent 0a2123f8a2
commit 367de4826c
3 changed files with 33 additions and 5 deletions
+6 -4
View File
@@ -507,22 +507,24 @@ void BiboumiComponent::handle_iq(const Stanza& stanza)
Bridge* BiboumiComponent::get_user_bridge(const std::string& user_jid)
{
auto bare_jid = Jid{user_jid}.bare();
try
{
return this->bridges.at(user_jid).get();
return this->bridges.at(bare_jid).get();
}
catch (const std::out_of_range& exception)
{
this->bridges.emplace(user_jid, std::make_unique<Bridge>(user_jid, *this, this->poller));
return this->bridges.at(user_jid).get();
this->bridges.emplace(bare_jid, std::make_unique<Bridge>(bare_jid, *this, this->poller));
return this->bridges.at(bare_jid).get();
}
}
Bridge* BiboumiComponent::find_user_bridge(const std::string& user_jid)
{
auto bare_jid = Jid{user_jid}.bare();
try
{
return this->bridges.at(user_jid).get();
return this->bridges.at(bare_jid).get();
}
catch (const std::out_of_range& exception)
{
+1 -1
View File
@@ -83,7 +83,7 @@ public:
private:
/**
* Return the bridge associated with the given full JID. Create a new one
* Return the bridge associated with the bare JID. Create a new one
* if none already exist.
*/
Bridge* get_user_bridge(const std::string& user_jid);