title: Prosody muc chat history is not complete
body: <p>I try to make conference chat using prosody, and for the client I use strophe.js. Everything works great except one thing that the chat history shown to user when they just join in to the room is not complete. For example:
  One client has already sent messages to the room like this:</p>
  
  <pre><code>1
  2
  3
  4
  5
  6
  7
  8
  9
  10
  </code></pre>
  
  <p>But when new client join in to the room, they only get messages like this:</p>
  
  <pre><code>1
  3
  5
  7
  9
  </code></pre>
  
  <p>I try to set <code>max_history_messages = 10</code> in prosody config, and set <code>maxstanzas = 10</code> from client. But still the same.</p>
  
  <p>Here is my config file</p>
  
  <pre><code>admins = { "agent@localhost" }
  modules_enabled = {
          "message_logging";
          "roster";
          "saslauth";
          "tls";
          "dialback";
          "disco"; 
  
          "private";
          "vcard";
  
          "version";
          "uptime";
          "time";
          "ping";
          "pep";
          "register";
  
          "admin_adhoc";
          "admin_telnet";
  
          "bosh";
  
          "posix";
  };
  
  bosh_ports = { 5280 }
  bosh_max_inactivity = 60
  consider_bosh_secure = true
  cross_domain_bosh = true
  http_paths = {
          bosh = "/http-bind"; -- Serve BOSH at /http-bind
          files = "/"; -- Serve files from the base URL
      }
  
  allow_registration = true;
  
  daemonize = true;
  
  pidfile = "/var/run/prosody/prosody.pid";
  
  ssl = {
      key = "/etc/prosody/certs/localhost.key";
      certificate = "/etc/prosody/certs/localhost.crt";
  }
  
  c2s_require_encryption = false
  
  s2s_secure_auth = false
  
  authentication = "internal_plain"
  
  log = {
      info = "/var/log/prosody/prosody.log";
      error = "/var/log/prosody/prosody.err";
      { levels = { "error" }; to = "syslog";  };
  }
  
  VirtualHost "localhost"
      enabled = true -- Remove this line to enable this host
      ssl = {
          key = "/etc/prosody/certs/localhost.key";
          certificate = "/etc/prosody/certs/localhost.crt";
      }
  
  Component "conference.localhost" "muc"
      restrict_room_creation = true
      max_history_messages = 10
  
  Include "conf.d/*.cfg.lua"
  </code></pre>
  
  <p>Is there something need to set in config?</p>
  
  <p>Here's how I handle message in Strophe.js:</p>
  
  <pre><code>function onLoginComplete(status) {
      console.log(status);
      if (status == Strophe.Status.CONNECTING) {
          console.log('Strophe is connecting.');
      } else if (status == Strophe.Status.CONNFAIL) {
          console.log('Strophe failed to connect.');
      } else if (status == Strophe.Status.DISCONNECTING) {
          console.log('Strophe is disconnecting.');
      } else if (status == Strophe.Status.DISCONNECTED) {
          console.log('Strophe is disconnected.');
      } else if (status == Strophe.Status.CONNECTED) {
          console.log('Strophe is connected.');
          connection.addHandler(onMessage, null, 'message', null, null, null);
  
      if (!chat_room) {
        // join to chatroom
      }
  }
  
  /**
  * on new message handler
  **/
  function onMessage(message) {
      console.log(message);
      var type = $(message).attr('type');
      var body = $(message).find('body').text();
      switch (type) {
      case 'groupchat':
          console.log(body);
          // todo append message to the list
          appendMessage(message);
          break;
      }
      return true;
  }
  </code></pre>
  
  <p>Here's one message of the history when user just join the room:</p>
  
  <pre><code>&lt;message xmlns="jabber:client" type="groupchat"     to="subkhan@localhost/edff55f2-2980-4d01-bf65-0d2c0b011845"     from="test@conference.localhost/subkhan"&gt;&lt;body&gt;8&lt;/body&gt;&lt;delay xmlns="urn:xmpp:delay" stamp="2017-04-12T02:54:48Z"&gt;&lt;/delay&gt;&lt;x xmlns="jabber:x:delay" stamp="20170412T02:54:48"&gt;&lt;/x&gt;&lt;/message&gt;
  </code></pre>
  
  <p>Is there something to do with the delay?</p>
  
  <p>Thank you in advance.</p>