设置自定义IQ实现以读取以下XMPP。

时间:2012-02-26 15:36:58

标签: java xmpp smack

我想阅读并处理以下自定义IQ数据包。谁知道我能在哪里找到一个好榜样?

<iq from='pubsub.xmpp.exmaple.net' to='town@xmpp.exmaple.net/Smack' type='result' id='publish-drop-at-4f21a00ce4b0bea7ce62e026'>
        <query xmlns='exmaple:pubsub'>
            <drop>
                <id type='id'>4f49c82ce4b05dc1f0fb9ebb</id>
                <lastEditorId type='id'>marcus</lastEditorId>
                <creatorId type='id'>8732</creatorId>
                <lastEditDate type='date'>1330235436550</lastEditDate>
                <version type='integer'>0</version>
                <creator type='map'>
                    <alias type='string'>marcus</alias>
                </creator>
                <creationDate type='date'>1330235436550</creationDate>
                <path type='path'>town</path>
                <elems type='map'>
                    <song_name type='string'>qewrqwe</song_name>
                    <artist type='string'>wrqer</artist>
                </elems>
    >
            </drop>
        </query>
    </iq>

1 个答案:

答案 0 :(得分:1)

您是否尝试过PacketListener/PacketExtensionFilter or PacketCollector

上的文档

您应该能够在Smack源代码和测试代码中找到每个示例。这是一个example of PacketCollector