本文整理汇总了C++中QXmppMessage::extendedAddresses方法的典型用法代码示例。如果您正苦于以下问题:C++ QXmppMessage::extendedAddresses方法的具体用法?C++ QXmppMessage::extendedAddresses怎么用?C++ QXmppMessage::extendedAddresses使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QXmppMessage
的用法示例。
在下文中一共展示了QXmppMessage::extendedAddresses方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testMessageReceipt
void tst_QXmppMessage::testMessageReceipt()
{
const QByteArray xml(
"<message id=\"richard2-4.1.247\" to=\"[email protected]/throne\" from=\"[email protected]/westminster\" type=\"normal\">"
"<body>My lord, dispatch; read o'er these articles.</body>"
"<request xmlns=\"urn:xmpp:receipts\"/>"
"</message>");
QXmppMessage message;
parsePacket(message, xml);
QCOMPARE(message.id(), QString("richard2-4.1.247"));
QCOMPARE(message.to(), QString("[email protected]/throne"));
QCOMPARE(message.from(), QString("[email protected]/westminster"));
QVERIFY(message.extendedAddresses().isEmpty());
QCOMPARE(message.type(), QXmppMessage::Normal);
QCOMPARE(message.body(), QString("My lord, dispatch; read o'er these articles."));
QCOMPARE(message.isAttentionRequested(), false);
QCOMPARE(message.isReceiptRequested(), true);
QCOMPARE(message.receiptId(), QString());
serializePacket(message, xml);
const QByteArray receiptXml(
"<message id=\"bi29sg183b4v\" to=\"[email protected]/westminster\" from=\"[email protected]/throne\" type=\"normal\">"
"<received xmlns=\"urn:xmpp:receipts\" id=\"richard2-4.1.247\"/>"
"</message>");
QXmppMessage receipt;
parsePacket(receipt, receiptXml);
QCOMPARE(receipt.id(), QString("bi29sg183b4v"));
QCOMPARE(receipt.to(), QString("[email protected]/westminster"));
QCOMPARE(receipt.from(), QString("[email protected]/throne"));
QVERIFY(receipt.extendedAddresses().isEmpty());
QCOMPARE(receipt.type(), QXmppMessage::Normal);
QCOMPARE(receipt.body(), QString());
QCOMPARE(receipt.isAttentionRequested(), false);
QCOMPARE(receipt.isReceiptRequested(), false);
QCOMPARE(receipt.receiptId(), QString("richard2-4.1.247"));
serializePacket(receipt, receiptXml);
const QByteArray oldXml(
"<message id=\"richard2-4.1.247\" to=\"[email protected]/westminster\" from=\"[email protected]/throne\" type=\"normal\">"
"<received xmlns=\"urn:xmpp:receipts\"/>"
"</message>");
QXmppMessage old;
parsePacket(old, oldXml);
QCOMPARE(old.id(), QString("richard2-4.1.247"));
QCOMPARE(old.to(), QString("[email protected]/westminster"));
QCOMPARE(old.from(), QString("[email protected]/throne"));
QVERIFY(old.extendedAddresses().isEmpty());
QCOMPARE(old.type(), QXmppMessage::Normal);
QCOMPARE(old.body(), QString());
QCOMPARE(old.isAttentionRequested(), false);
QCOMPARE(old.isReceiptRequested(), false);
QCOMPARE(old.receiptId(), QString("richard2-4.1.247"));
}
示例2: testBasic
void tst_QXmppMessage::testBasic()
{
QFETCH(QByteArray, xml);
QFETCH(int, type);
QFETCH(QString, body);
QFETCH(QString, subject);
QFETCH(QString, thread);
QXmppMessage message;
parsePacket(message, xml);
QCOMPARE(message.to(), QString("[email protected]/QXmpp"));
QCOMPARE(message.from(), QString("[email protected]/QXmpp"));
QVERIFY(message.extendedAddresses().isEmpty());
QCOMPARE(int(message.type()), type);
QCOMPARE(message.body(), body);
QCOMPARE(message.subject(), subject);
QCOMPARE(message.thread(), thread);
QCOMPARE(message.state(), QXmppMessage::None);
QCOMPARE(message.isAttentionRequested(), false);
QCOMPARE(message.isReceiptRequested(), false);
QCOMPARE(message.hasForwarded(), false);
QCOMPARE(message.receiptId(), QString());
QCOMPARE(message.xhtml(), QString());
serializePacket(message, xml);
}
示例3: testMessageAttention
void tst_QXmppMessage::testMessageAttention()
{
const QByteArray xml(
"<message to=\"[email protected]/QXmpp\" from=\"[email protected]/QXmpp\" type=\"normal\">"
"<attention xmlns=\"urn:xmpp:attention:0\"/>"
"</message>");
QXmppMessage message;
parsePacket(message, xml);
QCOMPARE(message.to(), QString("[email protected]/QXmpp"));
QCOMPARE(message.from(), QString("[email protected]/QXmpp"));
QVERIFY(message.extendedAddresses().isEmpty());
QCOMPARE(message.type(), QXmppMessage::Normal);
QCOMPARE(message.body(), QString());
QCOMPARE(message.isAttentionRequested(), true);
QCOMPARE(message.isReceiptRequested(), false);
QCOMPARE(message.receiptId(), QString());
serializePacket(message, xml);
}
示例4: testExtendedAddresses
void tst_QXmppMessage::testExtendedAddresses()
{
QByteArray xml(
"<message to=\"multicast.jabber.org\" type=\"normal\">"
"<addresses xmlns=\"http://jabber.org/protocol/address\">"
"<address desc=\"Joe Hildebrand\" jid=\"[email protected]/Work\" type=\"to\"/>"
"<address desc=\"Jeremie Miller\" jid=\"[email protected]/Home\" type=\"cc\"/>"
"</addresses>"
"</message>");
QXmppMessage message;
parsePacket(message, xml);
QCOMPARE(message.extendedAddresses().size(), 2);
QCOMPARE(message.extendedAddresses()[0].description(), QLatin1String("Joe Hildebrand"));
QCOMPARE(message.extendedAddresses()[0].jid(), QLatin1String("[email protected]/Work"));
QCOMPARE(message.extendedAddresses()[0].type(), QLatin1String("to"));
QCOMPARE(message.extendedAddresses()[1].description(), QLatin1String("Jeremie Miller"));
QCOMPARE(message.extendedAddresses()[1].jid(), QLatin1String("[email protected]/Home"));
QCOMPARE(message.extendedAddresses()[1].type(), QLatin1String("cc"));
serializePacket(message, xml);
}