commit 7613620ea89c95d5d8583c57a02a9b97e95717ba
Author: Sebastian P <5564491+s3lph@users.noreply.github.com>
Date: Sun Nov 27 00:17:11 2022 +0000
diff --git a/bridge/mumble/handlers.go b/bridge/mumble/handlers.go
index 4027263..8120159 100644
--- a/bridge/mumble/handlers.go
+++ b/bridge/mumble/handlers.go
@@ -7819 +7875 @@ func (b *Bmumble) handleConnect(event *gumble.ConnectEvent) {
}
}
-func (b *Bmumble) handleUserChange(event *gumble.UserChangeEvent) {
- // Only care about changes to self
- if event.User != event.Client.Self {
+func (b *Bmumble) handleJoinLeave(event *gumble.UserChangeEvent) {
+ // Ignore events happening before setup is done
+ if b.Channel == nil {
return
}
- // Someone attempted to move the user out of the configured channel; attempt to join back
- if b.Channel != nil {
+ if b.GetBool("nosendjoinpart") {
+ return
+ }
+ b.Log.Debugf("Received gumble user change event: %+v", event)
+
+ text := ""
+ switch {
+ case event.Type&gumble.UserChangeKicked > 0:
+ text = " was kicked"
+ case event.Type&gumble.UserChangeBanned > 0:
+ text = " was banned"
+ case event.Type&gumble.UserChangeDisconnected > 0:
+ if event.User.Channel != nil && event.User.Channel.ID == *b.Channel {
+ text = " left"
+ }
+ case event.Type&gumble.UserChangeConnected > 0:
+ if event.User.Channel != nil && event.User.Channel.ID == *b.Channel {
+ text = " joined"
+ }
+ case event.Type&gumble.UserChangeChannel > 0:
+ // Treat Mumble channel changes the same as connects/disconnects; as far as matterbridge is concerned, they are identical
+ if event.User.Channel != nil && event.User.Channel.ID == *b.Channel {
+ text = " joined"
+ } else {
+ text = " left"
+ }
+ }
+
+ if text != "" {
+ b.Remote <- config.Message{
+ Username: "system",
+ Text: event.User.Name + text,
+ Channel: strconv.FormatUint(uint64(*b.Channel), 10),
+ Account: b.Account,
+ Event: config.EventJoinLeave,
+ }
+ }
+}
+
+func (b *Bmumble) handleUserModified(event *gumble.UserChangeEvent) {
+ // Ignore events happening before setup is done
+ if b.Channel == nil {
+ return
+ }
+
+ if event.Type&gumble.UserChangeChannel > 0 {
+ // Someone attempted to move the user out of the configured channel; attempt to join back
if err := b.doJoin(event.Client, *b.Channel); err != nil {
b.Log.Error(err)
}
}
}
+func (b *Bmumble) handleUserChange(event *gumble.UserChangeEvent) {
+ // The UserChangeEvent is used for both the gumble client itself as well as other clients
+ if event.User != event.Client.Self {
+ // other users
+ b.handleJoinLeave(event)
+ } else {
+ // gumble user
+ b.handleUserModified(event)
+ }
+}
+
func (b *Bmumble) handleDisconnect(event *gumble.DisconnectEvent) {
b.connected <- *event
}
diff --git a/bridge/mumble/mumble.go b/bridge/mumble/mumble.go
index 1943bd3..945cf55 100644
--- a/bridge/mumble/mumble.go
+++ b/bridge/mumble/mumble.go
@@ -937 +937 @@ func (b *Bmumble) JoinChannel(channel config.ChannelInfo) error {
func (b *Bmumble) Send(msg config.Message) (string, error) {
// Only process text messages
b.Log.Debugf("=> Received local message %#v", msg)
- if msg.Event != "" && msg.Event != config.EventUserAction {
+ if msg.Event != "" && msg.Event != config.EventUserAction && msg.Event != config.EventJoinLeave {
return "", nil
}
diff --git a/matterbridge.toml.sample b/matterbridge.toml.sample
index 2080068..9610450 100644
--- a/matterbridge.toml.sample
+++ b/matterbridge.toml.sample
@@ -1887 +1887 @@ Label=""
RemoteNickFormat="[{PROTOCOL}] <{NICK}> "
#Enable to show users joins/parts from other bridges
-#Currently works for messages from the following bridges: irc, mattermost, slack, discord
+#Currently works for messages from the following bridges: irc, mattermost, mumble, slack, discord
#OPTIONAL (default false)
ShowJoinPart=false
@@ -1987 +1987 @@ ShowJoinPart=false
VerboseJoinPart=false
#Do not send joins/parts to other bridges
-#Currently works for messages from the following bridges: irc, mattermost, slack, discord
+#Currently works for messages from the following bridges: irc, mattermost, mumble, slack, discord
#OPTIONAL (default false)
NoSendJoinPart=false
@@ -3257 +3257 @@ Label=""
RemoteNickFormat="[{PROTOCOL}] <{NICK}> "
#Enable to show users joins/parts from other bridges
-#Currently works for messages from the following bridges: irc, mattermost, slack, discord
+#Currently works for messages from the following bridges: irc, mattermost, mumble, slack, discord
#OPTIONAL (default false)
ShowJoinPart=false
@@ -49212 +49212 @@ Label=""
RemoteNickFormat="[{PROTOCOL}] <{NICK}> "
#Enable to show users joins/parts from other bridges
-#Currently works for messages from the following bridges: irc, mattermost, slack, discord
+#Currently works for messages from the following bridges: irc, mattermost, mumble, slack, discord
#OPTIONAL (default false)
ShowJoinPart=false
#Do not send joins/parts to other bridges
-#Currently works for messages from the following bridges: irc, mattermost, slack, discord
+#Currently works for messages from the following bridges: irc, mattermost, mumble, slack, discord
#OPTIONAL (default false)
NoSendJoinPart=false
@@ -5797 +5797 @@ Label=""
RemoteNickFormat="[{PROTOCOL}] <{NICK}> "
#Enable to show users joins/parts from other bridges
-#Currently works for messages from the following bridges: irc, mattermost, slack, discord
+#Currently works for messages from the following bridges: irc, mattermost, mumble, slack, discord
#OPTIONAL (default false)
ShowJoinPart=false
@@ -6877 +6877 @@ Label=""
RemoteNickFormat="[{PROTOCOL}] <{NICK}> "
#Enable to show users joins/parts from other bridges
-#Currently works for messages from the following bridges: irc, mattermost, slack, discord
+#Currently works for messages from the following bridges: irc, mattermost, mumble, slack, discord
#OPTIONAL (default false)
ShowJoinPart=false
@@ -82612 +82612 @@ Label=""
RemoteNickFormat="[{PROTOCOL}] <{NICK}> "
#Enable to show users joins/parts from other bridges
-#Currently works for messages from the following bridges: irc, mattermost, slack, discord
+#Currently works for messages from the following bridges: irc, mattermost, mumble, slack, discord
#OPTIONAL (default false)
ShowJoinPart=false
#Do not send joins/parts to other bridges
-#Currently works for messages from the following bridges: irc, mattermost, slack, discord
+#Currently works for messages from the following bridges: irc, mattermost, mumble, slack, discord
#OPTIONAL (default false)
NoSendJoinPart=false
@@ -11387 +11387 @@ Label=""
RemoteNickFormat="[{PROTOCOL}] <{NICK}> "
#Enable to show users joins/parts from other bridges
-#Currently works for messages from the following bridges: irc, mattermost, slack, discord
+#Currently works for messages from the following bridges: irc, mattermost, mumble, slack, discord
#OPTIONAL (default false)
ShowJoinPart=false
@@ -12757 +12757 @@ Label=""
RemoteNickFormat="[{PROTOCOL}] <{NICK}> "
#Enable to show users joins/parts from other bridges
-#Currently works for messages from the following bridges: irc, mattermost, slack, discord
+#Currently works for messages from the following bridges: irc, mattermost, mumble, slack, discord
#OPTIONAL (default false)
ShowJoinPart=false
@@ -13877 +13877 @@ Label=""
RemoteNickFormat="[{PROTOCOL}] <{NICK}> "
#Enable to show users joins/parts from other bridges
-#Currently works for messages from the following bridges: irc, mattermost, slack, discord
+#Currently works for messages from the following bridges: irc, mattermost, mumble, slack, discord
#OPTIONAL (default false)
ShowJoinPart=false
@@ -14847 +14847 @@ Label=""
RemoteNickFormat="[{PROTOCOL}] <{NICK}> "
#Enable to show users joins/parts from other bridges
-#Currently works for messages from the following bridges: irc, mattermost, slack, discord
+#Currently works for messages from the following bridges: irc, mattermost, mumble, slack, discord
#OPTIONAL (default false)
ShowJoinPart=false
@@ -15726 +157215 @@ SkipTLSVerify=false
#Default "<clipped message>"
MessageClipped="<clipped message>"
+#Enable to show users joins/parts from other bridges
+#Currently works for messages from the following bridges: irc, mattermost, mumble, slack, discord
+#OPTIONAL (default false)
+ShowJoinPart=false
+
+#Do not send joins/parts to other bridges
+#OPTIONAL (default false)
+NoSendJoinPart=false
+
###################################################################
#VK
###################################################################
@@ -16847 +16937 @@ Label=""
RemoteNickFormat="[{PROTOCOL}] <{NICK}> "
#Enable to show users joins/parts from other bridges
-#Currently works for messages from the following bridges: irc, mattermost, slack, discord
+#Currently works for messages from the following bridges: irc, mattermost, mumble, slack, discord
#OPTIONAL (default false)
ShowJoinPart=false