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()); }
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; } } }
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; } } }
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()); } }
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()); } }
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; } } } }
UsersFrame::UserInfo::UserInfo(const FavoriteUser& u) : UserInfoBase(u.getUser()) { update(u); }
void UsersFrame::on(UserRemoved, const FavoriteUser& aUser) noexcept { auto u = aUser.getUser(); callAsync([=] { updateUser(u); }); }
void UsersFrame::on(FavoriteManagerListener::UserUpdated, const FavoriteUser& aUser) noexcept { auto u = aUser.getUser(); callAsync([=] { updateUser(u); }); }
void UsersFrame::on(UserAdded, const FavoriteUser& aUser) noexcept { auto u = aUser.getUser(); callAsync([=] { addUser(u); }); }
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()); }
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()); }