Changeset - 3ff7f9249074
[Not reviewed]
2 2 0
HanzZ - 13 years ago 2012-09-22 13:40:28
hanzz.k@gmail.com
Send status code 332 when spectrum goes down
4 files changed with 5 insertions and 128 deletions:
0 comments (0 inline, 0 general)
backends/twitter/userdb.cpp
Show inline comments
 
deleted file
backends/twitter/userdb.h
Show inline comments
 
deleted file
src/conversation.cpp
Show inline comments
 
@@ -46,24 +46,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;
 
		Swift::MUCUserPayload *p = new Swift::MUCUserPayload ();
 
		p->addItem(item);
 

	
 
		Swift::MUCUserPayload::StatusCode c;
 
		c.code = 332;
 
		p->addStatusCode(c);
 

	
 
		presence->addPayload(boost::shared_ptr<Swift::Payload>(p));
 
		m_conversationManager->getComponent()->getStanzaChannel()->sendPresence(presence);
 
	}
 
}
 

	
 
void Conversation::setRoom(const std::string &room) {
 
	m_room = room;
 
	m_legacyName = m_room + "/" + m_legacyName;
 
}
 

	
 
void Conversation::handleMessage(boost::shared_ptr<Swift::Message> &message, const std::string &nickname) {
 
	if (m_muc) {
src/tests/conversationmanager.cpp
Show inline comments
 
@@ -284,17 +284,18 @@ class ConversationManagerTest : public CPPUNIT_NS :: TestFixture, public BasicTe
 
		TestingConversation *conv = new TestingConversation(user->getConversationManager(), "#room", true);
 
		conv->setNickname("nickname");
 
		conv->setJID("user@localhost/resource");
 
		received.clear();
 
		conv->destroyRoom();
 
		delete conv;
 

	
 
		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());
 
		CPPUNIT_ASSERT_EQUAL(std::string("user@localhost/resource"), dynamic_cast<Swift::Presence *>(getStanza(received[0]))->getTo().toString());
 
		CPPUNIT_ASSERT_EQUAL(std::string("#room@localhost/nickname"), dynamic_cast<Swift::Presence *>(getStanza(received[0]))->getFrom().toString());
 
		CPPUNIT_ASSERT_EQUAL(332, getStanza(received[0])->getPayload<Swift::MUCUserPayload>()->getStatusCodes()[0].code);
 
	}
 

	
 
};
 

	
 
CPPUNIT_TEST_SUITE_REGISTRATION (ConversationManagerTest);
0 comments (0 inline, 0 general)