Fix crash caused by two XMPP users using single PurpleAccount instance

This commit is contained in:
Jan Kaluza 2012-08-01 07:12:55 +02:00
parent ef259f4aef
commit 132059ca7d

View file

@ -344,8 +344,13 @@ class SpectrumNetworkPlugin : public NetworkPlugin {
}
if (purple_accounts_find(name.c_str(), protocol.c_str()) != NULL) {
LOG4CXX_INFO(logger, "Using previously created account with name '" << name.c_str() << "' and protocol '" << protocol << "'");
account = purple_accounts_find(name.c_str(), protocol.c_str());
if (m_accounts.find(account) != m_accounts.end() && m_accounts[account] != user) {
LOG4CXX_INFO(logger, "Account '" << name << "' is already used by '" << m_accounts[account] << "'");
np->handleDisconnected(user, 0, "Account '" + name + "' is already used by '" + m_accounts[account] + "'");
return;
}
LOG4CXX_INFO(logger, "Using previously created account with name '" << name.c_str() << "' and protocol '" << protocol << "'");
}
else {
LOG4CXX_INFO(logger, "Creating account with name '" << name.c_str() << "' and protocol '" << protocol << "'");