From c1c973e8afe9826f82cc0bcda6e855aa76eeeabc Mon Sep 17 00:00:00 2001
From: Kevin Smith <git@kismith.co.uk>
Date: Mon, 22 Mar 2010 22:01:57 +0000
Subject: Don't prompt for subscription requests you've already added.


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));
-- 
cgit v0.10.2-6-g49f6