Changeset - 36b444536cb0
[Not reviewed]
0 7 0
Jan Kaluza - 10 years ago 2015-12-14 13:59:05
jkaluza@redhat.com
Fix regression when 'from' attribute has not been sent in some situations in server mode.
7 files changed with 19 insertions and 1 deletions:
0 comments (0 inline, 0 general)
include/Swiften/Server/Server.cpp
Show inline comments
 
@@ -48,7 +48,7 @@ Server::Server(
 
			selfJID(jid),
 
			stanzaChannel_(),
 
			address_(address){
 
	stanzaChannel_ = new ServerStanzaChannel();
 
	stanzaChannel_ = new ServerStanzaChannel(selfJID);
 
	iqRouter_ = new IQRouter(stanzaChannel_);
 
	tlsFactory = NULL;
 
	parserFactory_ = new PlatformXMLParserFactory();
include/Swiften/Server/ServerStanzaChannel.cpp
Show inline comments
 
@@ -102,6 +102,10 @@ void ServerStanzaChannel::send(boost::shared_ptr<Stanza> stanza) {
 
	JID to = stanza->getTo();
 
	assert(to.isValid());
 

	
 
	if (!stanza->getFrom().isValid()) {
 
		stanza->setFrom(m_jid);
 
	}
 

	
 
	// For a full JID, first try to route to a session with the full JID
 
	if (!to.isBare()) {
 
		std::list<boost::shared_ptr<ServerFromClientSession> >::const_iterator i = std::find_if(sessions[stanza->getTo().toBare().toString()].begin(), sessions[stanza->getTo().toBare().toString()].end(), HasJID(to));
include/Swiften/Server/ServerStanzaChannel.h
Show inline comments
 
@@ -22,6 +22,9 @@ namespace Swift {
 
	class Error;
 
	class ServerStanzaChannel : public StanzaChannel {
 
		public:
 
			ServerStanzaChannel(const JID &selfJID) : StanzaChannel() {
 
				m_jid = selfJID;
 
			}
 
			void addSession(boost::shared_ptr<ServerFromClientSession> session);
 
			void removeSession(boost::shared_ptr<ServerFromClientSession> session);
 

	
 
@@ -54,6 +57,7 @@ namespace Swift {
 
			void handleSessionInitialized();
 

	
 
		private:
 
			JID m_jid;
 
			IDGenerator idGenerator;
 
			// [JID][resources][ServerFromClientSession]
 
			std::map<std::string, std::list<boost::shared_ptr<ServerFromClientSession> > > sessions;
spectrum/src/frontends/xmpp/XMPPUserManager.cpp
Show inline comments
 
@@ -31,6 +31,7 @@
 
#include "gatewayresponder.h"
 
#include "adhocmanager.h"
 
#include "settingsadhoccommand.h"
 
#include "RosterResponder.h"
 

	
 
#include "Swiften/Server/ServerStanzaChannel.h"
 
#include "Swiften/Elements/StreamError.h"
 
@@ -75,6 +76,9 @@ XMPPUserManager::XMPPUserManager(Component *component, UserRegistry *userRegistr
 
	m_gatewayResponder = new GatewayResponder(frontend->getIQRouter(), this);
 
	m_gatewayResponder->start();
 

	
 
	m_rosterResponder = new RosterResponder(frontend->getIQRouter(), this);
 
	m_rosterResponder->start();
 

	
 
	m_adHocManager = new AdHocManager(component, frontend->getDiscoItemsResponder(), this, storageBackend);
 
	m_adHocManager->start();
 

	
 
@@ -97,6 +101,7 @@ XMPPUserManager::~XMPPUserManager() {
 
	delete m_adHocManager;
 
	delete m_settings;
 
	delete m_vcardResponder;
 
	delete m_rosterResponder;
 
}
 

	
 
void XMPPUserManager::sendVCard(unsigned int id, Swift::VCard::ref vcard) {
spectrum/src/frontends/xmpp/XMPPUserManager.h
Show inline comments
 
@@ -39,6 +39,7 @@ class XMPPUserRegistration;
 
class GatewayResponder;
 
class AdHocManager;
 
class SettingsAdHocCommandFactory;
 
class RosterResponder;
 

	
 
class XMPPUserManager : public UserManager {
 
	public:
 
@@ -61,6 +62,7 @@ class XMPPUserManager : public UserManager {
 
		GatewayResponder *m_gatewayResponder;
 
		AdHocManager *m_adHocManager;
 
		SettingsAdHocCommandFactory *m_settings;
 
		RosterResponder *m_rosterResponder;
 
};
 

	
 
}
spectrum/src/tests/irc_test.py
Show inline comments
 
@@ -43,6 +43,8 @@ class Client(sleekxmpp.ClientXMPP):
 
				self.echo_received = True
 

	
 
	def start(self, event):
 
		self.getRoster()
 
		self.sendPresence()
 
		self.plugin['xep_0045'].joinMUC(self.room, self.nick, wait=True)
 
		self.send_message(mto=self.room, mbody="abc", mtype='groupchat')
 
		#time.sleep(10)
src/tests/rostermanager.cpp
Show inline comments
 
@@ -95,6 +95,7 @@ class RosterManagerTest : public CPPUNIT_NS :: TestFixture, public BasicTest {
 
		Swift::RosterItemPayload item = payload1->getItems()[0];
 
		CPPUNIT_ASSERT_EQUAL(std::string("buddy1"), Buddy::JIDToLegacyName(item.getJID()));
 
		CPPUNIT_ASSERT_EQUAL(std::string("Buddy 1"), item.getName());
 
		CPPUNIT_ASSERT_EQUAL(std::string("localhost"), getStanza(received[0])->getFrom().toString());
 

	
 
		Swift::RosterPayload::ref payload2 = getStanza(received[2])->getPayload<Swift::RosterPayload>();
 
		CPPUNIT_ASSERT(payload2);
0 comments (0 inline, 0 general)