void BasicTest::add2Buddies() { User *user = userManager->getUser("user@localhost"); CPPUNIT_ASSERT(user); std::vector<std::string> grp; grp.push_back("group1"); LocalBuddy *buddy = new LocalBuddy(user->getRosterManager(), -1, "buddy1", "Buddy 1", grp, BUDDY_JID_ESCAPING); buddy->setStatus(Swift::StatusShow(Swift::StatusShow::Away), "status1"); user->getRosterManager()->setBuddy(buddy); std::vector<std::string> grp2; grp2.push_back("group2"); buddy = new LocalBuddy(user->getRosterManager(), -1, "buddy2", "Buddy 2", grp2, BUDDY_JID_ESCAPING); buddy->setStatus(Swift::StatusShow(Swift::StatusShow::Away), "status2"); user->getRosterManager()->setBuddy(buddy); }
void sendPresenceTypeNone() { User *user = userManager->getUser("user@localhost"); CPPUNIT_ASSERT(user); std::vector<std::string> grp; grp.push_back("group1"); LocalBuddy *buddy = new LocalBuddy(user->getRosterManager(), -1, "buddy1", "Buddy 1", grp, BUDDY_JID_ESCAPING); buddy->setStatus(Swift::StatusShow(Swift::StatusShow::Away), ""); user->getRosterManager()->setBuddy(buddy); received.clear(); buddy->setStatus(Swift::StatusShow(Swift::StatusShow::None), ""); CPPUNIT_ASSERT_EQUAL(1, (int) received.size()); CPPUNIT_ASSERT(dynamic_cast<Swift::Presence *>(getStanza(received[0]))); CPPUNIT_ASSERT_EQUAL(Swift::StatusShow::None, dynamic_cast<Swift::Presence *>(getStanza(received[0]))->getShow()); }
void add2Buddies() { User *user = userManager->getUser("user@localhost"); CPPUNIT_ASSERT(user); LocalBuddy *buddy = new LocalBuddy(user->getRosterManager(), -1); buddy->setFlags(BUDDY_JID_ESCAPING); buddy->setName("buddy1"); buddy->setAlias("Buddy 1"); std::vector<std::string> grp; grp.push_back("group1"); buddy->setGroups(grp); buddy->setStatus(Swift::StatusShow(Swift::StatusShow::Away), "status1"); user->getRosterManager()->setBuddy(buddy); buddy = new LocalBuddy(user->getRosterManager(), -1); buddy->setFlags(BUDDY_JID_ESCAPING); buddy->setName("buddy2"); buddy->setAlias("Buddy 2"); std::vector<std::string> grp2; grp2.push_back("group2"); buddy->setGroups(grp2); buddy->setStatus(Swift::StatusShow(Swift::StatusShow::Away), "status2"); user->getRosterManager()->setBuddy(buddy); }
void setAlias() { User *user = userManager->getUser("user@localhost"); CPPUNIT_ASSERT(user); std::vector<std::string> grp; grp.push_back("group1"); LocalBuddy *buddy = new LocalBuddy(user->getRosterManager(), -1, "buddy1", "Buddy 1", grp, BUDDY_JID_ESCAPING); buddy->setStatus(Swift::StatusShow(Swift::StatusShow::Away), "status1"); user->getRosterManager()->setBuddy(buddy); received.clear(); buddy->setAlias("Buddy 2"); CPPUNIT_ASSERT_EQUAL(1, (int) received.size()); Swift::RosterPayload::ref payload1 = getStanza(received[0])->getPayload<Swift::RosterPayload>(); CPPUNIT_ASSERT(payload1); CPPUNIT_ASSERT_EQUAL(1, (int) payload1->getItems().size()); Swift::RosterItemPayload item = payload1->getItems()[0]; CPPUNIT_ASSERT_EQUAL(std::string("buddy1"), Buddy::JIDToLegacyName(item.getJID())); CPPUNIT_ASSERT_EQUAL(std::string("Buddy 2"), item.getName()); }