Send 307 and also 332 codes from rooms when stopping spectrum
This commit is contained in:
parent
fdfbc5dc78
commit
97a2cd5b2a
2 changed files with 10 additions and 3 deletions
|
@ -47,21 +47,28 @@ void Conversation::destroyRoom() {
|
|||
legacyName.replace(legacyName.find_last_of("@"), 1, "%"); // OK
|
||||
}
|
||||
presence->setFrom(Swift::JID(legacyName, m_conversationManager->getComponent()->getJID().toBare(), m_nickname));
|
||||
presence->setTo(m_jid);
|
||||
presence->setType(Swift::Presence::Unavailable);
|
||||
|
||||
Swift::MUCItem item;
|
||||
item.affiliation = Swift::MUCOccupant::NoAffiliation;
|
||||
item.role = Swift::MUCOccupant::NoRole;
|
||||
item.actor = "Transport";
|
||||
item.reason = "Spectrum 2 transport is being shut down.";
|
||||
Swift::MUCUserPayload *p = new Swift::MUCUserPayload ();
|
||||
p->addItem(item);
|
||||
|
||||
Swift::MUCUserPayload::StatusCode c;
|
||||
c.code = 332;
|
||||
p->addStatusCode(c);
|
||||
Swift::MUCUserPayload::StatusCode c2;
|
||||
c2.code = 307;
|
||||
p->addStatusCode(c2);
|
||||
|
||||
presence->addPayload(boost::shared_ptr<Swift::Payload>(p));
|
||||
m_conversationManager->getComponent()->getStanzaChannel()->sendPresence(presence);
|
||||
BOOST_FOREACH(const Swift::JID &jid, m_jids) {
|
||||
presence->setTo(jid);
|
||||
m_conversationManager->getComponent()->getStanzaChannel()->sendPresence(presence);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -402,7 +402,7 @@ class ConversationManagerTest : public CPPUNIT_NS :: TestFixture, public BasicTe
|
|||
User *user = userManager->getUser("user@localhost");
|
||||
TestingConversation *conv = new TestingConversation(user->getConversationManager(), "#room", true);
|
||||
conv->setNickname("nickname");
|
||||
conv->setJID("user@localhost/resource");
|
||||
conv->addJID("user@localhost/resource");
|
||||
received.clear();
|
||||
conv->destroyRoom();
|
||||
delete conv;
|
||||
|
|
Loading…
Add table
Reference in a new issue