diff options
| author | Remko Tronçon <git@el-tramo.be> | 2011-05-13 22:20:04 (GMT) | 
|---|---|---|
| committer | Remko Tronçon <git@el-tramo.be> | 2011-05-13 22:20:04 (GMT) | 
| commit | 9a6d7a8c18024b400174be8008b9f19c18a8131f (patch) | |
| tree | 4461fed0c6386fa865a1eeedecc05a378710c6b1 | |
| parent | e8ce0b8e97466e9fa849da6a8c0a4df77fbd0ddd (diff) | |
| download | swift-contrib-9a6d7a8c18024b400174be8008b9f19c18a8131f.zip swift-contrib-9a6d7a8c18024b400174be8008b9f19c18a8131f.tar.bz2 | |
Cut dependency from AdHocCommandSession on DiscoItem.
| -rw-r--r-- | Swift/Controllers/AdHocManager.cpp | 3 | ||||
| -rw-r--r-- | Swiften/AdHoc/OutgoingAdHocCommandSession.cpp | 8 | ||||
| -rw-r--r-- | Swiften/AdHoc/OutgoingAdHocCommandSession.h | 5 | 
3 files changed, 9 insertions, 7 deletions
| diff --git a/Swift/Controllers/AdHocManager.cpp b/Swift/Controllers/AdHocManager.cpp index 834aaec..e926138 100644 --- a/Swift/Controllers/AdHocManager.cpp +++ b/Swift/Controllers/AdHocManager.cpp @@ -8,6 +8,7 @@  #include <boost/bind.hpp>  #include <boost/shared_ptr.hpp> +#include <boost/smart_ptr/make_shared.hpp>  #include <Swiften/Base/foreach.h>  #include <Swiften/Queries/IQRouter.h> @@ -62,7 +63,7 @@ void AdHocManager::handleServerDiscoItemsResponse(boost::shared_ptr<DiscoItems>  void AdHocManager::handleUIEvent(boost::shared_ptr<UIEvent> event) {  	boost::shared_ptr<RequestAdHocUIEvent> adHocEvent = boost::dynamic_pointer_cast<RequestAdHocUIEvent>(event);  	if (adHocEvent) { -		factory_->createAdHocCommandWindow(boost::shared_ptr<OutgoingAdHocCommandSession>(new OutgoingAdHocCommandSession(adHocEvent->getCommand(), iqRouter_))); +		factory_->createAdHocCommandWindow(boost::make_shared<OutgoingAdHocCommandSession>(adHocEvent->getCommand().getJID(), adHocEvent->getCommand().getNode(), iqRouter_));  	}  } diff --git a/Swiften/AdHoc/OutgoingAdHocCommandSession.cpp b/Swiften/AdHoc/OutgoingAdHocCommandSession.cpp index 0632bbf..ecc6cd0 100644 --- a/Swiften/AdHoc/OutgoingAdHocCommandSession.cpp +++ b/Swiften/AdHoc/OutgoingAdHocCommandSession.cpp @@ -13,7 +13,7 @@  #include <Swiften/Base/Algorithm.h>  namespace Swift { -OutgoingAdHocCommandSession::OutgoingAdHocCommandSession(const DiscoItems::Item& command, IQRouter* iqRouter) : command_(command), iqRouter_(iqRouter), isMultiStage_(false) { +OutgoingAdHocCommandSession::OutgoingAdHocCommandSession(const JID& to, const std::string& commandNode, IQRouter* iqRouter) : to_(to), commandNode_(commandNode), iqRouter_(iqRouter), isMultiStage_(false) {  } @@ -57,7 +57,7 @@ bool OutgoingAdHocCommandSession::getIsMultiStage() const {  }  void OutgoingAdHocCommandSession::start() { -	boost::shared_ptr<GenericRequest<Command> > commandRequest = boost::make_shared< GenericRequest<Command> >(IQ::Set, command_.getJID(), boost::make_shared<Command>(command_.getNode()), iqRouter_); +	boost::shared_ptr<GenericRequest<Command> > commandRequest = boost::make_shared< GenericRequest<Command> >(IQ::Set, to_, boost::make_shared<Command>(commandNode_), iqRouter_);  	commandRequest->onResponse.connect(boost::bind(&OutgoingAdHocCommandSession::handleResponse, this, _1, _2));  	commandRequest->send();  } @@ -81,9 +81,9 @@ void OutgoingAdHocCommandSession::goNext(Form::ref form) {  }  void OutgoingAdHocCommandSession::submitForm(Form::ref form, Command::Action action) { -	boost::shared_ptr<Command> command(boost::make_shared<Command>(command_.getNode(), sessionID_, action)); +	boost::shared_ptr<Command> command(boost::make_shared<Command>(commandNode_, sessionID_, action));  	command->setForm(form); -	boost::shared_ptr<GenericRequest<Command> > commandRequest = boost::make_shared< GenericRequest<Command> >(IQ::Set, command_.getJID(), command, iqRouter_); +	boost::shared_ptr<GenericRequest<Command> > commandRequest = boost::make_shared< GenericRequest<Command> >(IQ::Set, to_, command, iqRouter_);  	commandRequest->onResponse.connect(boost::bind(&OutgoingAdHocCommandSession::handleResponse, this, _1, _2));  	commandRequest->send();  } diff --git a/Swiften/AdHoc/OutgoingAdHocCommandSession.h b/Swiften/AdHoc/OutgoingAdHocCommandSession.h index 6b80300..5c27022 100644 --- a/Swiften/AdHoc/OutgoingAdHocCommandSession.h +++ b/Swiften/AdHoc/OutgoingAdHocCommandSession.h @@ -29,7 +29,7 @@ namespace Swift {  				Enabled /** Action is applicable and currently available */ = 2,  				EnabledAndPresent = 3}; -			OutgoingAdHocCommandSession(const DiscoItems::Item& command, IQRouter* iqRouter); +			OutgoingAdHocCommandSession(const JID& to, const std::string& commandNode, IQRouter* iqRouter);  			/**  			 * Send initial request to the target.  			 */ @@ -82,7 +82,8 @@ namespace Swift {  			void submitForm(Form::ref, Command::Action action);  		private: -			DiscoItems::Item command_; +			JID to_; +			std::string commandNode_;  			IQRouter* iqRouter_;  			bool isMultiStage_;  			std::string sessionID_; | 
 Swift
 Swift