summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2012-02-09 20:22:04 (GMT)
committerKevin Smith <git@kismith.co.uk>2012-02-09 20:22:04 (GMT)
commit24afb2e086b62719fec45a5eeb04a7ba24918220 (patch)
tree27b7add095de97385d545bd083767dd31df800dd
parent94b7aaf53c8b20e03c8081cce49cda14cd5c01da (diff)
downloadswift-contrib-24afb2e086b62719fec45a5eeb04a7ba24918220.zip
swift-contrib-24afb2e086b62719fec45a5eeb04a7ba24918220.tar.bz2
Fixes for mediated invites
-rw-r--r--Swift/Controllers/Chat/ChatControllerBase.cpp5
-rw-r--r--Swift/Controllers/Chat/ChatsManager.cpp10
2 files changed, 8 insertions, 7 deletions
diff --git a/Swift/Controllers/Chat/ChatControllerBase.cpp b/Swift/Controllers/Chat/ChatControllerBase.cpp
index f8f30ff..db71397 100644
--- a/Swift/Controllers/Chat/ChatControllerBase.cpp
+++ b/Swift/Controllers/Chat/ChatControllerBase.cpp
@@ -273,10 +273,7 @@ void ChatControllerBase::handleMUCInvitation(Message::ref message) {
void ChatControllerBase::handleMediatedMUCInvitation(Message::ref message) {
MUCUserPayload::Invite invite = *message->getPayload<MUCUserPayload>()->getInvite();
- JID from;
- if (invite.from.isValid()) {
- from = invite.from;
- }
+ JID from = message->getFrom();
std::string reason;
if (!invite.reason.empty()) {
reason = invite.reason;
diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp
index ff00bc1..c19c524 100644
--- a/Swift/Controllers/Chat/ChatsManager.cpp
+++ b/Swift/Controllers/Chat/ChatsManager.cpp
@@ -575,13 +575,17 @@ void ChatsManager::handleSearchMUCRequest() {
void ChatsManager::handleIncomingMessage(boost::shared_ptr<Message> message) {
JID jid = message->getFrom();
boost::shared_ptr<MessageEvent> event(new MessageEvent(message));
- bool isInvite = message->getPayload<MUCInvitationPayload>() || (message->getPayload<MUCUserPayload>() && message->getPayload<MUCUserPayload>()->getInvite());
- if (!event->isReadable() && !message->getPayload<ChatState>() && !message->getPayload<DeliveryReceipt>() && !message->getPayload<DeliveryReceiptRequest>() && !isInvite && !message->hasSubject()) {
+ bool isInvite = message->getPayload<MUCInvitationPayload>();
+ bool isMediatedInvite = (message->getPayload<MUCUserPayload>() && message->getPayload<MUCUserPayload>()->getInvite());
+ if (isMediatedInvite) {
+ jid = (*message->getPayload<MUCUserPayload>()->getInvite()).from;
+ }
+ if (!event->isReadable() && !message->getPayload<ChatState>() && !message->getPayload<DeliveryReceipt>() && !message->getPayload<DeliveryReceiptRequest>() && !isInvite && !isMediatedInvite && !message->hasSubject()) {
return;
}
// Try to deliver it to a MUC
- if (message->getType() == Message::Groupchat || message->getType() == Message::Error || (isInvite && message->getType() == Message::Normal)) {
+ if (message->getType() == Message::Groupchat || message->getType() == Message::Error /*|| (isInvite && message->getType() == Message::Normal)*/) {
std::map<JID, MUCController*>::iterator i = mucControllers_.find(jid.toBare());
if (i != mucControllers_.end()) {
i->second->handleIncomingMessage(event);