summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-09-09 16:05:18 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-09-11 21:53:45 (GMT)
commit8bdc3c2e2e520407027ac3a3e09d7af8054a0e5b (patch)
treeaada96d0c28d46b771d4afb59cb84a93ea358df4 /Swift
parent37511b6d30cb9cb6c1f5b1fdcca5f6658e4425da (diff)
downloadswift-contrib-8bdc3c2e2e520407027ac3a3e09d7af8054a0e5b.zip
swift-contrib-8bdc3c2e2e520407027ac3a3e09d7af8054a0e5b.tar.bz2
Added VCardAvatarManager for offline avatars.
Resolves: #418
Diffstat (limited to 'Swift')
-rw-r--r--Swift/Controllers/Chat/MUCController.cpp4
-rw-r--r--Swift/Controllers/RosterController.cpp25
-rw-r--r--Swift/Controllers/RosterController.h1
3 files changed, 10 insertions, 20 deletions
diff --git a/Swift/Controllers/Chat/MUCController.cpp b/Swift/Controllers/Chat/MUCController.cpp
index 3031efe..acef7ae 100644
--- a/Swift/Controllers/Chat/MUCController.cpp
+++ b/Swift/Controllers/Chat/MUCController.cpp
@@ -175,7 +175,7 @@ void MUCController::handleOccupantJoined(const MUCOccupant& occupant) {
currentOccupants_.insert(occupant.getNick());
NickJoinPart event(occupant.getNick(), Join);
appendToJoinParts(joinParts_, event);
- roster_->addContact(jid, realJID, occupant.getNick(), roleToGroupName(occupant.getRole()));
+ roster_->addContact(jid, realJID, occupant.getNick(), roleToGroupName(occupant.getRole()), avatarManager_->getAvatarPath(jid).string());
if (joined_) {
String joinString = occupant.getNick() + " has joined the room";
MUCOccupant::Role role = occupant.getRole();
@@ -253,7 +253,7 @@ void MUCController::handleOccupantRoleChanged(const String& nick, const MUCOccup
if (occupant.getRealJID()) {
realJID = occupant.getRealJID().get();
}
- roster_->addContact(jid, realJID, nick, roleToGroupName(occupant.getRole()));
+ roster_->addContact(jid, realJID, nick, roleToGroupName(occupant.getRole()), avatarManager_->getAvatarPath(jid).string());
chatWindow_->addSystemMessage(nick + " is now a " + roleToFriendlyName(occupant.getRole()));
}
diff --git a/Swift/Controllers/RosterController.cpp b/Swift/Controllers/RosterController.cpp
index b4626fb..7285f38 100644
--- a/Swift/Controllers/RosterController.cpp
+++ b/Swift/Controllers/RosterController.cpp
@@ -53,8 +53,9 @@ RosterController::RosterController(const JID& jid, boost::shared_ptr<XMPPRoster>
presenceOracle_->onPresenceSubscriptionRequest.connect(boost::bind(&RosterController::handleSubscriptionRequest, this, _1, _2));
presenceOracle_->onPresenceChange.connect(boost::bind(&RosterController::handleIncomingPresence, this, _1, _2));
uiEventConnection_ = uiEventStream->onUIEvent.connect(boost::bind(&RosterController::handleUIEvent, this, _1));
- avatarManager_ = NULL;
- setAvatarManager(avatarManager);
+ avatarManager_ = avatarManager;
+ avatarManager_->onAvatarChanged.connect(boost::bind(&RosterController::handleAvatarChanged, this, _1));
+ mainWindow_->setMyAvatarPath(avatarManager_->getAvatarPath(myJID_).string());
setNickResolver(nickResolver);
}
@@ -77,17 +78,6 @@ void RosterController::handleOwnNickChanged(const String& nick) {
mainWindow_->setMyName(nick);
}
-void RosterController::setAvatarManager(AvatarManager* avatarManager) {
- if (avatarManager_ != NULL) {
- //FIXME: disconnect old signal;
- }
- avatarManager_ = avatarManager;
- if (avatarManager != NULL) {
- avatarManager_->onAvatarChanged.connect(boost::bind(&RosterController::handleAvatarChanged, this, _1));
- mainWindow_->setMyAvatarPath(avatarManager_->getAvatarPath(myJID_).string());
- }
-}
-
void RosterController::setEnabled(bool enabled) {
if (!enabled) {
roster_->applyOnItems(AppearOffline());
@@ -111,10 +101,11 @@ void RosterController::handleOnJIDAdded(const JID& jid) {
String name = nickResolver_->jidToNick(jid);
if (!groups.empty()) {
foreach(const String& group, groups) {
- roster_->addContact(jid, jid, name, group);
+ roster_->addContact(jid, jid, name, group, avatarManager_->getAvatarPath(jid).string());
}
- } else {
- roster_->addContact(jid, jid, name, "Contacts");
+ }
+ else {
+ roster_->addContact(jid, jid, name, "Contacts", avatarManager_->getAvatarPath(jid).string());
}
}
@@ -143,7 +134,7 @@ void RosterController::handleOnJIDUpdated(const JID& jid, const String& oldName,
}
foreach(const String& group, groups) {
if (std::find(oldGroups.begin(), oldGroups.end(), group) == oldGroups.end()) {
- roster_->addContact(jid, jid, xmppRoster_->getNameForJID(jid), group);
+ roster_->addContact(jid, jid, xmppRoster_->getNameForJID(jid), group, avatarManager_->getAvatarPath(jid).string());
}
}
foreach(const String& group, oldGroups) {
diff --git a/Swift/Controllers/RosterController.h b/Swift/Controllers/RosterController.h
index dea1f0f..ba8d4e2 100644
--- a/Swift/Controllers/RosterController.h
+++ b/Swift/Controllers/RosterController.h
@@ -37,7 +37,6 @@ namespace Swift {
~RosterController();
void showRosterWindow();
MainWindow* getWindow() {return mainWindow_;};
- void setAvatarManager(AvatarManager* avatarManager);
void setNickResolver(NickResolver* nickResolver);
boost::signal<void (StatusShow::Type, const String&)> onChangeStatusRequest;
boost::signal<void ()> onSignOutRequest;