igniterealtime/openfire-monitoring-plugin

Some private chat history is better than none.

Closed this issue · 5 comments

Private chat history via MAM is not working. My investigation found that the following code is failing. It returns feature not implemented to XMPP client (conversejs)

        this.iqDispatcher = new AbstractIQHandler(iqDispatcherName, null, iqDispatcherNamespace) {
            public IQ handleIQ(IQ packet) throws UnauthorizedException {
                if (!MonitoringPlugin.getInstance().isEnabled()) {
                    return error(packet,
                            PacketError.Condition.feature_not_implemented);
                }

                final IQHandler iqHandler = element2Handlers.get(packet
                        .getChildElement().getName());
                if (iqHandler != null) {
                    return iqHandler.handleIQ(packet);
                } else {
                    return error(packet,
                            PacketError.Condition.feature_not_implemented);
                }
            }
        };

I found that I can replace this with the following hack to get at least MAM:2 private chat

        this.iqDispatcher = new IQQueryHandler2();

This commit is not working reliably. It works on my dev PC with 1.8.0_144 Oracle Corporation -- Java HotSpot(TM) 64-Bit Server VM, but does not work on my production server with 1.8.0_222 Oracle Corporation -- OpenJDK 64-Bit Server VM

I had to revert back to

   this.iqDispatcher = new IQQueryHandler2();

To get a reliable result

That's surprising. It's the change in key type (from String to QName) that's causing you issues? What issues are those?

It returns feature not implemented to XMPP client (conversejs). The change seems to fail on all my linux servers so far. Only works with my windows dev pc

I've set a breakpoint there and it seems conversejs sends this packet too:

<iq id="10608cea-60f6-44a5-a475-d42cb3a6f750:sendIQ" type="get" from="test2@mopbook/converse.js-75072354">
  <prefs xmlns="urn:xmpp:mam:2"></prefs>
</iq>

This results in a null object and therefore feauture not implemented and should be okay because
we dont have implemented mam configuration from client side.

then it sends this normal mam2 query:

<iq id="62582888-1cf1-485f-b575-0ab904688d08:sendIQ" type="set" from="test2@mopbook/converse.js-75072354">
  <query xmlns="urn:xmpp:mam:2" queryid="0cc75303-9141-448a-b7b4-3ef1451f8e8f">
    <x xmlns="jabber:x:data" type="submit">
      <field type="hidden" var="FORM_TYPE">
        <value>urn:xmpp:mam:2</value>
      </field>
      <field var="with">
        <value>test1@mopbook</value>
      </field>
    </x>
    <set xmlns="http://jabber.org/protocol/rsm">
      <max>50</max>
      <before/>
    </set>
  </query>
</iq>

and then it gets a mam2-handler

It seems to work... at least on my dev environment (win10)
Does the error still occur?

I will look into it on my linux dev pc @work on monday the 6th of january again...

i checked it again, and it seems to work under my linux dev env with guusdk's commit