当前位置: 首页>>代码示例>>C++>>正文


C++ QXmppPresence::type方法代码示例

本文整理汇总了C++中QXmppPresence::type方法的典型用法代码示例。如果您正苦于以下问题:C++ QXmppPresence::type方法的具体用法?C++ QXmppPresence::type怎么用?C++ QXmppPresence::type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QXmppPresence的用法示例。


在下文中一共展示了QXmppPresence::type方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: presenceReceived

void QXmppRosterManager::presenceReceived(const QXmppPresence& presence)
{
    QString jid = presence.from();
    QString bareJid = jidToBareJid(jid);
    QString resource = jidToResource(jid);

    if (bareJid.isEmpty())
        return;

    switch(presence.type())
    {
    case QXmppPresence::Available:
        m_presences[bareJid][resource] = presence;
        emit presenceChanged(bareJid, resource);
        break;
    case QXmppPresence::Unavailable:
        m_presences[bareJid].remove(resource);
        emit presenceChanged(bareJid, resource);
        break;
    case QXmppPresence::Subscribe:
        if (m_stream->configuration().autoAcceptSubscriptions())
        {
            QXmppPresence presence;
            presence.setTo(jid);
            presence.setType(QXmppPresence::Subscribed);
            m_stream->sendPacket(presence);
        }
        break;
    default:
        break;
    }
}
开发者ID:mecalwang,项目名称:imXmpp,代码行数:32,代码来源:QXmppRosterManager.cpp

示例2: _q_presenceReceived

void QXmppRosterManager::_q_presenceReceived(const QXmppPresence& presence)
{
    const QString jid = presence.from();
    const QString bareJid = QXmppUtils::jidToBareJid(jid);
    const QString resource = QXmppUtils::jidToResource(jid);

    if (bareJid.isEmpty())
        return;

    switch(presence.type())
    {
    case QXmppPresence::Available:
        d->presences[bareJid][resource] = presence;
        emit presenceChanged(bareJid, resource);
        break;
    case QXmppPresence::Unavailable:
        d->presences[bareJid].remove(resource);
        emit presenceChanged(bareJid, resource);
        break;
    case QXmppPresence::Subscribe:
        if (client()->configuration().autoAcceptSubscriptions())
        {
            // accept subscription request
            acceptSubscription(bareJid);

            // ask for reciprocal subscription
            subscribe(bareJid);
        } else {
            emit subscriptionReceived(bareJid);
        }
        break;
    default:
        break;
    }
}
开发者ID:mik9,项目名称:qt-radio-t-client,代码行数:35,代码来源:QXmppRosterManager.cpp

示例3: slotPresenceReceived

void xmppClient::slotPresenceReceived(const QXmppPresence &presence)
{
    const QLatin1String recipient("[email protected]");

    // if we are the recipient, or if the presence is not from the recipient,
    // do nothing
    if (jidToBareJid(configuration().jid()) == recipient ||
        jidToBareJid(presence.from()) != recipient ||
        presence.type() != QXmppPresence::Available)
        return;

    // send the file and connect to the job's signals
    QXmppTransferJob *job = transferManager->sendFile(presence.from(), "xmppClient.cpp");

    bool check = connect( job, SIGNAL(error(QXmppTransferJob::Error)),
             this, SLOT(slotError(QXmppTransferJob::Error)) );
    Q_ASSERT(check);

    check = connect( job, SIGNAL(finished()),
             this, SLOT(slotFinished()) );
    Q_ASSERT(check);

    check = connect( job, SIGNAL(progress(qint64,qint64)),
             this, SLOT(slotProgress(qint64,qint64)) );
    Q_ASSERT(check);
}
开发者ID:berndhs,项目名称:qxmpp,代码行数:26,代码来源:xmppClient.cpp

示例4: PresenceToStatus

	EntryStatus PresenceToStatus (const QXmppPresence& pres)
	{
		EntryStatus st (static_cast<State> (pres.availableStatusType () + 1), pres.statusText ());
		if (pres.type () == QXmppPresence::Unavailable)
			st.State_ = SOffline;
		return st;
	}
开发者ID:AlexWMF,项目名称:leechcraft,代码行数:7,代码来源:util.cpp

示例5: presenceToStatusText

