igniterealtime / openfire-search-plugin

Adds Jabber Search (XEP-0055) capabilities to Openfire
Apache License 2.0
3 stars 8 forks source link

Order of fields does not equal to reported fields order #12

Closed mightymop closed 2 years ago

mightymop commented 3 years ago

Because of using a HashMap while creating response packet the order of result fields differ from order of reported fields. HashMap will sort keys... using a LinkedHashMap would keep the right order... PR: #14

<iq type="result" id="8f96e316-6c33-4663-951e-972c4a9ff7a0:sendIQ" from="search.MYDOMAIN.de" to="mops@MYDOMAIN.de/jsxc-a04cf6a1" xmlns="jabber:client">
    <query xmlns="jabber:iq:search">
        <x xmlns="jabber:x:data" type="result">
            <field var="FORM_TYPE" type="hidden"/>
            <reported>
                <field var="jid" type="jid-single" label="JID"/>
                <field var="Username" type="text-single" label="Username"/>
                <field var="Name" type="text-single" label="Name"/>
                <field var="Email" type="text-single" label="Email"/>
            </reported>
            <item>
                <field var="Email">
                    <value>mopsmail@MYDOMAIN.de</value>
                </field>
                <field var="jid">
                    <value>mops@MYDOMAIN.de</value>
                </field>
                <field var="Username">
                    <value>mops</value>
                </field>
                <field var="Name">
                    <value>mops</value>
                </field>
            </item>
        </x>
    </query>
</iq>
mightymop commented 2 years ago

Depending of the clients implementation the wrong order of fields could end in empty fields. https://discourse.igniterealtime.org/t/several-problems-with-search-plugin/89716/7