summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Queries/Request.cpp')
-rw-r--r--Swiften/Queries/Request.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/Swiften/Queries/Request.cpp b/Swiften/Queries/Request.cpp
index 609d67b..189bbaa 100644
--- a/Swiften/Queries/Request.cpp
+++ b/Swiften/Queries/Request.cpp
@@ -4,7 +4,7 @@
namespace Swift {
-Request::Request(IQ::Type type, const JID& receiver, boost::shared_ptr<Payload> payload, IQRouter* router, AutoDeleteBehavior autoDeleteBehavior) : IQHandler(router), type_(type), receiver_(receiver), payload_(payload), autoDeleteBehavior_(autoDeleteBehavior) {
+Request::Request(IQ::Type type, const JID& receiver, boost::shared_ptr<Payload> payload, IQRouter* router, AutoDeleteBehavior autoDeleteBehavior) : IQHandler(router), type_(type), receiver_(receiver), payload_(payload), autoDeleteBehavior_(autoDeleteBehavior), sent_(false) {
id_ = getRouter()->getNewIQID();
}
@@ -13,12 +13,13 @@ void Request::send() {
iq->setTo(receiver_);
iq->addPayload(payload_);
iq->setID(id_);
+ sent_ = true;
getRouter()->sendIQ(iq);
}
bool Request::handleIQ(boost::shared_ptr<IQ> iq) {
bool handled = false;
- if (iq->getID() == id_) {
+ if (sent_ && iq->getID() == id_) {
if (iq->getType() == IQ::Result) {
handleResponse(iq->getPayloadOfSameType(payload_), boost::optional<Error>());
}