muchopper icon indicating copy to clipboard operation
muchopper copied to clipboard

Iteration sometimes results in loop where last room in list is always returned

Open SamWhited opened this issue 3 years ago • 0 comments

Sometimes when querying for a chat room after the last room in the list, the last room is returned again resulting in a loop. For example, see the following exchange:

<iq id="e24c908ff334c" type="get" xml:lang="en" to="[email protected]" xmlns="jabber:client">
  <search xmlns="https://xmlns.zombofant.net/muclumbus/search/1.0">
    <x xmlns="jabber:x:data" type="form">
      <field var="FORM_TYPE" type="hidden">
        <value>https://xmlns.zombofant.net/muclumbus/search/1.0#params</value>
</field>
      <field label="Search for" var="q" type="text-single">
        <value>Gopher</value>
</field>
</x>
</search>
</iq>

<iq xmlns="jabber:client" id="e24c908ff334c" type="result" xml:lang="en" from="[email protected]" to="[email protected]/gajim.1EECNY24">
  <result xmlns="https://xmlns.zombofant.net/muclumbus/search/1.0">
    <item address="[email protected]">
      <name>The Go Programming Language</name>
      <description>The Go (golang) programming language.</description>
      <language>en</language>
      <nusers>10</nusers>
      <is-open />
      <anonymity-mode>semi</anonymity-mode>
</item>
    <set xmlns="http://jabber.org/protocol/rsm">
      <first>10.0794637124594</first>
      <last>10.0794637124594</last>
      <max>100</max>
</set>
</result>
</iq>

<!-- Oops, we did not check if first==last and terminate the loop, we should get an empty page to let us know to terminate though. -->
<iq id="08ff334c" type="get" xml:lang="en" to="[email protected]" xmlns="jabber:client">
  <search xmlns="https://xmlns.zombofant.net/muclumbus/search/1.0">
    <set xmlns="http://jabber.org/protocol/rsm">
      <after>10.0794637124594</after>
      <max>5</max>
</set>
    <x xmlns="jabber:x:data" type="form">
      <field var="FORM_TYPE" type="hidden">
        <value>https://xmlns.zombofant.net/muclumbus/search/1.0#params</value>
</field>
      <field label="Search for" var="q" type="text-single">
        <value>Gopher</value>
</field>
</x>
</search>
</iq>

<iq xmlns="jabber:client" id="08ff334c" type="result" xml:lang="en" from="[email protected]" to="[email protected]/gajim.1EECNY24">
  <result xmlns="https://xmlns.zombofant.net/muclumbus/search/1.0">
    <item address="[email protected]">
      <name>The Go Programming Language</name>
      <description>The Go (golang) programming language.</description>
      <language>en</language>
      <nusers>10</nusers>
      <is-open />
      <anonymity-mode>semi</anonymity-mode>
</item>
    <set xmlns="http://jabber.org/protocol/rsm">
      <first>10.0794637124594</first>
      <last>10.0794637124594</last>
      <max>5</max>
</set>
</result>
</iq>

<!-- Loop here -->

SamWhited avatar Mar 14 '22 11:03 SamWhited