Added README.md & license

This commit is contained in:
annelin 2019-04-16 07:53:31 +03:00
parent 8203210292
commit 7a0845ad39
3 changed files with 63 additions and 1 deletions

24
LICENSE Normal file
View file

@ -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.

38
README.md Normal file
View file

@ -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.

View file

@ -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