diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-09-09 16:05:18 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-09-11 21:53:45 (GMT) |
commit | 8bdc3c2e2e520407027ac3a3e09d7af8054a0e5b (patch) | |
tree | aada96d0c28d46b771d4afb59cb84a93ea358df4 /Swiften/Roster | |
parent | 37511b6d30cb9cb6c1f5b1fdcca5f6658e4425da (diff) | |
download | swift-contrib-8bdc3c2e2e520407027ac3a3e09d7af8054a0e5b.zip swift-contrib-8bdc3c2e2e520407027ac3a3e09d7af8054a0e5b.tar.bz2 |
Added VCardAvatarManager for offline avatars.
Resolves: #418
Diffstat (limited to 'Swiften/Roster')
-rw-r--r-- | Swiften/Roster/Roster.cpp | 3 | ||||
-rw-r--r-- | Swiften/Roster/Roster.h | 2 | ||||
-rw-r--r-- | Swiften/Roster/UnitTest/RosterTest.cpp | 24 |
3 files changed, 15 insertions, 14 deletions
diff --git a/Swiften/Roster/Roster.cpp b/Swiften/Roster/Roster.cpp index 64a7241..f9f0dbb 100644 --- a/Swiften/Roster/Roster.cpp +++ b/Swiften/Roster/Roster.cpp @@ -68,9 +68,10 @@ void Roster::handleChildrenChanged(GroupRosterItem* item) { onChildrenChanged(item); } -void Roster::addContact(const JID& jid, const JID& displayJID, const String& name, const String& groupName) { +void Roster::addContact(const JID& jid, const JID& displayJID, const String& name, const String& groupName, const String& avatarPath) { GroupRosterItem* group(getGroup(groupName)); ContactRosterItem *item = new ContactRosterItem(jid, displayJID, name, group); + item->setAvatarPath(avatarPath); group->addChild(item); itemMap_[fullJIDMapping_ ? jid : jid.toBare()].push_back(item); item->onDataChanged.connect(boost::bind(&Roster::handleDataChanged, this, item)); diff --git a/Swiften/Roster/Roster.h b/Swiften/Roster/Roster.h index aa117d7..2f12b57 100644 --- a/Swiften/Roster/Roster.h +++ b/Swiften/Roster/Roster.h @@ -28,7 +28,7 @@ class Roster { Roster(bool sortByStatus = true, bool fullJIDMapping = false); ~Roster(); - void addContact(const JID& jid, const JID& displayJID, const String& name, const String& group); + void addContact(const JID& jid, const JID& displayJID, const String& name, const String& group, const String& avatarPath); void removeContact(const JID& jid); void removeContactFromGroup(const JID& jid, const String& group); void removeAll(); diff --git a/Swiften/Roster/UnitTest/RosterTest.cpp b/Swiften/Roster/UnitTest/RosterTest.cpp index 5dbe5e1..9c8e65b 100644 --- a/Swiften/Roster/UnitTest/RosterTest.cpp +++ b/Swiften/Roster/UnitTest/RosterTest.cpp @@ -43,9 +43,9 @@ class RosterTest : public CppUnit::TestFixture } void testGetGroup() { - roster_->addContact(jid1_, JID(), "Bert", "group1"); - roster_->addContact(jid2_, JID(), "Ernie", "group2"); - roster_->addContact(jid3_, JID(), "Cookie", "group1"); + roster_->addContact(jid1_, JID(), "Bert", "group1", ""); + roster_->addContact(jid2_, JID(), "Ernie", "group2", ""); + roster_->addContact(jid3_, JID(), "Cookie", "group1", ""); CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(roster_->getRoot()->getChildren().size())); CPPUNIT_ASSERT_EQUAL(String("group1"), roster_->getRoot()->getChildren()[0]->getDisplayName()); @@ -57,7 +57,7 @@ class RosterTest : public CppUnit::TestFixture } void testRemoveContact() { - roster_->addContact(jid1_, jid1_, "Bert", "group1"); + roster_->addContact(jid1_, jid1_, "Bert", "group1", ""); CPPUNIT_ASSERT_EQUAL(String("Bert"), static_cast<GroupRosterItem*>(roster_->getRoot()->getChildren()[0])->getChildren()[0]->getDisplayName()); roster_->removeContact(jid1_); @@ -65,8 +65,8 @@ class RosterTest : public CppUnit::TestFixture } void testRemoveSecondContact() { - roster_->addContact(jid1_, jid1_, "Bert", "group1"); - roster_->addContact(jid2_, jid2_, "Cookie", "group1"); + roster_->addContact(jid1_, jid1_, "Bert", "group1", ""); + roster_->addContact(jid2_, jid2_, "Cookie", "group1", ""); CPPUNIT_ASSERT_EQUAL(String("Cookie"), static_cast<GroupRosterItem*>(roster_->getRoot()->getChildren()[0])->getChildren()[1]->getDisplayName()); roster_->removeContact(jid2_); @@ -77,8 +77,8 @@ class RosterTest : public CppUnit::TestFixture void testRemoveSecondContactSameBare() { JID jid4a("a@b/c"); JID jid4b("a@b/d"); - roster_->addContact(jid4a, JID(), "Bert", "group1"); - roster_->addContact(jid4b, JID(), "Cookie", "group1"); + roster_->addContact(jid4a, JID(), "Bert", "group1", ""); + roster_->addContact(jid4b, JID(), "Cookie", "group1", ""); CPPUNIT_ASSERT_EQUAL(String("Cookie"), static_cast<GroupRosterItem*>(roster_->getRoot()->getChildren()[0])->getChildren()[1]->getDisplayName()); roster_->removeContact(jid4b); @@ -90,11 +90,11 @@ class RosterTest : public CppUnit::TestFixture JID jid4a("a@b/c"); JID jid4b("a@b/d"); JID jid4c("a@b/e"); - roster_->addContact(jid4a, JID(), "Bird", "group1"); - roster_->addContact(jid4b, JID(), "Cookie", "group1"); + roster_->addContact(jid4a, JID(), "Bird", "group1", ""); + roster_->addContact(jid4b, JID(), "Cookie", "group1", ""); roster_->removeContact(jid4b); - roster_->addContact(jid4c, JID(), "Bert", "group1"); - roster_->addContact(jid4b, JID(), "Ernie", "group1"); + roster_->addContact(jid4c, JID(), "Bert", "group1", ""); + roster_->addContact(jid4b, JID(), "Ernie", "group1", ""); boost::shared_ptr<Presence> presence(new Presence()); presence->setShow(StatusShow::DND); presence->setFrom(jid4a); |