summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Queries/Request.cpp')
-rw-r--r--Swiften/Queries/Request.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/Swiften/Queries/Request.cpp b/Swiften/Queries/Request.cpp
index 95fd25e..f3f56c9 100644
--- a/Swiften/Queries/Request.cpp
+++ b/Swiften/Queries/Request.cpp
@@ -4,8 +4,8 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Queries/Request.h"
-#include "Swiften/Queries/IQRouter.h"
+#include <Swiften/Queries/Request.h>
+#include <Swiften/Queries/IQRouter.h>
#include <Swiften/Elements/RawXMLPayload.h>
namespace Swift {
@@ -16,6 +16,12 @@ Request::Request(IQ::Type type, const JID& receiver, boost::shared_ptr<Payload>
Request::Request(IQ::Type type, const JID& receiver, IQRouter* router) : router_(router), type_(type), receiver_(receiver), sent_(false) {
}
+Request::Request(IQ::Type type, const JID& sender, const JID& receiver, boost::shared_ptr<Payload> payload, IQRouter* router) : router_(router), type_(type), sender_(sender), receiver_(receiver), payload_(payload), sent_(false) {
+}
+
+Request::Request(IQ::Type type, const JID& sender, const JID& receiver, IQRouter* router) : router_(router), type_(type), sender_(sender), receiver_(receiver), sent_(false) {
+}
+
void Request::send() {
assert(payload_);
assert(!sent_);
@@ -23,6 +29,7 @@ void Request::send() {
boost::shared_ptr<IQ> iq(new IQ(type_));
iq->setTo(receiver_);
+ iq->setFrom(sender_);
iq->addPayload(payload_);
id_ = router_->getNewIQID();
iq->setID(id_);
@@ -67,16 +74,13 @@ bool Request::handleIQ(boost::shared_ptr<IQ> iq) {
}
bool Request::isCorrectSender(const JID& jid) {
- if (isAccountJID(receiver_)) {
- return isAccountJID(jid);
+ if (router_->isAccountJID(receiver_)) {
+ return router_->isAccountJID(jid);
}
else {
return jid.equals(receiver_, JID::WithResource);
}
}
-bool Request::isAccountJID(const JID& jid) {
- return jid.isValid() ? router_->getJID().toBare().equals(jid, JID::WithResource) : true;
-}
}