Skip to content

Commit 03d7800

Browse files
authored
Merge branch 'master' into socket-mode
2 parents 976202a + 5f75f98 commit 03d7800

File tree

1,177 files changed

+3543216
-5091
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,177 files changed

+3543216
-5091
lines changed

Dockerfile_whatsappmulti

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM alpine AS builder
2+
3+
COPY . /go/src/matterbridge
4+
RUN apk --no-cache add go git \
5+
&& cd /go/src/matterbridge \
6+
&& CGO_ENABLED=0 go build -tags whatsappmulti -mod vendor -ldflags "-X github.com/42wim/matterbridge/version.GitHash=$(git log --pretty=format:'%h' -n 1)" -o /bin/matterbridge
7+
8+
FROM alpine
9+
RUN apk --no-cache add ca-certificates mailcap
10+
COPY --from=builder /bin/matterbridge /bin/matterbridge
11+
RUN mkdir /etc/matterbridge \
12+
&& touch /etc/matterbridge/matterbridge.toml \
13+
&& ln -sf /matterbridge.toml /etc/matterbridge/matterbridge.toml
14+
ENTRYPOINT ["/bin/matterbridge", "-conf", "/etc/matterbridge/matterbridge.toml"]

README.md

Lines changed: 60 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -58,21 +58,22 @@ And more...
5858
- [Binaries](#binaries)
5959
- [Packages](#packages)
6060
- [Building](#building)
61+
- [Building with whatsapp (beta) multidevice support](#building-with-whatsapp-beta-multidevice-support)
6162
- [Configuration](#configuration)
6263
- [Basic configuration](#basic-configuration)
6364
- [Settings](#settings)
6465
- [Advanced configuration](#advanced-configuration)
65-
- [Examples](#examples)
66-
- [Bridge mattermost (off-topic) - irc (#testing)](#bridge-mattermost-off-topic---irc-testing)
67-
- [Bridge slack (#general) - discord (general)](#bridge-slack-general---discord-general)
68-
- [Running](#running)
69-
- [Docker](#docker)
70-
- [Systemd](#systemd)
71-
- [Changelog](#changelog)
72-
- [FAQ](#faq)
73-
- [Related projects](#related-projects)
74-
- [Articles / Tutorials](#articles--tutorials)
75-
- [Thanks](#thanks)
66+
- [Examples](#examples)
67+
- [Bridge mattermost (off-topic) - irc (#testing)](#bridge-mattermost-off-topic---irc-testing)
68+
- [Bridge slack (#general) - discord (general)](#bridge-slack-general---discord-general)
69+
- [Running](#running)
70+
- [Docker](#docker)
71+
- [Systemd](#systemd)
72+
- [Changelog](#changelog)
73+
- [FAQ](#faq)
74+
- [Related projects](#related-projects)
75+
- [Articles / Tutorials](#articles--tutorials)
76+
- [Thanks](#thanks)
7677

7778
## Features
7879

@@ -89,6 +90,7 @@ And more...
8990

9091
- [Discord](https://discordapp.com)
9192
- [Gitter](https://gitter.im)
93+
- [Harmony](https://harmonyapp.io)
9294
- [IRC](http://www.mirc.com/servers.html)
9395
- [Keybase](https://keybase.io)
9496
- [Matrix](https://matrix.org)
@@ -105,6 +107,8 @@ And more...
105107
- [Twitch](https://twitch.tv)
106108
- [VK](https://vk.com/)
107109
- [WhatsApp](https://www.whatsapp.com/)
110+
- Whatsapp legacy is natively supported
111+
- Whatsapp multidevice beta is natively supported but you need to build yourself, see [here](#building-with-whatsapp-beta-multidevice-support)
108112
- [XMPP](https://xmpp.org)
109113
- [Zulip](https://zulipchat.com)
110114

@@ -120,6 +124,8 @@ And more...
120124
- [Counter-Strike, half-life and more](https://forums.alliedmods.net/showthread.php?t=319430)
121125
- [MatterAMXX](https://github.com/GabeIggy/MatterAMXX)
122126
- [Vintage Story](https://github.com/NikkyAI/vs-matterbridge)
127+
- [Ultima Online Emulator](https://github.com/kuoushi/ServUO-Matterbridge)
128+
- [Teamspeak](https://github.com/Archeb/ts-matterbridge)
123129

124130
### API
125131

@@ -138,6 +144,8 @@ Used by the projects below. Feel free to make a PR to add your project to this l
138144
- [matterbabble](https://github.com/DeclanHoare/matterbabble) (Discourse support)
139145
- [MatterAMXX](https://forums.alliedmods.net/showthread.php?t=319430) (Counter-Strike, half-life and more via AMXX mod)
140146
- [Vintage Story](https://github.com/NikkyAI/vs-matterbridge)
147+
- [ServUO-matterbridge](https://github.com/kuoushi/ServUO-Matterbridge) (A matterbridge connector for ServUO servers)
148+
- [ts-matterbridge](https://github.com/Archeb/ts-matterbridge) (Integrate teamspeak chat with matterbridge)
141149

142150
## Chat with us
143151

@@ -164,10 +172,10 @@ See <https://github.com/42wim/matterbridge/wiki>
164172

165173
### Binaries
166174

167-
- Latest stable release [v1.24.0](https://github.com/42wim/matterbridge/releases/latest)
175+
- Latest stable release [v1.24.1](https://github.com/42wim/matterbridge/releases/latest)
168176
- Development releases (follows master) can be downloaded [here](https://github.com/42wim/matterbridge/actions) selecting the latest green build and then artifacts.
169177

170-
To install or upgrade just download the latest [binary](https://github.com/42wim/matterbridge/releases/latest). On \*nix platforms you may need to make the binary executable - you can do this by running `chmod a+x` on the binary (example: `chmod a+x matterbridge-1.20.0-linux-64bit`). After downloading (and making the binary executable, if necessary), follow the instructions on the [howto](https://github.com/42wim/matterbridge/wiki/How-to-create-your-config) for a step by step walkthrough for creating your configuration.
178+
To install or upgrade just download the latest [binary](https://github.com/42wim/matterbridge/releases/latest). On \*nix platforms you may need to make the binary executable - you can do this by running `chmod a+x` on the binary (example: `chmod a+x matterbridge-1.24.1-linux-64bit`). After downloading (and making the binary executable, if necessary), follow the instructions on the [howto](https://github.com/42wim/matterbridge/wiki/How-to-create-your-config) for a step by step walkthrough for creating your configuration.
171179

172180
### Packages
173181

@@ -182,10 +190,13 @@ Most people just want to use binaries, you can find those [here](https://github.
182190
If you really want to build from source, follow these instructions:
183191
Go 1.17+ is required. Make sure you have [Go](https://golang.org/doc/install) properly installed.
184192

193+
Building the binary with **all** the bridges enabled needs about 3GB RAM to compile.
194+
You can reduce this memory requirement to 0,5GB RAM by adding the `nomsteams` tag if you don't need/use the Microsoft Teams bridge
195+
185196
To install the latest stable run:
186197

187198
```bash
188-
go install github.com/42wim/matterbridge
199+
go install github.com/42wim/matterbridge@17da95b094e4bb433e5fe240fa42067d94d908c1
189200
```
190201

191202
To install the latest dev run:
@@ -194,6 +205,36 @@ To install the latest dev run:
194205
go install github.com/42wim/matterbridge@master
195206
```
196207

208+
To install the latest stable run without msteams or zulip bridge:
209+
210+
```bash
211+
go install -tags nomsteams,nozulip github.com/42wim/matterbridge@17da95b094e4bb433e5fe240fa42067d94d908c1
212+
```
213+
214+
You should now have matterbridge binary in the ~/go/bin directory:
215+
216+
```bash
217+
$ ls ~/go/bin/
218+
matterbridge
219+
```
220+
221+
## Building with whatsapp (beta) multidevice support
222+
223+
Because the library we use for Whatsapp multidevice support includes a GPL3 library we can not provide you binaries.
224+
(as this would require the Matterbridge to change it license to GPL)
225+
226+
So this means you have to build it yourself using the instructions below:
227+
228+
```bash
229+
go install -tags whatsappmulti github.com/42wim/matterbridge@master
230+
```
231+
232+
If you're low on memory and don't need msteams:
233+
234+
```bash
235+
go install -tags nomsteams,whatsappmulti github.com/42wim/matterbridge@master
236+
```
237+
197238
You should now have matterbridge binary in the ~/go/bin directory:
198239

199240
```bash
@@ -323,6 +364,8 @@ See [FAQ](https://github.com/42wim/matterbridge/wiki/FAQ)
323364
- [nextcloud talk](https://github.com/nextcloud/talk_matterbridge) (Integrates matterbridge in Nextcloud Talk)
324365
- [mattercraft](https://github.com/raws/mattercraft) (Minecraft bridge)
325366
- [vs-matterbridge](https://github.com/NikkyAI/vs-matterbridge) (Vintage Story bridge)
367+
- [ServUO-matterbridge](https://github.com/kuoushi/ServUO-Matterbridge) (A matterbridge connector for ServUO servers)
368+
- [ts-matterbridge](https://github.com/Archeb/ts-matterbridge) (Integrate teamspeak chat with matterbridge)
326369

327370
## Articles / Tutorials
328371

@@ -356,20 +399,23 @@ Matterbridge wouldn't exist without these libraries:
356399
- gops - <https://github.com/google/gops>
357400
- gozulipbot - <https://github.com/ifo/gozulipbot>
358401
- gumble - <https://github.com/layeh/gumble>
402+
- harmony - <https://github.com/harmony-development/shibshib>
359403
- irc - <https://github.com/lrstanley/girc>
360404
- keybase - <https://github.com/keybase/go-keybase-chat-bot>
361405
- matrix - <https://github.com/matrix-org/gomatrix>
362406
- mattermost - <https://github.com/mattermost/mattermost-server>
363407
- msgraph.go - <https://github.com/yaegashi/msgraph.go>
364408
- mumble - <https://github.com/layeh/gumble>
365409
- nctalk - <https://github.com/gary-kim/go-nc-talk>
410+
- rocketchat - <https://github.com/RocketChat/Rocket.Chat.Go.SDK>
366411
- slack - <https://github.com/nlopes/slack>
367412
- sshchat - <https://github.com/shazow/ssh-chat>
368413
- steam - <https://github.com/Philipp15b/go-steam>
369414
- telegram - <https://github.com/go-telegram-bot-api/telegram-bot-api>
370415
- tengo - <https://github.com/d5/tengo>
371416
- vk - <https://github.com/SevereCloud/vksdk>
372417
- whatsapp - <https://github.com/Rhymen/go-whatsapp>
418+
- whatsapp - <https://github.com/tulir/whatsmeow>
373419
- xmpp - <https://github.com/mattn/go-xmpp>
374420
- zulip - <https://github.com/ifo/gozulipbot>
375421

bridge/irc/charset.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package birc
2+
3+
import (
4+
"golang.org/x/text/encoding"
5+
"golang.org/x/text/encoding/japanese"
6+
"golang.org/x/text/encoding/korean"
7+
"golang.org/x/text/encoding/simplifiedchinese"
8+
"golang.org/x/text/encoding/traditionalchinese"
9+
"golang.org/x/text/encoding/unicode"
10+
)
11+
12+
var encoders = map[string]encoding.Encoding{
13+
"utf-8": unicode.UTF8,
14+
"iso-2022-jp": japanese.ISO2022JP,
15+
"big5": traditionalchinese.Big5,
16+
"gbk": simplifiedchinese.GBK,
17+
"euc-kr": korean.EUCKR,
18+
"gb2312": simplifiedchinese.HZGB2312,
19+
"shift-jis": japanese.ShiftJIS,
20+
"euc-jp": japanese.EUCJP,
21+
"gb18030": simplifiedchinese.GB18030,
22+
}
23+
24+
func toUTF8(from string, input string) string {
25+
enc, ok := encoders[from]
26+
if !ok {
27+
return input
28+
}
29+
30+
res, _ := enc.NewDecoder().String(input)
31+
return res
32+
}

bridge/irc/handlers.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"github.com/42wim/matterbridge/bridge/config"
1212
"github.com/42wim/matterbridge/bridge/helper"
1313
"github.com/lrstanley/girc"
14-
"github.com/missdeer/golib/ic"
1514
"github.com/paulrosania/go-charset/charset"
1615
"github.com/saintfish/chardet"
1716

@@ -24,12 +23,12 @@ func (b *Birc) handleCharset(msg *config.Message) error {
2423
if b.GetString("Charset") != "" {
2524
switch b.GetString("Charset") {
2625
case "gbk", "gb18030", "gb2312", "big5", "euc-kr", "euc-jp", "shift-jis", "iso-2022-jp":
27-
msg.Text = ic.ConvertString("utf-8", b.GetString("Charset"), msg.Text)
26+
msg.Text = toUTF8(b.GetString("Charset"), msg.Text)
2827
default:
2928
buf := new(bytes.Buffer)
3029
w, err := charset.NewWriter(b.GetString("Charset"), buf)
3130
if err != nil {
32-
b.Log.Errorf("charset from utf-8 conversion failed: %s", err)
31+
b.Log.Errorf("charset to utf-8 conversion failed: %s", err)
3332
return err
3433
}
3534
fmt.Fprint(w, msg.Text)
@@ -227,7 +226,7 @@ func (b *Birc) handlePrivMsg(client *girc.Client, event girc.Event) {
227226
}
228227
switch mycharset {
229228
case "gbk", "gb18030", "gb2312", "big5", "euc-kr", "euc-jp", "shift-jis", "iso-2022-jp":
230-
rmsg.Text = ic.ConvertString("utf-8", b.GetString("Charset"), rmsg.Text)
229+
rmsg.Text = toUTF8(b.GetString("Charset"), rmsg.Text)
231230
default:
232231
r, err := charset.NewReader(mycharset, strings.NewReader(rmsg.Text))
233232
if err != nil {

bridge/matrix/helpers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"strings"
99
"time"
1010

11-
matrix "github.com/matrix-org/gomatrix"
11+
matrix "github.com/matterbridge/gomatrix"
1212
)
1313

1414
func newMatrixUsername(username string) *matrixUsername {

bridge/matrix/matrix.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
"github.com/42wim/matterbridge/bridge"
1313
"github.com/42wim/matterbridge/bridge/config"
1414
"github.com/42wim/matterbridge/bridge/helper"
15-
matrix "github.com/matrix-org/gomatrix"
15+
matrix "github.com/matterbridge/gomatrix"
1616
)
1717

1818
var (

bridge/mumble/codec.go

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
package bmumble
2+
3+
import (
4+
"fmt"
5+
6+
"layeh.com/gumble/gumble"
7+
)
8+
9+
// This is a dummy implementation of a Gumble audio codec which claims
10+
// to implement Opus, but does not actually do anything. This serves
11+
// as a workaround until https://github.com/layeh/gumble/pull/61 is
12+
// merged.
13+
// See https://github.com/42wim/matterbridge/issues/1750 for details.
14+
15+
const (
16+
audioCodecIDOpus = 4
17+
)
18+
19+
func registerNullCodecAsOpus() {
20+
codec := &NullCodec{
21+
encoder: &NullAudioEncoder{},
22+
decoder: &NullAudioDecoder{},
23+
}
24+
gumble.RegisterAudioCodec(audioCodecIDOpus, codec)
25+
}
26+
27+
type NullCodec struct {
28+
encoder *NullAudioEncoder
29+
decoder *NullAudioDecoder
30+
}
31+
32+
func (c *NullCodec) ID() int {
33+
return audioCodecIDOpus
34+
}
35+
36+
func (c *NullCodec) NewEncoder() gumble.AudioEncoder {
37+
e := &NullAudioEncoder{}
38+
return e
39+
}
40+
41+
func (c *NullCodec) NewDecoder() gumble.AudioDecoder {
42+
d := &NullAudioDecoder{}
43+
return d
44+
}
45+
46+
type NullAudioEncoder struct{}
47+
48+
func (e *NullAudioEncoder) ID() int {
49+
return audioCodecIDOpus
50+
}
51+
52+
func (e *NullAudioEncoder) Encode(pcm []int16, mframeSize, maxDataBytes int) ([]byte, error) {
53+
return nil, fmt.Errorf("not implemented")
54+
}
55+
56+
func (e *NullAudioEncoder) Reset() {
57+
}
58+
59+
type NullAudioDecoder struct{}
60+
61+
func (d *NullAudioDecoder) ID() int {
62+
return audioCodecIDOpus
63+
}
64+
65+
func (d *NullAudioDecoder) Decode(data []byte, frameSize int) ([]int16, error) {
66+
return nil, fmt.Errorf("not implemented")
67+
}
68+
69+
func (d *NullAudioDecoder) Reset() {
70+
}

bridge/mumble/mumble.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ func (b *Bmumble) doConnect() error {
185185
gumbleConfig.Password = password
186186
}
187187

188+
registerNullCodecAsOpus()
188189
client, err := gumble.DialWithDialer(new(net.Dialer), b.GetString("Server"), gumbleConfig, &b.tlsConfig)
189190
if err != nil {
190191
return err

0 commit comments

Comments
 (0)