powered by Jive Software

Monitoring Plugin - Retrieve only 1 to 1 chat


#1

Hello,

When requesting 1 to 1 chat, is there a way to exclude groupchat?

When submitting this iq :

<iq type="set" id="1494335056199" xmlns="jabber:client">
        <query xmlns="urn:xmpp:mam:0" queryid="1494335056199query">
            <x xmlns="jabber:x:data" type="hidden">
                <field var="FORM_TYPE" type="hidden">
                    <value>urn:xmpp:mam:0</value>
                </field>
                <field var="with">
                    <value>aliced@aragon</value>
                </field>
            </x>
            <set xmlns="http://jabber.org/protocol/rsm">
                <max>10</max>
                <before />
            </set>
        </query>
    </iq>

I’m receiving last 10 messages including groupchat.
For example :

<message xmlns='jabber:client' from='room-test@conference.aragon/aliced' to='aliced@aragon/faq4e7lty' id='room-1491568033712' type='groupchat'>
     <body>Message test</body>
</message>

which I don’t want :confused:


#2

Even when requesting history using OpenFire admin archive search, I’m getting history from 1 to 1 and groupchat


#3

Looking at JdbcPersistenceManager.java on GIT : Openfire/JdbcPersistenceManager.java at master · igniterealtime/Openfire · GitHub

This is the SQL generated to retrieve message from one to one :

SELECT DISTINCT ofMessageArchive.fromJID, ofMessageArchive.toJID, ofMessageArchive.sentDate, ofMessageArchive.stanza, ofMessageArchive.messageID,
ofConParticipant.bareJID, ofMessageArchive.conversationID FROM ofMessageArchive
INNER JOIN ofConParticipant ON ofMessageArchive.conversationID = ofConParticipant.conversationID
WHERE (ofMessageArchive.stanza IS NOT NULL OR ofMessageArchive.body IS NOT NULL)
AND ofMessageArchive.toJID IS NOT NULL
AND ofConParticipant.bareJID = 'john@aragon'
AND (ofMessageArchive.toJID = 'aliced@aragon' OR ofMessageArchive.fromJID = 'aliced@aragon')

At this point, since ofConfParticipant also contains conversations from rooms, you do get messages from rooms when requesting history for 1 to 1

Shouldn’t it prevent this and ignore messages from rooms, adding :

INNER JOIN ofConversation ON ofConversation.conversationID = ofMessageArchive.conversationID
AND ofConversation.room IS NULL

I can’t believe something that big didn’t cause trouble for anyone. Is OpenFire even used to create chatroom and/or retrieve history from groupchat and one to one? Or is OpenFire dead like this forum?

EDIT : It uses the same SQL request for groupchat and chat -.-


#4

XEP-0313: Message Archive Management

5.1.1 User Archives

A user archive is anticipated to provide the user with the ability to access their prior conversations. To this end, a server SHOULD include in a user archive all of the messages a user sends or receives of type ‘normal’ or ‘chat’ that contain a element. A server SHOULD also include messages of type ‘groupchat’ that have a , but where such history is accessible through another method (e.g. through an archive on the MUC JID)


#5

We are all volunteers here, send a Pull Request with your suggested patch.


#6

Hi, have you found a way to solve this problem? I also want to filter 1-to-1 chat history from group chat history for particular user.