summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-03-22 22:01:57 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-03-22 22:01:57 (GMT)
commitc1c973e8afe9826f82cc0bcda6e855aa76eeeabc (patch)
tree068349048b959ab4199505202bdbcbdc70ddcd34 /Swift
parent2e86507010e1f8754049a3bb37ce9041bb19d870 (diff)
downloadswift-contrib-c1c973e8afe9826f82cc0bcda6e855aa76eeeabc.zip
swift-contrib-c1c973e8afe9826f82cc0bcda6e855aa76eeeabc.tar.bz2
Don't prompt for subscription requests you've already added.
Diffstat (limited to 'Swift')
-rw-r--r--Swift/Controllers/RosterController.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/Swift/Controllers/RosterController.cpp b/Swift/Controllers/RosterController.cpp
index 0fc80eb..888d324 100644
--- a/Swift/Controllers/RosterController.cpp
+++ b/Swift/Controllers/RosterController.cpp
@@ -151,7 +151,10 @@ void RosterController::handleIncomingPresence(boost::shared_ptr<Presence> newPre
}
void RosterController::handleSubscriptionRequest(const JID& jid, const String& message) {
- //FIXME: If already subscribed, auto-subscribe
+ if (xmppRoster_->containsJID(jid) && xmppRoster_->getSubscriptionStateForJID(jid) == RosterItemPayload::To || xmppRoster_->getSubscriptionStateForJID(jid) == RosterItemPayload::Both) {
+ presenceOracle_->confirmSubscription(jid);
+ return;
+ }
SubscriptionRequestEvent* eventPointer = new SubscriptionRequestEvent(jid, message);
eventPointer->onAccept.connect(boost::bind(&RosterController::handleSubscriptionRequestAccepted, this, eventPointer));
eventPointer->onDecline.connect(boost::bind(&RosterController::handleSubscriptionRequestDeclined, this, eventPointer));