From 1dea407037b513375274f31de0dfb39c7c230aff Mon Sep 17 00:00:00 2001 From: Dmitriy Simushev Date: Mon, 20 Oct 2014 12:44:44 +0000 Subject: [PATCH] Add "invitationReject" event --- .../libs/classes/Mibew/EventDispatcher/Events.php | 10 ++++++++++ src/mibew/libs/invitation.php | 5 +++++ 2 files changed, 15 insertions(+) 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); } /**