From e4f172e715961167d0146205d3204a0e0849a2bc Mon Sep 17 00:00:00 2001
From: Dmitriy Simushev <simushevds@ossg.ru>
Date: Mon, 21 Jan 2013 14:45:31 +0000
Subject: [PATCH] Update operator status in cache in notify_operator_alive
 function

---
 src/messenger/webim/libs/operator.php | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/messenger/webim/libs/operator.php b/src/messenger/webim/libs/operator.php
index b9d247b5..182e5c67 100644
--- a/src/messenger/webim/libs/operator.php
+++ b/src/messenger/webim/libs/operator.php
@@ -268,6 +268,7 @@ function create_operator($login, $email, $password, $localename, $commonname, $a
  */
 function notify_operator_alive($operatorid, $istatus)
 {
+	global $mysqlprefix;
 	$db = Database::getInstance();
 	$db->query(
 		"update {chatoperator} set istatus = :istatus, dtmlastvisited = :now " .
@@ -278,6 +279,11 @@ function notify_operator_alive($operatorid, $istatus)
 			':operatorid' => $operatorid
 		)
 	);
+	if (isset($_SESSION["${mysqlprefix}operator"])) {
+		if ($_SESSION["${mysqlprefix}operator"]['operatorid'] == $operatorid) {
+			$_SESSION["${mysqlprefix}operator"]['istatus'] = $istatus;
+		}
+	}
 }
 
 /**