Libtransport: Send self presence as first one when joining from second resource
This commit is contained in:
parent
2ca447264a
commit
99e958e8c8
2 changed files with 13 additions and 13 deletions
|
@ -251,13 +251,13 @@ void Conversation::sendParticipants(const Swift::JID &to, const std::string &nic
|
|||
presence->setTo(to);
|
||||
m_conversationManager->getComponent()->getFrontend()->sendPresence(presence);
|
||||
|
||||
// And send the presence from as new user
|
||||
m_nickname = tmp;
|
||||
presence = generatePresence(m_nickname, 0, (int) Swift::StatusShow::Online, "", "", "");
|
||||
presence->setTo(to);
|
||||
m_conversationManager->getComponent()->getFrontend()->sendPresence(presence);
|
||||
}
|
||||
|
||||
// Self presence has to be sent as first.
|
||||
Swift::Presence::ref presence = generatePresence(m_nickname, 0, (int) Swift::StatusShow::Online, "", "", "");
|
||||
presence->setTo(to);
|
||||
m_conversationManager->getComponent()->getFrontend()->sendPresence(presence);
|
||||
|
||||
for (std::map<std::string, Participant>::iterator it = m_participants.begin(); it != m_participants.end(); it++) {
|
||||
(*it).second.presence->setTo(to);
|
||||
m_conversationManager->getComponent()->getFrontend()->sendPresence((*it).second.presence);
|
||||
|
|
|
@ -193,14 +193,14 @@ class UserTest : public CPPUNIT_NS :: TestFixture, public BasicTest {
|
|||
CPPUNIT_ASSERT_EQUAL(std::string(""), roomNickname);
|
||||
CPPUNIT_ASSERT_EQUAL(std::string(""), roomPassword);
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(1, (int) received2.size());
|
||||
CPPUNIT_ASSERT(dynamic_cast<Swift::Presence *>(getStanza(received2[0])));
|
||||
CPPUNIT_ASSERT_EQUAL(Swift::StatusShow::Away, dynamic_cast<Swift::Presence *>(getStanza(received2[0]))->getShow());
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("user@localhost/resource2"), dynamic_cast<Swift::Presence *>(getStanza(received2[0]))->getTo().toString());
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("room@localhost/anotheruser"), dynamic_cast<Swift::Presence *>(getStanza(received2[0]))->getFrom().toString());
|
||||
CPPUNIT_ASSERT(getStanza(received2[0])->getPayload<Swift::MUCUserPayload>());
|
||||
CPPUNIT_ASSERT_EQUAL(Swift::MUCOccupant::Member, *getStanza(received2[0])->getPayload<Swift::MUCUserPayload>()->getItems()[0].affiliation);
|
||||
CPPUNIT_ASSERT_EQUAL(Swift::MUCOccupant::Participant, *getStanza(received2[0])->getPayload<Swift::MUCUserPayload>()->getItems()[0].role);
|
||||
CPPUNIT_ASSERT_EQUAL(2, (int) received2.size());
|
||||
CPPUNIT_ASSERT(dynamic_cast<Swift::Presence *>(getStanza(received2[1])));
|
||||
CPPUNIT_ASSERT_EQUAL(Swift::StatusShow::Away, dynamic_cast<Swift::Presence *>(getStanza(received2[1]))->getShow());
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("user@localhost/resource2"), dynamic_cast<Swift::Presence *>(getStanza(received2[1]))->getTo().toString());
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("room@localhost/anotheruser"), dynamic_cast<Swift::Presence *>(getStanza(received2[1]))->getFrom().toString());
|
||||
CPPUNIT_ASSERT(getStanza(received2[1])->getPayload<Swift::MUCUserPayload>());
|
||||
CPPUNIT_ASSERT_EQUAL(Swift::MUCOccupant::Member, *getStanza(received2[1])->getPayload<Swift::MUCUserPayload>()->getItems()[0].affiliation);
|
||||
CPPUNIT_ASSERT_EQUAL(Swift::MUCOccupant::Participant, *getStanza(received2[1])->getPayload<Swift::MUCUserPayload>()->getItems()[0].role);
|
||||
}
|
||||
|
||||
void handlePresenceLeaveRoom() {
|
||||
|
|
Loading…
Add table
Reference in a new issue