From 3074af94db5580943a65f44128efcaee036d2edf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaussoin=20Timoth=C3=A9e?= Date: Sun, 8 Mar 2015 23:28:58 +0100 Subject: [PATCH] - Comment the logs in the linker - Catch and display the "gone" event in the chat - Show when the message has been published (and not delivered) --- app/widgets/Chat/Chat.php | 6 ++++++ app/widgets/Chat/_chat_message.tpl | 2 +- app/widgets/Chat/locales.ini | 1 + linker.php | 6 +++--- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/widgets/Chat/Chat.php b/app/widgets/Chat/Chat.php index 2479ad53f..4e9537b45 100644 --- a/app/widgets/Chat/Chat.php +++ b/app/widgets/Chat/Chat.php @@ -14,6 +14,7 @@ class Chat extends WidgetCommon $this->registerEvent('message', 'onMessage'); $this->registerEvent('composing', 'onComposing'); $this->registerEvent('paused', 'onPaused'); + $this->registerEvent('gone', 'onGone'); } function onMessage($packet) @@ -62,6 +63,11 @@ class Chat extends WidgetCommon $this->setState($array, $this->__('message.paused')); } + function onGone($array) + { + $this->setState($array, $this->__('message.gone')); + } + private function setState($array, $message) { list($from, $to) = $array; diff --git a/app/widgets/Chat/_chat_message.tpl b/app/widgets/Chat/_chat_message.tpl index 8452070be..f137e44b6 100644 --- a/app/widgets/Chat/_chat_message.tpl +++ b/app/widgets/Chat/_chat_message.tpl @@ -34,7 +34,7 @@ {else}
{if="isset($message->html)"}{$message->html|prepareString}{else}{$message->body|htmlentities:ENT_COMPAT,'UTF-8'|prepareString}{/if}
{/if} - {$message->delivered|strtotime|prepareDate} + {$message->published|strtotime|prepareDate} {if="$message->type == 'groupchat'"} {$message->resource} - {/if} diff --git a/app/widgets/Chat/locales.ini b/app/widgets/Chat/locales.ini index d47cde358..85302f73e 100644 --- a/app/widgets/Chat/locales.ini +++ b/app/widgets/Chat/locales.ini @@ -3,6 +3,7 @@ message.published = 'Message Published' message.encrypted = 'Encrypted message' message.composing = 'Composing...' message.paused = 'Paused...' +message.gone = 'Contact gone' [chat] chat.attention = '%s needs your attention' diff --git a/linker.php b/linker.php index ba71d19fc..98463048a 100755 --- a/linker.php +++ b/linker.php @@ -45,7 +45,7 @@ $connector($config->websocketurl, array('xmpp'))->then(function($conn) use (&$st $conn->on('message', function($message) use ($conn, $loop) { if($message != '') { - fwrite(STDERR, colorize($message, 'yellow')." : ".colorize('received', 'green')."\n"); + #fwrite(STDERR, colorize($message, 'yellow')." : ".colorize('received', 'green')."\n"); if($message == '') { $conn->close(); @@ -76,7 +76,7 @@ $connector($config->websocketurl, array('xmpp'))->then(function($conn) use (&$st } if(!empty($xml)) { - fwrite(STDERR, colorize(trim($xml), 'yellow')." : ".colorize('sent to XMPP', 'green')."\n"); + #fwrite(STDERR, colorize(trim($xml), 'yellow')." : ".colorize('sent to XMPP', 'green')."\n"); $conn->send(trim($xml)); } } @@ -118,7 +118,7 @@ $connector($config->websocketurl, array('xmpp'))->then(function($conn) use (&$st \Moxl\API::clear(); if(!empty($xml)) { - fwrite(STDERR, colorize(trim($xml), 'yellow')." : ".colorize('sent to XMPP', 'green')."\n"); + #fwrite(STDERR, colorize(trim($xml), 'yellow')." : ".colorize('sent to XMPP', 'green')."\n"); $conn->send(trim($xml)); }