From 7a0845ad39f6b5c0dbdfaf1c29c64f9d0001ffc9 Mon Sep 17 00:00:00 2001 From: annelin Date: Tue, 16 Apr 2019 07:53:31 +0300 Subject: [PATCH] Added README.md & license --- LICENSE | 24 ++++++++++++++++++++++++ README.md | 38 ++++++++++++++++++++++++++++++++++++++ inc/telegramclient.rb | 2 +- 3 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 LICENSE create mode 100644 README.md diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..7925d62 --- /dev/null +++ b/LICENSE @@ -0,0 +1,24 @@ +Boost Software License - Version 1.0 - August 17th, 2003 + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + diff --git a/README.md b/README.md new file mode 100644 index 0000000..6b09401 --- /dev/null +++ b/README.md @@ -0,0 +1,38 @@ +### Dependencies ### + +* Ruby >= 1.9 +* ruby-sqlite3 >= 1.3 +* xmpp4r == 0.5.6 +* tdlib-ruby == 2.0 with pre-compiled _libtdjson.so_ + +(there is pre-compiled _libtdjson.so_ for Debian Stretch x64 in repository) + +### Installation ### + +First of all, you need to create component listener on your Jabber server. +For example, for ejabberd: + +```port: 8888 +module: ejabberd_service +access: all +shaper_rule: fast +ip: "127.0.0.1" +service_check_from: false +hosts: + "telegram.jabber.ru": + password: "secret" +``` + + +Next, move **config.yml.example** to and **config.yml** and edit **xmpp** section to match component listener: + +``` +db_path: 'users.db' +jid: 'telegram.jabber.ru' +host: 'localhost' +port: 8888 +secret: 'secret' +loglevel: 0 +``` + +If neccessary, edit **telegram** section too. diff --git a/inc/telegramclient.rb b/inc/telegramclient.rb index c2a98ce..338b385 100644 --- a/inc/telegramclient.rb +++ b/inc/telegramclient.rb @@ -154,7 +154,7 @@ class TelegramClient # text formatting text = "%s | %s | %s\n%s" % [update.message.id, self.format_username(update.message.sender_user_id), prefix, text] if update.message.chat_id < 0 # groupchats - text = "%s %s | %s%s" % [(update.message.is_outgoing ? '→' : '←'), update.message.id.to_s, prefix, text] if update.message.chat_id > 0 # private chats + text = "%s %s | %s%s" % [(update.message.is_outgoing ? '🠚' : '🠘'), update.message.id.to_s, prefix, text] if update.message.chat_id > 0 # private chats # send and add message id to unreads @cache[:unread_msg][update.message.chat_id] = update.message.id