本文整理汇总了C++中qxmpprosteriq::Item::bareJid方法的典型用法代码示例。如果您正苦于以下问题:C++ Item::bareJid方法的具体用法?C++ Item::bareJid怎么用?C++ Item::bareJid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qxmpprosteriq::Item
的用法示例。
在下文中一共展示了Item::bareJid方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rosterIqReceived
void QXmppRosterManager::rosterIqReceived(const QXmppRosterIq& rosterIq)
{
bool isInitial = (m_rosterReqId == rosterIq.id());
switch(rosterIq.type())
{
case QXmppIq::Set:
{
// send result iq
QXmppIq returnIq(QXmppIq::Result);
returnIq.setId(rosterIq.id());
m_stream->sendPacket(returnIq);
// store updated entries and notify changes
const QList<QXmppRosterIq::Item> items = rosterIq.items();
for (int i = 0; i < items.count(); i++)
{
QString bareJid = items.at(i).bareJid();
m_entries[bareJid] = items.at(i);
emit rosterChanged(bareJid);
}
// when contact subscribes user...user sends 'subscribed' presence
// then after recieving following iq user requests contact for subscription
// check the "from" is newly added in the roster...and remove this ask thing...and do this for all items
QXmppRosterIq::Item item = items.at(0);
if (!item.bareJid().isEmpty() &&
item.subscriptionType() == QXmppRosterIq::Item::From &&
item.subscriptionStatus().isEmpty())
{
QXmppPresence presence;
presence.setTo(item.bareJid());
presence.setType(QXmppPresence::Subscribe);
m_stream->sendPacket(presence);
}
}
break;
case QXmppIq::Result:
{
QList<QXmppRosterIq::Item> items = rosterIq.items();
for(int i = 0; i < items.count(); ++i)
{
QString bareJid = items.at(i).bareJid();
m_entries[bareJid] = items.at(i);
if (!isInitial)
emit rosterChanged(bareJid);
}
if (isInitial)
{
m_isRosterReceived = true;
emit rosterReceived();
}
break;
}
default:
break;
}
}
示例2: UpdateUserInfo
int CUserInfoXmpp::UpdateUserInfo(const QXmppRosterIq::Item &rosterItem)
{
if(m_szJid.isEmpty())
m_szJid = rosterItem.bareJid();
m_Groups = rosterItem.groups();
SetName(rosterItem.name());
m_subscriptionType = FromQxmppSubscriptionType(rosterItem.subscriptionType());
return 0;
}
示例3: InsertUser
int CFrmUserList::InsertUser(QXmppRosterIq::Item rosterItem)
{
int nRet = 0;
CRoster* pRoster = NULL;
QMap<QString, CRoster*>::iterator itRosters;
itRosters = m_Rosters.find(rosterItem.bareJid());
if(m_Rosters.end() == itRosters)
{
//新建好友对象实例
pRoster = new CRoster(rosterItem);
m_Rosters.insert(pRoster->BareJid(), pRoster);
}
else
{
LOG_MODEL_ERROR("Roster", qPrintable("Error:User had existed"));
return -1;
}
nRet = UpdateGroup(pRoster, rosterItem.groups());
return nRet;
}