QString presenceToStatusText(const QXmppPresence& presence)
{
    QString statusText = presence.statusText();
    if(statusText.isEmpty())
    {
        if(presence.type() == QXmppPresence::Available)
        {
            switch(presence.availableStatusType())
            {
            case QXmppPresence::Invisible:
                statusText = "Offline";
                break;
            case QXmppPresence::Online:
            case QXmppPresence::Chat:
                statusText = "Available";
                break;
            case QXmppPresence::Away:
            case QXmppPresence::XA:
                statusText = "Idle";
                break;
            case QXmppPresence::DND:
                statusText = "Busy";
                break;
            }
        }
        else
            statusText = "Offline";
    }

    return statusText;
}
开发者ID:balazsbela,项目名称:streamphony,代码行数:31,代码来源:utils.cpp

示例6: CheckVCardUpdate

	void EntryBase::CheckVCardUpdate (const QXmppPresence& pres)
	{
		auto conn = Account_->GetClientConnection ();
		if (!conn->GetInfoReqPolicyManager ()->IsRequestAllowed (InfoRequest::VCard, this))
			return;

		auto fetchVCard = [this, conn] () -> void
		{
			QPointer<EntryBase> ptr (this);
			conn->FetchVCard (GetJID (),
					[ptr] (const QXmppVCardIq& iq) { if (ptr) ptr->SetVCard (iq); });
		};

		const auto& vcardUpdate = pres.vCardUpdateType ();
		if (vcardUpdate == QXmppPresence::VCardUpdateNoPhoto)
		{
			if (!Avatar_.isNull ())
			{
				Avatar_ = QImage ();
				emit avatarChanged (GetAvatar ());
			}
		}
		else if (vcardUpdate == QXmppPresence::VCardUpdateValidPhoto)
		{
			if (pres.photoHash () != VCardPhotoHash_)
				fetchVCard ();
		}
		else if (pres.type () == QXmppPresence::Available && !HasBlindlyRequestedVCard_)
		{
			fetchVCard ();
			HasBlindlyRequestedVCard_ = true;
		}
	}
开发者ID:trett,项目名称:leechcraft,代码行数:33,代码来源:entrybase.cpp

示例7: slotPresenceReceived

void QFileTrans::slotPresenceReceived(const QXmppPresence &presence)
{
    bool check;
    Q_UNUSED(check);

    // if we don't have a recipient, or if the presence is not from the recipient,
    // do nothing
    if (m_recipient.isEmpty() ||
        QXmppUtils::jidToBareJid(presence.from()) != m_recipient ||
        presence.type() != QXmppPresence::Available)
        return;

    // send the file and connect to the job's signals
    QXmppTransferJob *job = transferManager->sendFile(presence.from(), ":/example_3_transferHandling.cpp", "example source code");

    check = connect(job, SIGNAL(error(QXmppTransferJob::Error)),
                    this, SLOT(slotError(QXmppTransferJob::Error)));
    Q_ASSERT(check);

    check = connect(job, SIGNAL(finished()),
                    this, SLOT(slotFinished()));
    Q_ASSERT(check);

    check = connect(job, SIGNAL(progress(qint64,qint64)),
                    this, SLOT(slotProgress(qint64,qint64)));
    Q_ASSERT(check);
}
开发者ID:xiaojianwu,项目名称:QtDeskTop,代码行数:27,代码来源:qfiletrans.cpp

示例8: setPresence

void rosterItem::setPresence(const QXmppPresence &presence)
{
    // determine status text
    QString statusText = presence.statusText();
    if (statusText.isEmpty()) {
        if(presence.type() == QXmppPresence::Available)
            statusText = "Available";
        else if(presence.type() == QXmppPresence::Unavailable)
            statusText = "Offline";
    }

    // store data
    setData(statusText, rosterItem::StatusText);
    setData(static_cast<int>(presence.type()), PresenceType);
    setData(static_cast<int>(presence.availableStatusType()), StatusType);

    // update icon
    QString icon;
    if (presence.type() == QXmppPresence::Available) {
        switch (presence.availableStatusType())
        {
        case QXmppPresence::Online:
        case QXmppPresence::Chat:
            icon = "green";
            break;
        case QXmppPresence::Away:
        case QXmppPresence::XA:
            icon = "orange";
            break;
        case QXmppPresence::DND:
            icon = "red";
            break;
        case QXmppPresence::Invisible:
            icon = "gray";
            break;
        }
    } else {
        icon = "gray";
    }
    if (!icon.isEmpty())
        setIcon(QIcon(":/icons/resource/"+icon+".png"));
}
开发者ID:Aseman-Land,项目名称:qxmpp,代码行数:42,代码来源:rosterItem.cpp

