summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2012-02-06 12:59:12 (GMT)
committerKevin Smith <git@kismith.co.uk>2012-02-06 13:39:43 (GMT)
commit94b7aaf53c8b20e03c8081cce49cda14cd5c01da (patch)
tree95b73b6021f332da7ae3197ad2c97dee2f2ebae3 /Swift/Controllers/Chat/ChatControllerBase.cpp
parentf3d68b13e120f471326449f68aa4140587d444fc (diff)
downloadswift-contrib-94b7aaf53c8b20e03c8081cce49cda14cd5c01da.zip
swift-contrib-94b7aaf53c8b20e03c8081cce49cda14cd5c01da.tar.bz2
Display mediated invites
Diffstat (limited to 'Swift/Controllers/Chat/ChatControllerBase.cpp')
-rw-r--r--Swift/Controllers/Chat/ChatControllerBase.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/Swift/Controllers/Chat/ChatControllerBase.cpp b/Swift/Controllers/Chat/ChatControllerBase.cpp
index ecb9288..f8f30ff 100644
--- a/Swift/Controllers/Chat/ChatControllerBase.cpp
+++ b/Swift/Controllers/Chat/ChatControllerBase.cpp
@@ -20,6 +20,7 @@
#include <Swiften/Client/StanzaChannel.h>
#include <Swiften/Elements/Delay.h>
#include <Swiften/Elements/MUCInvitationPayload.h>
+#include <Swiften/Elements/MUCUserPayload.h>
#include <Swiften/Base/foreach.h>
#include <Swift/Controllers/XMPPEvents/EventController.h>
#include <Swiften/Disco/EntityCapsProvider.h>
@@ -181,6 +182,10 @@ void ChatControllerBase::handleIncomingMessage(boost::shared_ptr<MessageEvent> m
handleMUCInvitation(messageEvent->getStanza());
return;
}
+ else if (messageEvent->getStanza()->getPayload<MUCUserPayload>() && messageEvent->getStanza()->getPayload<MUCUserPayload>()->getInvite()) {
+ handleMediatedMUCInvitation(messageEvent->getStanza());
+ return;
+ }
else {
if (!messageEvent->isReadable()) {
return;
@@ -266,4 +271,23 @@ void ChatControllerBase::handleMUCInvitation(Message::ref message) {
chatWindow_->addMUCInvitation(invite->getJID(), invite->getReason(), invite->getPassword());
}
+void ChatControllerBase::handleMediatedMUCInvitation(Message::ref message) {
+ MUCUserPayload::Invite invite = *message->getPayload<MUCUserPayload>()->getInvite();
+ JID from;
+ if (invite.from.isValid()) {
+ from = invite.from;
+ }
+ std::string reason;
+ if (!invite.reason.empty()) {
+ reason = invite.reason;
+ }
+ std::string password;
+ if (message->getPayload<MUCUserPayload>()->getPassword()) {
+ password = *message->getPayload<MUCUserPayload>()->getPassword();
+ }
+ chatWindow_->addMUCInvitation(from, reason, password, false);
+}
+
+
+
}