mirror of
https://github.com/42wim/matterbridge.git
synced 2024-11-24 03:32:02 -08:00
Add support for NoSendJoinPart. Closes #382
This commit is contained in:
parent
9e5da2f9d7
commit
e5989adf92
@ -87,6 +87,7 @@ type Protocol struct {
|
|||||||
NickServPassword string // IRC
|
NickServPassword string // IRC
|
||||||
NicksPerRow int // mattermost, slack
|
NicksPerRow int // mattermost, slack
|
||||||
NoHomeServerSuffix bool // matrix
|
NoHomeServerSuffix bool // matrix
|
||||||
|
NoSendJoinPart bool // all protocols
|
||||||
NoTLS bool // mattermost
|
NoTLS bool // mattermost
|
||||||
Password string // IRC,mattermost,XMPP,matrix
|
Password string // IRC,mattermost,XMPP,matrix
|
||||||
PrefixMessagesWithNick bool // mattemost, slack
|
PrefixMessagesWithNick bool // mattemost, slack
|
||||||
|
@ -302,6 +302,9 @@ func (b *Birc) handleJoinPart(client *girc.Client, event girc.Event) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if event.Source.Name != b.Nick {
|
if event.Source.Name != b.Nick {
|
||||||
|
if b.GetBool("nosendjoinpart") {
|
||||||
|
return
|
||||||
|
}
|
||||||
b.Log.Debugf("<= Sending JOIN_LEAVE event from %s to gateway", b.Account)
|
b.Log.Debugf("<= Sending JOIN_LEAVE event from %s to gateway", b.Account)
|
||||||
msg := config.Message{Username: "system", Text: event.Source.Name + " " + strings.ToLower(event.Command) + "s", Channel: channel, Account: b.Account, Event: config.EVENT_JOIN_LEAVE}
|
msg := config.Message{Username: "system", Text: event.Source.Name + " " + strings.ToLower(event.Command) + "s", Channel: channel, Account: b.Account, Event: config.EVENT_JOIN_LEAVE}
|
||||||
b.Log.Debugf("<= Message is %#v", msg)
|
b.Log.Debugf("<= Message is %#v", msg)
|
||||||
|
@ -400,6 +400,9 @@ func (b *Bmattermost) skipMessage(message *matterclient.Message) bool {
|
|||||||
if message.Type == "system_join_leave" ||
|
if message.Type == "system_join_leave" ||
|
||||||
message.Type == "system_join_channel" ||
|
message.Type == "system_join_channel" ||
|
||||||
message.Type == "system_leave_channel" {
|
message.Type == "system_leave_channel" {
|
||||||
|
if b.GetBool("nosendjoinpart") {
|
||||||
|
return true
|
||||||
|
}
|
||||||
b.Log.Debugf("Sending JOIN_LEAVE event from %s to gateway", b.Account)
|
b.Log.Debugf("Sending JOIN_LEAVE event from %s to gateway", b.Account)
|
||||||
b.Remote <- config.Message{Username: "system", Text: message.Text, Channel: message.Channel, Account: b.Account, Event: config.EVENT_JOIN_LEAVE}
|
b.Remote <- config.Message{Username: "system", Text: message.Text, Channel: message.Channel, Account: b.Account, Event: config.EVENT_JOIN_LEAVE}
|
||||||
return true
|
return true
|
||||||
|
@ -619,6 +619,10 @@ func (b *Bslack) sendWebhook(msg config.Message) (string, error) {
|
|||||||
|
|
||||||
// skipMessageEvent skips event that need to be skipped :-)
|
// skipMessageEvent skips event that need to be skipped :-)
|
||||||
func (b *Bslack) skipMessageEvent(ev *slack.MessageEvent) bool {
|
func (b *Bslack) skipMessageEvent(ev *slack.MessageEvent) bool {
|
||||||
|
if ev.SubType == "channel_leave" || ev.SubType == "channel_join" {
|
||||||
|
return b.GetBool("nosendjoinpart")
|
||||||
|
}
|
||||||
|
|
||||||
// ignore pinned items
|
// ignore pinned items
|
||||||
if ev.SubType == "pinned_item" || ev.SubType == "unpinned_item" {
|
if ev.SubType == "pinned_item" || ev.SubType == "unpinned_item" {
|
||||||
return true
|
return true
|
||||||
|
@ -135,6 +135,11 @@ RemoteNickFormat="[{PROTOCOL}] <{NICK}> "
|
|||||||
#OPTIONAL (default false)
|
#OPTIONAL (default false)
|
||||||
ShowJoinPart=false
|
ShowJoinPart=false
|
||||||
|
|
||||||
|
#Do not send joins/parts to other bridges
|
||||||
|
#Currently works for messages from the following bridges: irc, mattermost, slack
|
||||||
|
#OPTIONAL (default false)
|
||||||
|
NoSendJoinPart=false
|
||||||
|
|
||||||
#StripNick only allows alphanumerical nicks. See https://github.com/42wim/matterbridge/issues/285
|
#StripNick only allows alphanumerical nicks. See https://github.com/42wim/matterbridge/issues/285
|
||||||
#It will strip other characters from the nick
|
#It will strip other characters from the nick
|
||||||
#OPTIONAL (default false)
|
#OPTIONAL (default false)
|
||||||
@ -446,6 +451,11 @@ RemoteNickFormat="[{PROTOCOL}] <{NICK}> "
|
|||||||
#OPTIONAL (default false)
|
#OPTIONAL (default false)
|
||||||
ShowJoinPart=false
|
ShowJoinPart=false
|
||||||
|
|
||||||
|
#Do not send joins/parts to other bridges
|
||||||
|
#Currently works for messages from the following bridges: irc, mattermost, slack
|
||||||
|
#OPTIONAL (default false)
|
||||||
|
NoSendJoinPart=false
|
||||||
|
|
||||||
#StripNick only allows alphanumerical nicks. See https://github.com/42wim/matterbridge/issues/285
|
#StripNick only allows alphanumerical nicks. See https://github.com/42wim/matterbridge/issues/285
|
||||||
#It will strip other characters from the nick
|
#It will strip other characters from the nick
|
||||||
#OPTIONAL (default false)
|
#OPTIONAL (default false)
|
||||||
@ -636,6 +646,11 @@ RemoteNickFormat="[{PROTOCOL}] <{NICK}> "
|
|||||||
#OPTIONAL (default false)
|
#OPTIONAL (default false)
|
||||||
ShowJoinPart=false
|
ShowJoinPart=false
|
||||||
|
|
||||||
|
#Do not send joins/parts to other bridges
|
||||||
|
#Currently works for messages from the following bridges: irc, mattermost, slack
|
||||||
|
#OPTIONAL (default false)
|
||||||
|
NoSendJoinPart=false
|
||||||
|
|
||||||
#StripNick only allows alphanumerical nicks. See https://github.com/42wim/matterbridge/issues/285
|
#StripNick only allows alphanumerical nicks. See https://github.com/42wim/matterbridge/issues/285
|
||||||
#It will strip other characters from the nick
|
#It will strip other characters from the nick
|
||||||
#OPTIONAL (default false)
|
#OPTIONAL (default false)
|
||||||
|
Loading…
Reference in New Issue
Block a user