Add "invitationReject" event

This commit is contained in:
Dmitriy Simushev 2014-10-20 12:44:44 +00:00
parent b83cb193f1
commit 1dea407037
2 changed files with 15 additions and 0 deletions

View File

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

View File

@ -206,6 +206,8 @@ function invitation_accept($visitor_id)
/** /**
* Inviation was rejected by visitor * Inviation was rejected by visitor
* *
* Triggers {@link \Mibew\EventDispatcher\Events::INVITATION_REJECT} event.
*
* @param int $visitor_id ID of the visitor * @param int $visitor_id ID of the visitor
*/ */
function invitation_reject($visitor_id) function invitation_reject($visitor_id)
@ -237,6 +239,9 @@ function invitation_reject($visitor_id)
':now' => time(), ':now' => time(),
) )
); );
$args = array('invitation' => $thread);
EventDispatcher::getInstance()->triggerEvent(Events::INVITATION_REJECT, $args);
} }
/** /**