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 #