chore: register bridge id

This commit is contained in:
Felipe M 2025-08-06 08:36:51 +02:00
parent b1c6f21ea3
commit 245f5f96db
No known key found for this signature in database
GPG key ID: 52E5D65FCF99808A
5 changed files with 52 additions and 33 deletions

View file

@ -30,6 +30,7 @@ type xmppBridge struct {
kvstore kvstore.KVStore
bridgeClient *xmppClient.Client // Main bridge XMPP client connection
userManager pluginModel.BridgeUserManager
bridgeID string // Bridge identifier used for registration
remoteID string // Remote ID for shared channels
// Message handling
@ -52,7 +53,7 @@ type xmppBridge struct {
}
// NewBridge creates a new XMPP bridge
func NewBridge(log logger.Logger, api plugin.API, kvstore kvstore.KVStore, cfg *config.Configuration, remoteID string) pluginModel.Bridge {
func NewBridge(log logger.Logger, api plugin.API, kvstore kvstore.KVStore, cfg *config.Configuration, bridgeID, remoteID string) pluginModel.Bridge {
ctx, cancel := context.WithCancel(context.Background())
b := &xmppBridge{
logger: log,
@ -62,8 +63,9 @@ func NewBridge(log logger.Logger, api plugin.API, kvstore kvstore.KVStore, cfg *
cancel: cancel,
channelMappings: make(map[string]string),
config: cfg,
userManager: bridge.NewUserManager("xmpp", log),
userManager: bridge.NewUserManager(bridgeID, log),
incomingMessages: make(chan *pluginModel.DirectionalMessage, defaultMessageBufferSize),
bridgeID: bridgeID,
remoteID: remoteID,
}
@ -624,3 +626,8 @@ func (b *xmppBridge) GetUserResolver() pluginModel.UserResolver {
func (b *xmppBridge) GetRemoteID() string {
return b.remoteID
}
// ID returns the bridge identifier used when registering the bridge
func (b *xmppBridge) ID() string {
return b.bridgeID
}