From ff3bfa545f46a547f25602098eebcb60d0dea10c Mon Sep 17 00:00:00 2001 From: Dmitriy Simushev Date: Tue, 30 Apr 2013 13:20:14 +0000 Subject: [PATCH] Update pluginMessageIndex event Add ability for plugins to alter sender name and operator ID during message indexing. --- src/messenger/webim/libs/cron.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/messenger/webim/libs/cron.php b/src/messenger/webim/libs/cron.php index 7e7d3978..cffb3f4d 100644 --- a/src/messenger/webim/libs/cron.php +++ b/src/messenger/webim/libs/cron.php @@ -37,6 +37,10 @@ * - 'kind': int, indexed message kind. It must be one of the core messages * kinds, not Thread::KIND_PLUGIN. * - 'message': string, text of indexed message. + * - 'sender_name': string, name of person who sent the message. This field is + * arbitrary and do not use for some messages kinds. + * - 'operator_id': int, ID of the operator who send the message. This field is + * arbitrary and do not use for some messages kinds. * * If the 'result' element equals to boolean false message will be skipped. * @@ -120,6 +124,14 @@ function cron_index_messages() { // Update message $messages[$key]['ikind'] = $event_args['result']['kind']; $messages[$key]['tmessage'] = $event_args['result']['message']; + + if (array_key_exists('sender_name', $event_args['result'])) { + $messages[$key]['tname'] = $event_args['result']['sender_name']; + } + + if (array_key_exists('operator_id', $event_args['result'])) { + $messages[$key]['agentId'] = $event_args['result']['operator_id']; + } } // Check is there some messages that should be saved