Skip to content

Commit 47f1e38

Browse files
committed
Update dependencies
1 parent 6487375 commit 47f1e38

1,710 files changed

Lines changed: 153328 additions & 133501 deletions

File tree

Some content is hidden

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

bridge/mattermost/mattermost.go

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package mattermost
22

33
import (
4+
"context"
45
"encoding/json"
56
"errors"
67
"fmt"
@@ -14,7 +15,7 @@ import (
1415
lru "github.com/hashicorp/golang-lru"
1516
prefixed "github.com/matterbridge/logrus-prefixed-formatter"
1617
"github.com/matterbridge/matterclient"
17-
"github.com/mattermost/mattermost-server/v6/model"
18+
"github.com/mattermost/mattermost/server/public/model"
1819
"github.com/mitchellh/mapstructure"
1920
"github.com/sirupsen/logrus"
2021
"github.com/spf13/viper"
@@ -201,7 +202,7 @@ func (m *Mattermost) checkWsActionMessage(rmsg *model.WebSocketEvent, throttle *
201202
}
202203

203204
func (m *Mattermost) Invite(channelID, username string) error {
204-
_, _, err := m.mc.Client.AddChannelMember(channelID, username)
205+
_, _, err := m.mc.Client.AddChannelMember(context.TODO(), channelID, username)
205206
if err != nil {
206207
return err
207208
}
@@ -214,7 +215,7 @@ func (m *Mattermost) Join(channelName string) (string, string, error) {
214215

215216
sp := strings.Split(channelName, "/")
216217
if len(sp) > 1 {
217-
team, _, _ := m.mc.Client.GetTeamByName(sp[0], "")
218+
team, _, _ := m.mc.Client.GetTeamByName(context.TODO(), sp[0], "")
218219
if team == nil {
219220
return "", "", fmt.Errorf("cannot join channel (+i)")
220221
}
@@ -262,7 +263,7 @@ func (m *Mattermost) List() (map[string]string, error) {
262263
}
263264

264265
func (m *Mattermost) Part(channelID string) error {
265-
m.mc.Client.RemoveUserFromChannel(channelID, m.mc.User.Id)
266+
m.mc.Client.RemoveUserFromChannel(context.TODO(), channelID, m.mc.User.Id)
266267

267268
return nil
268269
}
@@ -302,7 +303,7 @@ func (m *Mattermost) MsgUser(userID, text string) (string, error) {
302303

303304
func (m *Mattermost) MsgUserThread(userID, parentID, text string) (string, error) {
304305
// create DM channel (only happens on first message)
305-
dchannel, _, err := m.mc.Client.CreateDirectChannel(m.mc.User.Id, userID)
306+
dchannel, _, err := m.mc.Client.CreateDirectChannel(context.TODO(), m.mc.User.Id, userID)
306307
if err != nil {
307308
return "", err
308309
}
@@ -329,7 +330,7 @@ func (m *Mattermost) MsgChannelThread(channelID, parentID, text string) (string,
329330

330331
post.SetProps(props)
331332

332-
rp, _, err := m.mc.Client.CreatePost(post)
333+
rp, _, err := m.mc.Client.CreatePost(context.TODO(), post)
333334
if err == nil {
334335
return rp.Id, nil
335336
}
@@ -339,7 +340,7 @@ func (m *Mattermost) MsgChannelThread(channelID, parentID, text string) (string,
339340
}
340341

341342
// Try to work out if we're trying to reply to a post within a thread.
342-
replyPost, _, err := m.mc.Client.GetPost(parentID, "")
343+
replyPost, _, err := m.mc.Client.GetPost(context.TODO(), parentID, "")
343344
if err != nil {
344345
return "", err
345346
}
@@ -352,7 +353,7 @@ func (m *Mattermost) MsgChannelThread(channelID, parentID, text string) (string,
352353

353354
post.SetProps(props)
354355

355-
rp, _, err = m.mc.Client.CreatePost(post)
356+
rp, _, err = m.mc.Client.CreatePost(context.TODO(), post)
356357
if err == nil {
357358
return rp.Id, nil
358359
}
@@ -362,15 +363,15 @@ func (m *Mattermost) MsgChannelThread(channelID, parentID, text string) (string,
362363

363364
func (m *Mattermost) ModifyPost(msgID, text string) error {
364365
if text == "" {
365-
_, err := m.mc.Client.DeletePost(msgID)
366+
_, err := m.mc.Client.DeletePost(context.TODO(), msgID)
366367
if err != nil {
367368
return err
368369
}
369370

370371
return nil
371372
}
372373

373-
_, _, err := m.mc.Client.PatchPost(msgID, &model.PostPatch{
374+
_, _, err := m.mc.Client.PatchPost(context.TODO(), msgID, &model.PostPatch{
374375
Message: &text,
375376
})
376377
if err != nil {
@@ -389,7 +390,7 @@ func (m *Mattermost) AddReaction(msgID, emoji string) error {
389390
CreateAt: 0,
390391
}
391392

392-
_, _, err := m.mc.Client.SaveReaction(reaction)
393+
_, _, err := m.mc.Client.SaveReaction(context.TODO(), reaction)
393394
if err != nil {
394395
return err
395396
}
@@ -406,7 +407,7 @@ func (m *Mattermost) RemoveReaction(msgID, emoji string) error {
406407
CreateAt: 0,
407408
}
408409

409-
_, err := m.mc.Client.DeleteReaction(reaction)
410+
_, err := m.mc.Client.DeleteReaction(context.TODO(), reaction)
410411
if err != nil {
411412
return err
412413
}
@@ -424,7 +425,7 @@ func (m *Mattermost) SetTopic(channelID, text string) error {
424425
Header: &text,
425426
}
426427

427-
_, _, err := m.mc.Client.PatchChannel(channelID, patch)
428+
_, _, err := m.mc.Client.PatchChannel(context.TODO(), channelID, patch)
428429
if err != nil {
429430
return err
430431
}
@@ -445,7 +446,7 @@ func (m *Mattermost) Protocol() string {
445446
}
446447

447448
func (m *Mattermost) Kick(channelID, username string) error {
448-
_, err := m.mc.Client.RemoveUserFromChannel(channelID, username)
449+
_, err := m.mc.Client.RemoveUserFromChannel(context.TODO(), channelID, username)
449450
if err != nil {
450451
return err
451452
}
@@ -454,7 +455,7 @@ func (m *Mattermost) Kick(channelID, username string) error {
454455
}
455456

456457
func (m *Mattermost) SetStatus(status string) error {
457-
_, _, err := m.mc.Client.UpdateUserStatus(m.mc.User.Id, &model.Status{
458+
_, _, err := m.mc.Client.UpdateUserStatus(context.TODO(), m.mc.User.Id, &model.Status{
458459
Status: status,
459460
UserId: m.mc.User.Id,
460461
})
@@ -521,7 +522,7 @@ func (m *Mattermost) GetChannelUsers(channelID string) ([]*bridge.UserInfo, erro
521522
max := 200
522523

523524
for {
524-
mmusersPaged, resp, err = m.mc.Client.GetUsersInChannel(channelID, idx, max, "")
525+
mmusersPaged, resp, err = m.mc.Client.GetUsersInChannel(context.TODO(), channelID, idx, max, "")
525526
if err == nil {
526527
break
527528
}
@@ -533,7 +534,7 @@ func (m *Mattermost) GetChannelUsers(channelID string) ([]*bridge.UserInfo, erro
533534

534535
for len(mmusersPaged) > 0 {
535536
for {
536-
mmusersPaged, resp, err = m.mc.Client.GetUsersInChannel(channelID, idx, max, "")
537+
mmusersPaged, resp, err = m.mc.Client.GetUsersInChannel(context.TODO(), channelID, idx, max, "")
537538
if err == nil {
538539
idx++
539540
time.Sleep(time.Millisecond * 200)
@@ -611,7 +612,7 @@ func (m *Mattermost) GetChannel(channelID string) (*bridge.ChannelInfo, error) {
611612
}
612613

613614
// Fallback if it's not found in the cache.
614-
mmchannel, _, err := m.mc.Client.GetChannel(channelID, "")
615+
mmchannel, _, err := m.mc.Client.GetChannel(context.TODO(), channelID, "")
615616
if err != nil {
616617
return nil, errors.New("channel not found")
617618
}
@@ -634,7 +635,7 @@ func (m *Mattermost) GetMe() *bridge.UserInfo {
634635

635636
func (m *Mattermost) GetUserByUsername(username string) *bridge.UserInfo {
636637
for {
637-
mmuser, resp, err := m.mc.Client.GetUserByUsername(username, "")
638+
mmuser, resp, err := m.mc.Client.GetUserByUsername(context.TODO(), username, "")
638639
if err == nil {
639640
return m.createUser(mmuser)
640641
}
@@ -818,10 +819,10 @@ func (m *Mattermost) addParentMsg(parentID string, msg string, newLen int, uncou
818819
// Search and use cached reply if it exists.
819820
// None found, so we'll need to create one and save it for future uses.
820821
if v, ok := m.msgParentCache.Get(parentID); !ok {
821-
parentPost, _, err := m.mc.Client.GetPost(parentID, "")
822+
parentPost, _, err := m.mc.Client.GetPost(context.TODO(), parentID, "")
822823
// Retry once on failure.
823824
if err != nil {
824-
parentPost, _, err = m.mc.Client.GetPost(parentID, "")
825+
parentPost, _, err = m.mc.Client.GetPost(context.TODO(), parentID, "")
825826
}
826827
if err != nil {
827828
return msg, err
@@ -980,7 +981,7 @@ func (m *Mattermost) handleWsActionPost(rmsg *model.WebSocketEvent) {
980981
Text: msg,
981982
ChannelID: data.ChannelId,
982983
MessageID: data.Id,
983-
Event: rmsg.EventType(),
984+
Event: string(rmsg.EventType()),
984985
ParentID: data.RootId,
985986
}
986987

@@ -1020,7 +1021,7 @@ func (m *Mattermost) handleWsActionPost(rmsg *model.WebSocketEvent) {
10201021
MessageType: messageType,
10211022
ChannelType: channelType,
10221023
MessageID: data.Id,
1023-
Event: rmsg.EventType(),
1024+
Event: string(rmsg.EventType()),
10241025
ParentID: data.RootId,
10251026
},
10261027
}
@@ -1047,7 +1048,7 @@ func (m *Mattermost) handleWsActionPost(rmsg *model.WebSocketEvent) {
10471048
Sender: ghost,
10481049
ChannelType: channelType,
10491050
MessageID: data.Id,
1050-
Event: rmsg.EventType(),
1051+
Event: string(rmsg.EventType()),
10511052
ParentID: data.RootId,
10521053
},
10531054
}
@@ -1328,7 +1329,7 @@ func (m *Mattermost) handleReactionEvent(rmsg *model.WebSocketEvent) {
13281329
}
13291330

13301331
parentID := reaction.PostId
1331-
parentPost, _, err := m.mc.Client.GetPost(reaction.PostId, "")
1332+
parentPost, _, err := m.mc.Client.GetPost(context.TODO(), reaction.PostId, "")
13321333
if err == nil {
13331334
parentID = parentPost.RootId
13341335
}
@@ -1392,7 +1393,7 @@ func (m *Mattermost) UpdateLastViewed(channelID string) {
13921393

13931394
func (m *Mattermost) UpdateLastViewedUser(userID string) error {
13941395
for {
1395-
dc, resp, err := m.mc.Client.CreateDirectChannel(m.mc.User.Id, userID)
1396+
dc, resp, err := m.mc.Client.CreateDirectChannel(context.TODO(), m.mc.User.Id, userID)
13961397
if err == nil {
13971398
return m.mc.UpdateLastViewed(dc.Id)
13981399
}
@@ -1412,7 +1413,7 @@ func (m *Mattermost) GetFileLinks(fileIDs []string) []string {
14121413
}
14131414

14141415
func (m *Mattermost) SearchUsers(query string) ([]*bridge.UserInfo, error) {
1415-
users, _, err := m.mc.Client.SearchUsers(&model.UserSearch{Term: query})
1416+
users, _, err := m.mc.Client.SearchUsers(context.TODO(), &model.UserSearch{Term: query})
14161417
if err != nil {
14171418
return nil, err
14181419
}

bridge/slack/slack.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,9 @@ func (s *Slack) getSlackUserFromMessage(rmsg *slack.MessageEvent) (*slack.User,
690690
}
691691

692692
if rmsg.Username == "" {
693-
bot, err := s.rtm.GetBotInfo(rmsg.BotID)
693+
bot, err := s.rtm.GetBotInfo(slack.GetBotInfoParameters{
694+
Bot: rmsg.BotID,
695+
})
694696
if err != nil {
695697
suser.Profile.DisplayName = "bot"
696698
suser.Name = "bot"

go.mod

Lines changed: 46 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,92 @@
11
module github.com/42wim/matterircd
22

33
require (
4-
github.com/alecthomas/chroma/v2 v2.9.1
4+
github.com/alecthomas/chroma/v2 v2.14.0
55
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
66
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f
77
github.com/google/gops v0.3.27
8-
github.com/grokify/html-strip-tags-go v0.0.1
8+
github.com/grokify/html-strip-tags-go v0.1.0
99
github.com/hashicorp/golang-lru v0.6.0
1010
github.com/matterbridge/logrus-prefixed-formatter v0.5.3-0.20200523233437-d971309a77ba
11-
github.com/matterbridge/matterclient v0.0.0-20230909230346-007c5c33c54c
12-
github.com/mattermost/mattermost-server/v6 v6.7.2
11+
github.com/matterbridge/matterclient v0.0.0-20240523235056-57f299489168
12+
github.com/mattermost/mattermost/server/public v0.1.3
1313
github.com/mattn/go-mastodon v0.0.6
1414
github.com/mitchellh/mapstructure v1.5.0
1515
github.com/muesli/reflow v0.3.0
1616
github.com/sirupsen/logrus v1.9.3
17-
github.com/slack-go/slack v0.12.3
17+
github.com/slack-go/slack v0.13.0
1818
github.com/sorcix/irc v1.1.4
1919
github.com/spf13/pflag v1.0.5
20-
github.com/spf13/viper v1.17.0
20+
github.com/spf13/viper v1.18.2
2121
github.com/stretchr/testify v1.8.4
22-
go.etcd.io/bbolt v1.3.7
22+
go.etcd.io/bbolt v1.3.10
2323
)
2424

2525
require (
26-
github.com/blang/semver v3.5.1+incompatible // indirect
27-
github.com/dlclark/regexp2 v1.10.0 // indirect
28-
github.com/dustin/go-humanize v1.0.0 // indirect
29-
github.com/dyatlov/go-opengraph v0.0.0-20210112100619-dae8665a5b09 // indirect
26+
github.com/blang/semver/v4 v4.0.0 // indirect
27+
github.com/dlclark/regexp2 v1.11.0 // indirect
28+
github.com/dyatlov/go-opengraph/opengraph v0.0.0-20220524092352-606d7b1e5f8a // indirect
29+
github.com/fatih/color v1.16.0 // indirect
3030
github.com/francoispqt/gojay v1.2.13 // indirect
31-
github.com/fsnotify/fsnotify v1.6.0 // indirect
32-
github.com/go-asn1-ber/asn1-ber v1.5.3 // indirect
33-
github.com/google/uuid v1.3.0 // indirect
34-
github.com/gorilla/websocket v1.5.0 // indirect
35-
github.com/graph-gophers/graphql-go v1.3.0 // indirect
31+
github.com/fsnotify/fsnotify v1.7.0 // indirect
32+
github.com/go-asn1-ber/asn1-ber v1.5.5 // indirect
33+
github.com/golang/protobuf v1.5.3 // indirect
34+
github.com/google/uuid v1.6.0 // indirect
35+
github.com/gorilla/websocket v1.5.1 // indirect
36+
github.com/hashicorp/errwrap v1.1.0 // indirect
37+
github.com/hashicorp/go-hclog v1.6.2 // indirect
38+
github.com/hashicorp/go-multierror v1.1.1 // indirect
39+
github.com/hashicorp/go-plugin v1.6.0 // indirect
3640
github.com/hashicorp/hcl v1.0.0 // indirect
41+
github.com/hashicorp/yamux v0.1.1 // indirect
3742
github.com/jpillora/backoff v1.0.0 // indirect
38-
github.com/json-iterator/go v1.1.12 // indirect
39-
github.com/klauspost/compress v1.17.0 // indirect
40-
github.com/klauspost/cpuid/v2 v2.0.12 // indirect
4143
github.com/magiconair/properties v1.8.7 // indirect
4244
github.com/mattermost/go-i18n v1.11.1-0.20211013152124-5c415071e404 // indirect
43-
github.com/mattermost/ldap v0.0.0-20201202150706-ee0e6284187d // indirect
44-
github.com/mattermost/logr/v2 v2.0.15 // indirect
45+
github.com/mattermost/ldap v0.0.0-20231116144001-0f480c025956 // indirect
46+
github.com/mattermost/logr/v2 v2.0.21 // indirect
4547
github.com/mattn/go-colorable v0.1.13 // indirect
46-
github.com/mattn/go-isatty v0.0.17 // indirect
48+
github.com/mattn/go-isatty v0.0.20 // indirect
4749
github.com/mattn/go-runewidth v0.0.13 // indirect
4850
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
49-
github.com/minio/md5-simd v1.1.2 // indirect
50-
github.com/minio/minio-go/v7 v7.0.24 // indirect
51-
github.com/minio/sha256-simd v1.0.0 // indirect
52-
github.com/mitchellh/go-homedir v1.1.0 // indirect
53-
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
54-
github.com/modern-go/reflect2 v1.0.2 // indirect
55-
github.com/opentracing/opentracing-go v1.2.0 // indirect
51+
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
52+
github.com/nxadm/tail v1.4.8 // indirect
53+
github.com/oklog/run v1.1.0 // indirect
5654
github.com/pborman/uuid v1.2.1 // indirect
5755
github.com/pelletier/go-toml v1.9.5 // indirect
5856
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
59-
github.com/philhofer/fwd v1.1.1 // indirect
57+
github.com/philhofer/fwd v1.1.2 // indirect
6058
github.com/pkg/errors v0.9.1 // indirect
6159
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
6260
github.com/rivo/uniseg v0.2.0 // indirect
63-
github.com/rs/xid v1.4.0 // indirect
64-
github.com/sagikazarmark/locafero v0.3.0 // indirect
61+
github.com/sagikazarmark/locafero v0.4.0 // indirect
6562
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
6663
github.com/sourcegraph/conc v0.3.0 // indirect
67-
github.com/spf13/afero v1.10.0 // indirect
68-
github.com/spf13/cast v1.5.1 // indirect
64+
github.com/spf13/afero v1.11.0 // indirect
65+
github.com/spf13/cast v1.6.0 // indirect
6966
github.com/subosito/gotenv v1.6.0 // indirect
70-
github.com/tinylib/msgp v1.1.6 // indirect
67+
github.com/tinylib/msgp v1.1.9 // indirect
7168
github.com/tomnomnom/linkheader v0.0.0-20180905144013-02ca5825eb80 // indirect
72-
github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect
69+
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
7370
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
74-
github.com/wiggin77/merror v1.0.3 // indirect
71+
github.com/wiggin77/merror v1.0.5 // indirect
7572
github.com/wiggin77/srslog v1.0.1 // indirect
7673
go.uber.org/atomic v1.9.0 // indirect
7774
go.uber.org/multierr v1.9.0 // indirect
78-
golang.org/x/crypto v0.13.0 // indirect
75+
golang.org/x/crypto v0.22.0 // indirect
7976
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
80-
golang.org/x/net v0.15.0 // indirect
81-
golang.org/x/sys v0.12.0 // indirect
82-
golang.org/x/term v0.12.0 // indirect
83-
golang.org/x/text v0.13.0 // indirect
77+
golang.org/x/net v0.24.0 // indirect
78+
golang.org/x/sys v0.19.0 // indirect
79+
golang.org/x/term v0.19.0 // indirect
80+
golang.org/x/text v0.14.0 // indirect
81+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect
82+
google.golang.org/grpc v1.62.0 // indirect
83+
google.golang.org/protobuf v1.33.0 // indirect
8484
gopkg.in/ini.v1 v1.67.0 // indirect
85-
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
85+
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
8686
gopkg.in/yaml.v2 v2.4.0 // indirect
8787
gopkg.in/yaml.v3 v3.0.1 // indirect
8888
)
8989

90-
go 1.19
90+
go 1.21
91+
92+
toolchain go1.22.3

0 commit comments

Comments
 (0)