示例9: HandlePresence

	void RoomHandler::HandlePresence (const QXmppPresence& pres, const QString& nick)
	{
		if (pres.type () == QXmppPresence::Unavailable &&
				PendingNickChanges_.remove (nick))
			return;
		const bool existed = Nick2Entry_.contains (nick);
		RoomParticipantEntry_ptr entry = GetParticipantEntry (nick);

		if (pres.type () == QXmppPresence::Unavailable)
		{
			MakeLeaveMessage (pres, nick);

			Account_->handleEntryRemoved (entry.get ());
			Nick2Entry_.remove (nick);
			return;
		}

		entry->SetClientInfo ("", pres);

		const QXmppPresence::Status& xmppSt = pres.status ();
		EntryStatus status (static_cast<State> (xmppSt.type ()),
				xmppSt.statusText ());
		const bool statusChanged = (status != entry->GetStatus (QString ()));
		if (statusChanged)
			entry->SetStatus (status, QString ());

		if (!PendingNickChanges_.remove (nick))
		{
			if (!existed)
			{	
				Account_->GetClientConnection ()->
					FetchVCard (RoomJID_ + "/" + nick);
				MakeJoinMessage (pres, nick);
				entry->SetAffiliation (MUCManager_->getAffiliation (RoomJID_, nick));
				entry->SetRole (MUCManager_->getRole (RoomJID_, nick));
			}
			else if (statusChanged)
				MakeStatusChangedMessage (pres, nick);
		}
	}
开发者ID:Mezomish,项目名称:leechcraft,代码行数:40,代码来源:roomhandler.cpp

示例10: slotPresenceReceived

void xmppClient::slotPresenceReceived(const QXmppPresence &presence)
{
    // if we don't have a recipient, or if the presence is not from the recipient,
    // do nothing
    if (m_recipient.isEmpty() ||
        QXmppUtils::jidToBareJid(presence.from()) != m_recipient ||
        presence.type() != QXmppPresence::Available)
        return;

    // start the call and connect to the its signals
    m_recipientFullJid = presence.from();
    startCall();
}
开发者ID:ninoles,项目名称:qxmpp,代码行数:13,代码来源:example_4_callHandling.cpp

示例11: slotPresenceReceived

void rpcClient::slotPresenceReceived(const QXmppPresence &presence)
{
    const QLatin1String recipient("[email protected]");

    // if we are the recipient, or if the presence is not from the recipient,
    // do nothing
    if (QXmppUtils::jidToBareJid(configuration().jid()) == recipient ||
        QXmppUtils::jidToBareJid(presence.from()) != recipient ||
        presence.type() != QXmppPresence::Available)
        return;

    // invoke the remote method in 1 second
    m_remoteJid = presence.from();
    QTimer::singleShot(1000, this, SLOT(slotInvokeRemoteMethod()));
}
开发者ID:antofik,项目名称:RedHelper,代码行数:15,代码来源:rpcClient.cpp

示例12: getPicPresence

QString MyXmppClient::getPicPresence( const QXmppPresence &presence ) const
{
    QString picPresenceName;
    QXmppPresence::Type status = presence.type();
    if( status != QXmppPresence::Available ) picPresenceName = "qrc:/presence/offline";
    else
    {
        QXmppPresence::AvailableStatusType availableStatus = presence.availableStatusType();
        if( availableStatus == QXmppPresence::Online ) picPresenceName = "qrc:/presence/online";
        else if ( availableStatus == QXmppPresence::Chat ) picPresenceName = "qrc:/presence/chatty";
        else if ( availableStatus == QXmppPresence::Away ) picPresenceName = "qrc:/presence/away";
        else if ( availableStatus == QXmppPresence::XA ) picPresenceName = "qrc:/presence/xa";
        else if ( availableStatus == QXmppPresence::DND ) picPresenceName = "qrc:/presence/busy";
    }

    return picPresenceName;
}
开发者ID:ksiazkowicz,项目名称:lightbulb,代码行数:17,代码来源:MyXmppClient.cpp

