本文整理汇总了C++中swift::presence::ref::setShow方法的典型用法代码示例。如果您正苦于以下问题:C++ ref::setShow方法的具体用法?C++ ref::setShow怎么用?C++ ref::setShow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类swift::presence::ref
的用法示例。
在下文中一共展示了ref::setShow方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getAlias
Swift::Presence::ref Buddy::generatePresenceStanza(int features, bool only_new) {
std::string alias = getAlias();
std::string name = getSafeName();
Swift::StatusShow s;
std::string statusMessage;
if (!getStatus(s, statusMessage))
return Swift::Presence::ref();
if (m_jid.getNode().empty()) {
generateJID();
}
Swift::Presence::ref presence = Swift::Presence::create();
presence->setFrom(m_jid);
presence->setTo(m_rosterManager->getUser()->getJID().toBare());
presence->setType(Swift::Presence::Available);
if (!statusMessage.empty())
presence->setStatus(statusMessage);
if (s.getType() == Swift::StatusShow::None)
presence->setType(Swift::Presence::Unavailable);
presence->setShow(s.getType());
if (presence->getType() != Swift::Presence::Unavailable) {
// caps
presence->addPayload(boost::shared_ptr<Swift::Payload>(new Swift::CapsInfo(m_rosterManager->getUser()->getComponent()->getBuddyCapsInfo())));
// if (features & 0/*TRANSPORT_FEATURE_AVATARS*/) {
presence->addPayload(boost::shared_ptr<Swift::Payload>(new Swift::VCardUpdate (getIconHash())));
// }
if (isBlocked()) {
presence->addPayload(boost::shared_ptr<Swift::Payload>(new Transport::BlockPayload ()));
}
}
// if (only_new) {
// if (m_lastPresence)
// m_lastPresence->setTo(Swift::JID(""));
// if (m_lastPresence == presence) {
// return Swift::Presence::ref();
// }
// m_lastPresence = presence;
// }
return presence;
}
示例2: handlePresence
void handlePresence() {
Swift::Presence::ref response = Swift::Presence::create();
response->setTo("localhost");
response->setFrom("[email protected]/resource");
response->setShow(Swift::StatusShow::Away);
injectPresence(response);
loop->processEvents();
// no presence received in server mode, just disco#info
CPPUNIT_ASSERT_EQUAL(1, (int) received.size());
CPPUNIT_ASSERT(getStanza(received[0])->getPayload<Swift::DiscoInfo>());
CPPUNIT_ASSERT(changedPresence);
CPPUNIT_ASSERT_EQUAL(Swift::StatusShow::Away, changedPresence->getShow());
}