Skip to content

Commit cce6fe6

Browse files
committed
Improvements
1 parent 20d585a commit cce6fe6

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

nodejshelper/bootstrap/bootstrap.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ public function run() {
1717
$dispatcher->listen('chat.addmsguser', array( $this, 'messageReceived' ));
1818
$dispatcher->listen('telegram.msg_received', array( $this, 'messageReceived' ));
1919
$dispatcher->listen('twilio.sms_received', array( $this,'messageReceived' ));
20-
$dispatcher->listen('chat.web_add_msg_admin', array( $this,'messageReceived' ));
20+
21+
$dispatcher->listen('chat.visitor_regular_closed', array( $this,'messageReceived' ));
22+
$dispatcher->listen('chat.explicitly_closed', array( $this,'messageReceived' ));
23+
24+
$dispatcher->listen('chat.web_add_msg_admin', array( $this,'messageReceivedAdmin' ));
25+
$dispatcher->listen('chat.chatwidgetchat', array( $this,'messageReceived' ));
2126

2227
// Chat was accepted.
2328
$dispatcher->listen('chat.accept', array( $this,'statusChange' ));
@@ -40,6 +45,14 @@ public function __get($var)
4045
}
4146
}
4247

48+
public function messageReceivedAdmin($params) {
49+
if (isset($params['ou']) && $params['ou'] instanceof erLhcoreClassModelChatOnlineUser && $params['chat']->user_status == erLhcoreClassModelChat::USER_STATUS_PENDING_REOPEN) {
50+
erLhcoreClassNodeJSRedis::instance()->publish('uo_' . $params['ou']->vid,'o:' . json_encode(array('op' => 'check_message')));
51+
} else {
52+
erLhcoreClassNodeJSRedis::instance()->publish('chat_' . $params['chat']->id,'o:' . json_encode(array('op' => 'cmsg')));
53+
}
54+
}
55+
4356
public function getSettingVariable($var) {
4457

4558
switch ($var) {

0 commit comments

Comments
 (0)