mirror of
https://github.com/42wim/matterbridge.git
synced 2024-12-01 16:59:29 +01:00
get PersistentMessageStorePath config properly
(also reformatted and sorted the config struct)
This commit is contained in:
parent
2845740e97
commit
60219a39d1
@ -97,25 +97,25 @@ type Protocol struct {
|
|||||||
Debug bool // general
|
Debug bool // general
|
||||||
DebugLevel int // only for irc now
|
DebugLevel int // only for irc now
|
||||||
DisableWebPagePreview bool // telegram
|
DisableWebPagePreview bool // telegram
|
||||||
EditSuffix string // mattermost, slack, discord, telegram, gitter
|
|
||||||
EditDisable bool // mattermost, slack, discord, telegram, gitter
|
EditDisable bool // mattermost, slack, discord, telegram, gitter
|
||||||
|
EditSuffix string // mattermost, slack, discord, telegram, gitter
|
||||||
HTMLDisable bool // matrix
|
HTMLDisable bool // matrix
|
||||||
IconURL string // mattermost, slack
|
IconURL string // mattermost, slack
|
||||||
IgnoreFailureOnStart bool // general
|
IgnoreFailureOnStart bool // general
|
||||||
IgnoreNicks string // all protocols
|
|
||||||
IgnoreMessages string // all protocols
|
IgnoreMessages string // all protocols
|
||||||
|
IgnoreNicks string // all protocols
|
||||||
Jid string // xmpp
|
Jid string // xmpp
|
||||||
JoinDelay string // all protocols
|
JoinDelay string // all protocols
|
||||||
Label string // all protocols
|
Label string // all protocols
|
||||||
Login string // mattermost, matrix
|
|
||||||
LogFile string // general
|
LogFile string // general
|
||||||
MediaDownloadBlackList []string
|
Login string // mattermost, matrix
|
||||||
MediaDownloadPath string // Basically MediaServerUpload, but instead of uploading it, just write it to a file on the same server.
|
|
||||||
MediaDownloadSize int // all protocols
|
|
||||||
MediaServerDownload string
|
|
||||||
MediaServerUpload string
|
|
||||||
MediaConvertTgs string // telegram
|
MediaConvertTgs string // telegram
|
||||||
MediaConvertWebPToPNG bool // telegram
|
MediaConvertWebPToPNG bool // telegram
|
||||||
|
MediaDownloadBlackList []string // all protocols
|
||||||
|
MediaDownloadPath string // Basically MediaServerUpload, but instead of uploading it, just write it to a file on the same server.
|
||||||
|
MediaDownloadSize int // all protocols
|
||||||
|
MediaServerDownload string // all protocols
|
||||||
|
MediaServerUpload string // all protocols
|
||||||
MessageDelay int // IRC, time in millisecond to wait between messages
|
MessageDelay int // IRC, time in millisecond to wait between messages
|
||||||
MessageFormat string // telegram
|
MessageFormat string // telegram
|
||||||
MessageLength int // IRC, max length of a message allowed
|
MessageLength int // IRC, max length of a message allowed
|
||||||
@ -127,52 +127,53 @@ type Protocol struct {
|
|||||||
Nick string // all protocols
|
Nick string // all protocols
|
||||||
NickFormatter string // mattermost, slack
|
NickFormatter string // mattermost, slack
|
||||||
NickServNick string // IRC
|
NickServNick string // IRC
|
||||||
NickServUsername string // IRC
|
|
||||||
NickServPassword string // IRC
|
NickServPassword string // IRC
|
||||||
|
NickServUsername string // IRC
|
||||||
NicksPerRow int // mattermost, slack
|
NicksPerRow int // mattermost, slack
|
||||||
NoHomeServerSuffix bool // matrix
|
NoHomeServerSuffix bool // matrix
|
||||||
NoSendJoinPart bool // all protocols
|
NoSendJoinPart bool // all protocols
|
||||||
NoTLS bool // mattermost, xmpp
|
NoTLS bool // mattermost, xmpp
|
||||||
Password string // IRC,mattermost,XMPP,matrix
|
Password string // IRC,mattermost,XMPP,matrix
|
||||||
|
PersistentMessageStorePath string // all protocols
|
||||||
PrefixMessagesWithNick bool // mattemost, slack
|
PrefixMessagesWithNick bool // mattemost, slack
|
||||||
PreserveThreading bool // slack
|
PreserveThreading bool // slack, discord, telegram, whatsapp
|
||||||
Protocol string // all protocols
|
Protocol string // all protocols
|
||||||
QuoteDisable bool // telegram
|
QuoteDisable bool // telegram
|
||||||
QuoteFormat string // telegram
|
QuoteFormat string // telegram
|
||||||
QuoteLengthLimit int // telegram
|
QuoteLengthLimit int // telegram
|
||||||
RealName string // IRC
|
RealName string // IRC
|
||||||
RejoinDelay int // IRC
|
RejoinDelay int // IRC
|
||||||
|
RemoteNickFormat string // all protocols
|
||||||
ReplaceMessages [][]string // all protocols
|
ReplaceMessages [][]string // all protocols
|
||||||
ReplaceNicks [][]string // all protocols
|
ReplaceNicks [][]string // all protocols
|
||||||
RemoteNickFormat string // all protocols
|
|
||||||
RunCommands []string // IRC
|
RunCommands []string // IRC
|
||||||
Server string // IRC,mattermost,XMPP,discord,matrix
|
Server string // IRC,mattermost,XMPP,discord,matrix
|
||||||
SessionFile string // msteams,whatsapp
|
SessionFile string // msteams,whatsapp
|
||||||
|
ShowEmbeds bool // discord
|
||||||
ShowJoinPart bool // all protocols
|
ShowJoinPart bool // all protocols
|
||||||
ShowTopicChange bool // slack
|
ShowTopicChange bool // slack
|
||||||
ShowUserTyping bool // slack
|
ShowUserTyping bool // slack
|
||||||
ShowEmbeds bool // discord
|
|
||||||
SkipTLSVerify bool // IRC, mattermost
|
SkipTLSVerify bool // IRC, mattermost
|
||||||
SkipVersionCheck bool // mattermost
|
SkipVersionCheck bool // mattermost
|
||||||
StripNick bool // all protocols
|
|
||||||
StripMarkdown bool // irc
|
StripMarkdown bool // irc
|
||||||
|
StripNick bool // all protocols
|
||||||
SyncTopic bool // slack
|
SyncTopic bool // slack
|
||||||
TengoModifyMessage string // general
|
|
||||||
Team string // mattermost, keybase
|
Team string // mattermost, keybase
|
||||||
TeamID string // msteams
|
TeamID string // msteams
|
||||||
TenantID string // msteams
|
TenantID string // msteams
|
||||||
|
TengoModifyMessage string // general
|
||||||
Token string // gitter, slack, discord, api, matrix
|
Token string // gitter, slack, discord, api, matrix
|
||||||
Topic string // zulip
|
Topic string // zulip
|
||||||
URL string // mattermost, slack // DEPRECATED
|
URL string // mattermost, slack // DEPRECATED
|
||||||
UseAPI bool // mattermost, slack
|
UseAPI bool // mattermost, slack
|
||||||
UseLocalAvatar []string // discord
|
|
||||||
UseSASL bool // IRC
|
|
||||||
UseTLS bool // IRC
|
|
||||||
UseDiscriminator bool // discord
|
UseDiscriminator bool // discord
|
||||||
UseFirstName bool // telegram
|
UseFirstName bool // telegram
|
||||||
UseUserName bool // discord, matrix, mattermost
|
|
||||||
UseInsecureURL bool // telegram
|
UseInsecureURL bool // telegram
|
||||||
|
UseLocalAvatar []string // discord
|
||||||
UserName string // IRC
|
UserName string // IRC
|
||||||
|
UseSASL bool // IRC
|
||||||
|
UseTLS bool // IRC
|
||||||
|
UseUserName bool // discord, matrix, mattermost
|
||||||
VerboseJoinPart bool // IRC
|
VerboseJoinPart bool // IRC
|
||||||
WebhookBindAddress string // mattermost, slack
|
WebhookBindAddress string // mattermost, slack
|
||||||
WebhookURL string // mattermost, slack
|
WebhookURL string // mattermost, slack
|
||||||
|
@ -64,7 +64,9 @@ func New(rootLogger *logrus.Logger, cfg *config.Gateway, r *Router) (*Gateway, e
|
|||||||
logger.Errorf("Failed to add configuration to gateway: %#v", err)
|
logger.Errorf("Failed to add configuration to gateway: %#v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
persistentMessageStorePath, usePersistent := gw.Config.GetString("PersistentMessageStorePath")
|
persistentMessageStorePath := gw.BridgeValues().General.PersistentMessageStorePath
|
||||||
|
usePersistent := persistentMessageStorePath != ""
|
||||||
|
|
||||||
if usePersistent {
|
if usePersistent {
|
||||||
rootPath := fmt.Sprintf("%s/%s", persistentMessageStorePath, gw.Name)
|
rootPath := fmt.Sprintf("%s/%s", persistentMessageStorePath, gw.Name)
|
||||||
err := os.MkdirAll(rootPath, os.ModePerm)
|
err := os.MkdirAll(rootPath, os.ModePerm)
|
||||||
@ -89,7 +91,7 @@ func New(rootLogger *logrus.Logger, cfg *config.Gateway, r *Router) (*Gateway, e
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gw *Gateway) SetMessageMap(canonicalMsgID string, msgIDs []*BrMsgID) {
|
func (gw *Gateway) SetMessageMap(canonicalMsgID string, msgIDs []*BrMsgID) {
|
||||||
_, usePersistent := gw.Config.GetString("PersistentMessageStorePath")
|
usePersistent := gw.BridgeValues().General.PersistentMessageStorePath != ""
|
||||||
if usePersistent {
|
if usePersistent {
|
||||||
gw.setDestMessagesToStore(canonicalMsgID, msgIDs)
|
gw.setDestMessagesToStore(canonicalMsgID, msgIDs)
|
||||||
} else {
|
} else {
|
||||||
@ -101,7 +103,7 @@ func (gw *Gateway) SetMessageMap(canonicalMsgID string, msgIDs []*BrMsgID) {
|
|||||||
func (gw *Gateway) FindCanonicalMsgID(protocol string, mID string) string {
|
func (gw *Gateway) FindCanonicalMsgID(protocol string, mID string) string {
|
||||||
ID := protocol + " " + mID
|
ID := protocol + " " + mID
|
||||||
|
|
||||||
_, usePersistent := gw.Config.GetString("PersistentMessageStorePath")
|
usePersistent := gw.BridgeValues().General.PersistentMessageStorePath != ""
|
||||||
if usePersistent {
|
if usePersistent {
|
||||||
return gw.getCanonicalMessageFromStore(ID)
|
return gw.getCanonicalMessageFromStore(ID)
|
||||||
} else {
|
} else {
|
||||||
@ -306,7 +308,7 @@ func (gw *Gateway) getDestChannel(msg *config.Message, dest bridge.Bridge) []con
|
|||||||
func (gw *Gateway) getDestMsgID(msgID string, dest *bridge.Bridge, channel *config.ChannelInfo) string {
|
func (gw *Gateway) getDestMsgID(msgID string, dest *bridge.Bridge, channel *config.ChannelInfo) string {
|
||||||
var destID string
|
var destID string
|
||||||
|
|
||||||
_, usePersistent := gw.Config.GetString("PersistentMessageStorePath")
|
usePersistent := gw.BridgeValues().General.PersistentMessageStorePath != ""
|
||||||
if usePersistent {
|
if usePersistent {
|
||||||
destID = gw.getDestMessagesFromStore(msgID, dest, channel)
|
destID = gw.getDestMessagesFromStore(msgID, dest, channel)
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user