summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/Controllers/Chat/MUCController.cpp')
-rw-r--r--Swift/Controllers/Chat/MUCController.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/Swift/Controllers/Chat/MUCController.cpp b/Swift/Controllers/Chat/MUCController.cpp
index 7736aec..0ec8c28 100644
--- a/Swift/Controllers/Chat/MUCController.cpp
+++ b/Swift/Controllers/Chat/MUCController.cpp
@@ -33,6 +33,7 @@ MUCController::MUCController (
muc_(new MUC(stanzaChannel, presenceSender, muc)),
nick_(nick),
treeWidgetFactory_(treeWidgetFactory) {
+ parting_ = false;
roster_ = new Roster(chatWindow_->getTreeWidget(), treeWidgetFactory_);
chatWindow_->onClosed.connect(boost::bind(&MUCController::handleWindowClosed, this));
muc_->joinAs(nick);
@@ -42,7 +43,7 @@ MUCController::MUCController (
chatWindow_->convertToMUC();
chatWindow_->show();
if (avatarManager_ != NULL) {
- avatarManager_->onAvatarChanged.connect(boost::bind(&MUCController::handleAvatarChanged, this, _1, _2));
+ avatarChangedConnection_ = (avatarManager_->onAvatarChanged.connect(boost::bind(&MUCController::handleAvatarChanged, this, _1, _2)));
}
}
@@ -52,12 +53,17 @@ MUCController::~MUCController() {
}
void MUCController::handleAvatarChanged(const JID& jid, const String&) {
+ if (parting_) {
+ return;
+ }
String path = avatarManager_->getAvatarPath(jid).string();
roster_->applyOnItems(SetAvatar(jid, path, JID::WithResource));
}
void MUCController::handleWindowClosed() {
+ parting_ = true;
muc_->part();
+ onUserLeft();
}
void MUCController::handleOccupantJoined(const MUCOccupant& occupant) {