【问题标题】:Openfire - Monitoring Service - Get group chat historyOpenfire - 监控服务 - 获取群聊记录
【发布时间】:2016-12-04 07:29:59
【问题描述】:

我已经安装并配置了带有监控服务插件的 Openfire 服务器,以便保留聊天记录。

当用户在公共房间聊天时,所有聊天消息都保存在数据库中,当我从属于 MySQL 表的行中选择行时,我可以看到它们。

我的要求之一是让用户能够看到他的“旧”消息。为此,必须发送 IQ 节,这在以下链接中得到了很好的解释:http://xmpp.org/extensions/xep-0136.html#manage

我的 IQ Stanza 看起来像:

<iq type="get" id="pref1" xmlns="jabber:client">
    <retrieve xmlns="urn:xmpp:archive" with="user1@conference.kfm" start="2016-07-11T06:27:45.140Z">
        <set xmlns="http://jabber.org/protocol/rsm">
            <max>30</max>
        </set>
    </retrieve>
</iq>

对于那个 IQ Stanza,我收到以下输出:

<iq xmlns="jabber:client" type="result" id="pref1" to="testuser@kfm/b2yg0qj04r">
    <chat xmlns="urn:xmpp:archive" with="user1@conference.kfm" start="2016-07-29T13:45:24.245Z">
        <from secs="0" jid="user1@kfm">
            <body>This is just test</body>
        </from>
        <from secs="0" jid="user1@kfm">
            <body>This is just test</body>
        </from>
        <from secs="0" jid="user1@kfm">
            <body>This is just test</body>
        </from>
        <to secs="7">
            <body>Who is testing?</body>
        </to>
        <to secs="0">
            <body>Who is testing?</body>
        </to>
        <to secs="0">
            <body>Who is testing?</body>
        </to>
        <from secs="8" jid="user1@kfm">
            <body>I'M testing</body>
        </from>
        <from secs="0" jid="user1@kfm">
            <body>I'M testing</body>
        </from>
        <from secs="0" jid="user1@kfm">
            <body>I'M testing</body>
        </from>
        <to secs="5">
            <body>Ok</body>
        </to>
        <to secs="0">
            <body>Ok</body>
        </to>
        <to secs="0">
            <body>Ok</body>
        </to>
        <to secs="1">
            <body>super</body>
        </to>
        <to secs="0">
            <body>super</body>
        </to>
        <to secs="0">
            <body>super</body>
        </to>
        <set xmlns="http://jabber.org/protocol/rsm">
            <first index="0">0</first>
            <last>14</last>
            <count>15</count>
        </set>
    </chat>
</iq>

问题 1

聊天记录中只返回消息正文,而不返回消息属性(例如,当我发送消息时,我为其设置了附加属性,我在此聊天记录中需要它们)。有没有办法启用这个功能?

问题 2

为什么多次返回相同的消息?在我的情况下,每条消息都会返回 3 次,但我只发送了一次消息?

【问题讨论】:

    标签: xmpp openfire strophe


    【解决方案1】:

    关于问题1

    我检查了监控插件代码,它只返回消息正文。由于源是公开可用的,您可以根据需要进行一些修改。

    关于问题2

    检查数据库并确认消息 id 是否相同,因为重复可能是由于客户端应用程序重新提交相同的消息,因为没有得到服务器的确认。

    【讨论】:

    猜你喜欢
    • 2017-01-09
    • 1970-01-01
    • 2016-06-26
    • 2011-10-01
    • 2017-01-15
    • 2017-07-13
    • 2015-10-25
    • 2013-06-30
    相关资源
    最近更新 更多