示例13: initPresence

void MyXmppClient::initPresence(const QString& bareJid, const QString& resource)
{
    int indxItem = -1;
    RosterItemModel *item = (RosterItemModel*)cachedRoster->find( bareJid, indxItem );

    if( item == 0 ) {
        return;
    }

    QXmppPresence xmppPresence = rosterManager->getPresence( bareJid, resource );
    QXmppPresence::Type statusJid = xmppPresence.type();

    QStringList _listResources = this->getResourcesByJid( bareJid );
    if( (_listResources.count() > 0) && (!_listResources.contains(resource)) )
    {
        qDebug() << bareJid << "/" << resource << " ****************[" <<_listResources<<"]" ;
        if( statusJid == QXmppPresence::Unavailable ) {
            return;
        }
    }

    item->setResource( resource );

    QString picStatus = this->getPicPresence( xmppPresence );
    item->setPresence( picStatus );

    QString txtStatus = this->getTextStatus( xmppPresence.statusText(), xmppPresence );
    item->setStatusText( txtStatus );

    RosterItemModel *itemExists = (RosterItemModel*)cachedRoster->find( bareJid, indxItem );

    if( itemExists != 0 ) {
        itemExists->copy( item );
        QString picStatusPrev = itemExists->presence();
        if( picStatusPrev != picStatus )
        {
            //emit presenceJidChanged( bareJid, txtStatus, picStatus );
            emit rosterChanged();
        }
    }
    item = 0; itemExists = 0;
    delete item; delete itemExists;

    emit contactStatusChanged(m_accountId,bareJid);
}
开发者ID:ksiazkowicz,项目名称:lightbulb,代码行数:45,代码来源:MyXmppClient.cpp

示例14: presenceReceived

void Xmpp_client::presenceReceived(const QXmppPresence& presence)
{
    qDebug() << "Xmpp_client::presenceReceived !!!";
    QString from = presence.from();

    QString message;
    switch(presence.type())
    {
    case QXmppPresence::Subscribe:
        {
            QXmppPresence subscribed;
            subscribed.setTo(from);

            subscribed.setType(QXmppPresence::Subscribed);
            this->sendPacket(subscribed);

            // reciprocal subscription
            QXmppPresence subscribe;
            subscribe.setTo(from);
            subscribe.setType(QXmppPresence::Subscribe);
            this->sendPacket(subscribe);

            return;
        }
        break;
    case QXmppPresence::Subscribed:
        message = "<B>%1</B> accepted your request";
        break;
    case QXmppPresence::Unsubscribe:
        message = "<B>%1</B> unsubscribe";
        break;
    case QXmppPresence::Unsubscribed:
        message = "<B>%1</B> unsubscribed";
        break;
    default:
        return;
        break;
    }

    if(message.isEmpty())
        return;
}
开发者ID:fredix,项目名称:nodexmpp,代码行数:42,代码来源:xmpp_client.cpp

示例15: presenceReceived

void MyXmppClient::presenceReceived( const QXmppPresence & presence ) {
    QString bareJid = getBareJidByJid(presence.from());
    QString resource = getResourceByJid(presence.from());

    QString myResource = xmppClient->configuration().resource();

    if ((presence.from().indexOf( m_myjid ) >= 0 && resource == myResource) || (bareJid == "" && resource == "")) {
        if (presence.type() == QXmppPresence::Unavailable) m_status = Offline;
        else {
            switch (presence.availableStatusType()) {
              case QXmppPresence::Online: m_status = Online; break;
              case QXmppPresence::Chat: m_status = Chat; break;
              case QXmppPresence::Away: m_status = Away; break;
              case QXmppPresence::XA: m_status = XA; break;
              case QXmppPresence::DND: m_status = DND; break;
            }
        }
        emit statusChanged(m_accountId);
    }
}
开发者ID:ksiazkowicz,项目名称:lightbulb,代码行数:20,代码来源:MyXmppClient.cpp


注:本文中的QXmppPresence::type方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。