summaryrefslogtreecommitdiffstats
path: root/bridge
diff options
context:
space:
mode:
authorWim <wim@42.be>2023-01-28 22:57:53 +0100
committerGitHub <noreply@github.com>2023-01-28 22:57:53 +0100
commit880586bac42817ffcfea5d9f746f503fa29915b8 (patch)
treea89374cba6f88975f12316ec8d1b8aa1d4c6ba79 /bridge
parenteac2a8c8dc831f946970d327e2a80b26b0684255 (diff)
downloadmatterbridge-msglm-880586bac42817ffcfea5d9f746f503fa29915b8.tar.gz
matterbridge-msglm-880586bac42817ffcfea5d9f746f503fa29915b8.tar.bz2
matterbridge-msglm-880586bac42817ffcfea5d9f746f503fa29915b8.zip
Update dependencies (#1951)
Diffstat (limited to 'bridge')
-rw-r--r--bridge/mattermost/handlers.go6
-rw-r--r--bridge/mattermost/helpers.go4
-rw-r--r--bridge/whatsappmulti/helpers.go18
-rw-r--r--bridge/whatsappmulti/whatsapp.go16
4 files changed, 24 insertions, 20 deletions
diff --git a/bridge/mattermost/handlers.go b/bridge/mattermost/handlers.go
index fccb31b6..8c4ea365 100644
--- a/bridge/mattermost/handlers.go
+++ b/bridge/mattermost/handlers.go
@@ -41,7 +41,7 @@ func (b *Bmattermost) handleDownloadAvatar(userid string, channel string) {
}
}
-// nolint:wrapcheck
+//nolint:wrapcheck
func (b *Bmattermost) handleDownloadFile(rmsg *config.Message, id string) error {
url, _, _ := b.mc.Client.GetFileLink(id)
finfo, _, err := b.mc.Client.GetFileInfo(id)
@@ -91,7 +91,7 @@ func (b *Bmattermost) handleMatter() {
}
}
-// nolint:cyclop
+//nolint:cyclop
func (b *Bmattermost) handleMatterClient(messages chan *config.Message) {
for message := range b.mc.MessageChan {
b.Log.Debugf("%#v %#v", message.Raw.GetData(), message.Raw.EventType())
@@ -186,7 +186,7 @@ func (b *Bmattermost) handleUploadFile(msg *config.Message) (string, error) {
return res, err
}
-// nolint:forcetypeassert
+//nolint:forcetypeassert
func (b *Bmattermost) handleProps(rmsg *config.Message, message *matterclient.Message) {
props := message.Post.Props
if props == nil {
diff --git a/bridge/mattermost/helpers.go b/bridge/mattermost/helpers.go
index 3e1262c7..cca1c4e6 100644
--- a/bridge/mattermost/helpers.go
+++ b/bridge/mattermost/helpers.go
@@ -66,7 +66,7 @@ func (b *Bmattermost) doConnectWebhookURL() error {
return nil
}
-// nolint:wrapcheck
+//nolint:wrapcheck
func (b *Bmattermost) apiLogin() error {
password := b.GetString("Password")
if b.GetString("Token") != "" {
@@ -171,7 +171,7 @@ func (b *Bmattermost) sendWebhook(msg config.Message) (string, error) {
}
// skipMessages returns true if this message should not be handled
-// nolint:gocyclo,cyclop
+//nolint:gocyclo,cyclop
func (b *Bmattermost) skipMessage(message *matterclient.Message) bool {
// Handle join/leave
if message.Type == "system_join_leave" ||
diff --git a/bridge/whatsappmulti/helpers.go b/bridge/whatsappmulti/helpers.go
index c3c9d018..75d9f5fd 100644
--- a/bridge/whatsappmulti/helpers.go
+++ b/bridge/whatsappmulti/helpers.go
@@ -7,6 +7,7 @@ import (
"fmt"
"strings"
+ "go.mau.fi/whatsmeow"
"go.mau.fi/whatsmeow/store"
"go.mau.fi/whatsmeow/store/sqlstore"
"go.mau.fi/whatsmeow/types"
@@ -18,7 +19,7 @@ type ProfilePicInfo struct {
Status int16 `json:"status"`
}
-func (b *Bwhatsapp) reloadContacts(){
+func (b *Bwhatsapp) reloadContacts() {
if _, err := b.wc.Store.Contacts.GetAllContacts(); err != nil {
b.Log.Errorf("error on update of contacts: %v", err)
}
@@ -48,7 +49,7 @@ func (b *Bwhatsapp) getSenderName(info types.MessageInfo) string {
if exists && sender.FullName != "" {
return sender.FullName
}
-
+
if info.PushName != "" {
return info.PushName
}
@@ -56,7 +57,7 @@ func (b *Bwhatsapp) getSenderName(info types.MessageInfo) string {
if exists && sender.FirstName != "" {
return sender.FirstName
}
-
+
return "Someone"
}
@@ -71,11 +72,11 @@ func (b *Bwhatsapp) getSenderNotify(senderJid types.JID) string {
if !exists {
return "someone"
}
-
+
if exists && sender.FullName != "" {
return sender.FullName
}
-
+
if exists && sender.PushName != "" {
return sender.PushName
}
@@ -83,13 +84,16 @@ func (b *Bwhatsapp) getSenderNotify(senderJid types.JID) string {
if exists && sender.FirstName != "" {
return sender.FirstName
}
-
+
return "someone"
}
func (b *Bwhatsapp) GetProfilePicThumb(jid string) (*types.ProfilePictureInfo, error) {
pjid, _ := types.ParseJID(jid)
- info, err := b.wc.GetProfilePictureInfo(pjid, true, "")
+
+ info, err := b.wc.GetProfilePictureInfo(pjid, &whatsmeow.GetProfilePictureParams{
+ Preview: true,
+ })
if err != nil {
return nil, fmt.Errorf("failed to get avatar: %v", err)
}
diff --git a/bridge/whatsappmulti/whatsapp.go b/bridge/whatsappmulti/whatsapp.go
index 686396d3..76e4ae46 100644
--- a/bridge/whatsappmulti/whatsapp.go
+++ b/bridge/whatsappmulti/whatsapp.go
@@ -238,7 +238,7 @@ func (b *Bwhatsapp) PostDocumentMessage(msg config.Message, filetype string) (st
b.Log.Debugf("=> Sending %#v as a document", msg)
ID := whatsmeow.GenerateMessageID()
- _, err = b.wc.SendMessage(context.TODO(), groupJID, ID, &message)
+ _, err = b.wc.SendMessage(context.TODO(), groupJID, &message, whatsmeow.SendRequestExtra{ID: ID})
return ID, err
}
@@ -272,7 +272,7 @@ func (b *Bwhatsapp) PostImageMessage(msg config.Message, filetype string) (strin
b.Log.Debugf("=> Sending %#v as an image", msg)
ID := whatsmeow.GenerateMessageID()
- _, err = b.wc.SendMessage(context.TODO(), groupJID, ID, &message)
+ _, err = b.wc.SendMessage(context.TODO(), groupJID, &message, whatsmeow.SendRequestExtra{ID: ID})
return ID, err
}
@@ -305,7 +305,7 @@ func (b *Bwhatsapp) PostVideoMessage(msg config.Message, filetype string) (strin
b.Log.Debugf("=> Sending %#v as a video", msg)
ID := whatsmeow.GenerateMessageID()
- _, err = b.wc.SendMessage(context.TODO(), groupJID, ID, &message)
+ _, err = b.wc.SendMessage(context.TODO(), groupJID, &message, whatsmeow.SendRequestExtra{ID: ID})
return ID, err
}
@@ -335,14 +335,14 @@ func (b *Bwhatsapp) PostAudioMessage(msg config.Message, filetype string) (strin
b.Log.Debugf("=> Sending %#v as audio", msg)
ID := whatsmeow.GenerateMessageID()
- _, err = b.wc.SendMessage(context.TODO(), groupJID, ID, &message)
+ _, err = b.wc.SendMessage(context.TODO(), groupJID, &message, whatsmeow.SendRequestExtra{ID: ID})
var captionMessage proto.Message
caption := msg.Username + fi.Comment + "\u2B06" // the char on the end is upwards arrow emoji
captionMessage.Conversation = &caption
captionID := whatsmeow.GenerateMessageID()
- _, err = b.wc.SendMessage(context.TODO(), groupJID, captionID, &captionMessage)
+ _, err = b.wc.SendMessage(context.TODO(), groupJID, &captionMessage, whatsmeow.SendRequestExtra{ID: captionID})
return ID, err
}
@@ -389,10 +389,10 @@ func (b *Bwhatsapp) Send(msg config.Message) (string, error) {
switch filetype {
case "image/jpeg", "image/png", "image/gif":
return b.PostImageMessage(msg, filetype)
- case "video/mp4", "video/3gpp": //TODO: Check if codecs are supported by WA
+ case "video/mp4", "video/3gpp": // TODO: Check if codecs are supported by WA
return b.PostVideoMessage(msg, filetype)
case "audio/ogg":
- return b.PostAudioMessage(msg, "audio/ogg; codecs=opus") //TODO: Detect if it is actually OPUS
+ return b.PostAudioMessage(msg, "audio/ogg; codecs=opus") // TODO: Detect if it is actually OPUS
case "audio/aac", "audio/mp4", "audio/amr", "audio/mpeg":
return b.PostAudioMessage(msg, filetype)
default:
@@ -407,7 +407,7 @@ func (b *Bwhatsapp) Send(msg config.Message) (string, error) {
message.Conversation = &text
ID := whatsmeow.GenerateMessageID()
- _, err := b.wc.SendMessage(context.TODO(), groupJID, ID, &message)
+ _, err := b.wc.SendMessage(context.TODO(), groupJID, &message, whatsmeow.SendRequestExtra{ID: ID})
return ID, err
}