summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/MUC/MUC.cpp')
-rw-r--r--Swiften/MUC/MUC.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/Swiften/MUC/MUC.cpp b/Swiften/MUC/MUC.cpp
index 78546c8..9f6c7fb 100644
--- a/Swiften/MUC/MUC.cpp
+++ b/Swiften/MUC/MUC.cpp
@@ -145,15 +145,33 @@ void MUC::handleIncomingPresence(Presence::ref presence) {
//170 is room logging to http
//TODO: Nick changes
if (presence->getType() == Presence::Unavailable) {
+ LeavingType type = LeavePart;
+ if (mucPayload) {
+ if (boost::dynamic_pointer_cast<MUCDestroyPayload>(mucPayload->getPayload())) {
+ type = LeaveDestroy;
+ }
+ else foreach (MUCUserPayload::StatusCode status, mucPayload->getStatusCodes()) {
+ if (status.code == 307) {
+ type = LeaveKick;
+ }
+ else if (status.code == 301) {
+ type = LeaveBan;
+ }
+ else if (status.code == 321) {
+ type = LeaveNotMember;
+ }
+ }
+ }
+
if (presence->getFrom() == ownMUCJID) {
- handleUserLeft(Part);
+ handleUserLeft(type);
return;
}
else {
std::map<std::string,MUCOccupant>::iterator i = occupants.find(nick);
if (i != occupants.end()) {
//TODO: part type
- onOccupantLeft(i->second, Part, "");
+ onOccupantLeft(i->second, type, "");
occupants.erase(i);
}
}