Returns messages from the given chat sent after $last.
function($id_chat, $last = NULL, $day = NULL)
{
$res = ['success' => false, 'last' => null, 'messages' => []];
if ($this->check()) {
$dir = bbn\Mvc::getUserDataPath($this->user->getId(), 'appui-chat').$id_chat.'/'.($day ?: date('Y-m-d'));
if ($this->isParticipant($id_chat) && is_dir($dir)) {
$res['success'] = true;
$files = bbn\File\Dir::getFiles($dir);
foreach ($files as $file){
$time = (float)X::basename($file, '.msg');
if ((!$last || X::compareFloats($time, $last, '>')) && ($st = file_get_contents($file))) {
$res['messages'][] = json_decode(bbn\Util\Enc::decrypt($st), true);
}
}
if (isset($time)) {
$res['last'] = $time;
}
}
}
return $res;
}