Libpurple: Do not change the nickname when joining the room when it is the same as the one used by the user

This commit is contained in:
Jan Kaluza 2016-02-09 08:01:04 +01:00
parent 2580eba947
commit de8114d2da
3 changed files with 6 additions and 6 deletions

View file

@ -710,14 +710,14 @@ class SpectrumNetworkPlugin : public NetworkPlugin {
if (CONFIG_STRING(config, "service.protocol") != "prpl-jabber") {
np->handleParticipantChanged(np->m_accounts[account], nickname, room, 0, pbnetwork::STATUS_ONLINE);
const char *disp;
if ((disp = purple_connection_get_display_name(account->gc))) {
if ((disp = purple_connection_get_display_name(account->gc)) == NULL) {
disp = purple_account_get_username(account);
}
if (nickname != disp) {
handleRoomNicknameChanged(np->m_accounts[account], room, disp);
np->handleParticipantChanged(np->m_accounts[account], nickname, room, 0, pbnetwork::STATUS_ONLINE, "", disp);
}
else {
handleRoomNicknameChanged(np->m_accounts[account], room, purple_account_get_username(account));
np->handleParticipantChanged(np->m_accounts[account], nickname, room, 0, pbnetwork::STATUS_ONLINE, "", purple_account_get_username(account));
}
}
LOG4CXX_INFO(logger, user << ": Joining the room " << room);

View file

@ -313,6 +313,7 @@ Swift::Presence::ref Conversation::generatePresence(const std::string &nick, int
Swift::MUCUserPayload::StatusCode c;
c.code = 210;
p->addStatusCode(c);
m_nicknameChanged = false;
}
m_sentInitialPresence = true;
}

View file

@ -139,7 +139,6 @@ class LocalBuddyTest : public CPPUNIT_NS :: TestFixture, public BasicTest {
received.clear();
buddy->setStatus(Swift::StatusShow(Swift::StatusShow::None), "");
dumpReceived();
CPPUNIT_ASSERT_EQUAL(1, (int) received.size());
CPPUNIT_ASSERT(dynamic_cast<Swift::Presence *>(getStanza(received[0])));
CPPUNIT_ASSERT_EQUAL(Swift::StatusShow::None, dynamic_cast<Swift::Presence *>(getStanza(received[0]))->getShow());