Add "invitationIgnore" event

This commit is contained in:
Dmitriy Simushev 2014-10-22 14:15:05 +00:00
parent f070a121fe
commit 445a5866ad
2 changed files with 17 additions and 1 deletions

View File

@ -98,6 +98,16 @@ final class Events
*/
const INVITATION_REJECT = 'invitationReject';
/**
* An invitation is ignored.
*
* This event is triggered after an invitation has been ignored by a
* visitor and automatically closed by the system. An associative array with
* the following items is passed to the event handlers:
* - "invitation": an instance of {@link \Mibew\Thread} class.
*/
const INVITATION_IGNORE = 'invitationIgnore';
/**
* An operator cannot be authenticated.
*

View File

@ -245,7 +245,9 @@ function invitation_reject($visitor_id)
}
/**
* Close old invitations
* Close old invitations.
*
* Triggers {@link \Mibew\EventDispatcher\Events::INVITATION_IGNORE} event.
*/
function invitation_close_old()
{
@ -294,6 +296,10 @@ function invitation_close_old()
Thread::KIND_FOR_AGENT,
getlocal('Visitor ignored invitation and it was closed automatically', null, $thread->locale, true)
);
$args = array('invitation' => $thread);
EventDispatcher::getInstance()->triggerEvent(Events::INVITATION_IGNORE, $args);
unset($thread);
}
}