Ejemplo n.º 1
0
 /**
  * @brief Get the chat history
  *
  * @param string jid
  * @param string time
  */
 function ajaxGetHistory($jid, $date)
 {
     if (!$this->validateJid($jid)) {
         return;
     }
     $md = new \Modl\MessageDAO();
     $messages = $md->getHistory(echapJid($jid), date(DATE_ISO8601, strtotime($date)), $this->_pagination);
     if (count($messages) > 0) {
         Notification::append(false, $this->__('message.history', count($messages)));
         foreach ($messages as $message) {
             if (!preg_match('#^\\?OTR#', $message->body)) {
                 //RPC::call('Chat.appendMessage', $this->prepareMessage($message), true);
                 //$this->_msgMap[$message->published.$message->jid] = $message;
                 $this->prepareMessage($message);
             }
         }
         //foreach($this->_msgMap as $message)
         //    $this->prepareMessage($message);
         RPC::call('Chat.appendMessagesWrapper', $this->_wrapper, true);
         $this->_wrapper = array();
         //RPC::call('Chat.cleanBubbles');
     }
 }
Ejemplo n.º 2
0
 /**
  * @brief Get the chat history
  *
  * @param string jid
  * @param string time
  */
 function ajaxGetHistory($jid, $date)
 {
     if (!$this->validateJid($jid)) {
         return;
     }
     $md = new \Modl\MessageDAO();
     $messages = $md->getHistory(echapJid($jid), date(DATE_ISO8601, strtotime($date)), $this->_pagination);
     if (count($messages) > 0) {
         Notification::append(false, $this->__('message.history', count($messages)));
     }
     foreach ($messages as $message) {
         if (!preg_match('#^\\?OTR#', $message->body)) {
             RPC::call('Chat.appendMessage', $this->prepareMessage($message), true);
         }
     }
 }