本文整理汇总了C++中qxmpprosteriq::Item类的典型用法代码示例。如果您正苦于以下问题:C++ Item类的具体用法?C++ Item怎么用?C++ Item使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Item类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: SetGroups
void GlooxCLEntry::SetGroups (const QStringList& groups)
{
if (ODS_)
return;
QXmppRosterIq::Item item = GetRI ();
item.setGroups (QSet<QString>::fromList (groups));
Account_->GetClientConnection ()->Update (item);
}
示例3: 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;
}
示例4: itemChanged
void MyXmppClient::itemChanged(const QString &bareJid ) {
qDebug() << "MyXmppClient::itemChanged(): " << bareJid;
QXmppRosterIq::Item rosterEntry = rosterManager->getRosterEntry( bareJid );
if (rosterEntry.name() != "") {
RosterItemModel *item = (RosterItemModel*)cachedRoster->find( bareJid );
if( item != 0 ) item->setContactName( rosterEntry.name() );
emit contactRenamed(bareJid,rosterEntry.name());
item = 0; delete item;
}
}
示例5: SetEntryName
void GlooxCLEntry::SetEntryName (const QString& name)
{
if (ODS_)
return;
QXmppRosterIq::Item item = GetRI ();
item.setName (name);
Account_->GetClientConnection ()->Update (item);
emit nameChanged (name);
}
示例6: removeItem
bool QXmppRosterManager::removeItem(const QString &bareJid)
{
QXmppRosterIq::Item item;
item.setBareJid(bareJid);
item.setSubscriptionType(QXmppRosterIq::Item::Remove);
QXmppRosterIq iq;
iq.setType(QXmppIq::Set);
iq.addItem(item);
return client()->sendPacket(iq);
}
示例7: initVCard
void MyXmppClient::initVCard(const QXmppVCardIq &vCard)
{
QString bareJid = vCard.from();
RosterItemModel *item = (RosterItemModel*)cachedRoster->find( bareJid );
vCardData dataVCard;
if( item != 0 )
{
/* set nickname */
QXmppRosterIq::Item itemRoster = rosterManager->getRosterEntry( bareJid );
QString nickName = vCard.nickName();
if( (!nickName.isEmpty()) && (!nickName.isNull()) && (itemRoster.name().isEmpty()) ) {
qDebug() << "MyXmppClient::initPresence: updating name for"<< bareJid;
item->setContactName( nickName );
}
/* avatar */
bool isAvatarCreated = true;
QString avatarFile = cacheIM->getAvatarCache( bareJid );
if( (avatarFile.isEmpty() || avatarFile == "qrc:/avatar" || (flVCardRequest != "")) && vCard.photo() != "" ) {
isAvatarCreated = cacheIM->setAvatarCache( bareJid, vCard.photo() );
}
item->setAvatar(cacheIM->getAvatarCache(bareJid));
dataVCard.nickName = nickName;
dataVCard.firstName = vCard.firstName();
dataVCard.fullName = vCard.fullName();;
dataVCard.middleName = vCard.middleName();
dataVCard.lastName = vCard.lastName();
dataVCard.url = vCard.url();
dataVCard.eMail = vCard.email();
if( flVCardRequest == bareJid ) {
qmlVCard->setPhoto( avatarFile );
qmlVCard->setNickName( vCard.nickName() );
qmlVCard->setMiddleName( vCard.middleName() );
qmlVCard->setLastName( vCard.lastName() );
qmlVCard->setFullName( vCard.fullName() );
qmlVCard->setName( vCard.firstName() );
qmlVCard->setBirthday( vCard.birthday().toString("dd.MM.yyyy") );
qmlVCard->setEMail( vCard.email() );
qmlVCard->setUrl( vCard.url() );
qmlVCard->setJid( bareJid );
flVCardRequest = "";
emit vCardChanged();
}
cacheIM->setVCard( bareJid, dataVCard );
}
}
示例8: renameItem
bool QXmppRosterManager::renameItem(const QString &bareJid, const QString &name)
{
if (!d->entries.contains(bareJid))
return false;
QXmppRosterIq::Item item = d->entries.value(bareJid);
item.setName(name);
QXmppRosterIq iq;
iq.setType(QXmppIq::Set);
iq.addItem(item);
return client()->sendPacket(iq);
}
示例9: addItem
bool QXmppRosterManager::addItem(const QString &bareJid, const QString &name, const QSet<QString> &groups)
{
QXmppRosterIq::Item item;
item.setBareJid(bareJid);
item.setName(name);
item.setGroups(groups);
item.setSubscriptionType(QXmppRosterIq::Item::NotSet);
QXmppRosterIq iq;
iq.setType(QXmppIq::Set);
iq.addItem(item);
return client()->sendPacket(iq);
}
示例10: parseElementFromChild
void QXmppRosterIq::parseElementFromChild(const QDomElement &element)
{
QDomElement itemElement = element.
firstChildElement("query").
firstChildElement("item");
while(!itemElement.isNull())
{
QXmppRosterIq::Item item;
item.parse(itemElement);
m_items.append(item);
itemElement = itemElement.nextSiblingElement();
}
}
示例11: slotItemChanged
void CFrmUserList::slotItemChanged(const QString &bareJid)
{
LOG_MODEL_DEBUG("Roster", "CFrmUserList::itemChanged jid:%s", qPrintable(bareJid));
QMap<QString, CRoster*>::iterator it;
it = m_Rosters.find(QXmppUtils::jidToBareJid(bareJid));
if(m_Rosters.end() != it)
{
CRoster* pRoster = it.value();
QXmppRosterIq::Item item = CGlobal::Instance()->GetXmppClient()->rosterManager().getRosterEntry(bareJid);
pRoster->UpdateItems(item);
UpdateGroup(pRoster, item.groups());
}
}
示例12: initRoster
void MyXmppClient::initRoster() {
qDebug() << "MyXmppClient::initRoster() called";
if (!rosterManager->isRosterReceived()) {
qDebug() << "MyXmppClient::initRoster(): roster not available yet";
return;
}
cachedRoster->cleanList();
QStringList listBareJids = rosterManager->getRosterBareJids();
for( int j=0; j < listBareJids.length(); j++ )
{
QString bareJid = listBareJids.at(j);
cacheIM->addCacheJid( bareJid );
QXmppRosterIq::Item itemRoster = rosterManager->getRosterEntry( bareJid );
QString name = itemRoster.name();
vCardData vCdata = cacheIM->getVCard( bareJid );
if ( vCdata.isEmpty() && !disableAvatarCaching ) {
qDebug() << "MyXmppClient::initRoster():" << bareJid << "has no VCard. Requesting.";
vCardManager->requestVCard( bareJid );
}
RosterItemModel *itemExists = (RosterItemModel*)cachedRoster->find(bareJid);
if (itemExists == 0) {
RosterItemModel *itemModel = new RosterItemModel( );
itemModel->setPresence( this->getPicPresence( QXmppPresence::Unavailable ) );
itemModel->setContactName( name );
itemModel->setJid( bareJid );
itemModel->setAvatar(cacheIM->getAvatarCache(bareJid));
cachedRoster->append(itemModel);
itemModel = 0;
delete itemModel;
} else if (itemExists->name() != name) {
itemExists->setContactName(name);
emit contactRenamed(bareJid,name);
}
itemExists = 0; delete itemExists;
}
emit rosterChanged();
}
示例13: 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;
}
示例14: initVCard
void MyXmppClient::initVCard(const QXmppVCardIq &vCard)
{
QString bareJid = vCard.from();
RosterItemModel *item = (RosterItemModel*)cachedRoster->find( bareJid );
vCardData dataVCard;
if( item != 0 )
{
/* set nickname */
QXmppRosterIq::Item itemRoster = rosterManager->getRosterEntry( bareJid );
QString nickName = vCard.nickName();
if( (!nickName.isEmpty()) && (!nickName.isNull()) && (itemRoster.name().isEmpty()) ) {
qDebug() << "MyXmppClient::initPresence: updating name for"<< bareJid;
item->setContactName( nickName );
}
/* avatar */
bool isAvatarCreated = true;
QString avatarFile = cacheIM->getAvatarCache( bareJid );
if( (avatarFile.isEmpty() || avatarFile == "qrc:/avatar") && vCard.photo() != "" && !disableAvatarCaching) {
isAvatarCreated = cacheIM->setAvatarCache( bareJid, vCard.photo() );
}
item->setAvatar(cacheIM->getAvatarCache(bareJid));
dataVCard.nickName = nickName;
dataVCard.firstName = vCard.firstName();
dataVCard.fullName = vCard.fullName();;
dataVCard.middleName = vCard.middleName();
dataVCard.lastName = vCard.lastName();
dataVCard.url = vCard.url();
dataVCard.eMail = vCard.email();
cacheIM->setVCard( bareJid, dataVCard );
}
}