From f4d06133db1d77129785ef737edd3b39387cfcff Mon Sep 17 00:00:00 2001 From: annelin Date: Sat, 26 Sep 2020 11:03:01 +0300 Subject: [PATCH] Add `rawmessages` configuration option --- inc/telegramclient.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/inc/telegramclient.rb b/inc/telegramclient.rb index 1cf79cd..cc8883d 100644 --- a/inc/telegramclient.rb +++ b/inc/telegramclient.rb @@ -27,6 +27,7 @@ HELP_GATE_CMD = %q{Available commands: Configuration options timezone — adjust timezone for Telegram user statuses (example: +02:00) keeponline — always keep telegram session online and rely on jabber offline messages (example: true) + rawmessages — do not add additional info (message id, origin etc.) to incoming messages (example: true) } HELP_CHAT_CMD= %q{Available commands: @@ -190,7 +191,7 @@ class TelegramClient prefix = prefix.join(' | ') prefix += (update.message.chat_id < 0 and text and text != "") ? "\n" : '' # \n if it is groupchat and message is not empty prefix += (update.message.chat_id > 0 and text and text != "") ? " | " : '' - text = prefix + text unless text.start_with? '?OTR' # OTR support (I do not know why would you need it, seriously) + text = prefix + text unless (text.start_with? '?OTR' or @session[:rawmessages] == 'true') # OTR support (I do not know why would you need it, seriously) @telegram.view_messages(update.message.chat_id, [update.message.id], true) # mark message as read @xmpp.send_message(@jid, update.message.chat_id, text) # forward message to XMPP end