method talk documentation in bbn\Appui\Chat
Sends a new message from the current user in the given chat.
function(string $id_chat, string $message)
{
if ($this->check() && ($chat = $this->info($id_chat)) && !$chat['blocked']) {
$users = $this->getParticipants($id_chat);
if (\in_array($this->user->getId(), $users, true)) {
$time = X::microtime();
$st = bbn\Util\Enc::crypt(json_encode(['time' => $time, 'user' => $this->user->getId(), 'message' => $message]));
$day = date('Y-m-d');
foreach ($users as $user) {
$dir = bbn\Mvc::getUserDataPath($user, 'appui-chat').$id_chat.'/'.$day;
if (bbn\File\Dir::createPath($dir)) {
file_put_contents($dir.'/'.$time.'.msg', $st);
}
}
$this->setLastActivity($id_chat, $this->user->getId());
return $this->db->update('bbn_chats', ['last_message' => $time], ['id' => $id_chat]);
}
}
return null;
}
Sends a new message from the current user in the given chat. BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way
This website uses cookies to ensure you get the best experience on our website.
© 2011-2023
BBN Solutions