Changeset - 9ff51c193cc3
[Not reviewed]
0 3 0
Jan Kaluza - 9 years ago 2016-01-05 15:44:18
jkaluza@redhat.com
Twitter: Fix joining room by disabling sending raw xml to backends which do not need it
3 files changed with 10 insertions and 1 deletions:
0 comments (0 inline, 0 general)
backends/twitter/TwitterPlugin.cpp
Show inline comments
 
@@ -174,15 +174,16 @@ void TwitterPlugin::handleLogoutRequest(const std::string &user, const std::stri
 
}
 

	
 
// User joining a Chatroom
 
void TwitterPlugin::handleJoinRoomRequest(const std::string &user, const std::string &room, const std::string &nickname, const std::string &password)
 
{
 
	if(room == adminChatRoom) {	
 
		LOG4CXX_INFO(logger, "Received Join Twitter room request for " << user)
 
		LOG4CXX_INFO(logger, "Received Join Twitter room request for " << user << " '" << nickname << "'")
 

	
 
		setTwitterMode(user, 2);
 
		handleParticipantChanged(user, nickname, room, 0, pbnetwork::STATUS_ONLINE);
 
		handleParticipantChanged(user, adminNickName, room, 0, pbnetwork::STATUS_ONLINE);
 
		userdb[user].nickName = nickname;
 
		handleMessage(user, adminChatRoom, "Connected to Twitter room! Populating your followers list", adminNickName);
 
		tp->runAsThread(new FetchFriends(userdb[user].sessions, user,
 
										 boost::bind(&TwitterPlugin::populateRoster, this, _1, _2, _3, _4)));
 
	} else {
libtransport/NetworkPluginServer.cpp
Show inline comments
 
@@ -1100,12 +1100,16 @@ void NetworkPluginServer::handleElement(boost::shared_ptr<Swift::Element> elemen
 

	
 
void NetworkPluginServer::handleRawXML(const std::string &xml) {
 
	m_xmppParser->parse(xml);
 
}
 

	
 
void NetworkPluginServer::handleRawPresenceReceived(boost::shared_ptr<Swift::Presence> presence) {
 
	if (!CONFIG_BOOL_DEFAULTED(m_config, "features.rawxml", false)) {
 
		return;
 
	}
 

	
 
	User *user = m_userManager->getUser(presence->getFrom().toBare());
 
	if (!user)
 
		return;
 

	
 
	Backend *c = (Backend *) user->getData();
 
	if (!c) {
tests/twitter/twitter_test.py
Show inline comments
 
@@ -38,12 +38,13 @@ class Client(sleekxmpp.ClientXMPP):
 
		self.tests["follow"] = ["#follow command", False]
 
		self.tests["friends"] = ["#friends command", False]
 
		self.tests["unfollow"] = ["#unfollow command", False]
 
		self.tests["friends2"] = ["#friends after unfollow command", False]
 
		self.tests["mode1"] = ["#mode 1 response", False]
 
		self.tests["mode1buddy"] = ["#mode 1 buddy added", False]
 
		self.tests["mode2"] = ["#mode 2 join room", False]
 

	
 
		self.status = "timeline"
 
		self.timestamp = int(time.time())
 

	
 
	def message(self, msg):
 
		if self.status == "timeline" and msg['body'].find("spectrum2tests") != -1 and msg['body'].find("MsgId") != -1:
 
@@ -80,12 +81,15 @@ class Client(sleekxmpp.ClientXMPP):
 
			self.finished = True
 

	
 
	def roster_update(self, iq):
 
		roster = iq['roster']['items']
 

	
 
		if self.status == "mode1" and roster.has_key("colinpwheeler@localhost"):
 
			self.plugin['xep_0045'].joinMUC("#twitter@localhost", "client", wait=True)
 
			self.tests["mode2"][1] = True
 
			self.plugin['xep_0045'].leaveMUC("#twitter@localhost", "client")
 
			self.status = "unfollow"
 
			self.tests["mode1buddy"][1] = True
 
			self.send_message(mto="twitter.com@localhost", mbody="#unfollow colinpwheeler")
 

	
 
	def start(self, event):
 
		self.getRoster()
0 comments (0 inline, 0 general)