feat: complete XMPP bridge implementation with configuration fixes

- Fix configuration loading by matching JSON field names with plugin manifest keys
- Move configuration to separate package to resolve type conflicts
- Implement bridge startup logic that initializes on OnActivate and updates on OnConfigurationChange
- Add certificate verification skip option for development/testing environments
- Create XMPP client initialization helper function to avoid code duplication
- Add SetOnlinePresence() method to XMPP client for presence management
- Set bridge user online presence automatically upon successful XMPP connection
- Remove unused mock generation and test files as requested
- Update bridge constructor to accept configuration parameter
- Implement proper bridge lifecycle management with Start/Stop methods

The bridge now properly loads configuration from admin console, creates XMPP connections
with appropriate TLS settings, and manages online presence for the bridge user.

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Felipe M 2025-07-31 18:56:59 +02:00
parent 07ff46624d
commit 4d6929bab6
No known key found for this signature in database
GPG key ID: 52E5D65FCF99808A
12 changed files with 801 additions and 242 deletions

41
server/logger/logger.go Normal file
View file

@ -0,0 +1,41 @@
package logger
import "github.com/mattermost/mattermost/server/public/plugin"
// Logger interface for logging operations
type Logger interface {
LogDebug(message string, keyValuePairs ...any)
LogInfo(message string, keyValuePairs ...any)
LogWarn(message string, keyValuePairs ...any)
LogError(message string, keyValuePairs ...any)
}
// PluginAPILogger adapts the plugin.API to implement the Logger interface
type PluginAPILogger struct {
api plugin.API
}
// NewPluginAPILogger creates a new PluginAPILogger
func NewPluginAPILogger(api plugin.API) Logger {
return &PluginAPILogger{api: api}
}
// LogDebug logs a debug message
func (l *PluginAPILogger) LogDebug(message string, keyValuePairs ...any) {
l.api.LogDebug(message, keyValuePairs...)
}
// LogInfo logs an info message
func (l *PluginAPILogger) LogInfo(message string, keyValuePairs ...any) {
l.api.LogInfo(message, keyValuePairs...)
}
// LogWarn logs a warning message
func (l *PluginAPILogger) LogWarn(message string, keyValuePairs ...any) {
l.api.LogWarn(message, keyValuePairs...)
}
// LogError logs an error message
func (l *PluginAPILogger) LogError(message string, keyValuePairs ...any) {
l.api.LogError(message, keyValuePairs...)
}