From c0412e29545c109e3473b38dbeba4e17514a7b05 Mon Sep 17 00:00:00 2001 From: Linus Jahn Date: Sat, 5 Jan 2019 13:18:45 +0100 Subject: Implement MIX-PAM XEP-0405: Presence extension This implements the new presence extension defined by XEP-0405: Mediated Information eXchange (MIX): Participant Server Requirements in version 0.4.0. https://xmpp.org/extensions/xep-0405.html#usecase-user-presence-receive --- tests/qxmpppresence/tst_qxmpppresence.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'tests') diff --git a/tests/qxmpppresence/tst_qxmpppresence.cpp b/tests/qxmpppresence/tst_qxmpppresence.cpp index af144f26..4144467a 100644 --- a/tests/qxmpppresence/tst_qxmpppresence.cpp +++ b/tests/qxmpppresence/tst_qxmpppresence.cpp @@ -42,6 +42,7 @@ private slots: void testPresenceWithMucPassword(); void testPresenceWithMucSupport(); void testPresenceWithLastUserInteraction(); + void testPresenceWithMix(); }; void tst_QXmppPresence::testPresence_data() @@ -254,5 +255,32 @@ void tst_QXmppPresence::testPresenceWithLastUserInteraction() QCOMPARE(presence.lastUserInteraction(), another); } +void tst_QXmppPresence::testPresenceWithMix() +{ + const QByteArray xml( + "" + "dnd" + "Making a Brew" + "" + "hecate@shakespeare.example/UUID-x4r/2491" + "thirdwitch" + "" + "" + ); + + QXmppPresence presence; + parsePacket(presence, xml); + + QCOMPARE(presence.mixUserJid(), QString("hecate@shakespeare.example/UUID-x4r/2491")); + QCOMPARE(presence.mixUserNick(), QString("thirdwitch")); + serializePacket(presence, xml); + + presence.setMixUserJid("alexander@example.org"); + QCOMPARE(presence.mixUserJid(), QString("alexander@example.org")); + presence.setMixUserNick("erik"); + QCOMPARE(presence.mixUserNick(), QString("erik")); +} + QTEST_MAIN(tst_QXmppPresence) #include "tst_qxmpppresence.moc" -- cgit v1.2.3