summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-03-22 20:37:30 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-03-22 20:37:30 (GMT)
commit0c377fa93ffd8538da9e71ddc71d4e8c07600a22 (patch)
treefa655b09f94cdb9018bfad4aa1de3dba2d345969 /Swift
parent1ebd045cadb3585c846ea38c63d508e5aa6ec1e7 (diff)
downloadswift-0c377fa93ffd8538da9e71ddc71d4e8c07600a22.zip
swift-0c377fa93ffd8538da9e71ddc71d4e8c07600a22.tar.bz2
Can now accept roster subscriptions.
Diffstat (limited to 'Swift')
-rw-r--r--Swift/Controllers/RosterController.cpp8
-rw-r--r--Swift/Controllers/XMPPRosterController.cpp2
-rw-r--r--Swift/QtUI/QtSubscriptionRequestWindow.cpp2
3 files changed, 8 insertions, 4 deletions
diff --git a/Swift/Controllers/RosterController.cpp b/Swift/Controllers/RosterController.cpp
index 4c55ea8..8d13057 100644
--- a/Swift/Controllers/RosterController.cpp
+++ b/Swift/Controllers/RosterController.cpp
@@ -142,6 +142,7 @@ void RosterController::handleIncomingPresence(boost::shared_ptr<Presence> newPre
}
void RosterController::handleSubscriptionRequest(const JID& jid, const String& message) {
+ //FIXME: If already subscribed, auto-subscribe
SubscriptionRequestEvent* eventPointer = new SubscriptionRequestEvent(jid, message);
eventPointer->onAccept.connect(boost::bind(&RosterController::handleSubscriptionRequestAccepted, this, eventPointer));
eventPointer->onDecline.connect(boost::bind(&RosterController::handleSubscriptionRequestDeclined, this, eventPointer));
@@ -150,11 +151,14 @@ void RosterController::handleSubscriptionRequest(const JID& jid, const String& m
}
void RosterController::handleSubscriptionRequestAccepted(SubscriptionRequestEvent* event) {
- //FIXME: do something
+ presenceOracle_->confirmSubscription(event->getJID());
+ if (!xmppRoster_->containsJID(event->getJID()) || xmppRoster_->getSubscriptionStateForJID(event->getJID()) == RosterItemPayload::None || xmppRoster_->getSubscriptionStateForJID(event->getJID()) == RosterItemPayload::From) {
+ presenceOracle_->requestSubscription(event->getJID());
+ }
}
void RosterController::handleSubscriptionRequestDeclined(SubscriptionRequestEvent* event) {
- //FIXME: do something
+ presenceOracle_->cancelSubscription(event->getJID());
}
void RosterController::handleAvatarChanged(const JID& jid, const String&) {
diff --git a/Swift/Controllers/XMPPRosterController.cpp b/Swift/Controllers/XMPPRosterController.cpp
index d089cff..01e5169 100644
--- a/Swift/Controllers/XMPPRosterController.cpp
+++ b/Swift/Controllers/XMPPRosterController.cpp
@@ -37,7 +37,7 @@ void XMPPRosterController::handleRosterReceived(boost::shared_ptr<RosterPayload>
if (item.getSubscription() == RosterItemPayload::Remove) {
xmppRoster_->removeContact(item.getJID());
} else {
- xmppRoster_->addContact(item.getJID(), item.getName(), item.getGroups());
+ xmppRoster_->addContact(item.getJID(), item.getName(), item.getGroups(), item.getSubscription());
}
}
}
diff --git a/Swift/QtUI/QtSubscriptionRequestWindow.cpp b/Swift/QtUI/QtSubscriptionRequestWindow.cpp
index df0c8e6..bda86f2 100644
--- a/Swift/QtUI/QtSubscriptionRequestWindow.cpp
+++ b/Swift/QtUI/QtSubscriptionRequestWindow.cpp
@@ -9,7 +9,7 @@
namespace Swift {
QtSubscriptionRequestWindow::QtSubscriptionRequestWindow(boost::shared_ptr<SubscriptionRequestEvent> event, QWidget* parent) : QDialog(parent), event_(event) {
- QString text = P2QSTRING(event->getJID().toString()) + " would like to add you to their roster. Would you like to add them to your roster and share your status when you're online? If you choose to defer this choice, you'll be asked again when you next login.";
+ QString text = P2QSTRING(event->getJID().toString()) + " would like to add you to their roster.\n Would you like to add them to your roster and share your status when you're online? \n\nIf you choose to defer this choice, you'll be asked again when you next login.";
QVBoxLayout* layout = new QVBoxLayout();
QLabel* label = new QLabel(text, this);
layout->addWidget(label);