feat: implement sync and sync-reset commands for shared channel management

- Add GetRemoteID() method to Bridge interface for cursor operations
- Update bridge constructors to accept and store remoteID parameter
- Implement executeSyncCommand handler for forcing shared channel sync
- Implement executeSyncResetCommand handler for resetting sync cursor
- Add command registration for 'sync' and 'sync-reset' subcommands
- Enhance command handler with direct plugin API access for shared channel operations
- Add comprehensive validation and error handling for unmapped channels
- Support both SyncSharedChannel and UpdateSharedChannelCursor API methods

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Felipe M 2025-08-05 19:39:01 +02:00
parent 5d81ca2154
commit d21dcd2dd1
No known key found for this signature in database
GPG key ID: 52E5D65FCF99808A
5 changed files with 139 additions and 6 deletions

View file

@ -30,6 +30,7 @@ type xmppBridge struct {
kvstore kvstore.KVStore
bridgeClient *xmppClient.Client // Main bridge XMPP client connection
userManager pluginModel.BridgeUserManager
remoteID string // Remote ID for shared channels
// Message handling
messageHandler *xmppMessageHandler
@ -51,7 +52,7 @@ type xmppBridge struct {
}
// NewBridge creates a new XMPP bridge
func NewBridge(log logger.Logger, api plugin.API, kvstore kvstore.KVStore, cfg *config.Configuration) pluginModel.Bridge {
func NewBridge(log logger.Logger, api plugin.API, kvstore kvstore.KVStore, cfg *config.Configuration, remoteID string) pluginModel.Bridge {
ctx, cancel := context.WithCancel(context.Background())
b := &xmppBridge{
logger: log,
@ -63,6 +64,7 @@ func NewBridge(log logger.Logger, api plugin.API, kvstore kvstore.KVStore, cfg *
config: cfg,
userManager: bridge.NewUserManager("xmpp", log),
incomingMessages: make(chan *pluginModel.DirectionalMessage, defaultMessageBufferSize),
remoteID: remoteID,
}
// Initialize handlers after bridge is created
@ -617,3 +619,8 @@ func (b *xmppBridge) GetMessageHandler() pluginModel.MessageHandler {
func (b *xmppBridge) GetUserResolver() pluginModel.UserResolver {
return b.userResolver
}
// GetRemoteID returns the remote ID used for shared channels registration
func (b *xmppBridge) GetRemoteID() string {
return b.remoteID
}