本文整理汇总了C++中OnlineUserPtr类的典型用法代码示例。如果您正苦于以下问题:C++ OnlineUserPtr类的具体用法?C++ OnlineUserPtr怎么用?C++ OnlineUserPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OnlineUserPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onMatchQueue
LRESULT ChatCtrl::onMatchQueue(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) {
OnlineUserPtr ou = client->findUser(Text::fromT(selectedUser));
if(ou)
ou->matchQueue(client->getHubUrl());
return 0;
}
示例2: checkUser
void UserManager::checkUser(const OnlineUserPtr& user)
{
if (BOOLSETTING(CHECK_NEW_USERS))
{
if (!ClientManager::getInstance()->isMe(user))
{
const Client& client = user->getClient();
if (!client.getExcludeCheck() && client.isOp() &&
(client.isActive() || user->getIdentity().isTcpActive()))
{
if (!BOOLSETTING(PROT_FAVS) || !FavoriteManager::getInstance()->isNoFavUserOrUserBanUpload(user->getUser())) // !SMT!-opt
{
if (!isInProtectedUserList(user->getIdentity().getNick()))
{
try
{
QueueManager::getInstance()->addList(HintedUser(user->getUser(), client.getHubUrl()), QueueItem::FLAG_USER_CHECK);
}
catch (const Exception& e)
{
LogManager::getInstance()->message(e.getError());
}
}
}
}
}
}
}
示例3: onPrivateMessage
LRESULT ChatCtrl::onPrivateMessage(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) {
OnlineUserPtr ou = client->findUser(Text::fromT(selectedUser));
if(ou)
PrivateFrame::openWindow(HintedUser(ou->getUser(), client->getHubUrl()), Util::emptyStringT, client);
return 0;
}
示例4: handlePM
void UserConnection::handlePM(const AdcCommand& c, bool echo) noexcept{
const string& message = c.getParam(0);
OnlineUserPtr peer = nullptr;
OnlineUserPtr me = nullptr;
auto cm = ClientManager::getInstance();
{
RLock l(cm->getCS());
peer = cm->findOnlineUser(user->getCID(), getHubUrl());
//try to use the same hub so nicks match to a hub, not the perfect solution for CCPM, nicks keep changing when hubs go offline.
if(peer && peer->getHubUrl() != hubUrl)
setHubUrl(peer->getHubUrl());
me = cm->findOnlineUser(cm->getMe()->getCID(), getHubUrl());
}
if (!me || !peer){ //ChatMessage cant be formatted without the OnlineUser!
disconnect(true);
return;
}
if (echo) {
std::swap(peer, me);
}
string tmp;
auto msg = make_shared<ChatMessage>(message, peer, me, peer);
if (c.getParam("TS", 1, tmp)) {
msg->setTime(Util::toInt64(tmp));
}
msg->setThirdPerson(c.hasFlag("ME", 1));
fire(UserConnectionListener::PrivateMessage(), this, msg);
}
示例5: onUnignore
LRESULT ChatCtrl::onUnignore(UINT /*uMsg*/, WPARAM /*wParam*/, HWND /*lParam*/, BOOL& /*bHandled*/){
OnlineUserPtr ou = client->findUser(Text::fromT(selectedUser));
if(ou)
FavoriteManager::getInstance()->removeIgnoredUser(ou->getUser()->getCID());
return 0;
}
示例6: appendOnlineUserFlags
void Serializer::appendOnlineUserFlags(const OnlineUserPtr& aUser, StringSet& flags_) noexcept {
if (aUser->getIdentity().isAway()) {
flags_.insert("away");
}
if (aUser->getIdentity().isOp()) {
flags_.insert("op");
}
if (aUser->getIdentity().isBot() || aUser->getIdentity().isHub()) {
flags_.insert("bot");
}
if (aUser->isHidden()) {
flags_.insert("hidden");
}
if (aUser->supportsCCPM()) {
flags_.insert("ccpm");
}
auto cm = aUser->getIdentity().getConnectMode();
if (!aUser->getUser()->isNMDC() && (cm == Identity::MODE_NOCONNECT_PASSIVE || cm == Identity::MODE_NOCONNECT_IP || cm == Identity::MODE_UNDEFINED)) {
flags_.insert("noconnect");
} else if (!aUser->getIdentity().isTcpActive(aUser->getClient())) {
flags_.insert("passive");
}
}
示例7: onAddToFavorites
LRESULT ChatCtrl::onAddToFavorites(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) {
OnlineUserPtr ou = client->findUser(Text::fromT(selectedUser));
if(ou)
ou->addFav();
return 0;
}
示例8: getNumericInfo
double OnlineUserUtils::getNumericInfo(const OnlineUserPtr& aUser, int aPropertyName) noexcept {
switch (aPropertyName) {
case PROP_SHARED: return Util::toDouble(aUser->getIdentity().getShareSize());
case PROP_UPLOAD_SPEED: return (double)aUser->getIdentity().getAdcConnectionSpeed(false);
case PROP_DOWNLOAD_SPEED: return (double)aUser->getIdentity().getAdcConnectionSpeed(true);
case PROP_FILES: return Util::toDouble(aUser->getIdentity().getSharedFiles());
case PROP_UPLOAD_SLOTS: return aUser->getIdentity().getSlots();
default: dcassert(0); return 0;
}
}
示例9: onCheckList
LRESULT ChatCtrl::onCheckList(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) {
const OnlineUserPtr ou = client->findUser(Text::fromT(selectedUser));
if(ou) {
try {
QueueManager::getInstance()->addList(HintedUser(ou->getUser(), client->getHubUrl()), QueueItem::FLAG_USER_CHECK, client->getHubUrl());
} catch(const Exception& e) {
LogManager::getInstance()->message(e.getError());
}
}
return 0;
}
示例10: onCopyUserInfo
LRESULT ChatCtrl::onCopyUserInfo(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) {
tstring sCopy;
const OnlineUserPtr ou = client->findUser(Text::fromT(selectedUser));
if(ou) {
sCopy = ou->getText(static_cast<uint8_t>(wID - IDC_COPY));
}
if (!sCopy.empty())
WinUtil::setClipboard(sCopy);
return 0;
}
示例11: onUserUpdated
void HubInfo::onUserUpdated(const OnlineUserPtr& aUser, const PropertyIdSet& aUpdatedProperties) noexcept {
if (!aUser->isHidden()) {
view.onItemUpdated(aUser, aUpdatedProperties);
}
maybeSend("hub_user_updated", [&] { return Serializer::serializeItem(aUser, onlineUserPropertyHandler); });
}
示例12: on
void HubInfo::on(ClientListener::UserRemoved, const Client*, const OnlineUserPtr& aUser) noexcept {
if (!aUser->isHidden()) {
view.onItemRemoved(aUser);
}
maybeSend("hub_user_disconnected", [&] { return Serializer::serializeItem(aUser, onlineUserPropertyHandler); });
}
示例13: runUserCommand
void ChatCtrl::runUserCommand(UserCommand& uc) {
StringMap ucParams;
if(!WinUtil::getUCParams(m_hWnd, uc, ucParams))
return;
client->getMyIdentity().getParams(ucParams, "my", true);
client->getHubIdentity().getParams(ucParams, "hub", false);
const OnlineUserPtr ou = client->findUser(Text::fromT(selectedUser));
if(ou != NULL) {
StringMap tmp = ucParams;
ou->getIdentity().getParams(tmp, "user", true);
client->escapeParams(tmp);
client->sendUserCmd(uc, tmp);
}
}
示例14: serializeUser
json OnlineUserUtils::serializeUser(const OnlineUserPtr& aUser, int aPropertyName) noexcept {
switch (aPropertyName) {
case HubInfo::PROP_IP4: return Serializer::serializeIp(aUser->getIdentity().getIp4());
case HubInfo::PROP_IP6: return Serializer::serializeIp(aUser->getIdentity().getIp6());
case HubInfo::PROP_FLAGS: return Serializer::getOnlineUserFlags(aUser);
}
return nullptr;
}
示例15: onGrantSlot
LRESULT ChatCtrl::onGrantSlot(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) {
const OnlineUserPtr ou = client->findUser(Text::fromT(selectedUser));
if(ou) {
uint64_t time = 0;
switch(wID) {
case IDC_GRANTSLOT: time = 600; break;
case IDC_GRANTSLOT_DAY: time = 3600; break;
case IDC_GRANTSLOT_HOUR: time = 24*3600; break;
case IDC_GRANTSLOT_WEEK: time = 7*24*3600; break;
case IDC_UNGRANTSLOT: time = 0; break;
}
if(time > 0)
UploadManager::getInstance()->reserveSlot(HintedUser(ou->getUser(), client->getHubUrl()), time);
else
UploadManager::getInstance()->unreserveSlot(ou->getUser());
}
return 0;
}