Changeset - fd686f55a0a5
[Not reviewed]
0 2 0
Jan Kaluza - 12 years ago 2013-02-27 09:54:59
hanzz.k@gmail.com
Send raw presences also to rooms
2 files changed with 8 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/networkpluginserver.cpp
Show inline comments
 
@@ -1444,24 +1444,26 @@ void NetworkPluginServer::handleUserReadyToConnect(User *user) {
 

	
 
	Backend *c = (Backend *) user->getData();
 
	if (!c) {
 
		return;
 
	}
 
	send(c->connection, message);
 
}
 

	
 
void NetworkPluginServer::handleUserPresenceChanged(User *user, Swift::Presence::ref presence) {
 
	if (presence->getShow() == Swift::StatusShow::None)
 
		return;
 

	
 
	handleRawPresenceReceived(presence);
 

	
 
	UserInfo userInfo = user->getUserInfo();
 

	
 
	pbnetwork::Status status;
 
	status.set_username(user->getJID().toBare());
 

	
 
	bool isInvisible = presence->getPayload<Swift::InvisiblePayload>() != NULL;
 
	if (isInvisible) {
 
		LOG4CXX_INFO(logger, "This presence is invisible");
 
		status.set_status((pbnetwork::STATUS_INVISIBLE));
 
	}
 
	else {
 
		status.set_status((pbnetwork::StatusType) presence->getShow());
src/user.cpp
Show inline comments
 
@@ -249,24 +249,26 @@ void User::handlePresence(Swift::Presence::ref presence, bool forceJoin) {
 
				BOOST_FOREACH(Swift::Presence::ref &p, m_joinedRooms) {
 
					if (p->getTo() == presence->getTo()) {
 
						m_joinedRooms.remove(p);
 
						break;
 
					}
 
				}
 

	
 
				if (conv) {
 
					m_conversationManager->removeConversation(conv);
 
					delete conv;
 
				}
 
			}
 

	
 
			return;
 
		}
 
		else if (isMUC) {
 
			// force connection to legacy network to let backend to handle auto-join on connect.
 
			if (!m_readyForConnect) {
 
				LOG4CXX_INFO(logger, m_jid.toString() << ": Ready to be connected to legacy network");
 
				m_readyForConnect = true;
 
				onReadyToConnect();
 
			}
 

	
 
			std::string room = Buddy::JIDToLegacyName(presence->getTo());
 
			std::string password = "";
 
			if (presence->getPayload<Swift::MUCPayload>() != NULL) {
 
@@ -306,28 +308,31 @@ void User::handlePresence(Swift::Presence::ref presence, bool forceJoin) {
 
				return;
 
			}
 

	
 
			LOG4CXX_INFO(logger, m_jid.toString() << ": Going to join room " << room << " as " << presence->getTo().getResource());
 

	
 
			conv = m_component->getFactory()->createConversation(m_conversationManager, room, true);
 
			m_conversationManager->addConversation(conv);
 
			conv->setNickname(presence->getTo().getResource());
 
			conv->addJID(presence->getFrom());
 

	
 
			onRawPresenceReceived(presence);
 
			onRoomJoined(presence->getFrom(), room, presence->getTo().getResource(), password);
 
		}
 

	
 
			return;
 
		}
 

	
 
		onRawPresenceReceived(presence);
 
	}
 

	
 
	int currentResourcesCount = m_presenceOracle->getAllPresence(m_jid).size();
 

	
 
	m_conversationManager->resetResources();
 

	
 

	
 
	if (presence->getType() == Swift::Presence::Unavailable) {
 
		m_conversationManager->removeJID(presence->getFrom());
 

	
 
		std::string presences;
 
		std::vector<Swift::Presence::ref> ps = m_presenceOracle->getAllPresence(m_jid);
 
		BOOST_FOREACH(Swift::Presence::ref p, ps) {
 
			if (p != presence) {
0 comments (0 inline, 0 general)