summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-09-20 20:38:30 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-09-20 20:38:30 (GMT)
commit703a1c28c3c87ac0fb365ff0683d7c64fcdd2210 (patch)
treed8a6628f64403df172dafc6a85a8b03fab3e455e /Swiften/Queries
parent5c1ec7985808aba408bec724f5b90fed0dbcb7ce (diff)
downloadswift-contrib-703a1c28c3c87ac0fb365ff0683d7c64fcdd2210.zip
swift-contrib-703a1c28c3c87ac0fb365ff0683d7c64fcdd2210.tar.bz2
Added ClientBlockListManager.
Diffstat (limited to 'Swiften/Queries')
-rw-r--r--Swiften/Queries/IQRouter.h10
-rw-r--r--Swiften/Queries/Request.cpp7
-rw-r--r--Swiften/Queries/Request.h1
-rw-r--r--Swiften/Queries/Responder.h4
4 files changed, 16 insertions, 6 deletions
diff --git a/Swiften/Queries/IQRouter.h b/Swiften/Queries/IQRouter.h
index 167cb8f..8dba334 100644
--- a/Swiften/Queries/IQRouter.h
+++ b/Swiften/Queries/IQRouter.h
@@ -63,6 +63,16 @@ namespace Swift {
bool isAvailable();
+ /**
+ * Checks whether the given jid is the account JID (i.e. it is either
+ * the bare JID, or it is the empty JID).
+ * Can be used to check whether a stanza is sent by the server on behalf
+ * of the user's account.
+ */
+ bool isAccountJID(const JID& jid) {
+ return jid.isValid() ? jid_.toBare().equals(jid, JID::WithResource) : true;
+ }
+
private:
void handleIQ(boost::shared_ptr<IQ> iq);
void processPendingRemoves();
diff --git a/Swiften/Queries/Request.cpp b/Swiften/Queries/Request.cpp
index 0126d62..382e44c 100644
--- a/Swiften/Queries/Request.cpp
+++ b/Swiften/Queries/Request.cpp
@@ -67,16 +67,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;
-}
}
diff --git a/Swiften/Queries/Request.h b/Swiften/Queries/Request.h
index a7139cf..677a758 100644
--- a/Swiften/Queries/Request.h
+++ b/Swiften/Queries/Request.h
@@ -60,7 +60,6 @@ namespace Swift {
private:
bool handleIQ(boost::shared_ptr<IQ>);
bool isCorrectSender(const JID& jid);
- bool isAccountJID(const JID& jid);
private:
IQRouter* router_;
diff --git a/Swiften/Queries/Responder.h b/Swiften/Queries/Responder.h
index a9aab17..2ba9c24 100644
--- a/Swiften/Queries/Responder.h
+++ b/Swiften/Queries/Responder.h
@@ -94,6 +94,10 @@ namespace Swift {
router_->sendIQ(IQ::createError(to, from, id, condition, type));
}
+ IQRouter* getIQRouter() const {
+ return router_;
+ }
+
private:
virtual bool handleIQ(boost::shared_ptr<IQ> iq) {
if (iq->getType() == IQ::Set || iq->getType() == IQ::Get) {