Add THREAD_USER_IS_READY event

This commit is contained in:
Dmitriy Simushev 2015-06-19 11:15:07 +00:00
parent 227c7a9410
commit 8457e51717
2 changed files with 19 additions and 0 deletions

View File

@ -18,6 +18,8 @@
*/ */
use Mibew\Asset\Generator\UrlGeneratorInterface as AssetUrlGeneratorInterface; use Mibew\Asset\Generator\UrlGeneratorInterface as AssetUrlGeneratorInterface;
use Mibew\EventDispatcher\EventDispatcher;
use Mibew\EventDispatcher\Events;
use Mibew\Settings; use Mibew\Settings;
use Mibew\Thread; use Mibew\Thread;
use Mibew\Style\ChatStyle; use Mibew\Style\ChatStyle;
@ -717,5 +719,10 @@ function chat_start_for_user(
); );
} }
// Let plugins know that user is ready to chat.
$dispatcher = EventDispatcher::getInstance();
$event_args = array('thread' => $thread);
$dispatcher->triggerEvent(Events::THREAD_USER_IS_READY, $event_args);
return $thread; return $thread;
} }

View File

@ -414,6 +414,18 @@ final class Events
*/ */
const THREAD_GET_MESSAGES_ALTER = 'threadGetMessagesAlter'; const THREAD_GET_MESSAGES_ALTER = 'threadGetMessagesAlter';
/**
* User is ready to chat.
*
* This event is triggered after the thread is created, the user passed
* pre-chat survey and all system messages are sent to him. This event is
* not triggered if there are no online operators and the chat cannot be
* started. An associative array with the following items is passed to the
* event handlers:
* - "thread": an instance of {@link \Mibew\Thread}.
*/
const THREAD_USER_IS_READY = 'threadUserIsReady';
/** /**
* Threads list is ready to be sent to client. * Threads list is ready to be sent to client.
* *