diff options
Diffstat (limited to 'Swift')
-rw-r--r-- | Swift/Controllers/MUCController.cpp | 16 | ||||
-rw-r--r-- | Swift/Controllers/MUCController.h | 1 |
2 files changed, 16 insertions, 1 deletions
diff --git a/Swift/Controllers/MUCController.cpp b/Swift/Controllers/MUCController.cpp index da7a9e7..4d0acca 100644 --- a/Swift/Controllers/MUCController.cpp +++ b/Swift/Controllers/MUCController.cpp @@ -5,9 +5,11 @@ #include "Swiften/Base/foreach.h" #include "Swift/Controllers/ChatWindow.h" #include "Swift/Controllers/ChatWindowFactory.h" +#include "Swiften/Avatars/AvatarManager.h" #include "Swiften/MUC/MUC.h" #include "Swiften/Client/StanzaChannel.h" #include "Swiften/Roster/Roster.h" +#include "Swiften/Roster/SetAvatar.h" #include "Swiften/Roster/SetPresence.h" #include "Swiften/Roster/TreeWidgetFactory.h" @@ -39,6 +41,9 @@ MUCController::MUCController ( muc_->onOccupantLeft.connect(boost::bind(&MUCController::handleOccupantLeft, this, _1, _2, _3)); chatWindow_->convertToMUC(); chatWindow_->show(); + if (avatarManager_ != NULL) { + avatarManager_->onAvatarChanged.connect(boost::bind(&MUCController::handleAvatarChanged, this, _1, _2)); + } } MUCController::~MUCController() { @@ -46,12 +51,21 @@ MUCController::~MUCController() { delete roster_; } +void MUCController::handleAvatarChanged(const JID& jid, const String&) { + String path = avatarManager_->getAvatarPath(jid).string(); + roster_->applyOnItems(SetAvatar(jid, path, JID::WithResource)); +} + void MUCController::handleWindowClosed() { muc_->part(); } void MUCController::handleOccupantJoined(const MUCOccupant& occupant) { - roster_->addContact(JID(toJID_.getNode(), toJID_.getDomain(), occupant.getNick()), occupant.getNick(), "Occupants"); + JID jid(JID(toJID_.getNode(), toJID_.getDomain(), occupant.getNick())); + roster_->addContact(jid, occupant.getNick(), "Occupants"); + if (avatarManager_ != NULL) { + handleAvatarChanged(jid, "dummy"); + } } void MUCController::handleOccupantLeft(const MUCOccupant& occupant, MUC::LeavingType, const String& /*reason*/) { diff --git a/Swift/Controllers/MUCController.h b/Swift/Controllers/MUCController.h index 7ee6e81..aa5a274 100644 --- a/Swift/Controllers/MUCController.h +++ b/Swift/Controllers/MUCController.h @@ -32,6 +32,7 @@ namespace Swift { private: void handleWindowClosed(); + void handleAvatarChanged(const JID& jid, const String&); void handleOccupantJoined(const MUCOccupant& occupant); void handleOccupantLeft(const MUCOccupant& occupant, MUC::LeavingType type, const String& reason); void handleOccupantPresenceChange(boost::shared_ptr<Presence> presence); |