summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-04-12 13:47:07 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-04-12 13:47:07 (GMT)
commita65372d1a0a85d04329cd91bcf6bdff2de492c80 (patch)
treee9ac9af516f402aa4ee62027894a28da5cab98ec /Swift/Controllers
parented38ddf609f1190ecb2aebb5e23ead115e6a6a8d (diff)
downloadswift-contrib-a65372d1a0a85d04329cd91bcf6bdff2de492c80.zip
swift-contrib-a65372d1a0a85d04329cd91bcf6bdff2de492c80.tar.bz2
Show ErrorEvent when roster push fails.
Resolves: #293
Diffstat (limited to 'Swift/Controllers')
-rw-r--r--Swift/Controllers/RosterController.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/Swift/Controllers/RosterController.cpp b/Swift/Controllers/RosterController.cpp
index 6ddabc2..ab1f1fb 100644
--- a/Swift/Controllers/RosterController.cpp
+++ b/Swift/Controllers/RosterController.cpp
@@ -15,6 +15,7 @@
#include "Swiften/Queries/Requests/GetRosterRequest.h"
#include "Swiften/Queries/Requests/SetRosterRequest.h"
#include "Swiften/Events/SubscriptionRequestEvent.h"
+#include "Swiften/Events/ErrorEvent.h"
#include "Swiften/Presence/PresenceOracle.h"
#include "Swift/Controllers/EventController.h"
#include "Swiften/Queries/IQRouter.h"
@@ -180,7 +181,12 @@ void RosterController::handleUIEvent(boost::shared_ptr<UIEvent> event) {
}
void RosterController::handleRosterSetError(boost::optional<ErrorPayload> error, boost::shared_ptr<RosterPayload> rosterPayload) {
- //FIXME: Create error events.
+ String text = "Server " + myJID_.getDomain() + " rejected roster change to item '" + rosterPayload->getItems()[0].getJID() + "'";
+ if (!error->getText().isEmpty()) {
+ text += ": " + error->getText();
+ }
+ boost::shared_ptr<ErrorEvent> errorEvent(new ErrorEvent(JID(myJID_.getDomain()), text));
+ eventController_->handleIncomingEvent(errorEvent);
}
void RosterController::handleIncomingPresence(boost::shared_ptr<Presence> newPresence, boost::shared_ptr<Presence> /*oldPresence*/) {