Skip to content

Commit

Permalink
Allow disabling specific chat services / protocols
Browse files Browse the repository at this point in the history
  • Loading branch information
hloeung committed Sep 7, 2023
1 parent 88490ca commit 5c80306
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
9 changes: 9 additions & 0 deletions matterircd.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ PasteBufferTimeout = 2500
#
#DefaultTeam = "mycompany"

#disable Mattermost support
#Disable = false

#use http connection to mattermost (default false)
Insecure = false

Expand Down Expand Up @@ -169,6 +172,9 @@ LastViewedSaveFile = "matterircd-lastsaved.db"
##### SLACK EXAMPLE #########
#############################
[slack]
#disable Mattermost support
#Disable = false

#deny specific users from connecting.
#As we only connect using tokens, this will first do a ccnnection to see what username the token is from. If this
#username is on the DenyUsers the user will be disconnected.
Expand Down Expand Up @@ -230,6 +236,9 @@ PrefixContext = false
##### MASTODON EXAMPLE ######
#############################
[mastodon]
#disable Mattermost support
#Disable = false

#Go to https://yourmastodonserver/settings/applications/new
#Use matterircd as application name (default read/write/follow scopes are ok)
#Click on submit
Expand Down
15 changes: 15 additions & 0 deletions mm-go-irckit/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ func login(u *User, toUser *User, args []string, service string) {
}

if service == "mastodon" {
if u.v.GetBool("mastodon.disable") {
logger.Info("Mastodon disabled")
return
}

fmt.Println("login mastodon")
err := u.loginTo("mastodon")
if err != nil {
Expand All @@ -54,6 +59,11 @@ func login(u *User, toUser *User, args []string, service string) {
}

if service == "slack" {
if u.v.GetBool("slack.disable") {
logger.Info("Slack disabled")
return
}

var err error

if len(args) != 1 && len(args) != 3 {
Expand Down Expand Up @@ -112,6 +122,11 @@ func login(u *User, toUser *User, args []string, service string) {
return
}

if u.v.GetBool("mattermost.disable") {
logger.Info("Mattermost disabled")
return
}

cred := bridge.Credentials{}
datalen := 4

Expand Down

0 comments on commit 5c80306

Please sign in to comment.