Libtransport: Send also subject in sendCachedMessages()
This commit is contained in:
parent
95a144a285
commit
7805d876f8
2 changed files with 20 additions and 1 deletions
|
@ -214,6 +214,17 @@ void Conversation::sendCachedMessages(const Swift::JID &to) {
|
|||
}
|
||||
m_conversationManager->getComponent()->getStanzaChannel()->sendMessage(*it);
|
||||
}
|
||||
|
||||
if (m_subject) {
|
||||
if (to.isValid()) {
|
||||
m_subject->setTo(to);
|
||||
}
|
||||
else {
|
||||
m_subject->setTo(m_jid.toBare());
|
||||
}
|
||||
m_conversationManager->getComponent()->getStanzaChannel()->sendMessage(m_subject);
|
||||
}
|
||||
|
||||
m_cachedMessages.clear();
|
||||
}
|
||||
|
||||
|
|
|
@ -313,6 +313,10 @@ class ConversationManagerTest : public CPPUNIT_NS :: TestFixture, public BasicTe
|
|||
conv->setNickname("nickname");
|
||||
conv->addJID("user@localhost/resource");
|
||||
|
||||
boost::shared_ptr<Swift::Message> msg0(new Swift::Message());
|
||||
msg0->setSubject("subject");
|
||||
conv->handleMessage(msg0, "anotheruser");
|
||||
|
||||
CPPUNIT_ASSERT(!user->shouldCacheMessages());
|
||||
|
||||
// disconnectUser
|
||||
|
@ -350,7 +354,7 @@ class ConversationManagerTest : public CPPUNIT_NS :: TestFixture, public BasicTe
|
|||
injectPresence(response);
|
||||
loop->processEvents();
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(3, (int) received.size());
|
||||
CPPUNIT_ASSERT_EQUAL(4, (int) received.size());
|
||||
CPPUNIT_ASSERT(dynamic_cast<Swift::Message *>(getStanza(received[1])));
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("hi there!"), dynamic_cast<Swift::Message *>(getStanza(received[1]))->getBody());
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("user@localhost/resource"), dynamic_cast<Swift::Message *>(getStanza(received[1]))->getTo().toString());
|
||||
|
@ -361,6 +365,10 @@ class ConversationManagerTest : public CPPUNIT_NS :: TestFixture, public BasicTe
|
|||
CPPUNIT_ASSERT_EQUAL(std::string("user@localhost/resource"), dynamic_cast<Swift::Message *>(getStanza(received[2]))->getTo().toString());
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("#room@localhost/anotheruser"), dynamic_cast<Swift::Message *>(getStanza(received[2]))->getFrom().toString());
|
||||
|
||||
CPPUNIT_ASSERT(dynamic_cast<Swift::Message *>(getStanza(received[3])));
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("subject"), dynamic_cast<Swift::Message *>(getStanza(received[3]))->getSubject());
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("user@localhost/resource"), dynamic_cast<Swift::Message *>(getStanza(received[3]))->getTo().toString());
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("#room@localhost/anotheruser"), dynamic_cast<Swift::Message *>(getStanza(received[3]))->getFrom().toString());
|
||||
}
|
||||
|
||||
void handleGroupchatMessagesBouncerLeave() {
|
||||
|
|
Loading…
Add table
Reference in a new issue