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


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

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


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

示例1: testPresenceWithCapability

void TestPackets::testPresenceWithCapability()
{
    const QByteArray xml(
        "<presence to=\"[email protected]/QXmpp\" from=\"[email protected]/QXmpp\">"
        "<show>away</show>"
        "<status>In a meeting</status>"
        "<priority>5</priority>"
        "<x xmlns=\"vcard-temp:x:update\">"
        "<photo>73b908bc</photo>"
        "</x>"
        "<c xmlns=\"http://jabber.org/protocol/caps\" hash=\"sha-1\" node=\"http://code.google.com/p/qxmpp\" ver=\"QgayPKawpkPSDYmwT/WM94uAlu0=\"/>"
        "</presence>");

    QXmppPresence presence;
    parsePacket(presence, xml);
    QCOMPARE(presence.to(), QString("[email protected]/QXmpp"));
    QCOMPARE(presence.from(), QString("[email protected]/QXmpp"));
    QCOMPARE(presence.status().type(), QXmppPresence::Status::Away);
    QCOMPARE(presence.status().statusText(), QString("In a meeting"));
    QCOMPARE(presence.status().priority(), 5);
    QCOMPARE(presence.photoHash(), QByteArray::fromHex("73b908bc"));
    QCOMPARE(presence.vCardUpdateType(), QXmppPresence::VCardUpdateValidPhoto);
    QCOMPARE(presence.capabilityHash(), QString("sha-1"));
    QCOMPARE(presence.capabilityNode(), QString("http://code.google.com/p/qxmpp"));
    QCOMPARE(presence.capabilityVer(), QByteArray::fromBase64("QgayPKawpkPSDYmwT/WM94uAlu0="));

    serializePacket(presence, xml);
}
开发者ID:contextlogger,项目名称:contextlogger2,代码行数:28,代码来源:tests.cpp

示例2: testPresenceFull

void TestPackets::testPresenceFull()
{
    const QByteArray xml(
        "<presence to=\"[email protected]/QXmpp\" from=\"[email protected]/QXmpp\">"
        "<show>away</show>"
        "<status>In a meeting</status>"
        "<priority>5</priority>"
        "</presence>");

    QXmppPresence presence;
    parsePacket(presence, xml);
    QCOMPARE(presence.to(), QString("[email protected]/QXmpp"));
    QCOMPARE(presence.from(), QString("[email protected]/QXmpp"));
    QCOMPARE(presence.status().type(), QXmppPresence::Status::Away);
    QCOMPARE(presence.status().statusText(), QString("In a meeting"));
    QCOMPARE(presence.status().priority(), 5);
    QCOMPARE(presence.vCardUpdateType(), QXmppPresence::VCardUpdateNone);
    serializePacket(presence, xml);
}
开发者ID:contextlogger,项目名称:contextlogger2,代码行数:19,代码来源:tests.cpp

示例3: setClientPresence

void QXmppClient::setClientPresence(QXmppPresence::Status::Type statusType)
{
    QXmppPresence newPresence = d->clientPresence;
    if (statusType == QXmppPresence::Status::Offline)
        newPresence.setType(QXmppPresence::Unavailable);
    else
        newPresence.setType(QXmppPresence::Available);
    newPresence.status().setType(statusType);
    setClientPresence(newPresence);
}
开发者ID:mecalwang,项目名称:imXmpp,代码行数:10,代码来源:QXmppClient.cpp

示例4: testPresenceWithVCardUpdate

void TestPackets::testPresenceWithVCardUpdate()
{
    const QByteArray xml(
        "<presence to=\"[email protected]/QXmpp\" from=\"[email protected]/QXmpp\">"
        "<show>away</show>"
        "<status>In a meeting</status>"
        "<priority>5</priority>"
        "<x xmlns=\"vcard-temp:x:update\">"
        "<photo>73b908bc</photo>"
        "</x>"
        "</presence>");

    QXmppPresence presence;
    parsePacket(presence, xml);
    QCOMPARE(presence.to(), QString("[email protected]/QXmpp"));
    QCOMPARE(presence.from(), QString("[email protected]/QXmpp"));
    QCOMPARE(presence.status().type(), QXmppPresence::Status::Away);
    QCOMPARE(presence.status().statusText(), QString("In a meeting"));
    QCOMPARE(presence.status().priority(), 5);
    QCOMPARE(presence.photoHash(), QByteArray::fromHex("73b908bc"));
    QCOMPARE(presence.vCardUpdateType(), QXmppPresence::VCardUpdateValidPhoto);
    serializePacket(presence, xml);
}
开发者ID:contextlogger,项目名称:contextlogger2,代码行数:23,代码来源:tests.cpp

示例5: 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


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