• Stars
    star
    283
  • Rank 141,890 (Top 3 %)
  • Language
    Python
  • License
    GNU General Publi...
  • Created almost 9 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Message forwarding for multiple IM protocols

fishroom

GPL license Proudly Powered by Python3

Message forwarding for multiple IM protocols

Motivation

TUNA needs a chatroom, while each IM protocol/software has its own implementation for chatroom.

Unlike email and mailing list, instant messaging is fragmented: everyone prefers different softwares. As a result, people of TUNA are divided by the IM they use, be it IRC, wechat, telegram, or XMPP.

To reunify TUNA, we created this project to relay messages between IM clients, so that people can enjoy a big party again.

Supported IMs

  • IRC
  • XMPP
  • Matrix
  • Telegram
  • Gitter
  • Actor (not yet)
  • Tox (not yet)
  • Wechat (maybe)

Basic Architecture

Fishroom consists of a fishroom core process, which routes messages among IMs and process commands, and several IM handler processes to deal with different IMs. These components are connected via Redis pub/sub.

+----------+
| IRC      |<-+
+----------+  |
+----------+  |
| XMPP     |<-+
+----------+  |
+----------+  |    +-------+       +---------------+
| Telegram |<-+--> | Redis | <---> | Fishroom Core |
+----------+  |    +-------+       +---------------+
+----------+  |
| Gitter   |<-+
+----------+  |
+----------+  |
| Web      |<-+
+----------+

How to Use

Clone me first

git clone https://github.com/tuna/fishroom
cd fishroom

Docker Rocks!

Get a redis docker and run it:

docker pull redis:alpine
docker run --name redis -v /var/lib/redis:/data -d redis:alpine

Modify the config file, and remember the redis hostname you specified in config.py. I suggest that just use redis as the hostname.

mv fishroom/config.py.example fishroom/config.py
vim fishroom/config.py

Modify Dockerfile, you may want to change the sources.list content. Build the docker for fishroom:

docker build --tag fishroom:dev .

Since the code of fishroom often changes, we mount the code as a volume, and link redis to it.

You can test it using

# this is fishroom core
docker run -it --rm --link redis:redis -v /path/to/fishroom/fishroom:/data/fishroom fishroom:dev python3 -u -m fishroom.fishroom

# these are fishroom IM interfaces, not all of them are needed
docker run -it --rm --link redis:redis -v /path/to/fishroom/fishroom:/data/fishroom fishroom:dev python3 -u -m fishroom.telegram
docker run -it --rm --link redis:redis -v /path/to/fishroom/fishroom:/data/fishroom fishroom:dev python3 -u -m fishroom.IRC
docker run -it --rm --link redis:redis -v /path/to/fishroom/fishroom:/data/fishroom fishroom:dev python3 -u -m fishroom.gitter
docker run -it --rm --link redis:redis -v /path/to/fishroom/fishroom:/data/fishroom fishroom:dev python3 -u -m fishroom.xmpp

You may need tmux or simply multiple terminals to run the aforementioned foreground commands.

If everything works, we run it as daemon.

docker run -d --name fishroom --link redis:redis -v /path/to/fishroom/fishroom:/data/fishroom fishroom:dev python3 -u -m fishroom.fishroom
docker run -d --name fishroom --link redis:redis -v /path/to/fishroom/fishroom:/data/fishroom fishroom:dev python3 -u -m fishroom.telegram

To view the logs, use

docker logs fishroom

Next we run the web interface, if you have configured the chat_logger part in config.py.

docker run -d --name fishroom-web --link redis:redis -p 127.0.0.1:8000:8000 -v /path/to/fishroom/fishroom:/data/fishroom fishroom:dev python3 -u -m fishroom.web

Open your browser, and visit http://127.0.0.1:8000/, you should be able to view the web UI of fishoom.

Docker Sucks!

Install and run redis first, assuming you use ubuntu or debian.

apt-get install redis

Modify the config file, the redis server should be on addr 127.0.0.1 and port 6379.

mv fishroom/config.py.example fishroom/config.py
vim fishroom/config.py

Ensure your python version is at least 3.5, next, we install the dependencies for fishroom.

apt-get install -y python3-dev python3-pip libmagic1 libjpeg-dev libpng-dev libwebp-dev zlib1g-dev gcc
pip3 install --upgrade pip setuptools
pip3 install -r requirements.txt

Run fishroom and fishroom web.

# run fishroom core
python3 -m fishroom.fishroom

# start IM interfaces, select not all of them are needed
python3 -m fishroom.telegram
python3 -m fishroom.IRC
python3 -m fishroom.gitter
python3 -m fishroom.xmpp

python3 -m fishroom.web

Open your browser, and visit http://127.0.0.1:8000/, you should be able to view the web UI of fishoom.

Good Luck!

Related Projects

LICENSE

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

More Repositories

1

thuthesis

LaTeX Thesis Template for Tsinghua University
TeX
4,343
star
2

tunasync

Mirror job management tool.
Go
1,406
star
3

blogroll

世界一流兼容并包TUNA协会收集的周围同学们的Blog
Python
827
star
4

mirror-web

Source code of the web interface of https://mirrors.tuna.tsinghua.edu.cn/
HTML
690
star
5

oh-my-tuna

Keep calm and use TUNA mirrors.
Python
480
star
6

ipv6.tsinghua.edu.cn

CSS
399
star
7

tunasync-scripts

Custom scripts for mirror jobs
Python
390
star
8

issues

Code Unrelated Issues
336
star
9

THU-Beamer-Theme

A LaTeX beamer theme template for Tsinghua students.
TeX
305
star
10

collection

idea collections from TUNA
254
star
11

danmaQ

danmaku implemented in Qt5
JavaScript
185
star
12

freedns-go

Optimized DNS Server for Chinese users.
Go
180
star
13

opentuna

TUNA on AWS
TypeScript
144
star
14

gdanmaku-server

Web-based danmaku server
Python
123
star
15

tuna.moe

HTML
75
star
16

gdanmaku

play danmaku on any screen
Python
36
star
17

artwork

tuna artwork
26
star
18

QSerial

An advanced cross-platform serial port utility
C++
23
star
19

podcast

Voice from TUNA
CSS
19
star
20

scripts

Python
15
star
21

pub-mirror

Dart application to fully mirror the content on https://pub.dartlang.org/
Dart
13
star
22

mirrorhub

Redirects the user to a nearby mirror site.
Go
11
star
23

Books

Tracking Books of TUNA Library
9
star
24

registr

JavaScript
6
star
25

dataset-issues

Issues about academic dataset mirrors
5
star
26

tunaccount

Go
5
star
27

topdf

Automactically convert Office files to PDF via a web interface
PHP
4
star
28

live

CSS
3
star
29

pdns-ldap

Python
3
star
30

fakeTunet

a fake net.tsinghua.edu.cn
JavaScript
2
star
31

feed_tuna

Telegram shop/payment bot 金枪鱼喂食计划
Python
2
star
32

tunasay

tunasay is a configurable talking tuna
JavaScript
2
star
33

Cash

1
star
34

loglyzer

log analyzer for tuna mirrors
Python
1
star
35

docker-images

Repo for various docker images
Dockerfile
1
star
36

tunasync-monitor

Rust
1
star
37

playbooks

Python
1
star