Example #1
0
void UsersFrame::UserInfo::update(const FavoriteUser& u) {
	columns[COLUMN_NICK] = Text::toT(u.getNick());
	columns[COLUMN_HUB] = user->isOnline() ? WinUtil::getHubNames(u.getUser()).first : Text::toT(u.getUrl());
	columns[COLUMN_SEEN] = user->isOnline() ? T_("Online") : Text::toT(Util::formatTime("%Y-%m-%d %H:%M", u.getLastSeen()));
	columns[COLUMN_DESCRIPTION] = Text::toT(u.getDescription());
	columns[COLUMN_CID] = Text::toT(u.getUser()->getCID().toBase32());
}
Example #2
0
void UsersFrame::removeUser(const FavoriteUser& aUser) {
	for(size_t i = 0; i < users->size(); ++i) {
		UserInfo *ui = users->getData(i);
		if(ui->user == aUser.getUser()) {
			users->erase(i);
			return;
		}
	}
}
Example #3
0
void UsersFrame::removeUser(const FavoriteUser& aUser) {
	for(int i = 0; i < ctrlUsers.GetItemCount(); ++i) {
		const UserInfo *ui = ctrlUsers.getItemData(i);
		if(ui->user == aUser.getUser()) {
			ctrlUsers.DeleteItem(i);
			delete ui;
			return;
		}
	}
}
Example #4
0
void UsersFrame::updateUser(const int i, UserInfo* p_ui, const FavoriteUser& favUser) // [+] IRainman fix.
{
	dcassert(!ClientManager::isShutdown());
	if (!ClientManager::isShutdown())
	{
		p_ui->columns[COLUMN_SEEN] = favUser.getUser()->isOnline() ? TSTRING(ONLINE) : Text::toT(Util::formatDigitalClock(favUser.getLastSeen()));
		
		// !SMT!-UI
		int imageIndex = favUser.getUser()->isOnline() ? (favUser.getUser()->isAway() ? 1 : 0) : 2;
		
		if (favUser.getUploadLimit() == FavoriteUser::UL_BAN || favUser.isSet(FavoriteUser::FLAG_IGNORE_PRIVATE))
		{
			imageIndex += 3;
		}
		
		p_ui->update(favUser);
		
		ctrlUsers.SetItem(i, 0, LVIF_IMAGE, NULL, imageIndex, 0, 0, NULL);
		
		ctrlUsers.updateItem(i);
		setCountMessages(ctrlUsers.GetItemCount());
	}
}
Example #5
0
void UsersFrame::UserInfo::update(const FavoriteUser& u)
{
	dcassert(!ClientManager::isShutdown());
	if (!ClientManager::isShutdown())
	{
		columns[COLUMN_NICK] = Text::toT(u.getNick());
		columns[COLUMN_HUB] = user->isOnline() ? WinUtil::getHubNames(u.getUser(), u.getUrl()).first : Text::toT(u.getUrl());
		columns[COLUMN_SEEN] = user->isOnline() ? TSTRING(ONLINE) : Text::toT(Util::formatDigitalClock(u.getLastSeen()));
		columns[COLUMN_DESCRIPTION] = Text::toT(u.getDescription());
		
		// !SMT!-S
		if (u.isSet(FavoriteUser::FLAG_IGNORE_PRIVATE))
			columns[COLUMN_IGNORE] = TSTRING(IGNORE_S);
		else if (u.isSet(FavoriteUser::FLAG_FREE_PM_ACCESS))
			columns[COLUMN_IGNORE] = TSTRING(FREE_PM_ACCESS);
		else
			columns[COLUMN_IGNORE].clear();
			
		columns[COLUMN_SPEED_LIMIT] = Text::toT(FavoriteUser::getSpeedLimitText(u.getUploadLimit()));
		//[+]PPA
		columns[COLUMN_USER_SLOTS] = Util::toStringW(u.getUser()->getSlots());
		columns[COLUMN_CID] = Text::toT(u.getUser()->getCID().toBase32());
	}
}
Example #6
0
void UsersFrame::removeUser(const FavoriteUser& aUser)
{
	dcassert(!ClientManager::isShutdown());
	if (!ClientManager::isShutdown())
	{
		const int l_cnt = ctrlUsers.GetItemCount();
		for (int i = 0; i < l_cnt; ++i)
		{
			dcassert(l_cnt == ctrlUsers.GetItemCount());
			UserInfo *ui = ctrlUsers.getItemData(i);
			if (ui->getUser() == aUser.getUser())
			{
				ctrlUsers.DeleteItem(i);
				delete ui;
				setCountMessages(ctrlUsers.GetItemCount());
				return;
			}
		}
	}
}
Example #7
0
UsersFrame::UserInfo::UserInfo(const FavoriteUser& u) : UserInfoBase(u.getUser()) {
	update(u);
}
Example #8
0
void UsersFrame::on(UserRemoved, const FavoriteUser& aUser) noexcept {
	auto u = aUser.getUser();
	callAsync([=] { updateUser(u); });
}
Example #9
0
void UsersFrame::on(FavoriteManagerListener::UserUpdated, const FavoriteUser& aUser) noexcept {
	auto u = aUser.getUser();
	callAsync([=] { updateUser(u); });
}
Example #10
0
void UsersFrame::on(UserAdded, const FavoriteUser& aUser) noexcept {
	auto u = aUser.getUser();
	callAsync([=] { addUser(u); });
}
Example #11
0
void UsersFrame::UserInfo::update(const FavoriteUser& u) {
	columns[COLUMN_NICK] = Text::toT(u.getNick());
	columns[COLUMN_HUB] = user->isOnline() ? WinUtil::getHubNames(u.getUser(), Util::emptyString).first : Text::toT(u.getUrl());
	columns[COLUMN_SEEN] = user->isOnline() ? TSTRING(ONLINE) : Text::toT(Util::formatTime("%Y-%m-%d %H:%M", u.getLastSeen()));
	columns[COLUMN_DESCRIPTION] = Text::toT(u.getDescription());
}
Example #12
0
void UsersFrame::addUser(const FavoriteUser& aUser) {
	int i = ctrlUsers.insertItem(new UserInfo(aUser), 0);
	bool b = aUser.isSet(FavoriteUser::FLAG_GRANTSLOT);
	ctrlUsers.SetCheckState(i, b);
	updateUser(aUser.getUser());
}