8
votes

I'm using ejabberd 15.09 and have enabled archive management for every MUC in the server configuration like below:

mod_mam:
    default: always
 mod_muc:
    ## host: "conference.@HOST@"
    access: muc
    access_create: muc_create
    access_persistent: muc_create
    access_admin: muc_admin
    default_room_options:
      mam: true
      persistent: true
      public: true

Also inspection on the admin panel for Ejabberd shows that messages are getting archived as the number of elements in archive table goes up after each message is sent to the MUC. This is verifying that archiving is enabled for the session.

To query the server for message archive from MUC, I am sending this iq packet:

<iq type='set' id='testid1'>
      <query xmlns='urn:xmpp:mam:1'>
        <x xmlns='jabber:x:data' type='submit'>
           <field var='FORM_TYPE' type='hidden'>
               <value>urn:xmpp:mam:1</value>
           </field>
          <field var='with'>
             <value>[email protected]/</value>
          </field>
       </x>
      </query>
    </iq>

Response received from the server doesn't contain any messages.

<message from='user@ip' to='user@ip/Gajim'>
<fin xmlns='urn:xmpp:mam:0' complete='true'>
<set xmlns='http://jabber.org/protocol/rsm'>
<count>0</count>
</set>
</fin>
</message>

This MUC already contains some messages but querying like above is not returning any message. It seems that the format of xml stanza is not correct. Either the format for sending JID for conference is not correct or something else.

Not sure what to do as I'm already using the latest version of Ejabberd which is showing to support archive of MUC. Other that what I'm doing here, I have no idea how to query a MUC archive from ejabberd server.

1
Thanks for highlighting the mam option !Alexandre Bourlier

1 Answers

4
votes

You need to query the MUC service for MUC archive. The user MAM service only stores message for one-to-one conversation.

Please also note that you are not using the latest ejabberd. As of today, latest version is 15.11. I recommend you use the latest one regarding MAM MUC, as several clarifications has been made to XEP-0313 and were added to latest ejabberd.

Here is example query, sending MAM query stanza to MUC room itself:

<iq type='set' id='juliet1' to='[email protected]'>
  <query xmlns='urn:xmpp:mam:0' queryid='f27'>
  <set xmlns='http://jabber.org/protocol/rsm'>
        <max>10</max>
      </set>
  </query>
</iq>