From 132059ca7d10eaa30a77f954aadd7dd8cd5ef45d Mon Sep 17 00:00:00 2001 From: Jan Kaluza Date: Wed, 1 Aug 2012 07:12:55 +0200 Subject: [PATCH] Fix crash caused by two XMPP users using single PurpleAccount instance --- backends/libpurple/main.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backends/libpurple/main.cpp b/backends/libpurple/main.cpp index fc2a3049..09b63049 100644 --- a/backends/libpurple/main.cpp +++ b/backends/libpurple/main.cpp @@ -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 << "'");