diff --git a/src/mibew/libs/classes/Mibew/EventDispatcher/Events.php b/src/mibew/libs/classes/Mibew/EventDispatcher/Events.php index 40295809..59873ffa 100644 --- a/src/mibew/libs/classes/Mibew/EventDispatcher/Events.php +++ b/src/mibew/libs/classes/Mibew/EventDispatcher/Events.php @@ -70,6 +70,16 @@ final class Events */ 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. * diff --git a/src/mibew/libs/invitation.php b/src/mibew/libs/invitation.php index 5b8bf3c2..8fedc065 100644 --- a/src/mibew/libs/invitation.php +++ b/src/mibew/libs/invitation.php @@ -206,6 +206,8 @@ function invitation_accept($visitor_id) /** * Inviation was rejected by visitor * + * Triggers {@link \Mibew\EventDispatcher\Events::INVITATION_REJECT} event. + * * @param int $visitor_id ID of the visitor */ function invitation_reject($visitor_id) @@ -237,6 +239,9 @@ function invitation_reject($visitor_id) ':now' => time(), ) ); + + $args = array('invitation' => $thread); + EventDispatcher::getInstance()->triggerEvent(Events::INVITATION_REJECT, $args); } /**