summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
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));