本文整理汇总了C++中OnlineUserPtr::getHubUrl方法的典型用法代码示例。如果您正苦于以下问题:C++ OnlineUserPtr::getHubUrl方法的具体用法?C++ OnlineUserPtr::getHubUrl怎么用?C++ OnlineUserPtr::getHubUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OnlineUserPtr
的用法示例。
在下文中一共展示了OnlineUserPtr::getHubUrl方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: getStringInfo
std::string OnlineUserUtils::getStringInfo(const OnlineUserPtr& aUser, int aPropertyName) noexcept {
switch (aPropertyName) {
case HubInfo::PROP_NICK: return aUser->getIdentity().getNick();
case HubInfo::PROP_DESCRIPTION: return aUser->getIdentity().getDescription();
case HubInfo::PROP_EMAIL: return aUser->getIdentity().getEmail();
case HubInfo::PROP_TAG: return aUser->getIdentity().getTag();
case HubInfo::PROP_HUB_URL: return aUser->getHubUrl();
case HubInfo::PROP_HUB_NAME: return aUser->getClient()->getHubName();
case HubInfo::PROP_IP4: return aUser->getIdentity().getIp4();
case HubInfo::PROP_IP6: return aUser->getIdentity().getIp6();
case HubInfo::PROP_CID: return aUser->getUser()->getCID().toBase32();
default: dcassert(0); return 0;
}
}