diff options
-rw-r--r-- | Swift/QtUI/QtChatWindow.h | 1 | ||||
-rw-r--r-- | Swift/QtUI/QtTabbable.h | 1 | ||||
-rw-r--r-- | Swiften/MUC/MUC.cpp | 7 | ||||
-rw-r--r-- | Swiften/MUC/MUCOccupant.cpp | 4 | ||||
-rw-r--r-- | Swiften/MUC/MUCOccupant.h | 2 |
5 files changed, 11 insertions, 4 deletions
diff --git a/Swift/QtUI/QtChatWindow.h b/Swift/QtUI/QtChatWindow.h index 2b64f83..20c8685 100644 --- a/Swift/QtUI/QtChatWindow.h +++ b/Swift/QtUI/QtChatWindow.h @@ -57,7 +57,6 @@ namespace Swift { signals: void geometryChanged(); - void requestFlash(); protected slots: void qAppFocusChanged(QWidget* old, QWidget* now); diff --git a/Swift/QtUI/QtTabbable.h b/Swift/QtUI/QtTabbable.h index 1a1170f..e236a0b 100644 --- a/Swift/QtUI/QtTabbable.h +++ b/Swift/QtUI/QtTabbable.h @@ -30,5 +30,6 @@ namespace Swift { void requestPreviousTab(); void requestNextTab(); void requestActiveTab(); + void requestFlash(); }; } diff --git a/Swiften/MUC/MUC.cpp b/Swiften/MUC/MUC.cpp index bcc9e6f..3446849 100644 --- a/Swiften/MUC/MUC.cpp +++ b/Swiften/MUC/MUC.cpp @@ -6,8 +6,6 @@ #include "Swiften/MUC/MUC.h" -#include <iostream> - #include <boost/bind.hpp> #include <boost/shared_ptr.hpp> @@ -110,10 +108,12 @@ void MUC::handleIncomingPresence(boost::shared_ptr<Presence> presence) { } else if (presence->getType() == Presence::Available) { std::map<String, MUCOccupant>::iterator it = occupants.find(nick); MUCOccupant occupant(nick, role, affiliation); + bool isJoin = true; if (realJID) { occupant.setRealJID(realJID.get()); } if (it != occupants.end()) { + isJoin = false; MUCOccupant oldOccupant = it->second; if (oldOccupant.getRole() != role) { onOccupantRoleChanged(nick, occupant, oldOccupant.getRole()); @@ -121,9 +121,10 @@ void MUC::handleIncomingPresence(boost::shared_ptr<Presence> presence) { if (oldOccupant.getAffiliation() != affiliation) { onOccupantAffiliationChanged(nick, affiliation, oldOccupant.getAffiliation()); } + occupants.erase(it); } std::pair<std::map<String, MUCOccupant>::iterator, bool> result = occupants.insert(std::make_pair(nick, occupant)); - if (result.second) { + if (isJoin) { onOccupantJoined(result.first->second); } onOccupantPresenceChange(presence); diff --git a/Swiften/MUC/MUCOccupant.cpp b/Swiften/MUC/MUCOccupant.cpp index 3e907ab..33a5fcc 100644 --- a/Swiften/MUC/MUCOccupant.cpp +++ b/Swiften/MUC/MUCOccupant.cpp @@ -14,6 +14,10 @@ MUCOccupant::MUCOccupant(const String &nick, Role role, Affiliation affiliation) MUCOccupant::~MUCOccupant() { } +MUCOccupant::MUCOccupant(const MUCOccupant& other) : nick_(other.getNick()), role_(other.getRole()), affiliation_(other.getAffiliation()), realJID_(other.getRealJID()) { + +} + String MUCOccupant::getNick() const { return nick_; } diff --git a/Swiften/MUC/MUCOccupant.h b/Swiften/MUC/MUCOccupant.h index c9551de..96ac5ad 100644 --- a/Swiften/MUC/MUCOccupant.h +++ b/Swiften/MUC/MUCOccupant.h @@ -20,6 +20,7 @@ namespace Swift { enum Affiliation {Owner, Admin, Member, Outcast, NoAffiliation}; MUCOccupant(const String &nick, Role role, Affiliation affiliation); + MUCOccupant(const MUCOccupant& other); ~MUCOccupant(); String getNick() const; @@ -34,6 +35,7 @@ namespace Swift { Role role_; Affiliation affiliation_; boost::optional<JID> realJID_; + /* If you add a field, remember to update the const copy constructor */ }; } |