From f1224a98ee3b20aa1eecd5a93597299a6f25f78b Mon Sep 17 00:00:00 2001 From: Dmitriy Simushev Date: Tue, 2 Oct 2012 09:54:09 +0000 Subject: [PATCH] Fix ability to change avatar --- .../webim/libs/classes/thread_processor.php | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/messenger/webim/libs/classes/thread_processor.php b/src/messenger/webim/libs/classes/thread_processor.php index 35806ce2..cd974146 100644 --- a/src/messenger/webim/libs/classes/thread_processor.php +++ b/src/messenger/webim/libs/classes/thread_processor.php @@ -238,8 +238,32 @@ class ThreadProcessor extends RequestProcessor { $messages = $thread->getMessages($is_user, $last_message_id); if (! empty($messages)) { foreach($messages as $key => $msg) { + // Check if message is avatar + if ($msg['ikind'] == Thread::KIND_AVATAR) { + // Update avatar + $this->responses[] = array( + 'token' => md5(time() . rand()), + 'functions' => array( + array( + 'function' => 'setupAvatar', + 'arguments' => array( + 'threadId' => $thread->id, + 'token' => $thread->lastToken, + 'return' => array(), + 'references' => array(), + 'imageLink' => $msg['tmessage'] + ) + ) + ) + ); + unset($messages[$key]); + continue; + } + + // Theme message $messages[$key] = Thread::themeMessage($msg); } + // Send messages $this->responses[] = array( 'token' => md5(time() . rand()), 'functions' => array(