diff options
author | Kevin Smith <git@kismith.co.uk> | 2010-03-26 13:42:19 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2010-03-26 13:42:19 (GMT) |
commit | 42cf17e614f0c490ea214e36ac4e7ded2d0495b7 (patch) | |
tree | d29dd06d1942c89a9e7cfb2243359b4460df01af /Swift/Controllers/Chat/MUCController.cpp | |
parent | fd6e929a54514d5c3f77956429d5ab5fb4271ff2 (diff) | |
download | swift-contrib-42cf17e614f0c490ea214e36ac4e7ded2d0495b7.zip swift-contrib-42cf17e614f0c490ea214e36ac4e7ded2d0495b7.tar.bz2 |
Remove MUCs from the ChatsManager's list once you leave them.
Resolves: #292
Diffstat (limited to 'Swift/Controllers/Chat/MUCController.cpp')
-rw-r--r-- | Swift/Controllers/Chat/MUCController.cpp | 8 |
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) { |