5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-26 03:11:37 +00:00

Implement xep-0245 (xmpp). Closes #1137 (#1144)

This commit is contained in:
Wim 2020-05-23 20:51:04 +02:00 committed by GitHub
parent 274fb09ed4
commit 3c4a3e3f75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,12 +70,19 @@ func (b *Bxmpp) Send(msg config.Message) (string, error) {
if msg.Event == config.EventMsgDelete { if msg.Event == config.EventMsgDelete {
return "", nil return "", nil
} }
b.Log.Debugf("=> Receiving %#v", msg) b.Log.Debugf("=> Receiving %#v", msg)
if msg.Event == config.EventAvatarDownload { if msg.Event == config.EventAvatarDownload {
return b.cacheAvatar(&msg), nil return b.cacheAvatar(&msg), nil
} }
// Make a action /me of the message, prepend the username with it.
// https://xmpp.org/extensions/xep-0245.html
if msg.Event == config.EventUserAction {
msg.Username = "/me " + msg.Username
}
// Upload a file (in XMPP case send the upload URL because XMPP has no native upload support). // Upload a file (in XMPP case send the upload URL because XMPP has no native upload support).
if msg.Extra != nil { if msg.Extra != nil {
for _, rmsg := range helper.HandleExtra(&msg, b.General) { for _, rmsg := range helper.HandleExtra(&msg, b.General) {