feat: implement XMPP bridge configuration and logger setup
- Add comprehensive XMPP settings schema to plugin.json - Implement configuration struct with validation and helper methods - Add configurable username prefix for XMPP users - Set up logger in Plugin struct following Matrix bridge pattern - Update KV store constants to use XMPP terminology - Replace Matrix references with XMPP equivalents in test helpers 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
202622f2c4
commit
f1a6cb138f
5 changed files with 135 additions and 451 deletions
|
@ -7,43 +7,43 @@ package kvstore
|
|||
const (
|
||||
// CurrentKVStoreVersion is the current version requiring migrations
|
||||
CurrentKVStoreVersion = 2
|
||||
// KeyPrefixMatrixUser is the prefix for Matrix user ID -> Mattermost user ID mappings
|
||||
KeyPrefixMatrixUser = "matrix_user_"
|
||||
// KeyPrefixMattermostUser is the prefix for Mattermost user ID -> Matrix user ID mappings
|
||||
// KeyPrefixXMPPUser is the prefix for XMPP user ID -> Mattermost user ID mappings
|
||||
KeyPrefixXMPPUser = "xmpp_user_"
|
||||
// KeyPrefixMattermostUser is the prefix for Mattermost user ID -> XMPP user ID mappings
|
||||
KeyPrefixMattermostUser = "mattermost_user_"
|
||||
|
||||
// KeyPrefixChannelMapping is the prefix for Mattermost channel ID -> Matrix room mappings
|
||||
// KeyPrefixChannelMapping is the prefix for Mattermost channel ID -> XMPP room mappings
|
||||
KeyPrefixChannelMapping = "channel_mapping_"
|
||||
// KeyPrefixRoomMapping is the prefix for Matrix room identifier -> Mattermost channel ID mappings
|
||||
KeyPrefixRoomMapping = "room_mapping_"
|
||||
// KeyPrefixRoomMapping is the prefix for XMPP room identifier -> Mattermost channel ID mappings
|
||||
KeyPrefixRoomMapping = "xmpp_room_mapping_"
|
||||
|
||||
// KeyPrefixGhostUser is the prefix for Mattermost user ID -> Matrix ghost user ID cache
|
||||
// KeyPrefixGhostUser is the prefix for Mattermost user ID -> XMPP ghost user ID cache
|
||||
KeyPrefixGhostUser = "ghost_user_"
|
||||
// KeyPrefixGhostRoom is the prefix for ghost user room membership tracking
|
||||
KeyPrefixGhostRoom = "ghost_room_"
|
||||
|
||||
// KeyPrefixMatrixEventPost is the prefix for Matrix event ID -> Mattermost post ID mappings
|
||||
KeyPrefixMatrixEventPost = "matrix_event_post_"
|
||||
// KeyPrefixMatrixReaction is the prefix for Matrix reaction event ID -> reaction info mappings
|
||||
KeyPrefixMatrixReaction = "matrix_reaction_"
|
||||
// KeyPrefixXMPPEventPost is the prefix for XMPP event ID -> Mattermost post ID mappings
|
||||
KeyPrefixXMPPEventPost = "xmpp_event_post_"
|
||||
// KeyPrefixXMPPReaction is the prefix for XMPP reaction event ID -> reaction info mappings
|
||||
KeyPrefixXMPPReaction = "xmpp_reaction_"
|
||||
|
||||
// KeyStoreVersion is the key for tracking the current KV store schema version
|
||||
KeyStoreVersion = "kv_store_version"
|
||||
|
||||
// KeyPrefixLegacyDMMapping was the old prefix for DM mappings (migrated to channel_mapping_)
|
||||
KeyPrefixLegacyDMMapping = "dm_mapping_"
|
||||
// KeyPrefixLegacyMatrixDMMapping was the old prefix for Matrix DM mappings (migrated to room_mapping_)
|
||||
KeyPrefixLegacyMatrixDMMapping = "matrix_dm_mapping_"
|
||||
// KeyPrefixLegacyXMPPDMMapping was the old prefix for XMPP DM mappings (migrated to room_mapping_)
|
||||
KeyPrefixLegacyXMPPDMMapping = "xmpp_dm_mapping_"
|
||||
)
|
||||
|
||||
// Helper functions for building KV store keys
|
||||
|
||||
// BuildMatrixUserKey creates a key for Matrix user -> Mattermost user mapping
|
||||
func BuildMatrixUserKey(matrixUserID string) string {
|
||||
return KeyPrefixMatrixUser + matrixUserID
|
||||
// BuildXMPPUserKey creates a key for XMPP user -> Mattermost user mapping
|
||||
func BuildXMPPUserKey(xmppUserID string) string {
|
||||
return KeyPrefixXMPPUser + xmppUserID
|
||||
}
|
||||
|
||||
// BuildMattermostUserKey creates a key for Mattermost user -> Matrix user mapping
|
||||
// BuildMattermostUserKey creates a key for Mattermost user -> XMPP user mapping
|
||||
func BuildMattermostUserKey(mattermostUserID string) string {
|
||||
return KeyPrefixMattermostUser + mattermostUserID
|
||||
}
|
||||
|
@ -68,12 +68,12 @@ func BuildGhostRoomKey(mattermostUserID, roomID string) string {
|
|||
return KeyPrefixGhostRoom + mattermostUserID + "_" + roomID
|
||||
}
|
||||
|
||||
// BuildMatrixEventPostKey creates a key for Matrix event -> post mapping
|
||||
func BuildMatrixEventPostKey(matrixEventID string) string {
|
||||
return KeyPrefixMatrixEventPost + matrixEventID
|
||||
// BuildXMPPEventPostKey creates a key for XMPP event -> post mapping
|
||||
func BuildXMPPEventPostKey(xmppEventID string) string {
|
||||
return KeyPrefixXMPPEventPost + xmppEventID
|
||||
}
|
||||
|
||||
// BuildMatrixReactionKey creates a key for Matrix reaction storage
|
||||
func BuildMatrixReactionKey(reactionEventID string) string {
|
||||
return KeyPrefixMatrixReaction + reactionEventID
|
||||
// BuildXMPPReactionKey creates a key for XMPP reaction storage
|
||||
func BuildXMPPReactionKey(reactionEventID string) string {
|
||||
return KeyPrefixXMPPReaction + reactionEventID
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue