From 7a2f85e0fe9b9f0ff35a124f7ba86121f8ce30a3 Mon Sep 17 00:00:00 2001 From: annelin Date: Thu, 20 Jun 2019 19:29:06 +0300 Subject: [PATCH] =?UTF-8?q?hey=20I'm=20just=20added=20OTR=20support=20?= =?UTF-8?q?=E2=98=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inc/telegramclient.rb | 5 ++++- inc/xmppcomponent.rb | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/inc/telegramclient.rb b/inc/telegramclient.rb index 726fef5..80bd01e 100644 --- a/inc/telegramclient.rb +++ b/inc/telegramclient.rb @@ -165,9 +165,12 @@ class TelegramClient 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 != "") ? " | " : '' + # OTR support + text = prefix + text unless text.start_with? '?OTR' + # read message & send it to xmpp @client.view_messages(update.message.chat_id, [update.message.id], force_read: true) - @xmpp.message(@jid, update.message.chat_id.to_s, prefix + text) + @xmpp.message(@jid, update.message.chat_id.to_s, text) end # new chat update -- when tg client discovers new chat # diff --git a/inc/xmppcomponent.rb b/inc/xmppcomponent.rb index 7cc29eb..0de56d0 100644 --- a/inc/xmppcomponent.rb +++ b/inc/xmppcomponent.rb @@ -134,8 +134,8 @@ class XMPPComponent req.add_element('nick', {'xmlns' => 'http://jabber.org/protocol/nick'} ).add_text(nickname) unless nickname.nil? # nickname req.add_element('x', {'xmlns' => 'vcard-temp:x:update'} ).add_element("photo").add_text(photo) unless photo.nil? # nickname @logger.debug req.to_s - #(immediately) ? @component.send(req) : @presence_que.store(req.from.to_s+req.to.to_s, req) - @component.send(req) + (immediately) ? @component.send(req) : @presence_que.store(req.from.to_s+req.to.to_s, req) + # @component.send(req) end # request timezone information #