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

@ -82,7 +82,7 @@ func (p *Plugin) OnActivate() error {
return fmt.Errorf("failed to initialize bridges: %w", err)
}
p.commandClient = command.NewCommandHandler(p.client, p.bridgeManager)
p.commandClient = command.NewCommandHandler(p.client, p.API, p.bridgeManager)
// Start the bridge manager (this starts message routing)
if err := p.bridgeManager.Start(); err != nil {
@ -148,6 +148,7 @@ func (p *Plugin) initBridges(cfg config.Configuration) error {
p.API,
p.kvstore,
&cfg,
p.remoteID,
)
if err := p.bridgeManager.RegisterBridge("xmpp", xmppBridge); err != nil {
@ -161,6 +162,7 @@ func (p *Plugin) initBridges(cfg config.Configuration) error {
p.kvstore,
&cfg,
p.botUserID,
"mattermost",
)
if err := p.bridgeManager.RegisterBridge("mattermost", mattermostBridge); err != nil {
@ -188,7 +190,7 @@ func (p *Plugin) registerForSharedChannels() error {
PluginID: manifest.Id,
CreatorID: botUserID,
AutoShareDMs: false,
AutoInvited: true,
AutoInvited: false,
}
remoteID, appErr := p.API.RegisterPluginForSharedChannels(opts)