Esempio n. 1
0
	void getSafeName() {
		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@test", "Buddy 1", grp, BUDDY_JID_ESCAPING);

		CPPUNIT_ASSERT_EQUAL(std::string("buddy1\\40test"), buddy->getSafeName());

		buddy->setFlags(BUDDY_NO_FLAG);
		CPPUNIT_ASSERT_EQUAL(std::string("buddy1%test"), buddy->getSafeName());
	}
Esempio n. 2
0
	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);
	}