mirror of
https://github.com/42wim/matterbridge.git
synced 2024-11-29 07:29: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
|
||||
DebugLevel int // only for irc now
|
||||
DisableWebPagePreview bool // telegram
|
||||
EditSuffix string // mattermost, slack, discord, telegram, gitter
|
||||
EditDisable bool // mattermost, slack, discord, telegram, gitter
|
||||
EditSuffix string // mattermost, slack, discord, telegram, gitter
|
||||
HTMLDisable bool // matrix
|
||||
IconURL string // mattermost, slack
|
||||
IgnoreFailureOnStart bool // general
|
||||
IgnoreNicks string // all protocols
|
||||
IgnoreMessages string // all protocols
|
||||
IgnoreNicks string // all protocols
|
||||
Jid string // xmpp
|
||||
JoinDelay string // all protocols
|
||||
Label string // all protocols
|
||||
Login string // mattermost, matrix
|
||||
LogFile string // general
|
||||
MediaDownloadBlackList []string
|
||||
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
|
||||
Login string // mattermost, matrix
|
||||
MediaConvertTgs string // 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
|
||||
MessageFormat string // telegram
|
||||
MessageLength int // IRC, max length of a message allowed
|
||||
@ -127,52 +127,53 @@ type Protocol struct {
|
||||
Nick string // all protocols
|
||||
NickFormatter string // mattermost, slack
|
||||
NickServNick string // IRC
|
||||
NickServUsername string // IRC
|
||||
NickServPassword string // IRC
|
||||
NickServUsername string // IRC
|
||||
NicksPerRow int // mattermost, slack
|
||||
NoHomeServerSuffix bool // matrix
|
||||
NoSendJoinPart bool // all protocols
|
||||
NoTLS bool // mattermost, xmpp
|
||||
Password string // IRC,mattermost,XMPP,matrix
|
||||
PersistentMessageStorePath string // all protocols
|
||||
PrefixMessagesWithNick bool // mattemost, slack
|
||||
PreserveThreading bool // slack
|
||||
PreserveThreading bool // slack, discord, telegram, whatsapp
|
||||
Protocol string // all protocols
|
||||
QuoteDisable bool // telegram
|
||||
QuoteFormat string // telegram
|
||||
QuoteLengthLimit int // telegram
|
||||
RealName string // IRC
|
||||
RejoinDelay int // IRC
|
||||
RemoteNickFormat string // all protocols
|
||||
ReplaceMessages [][]string // all protocols
|
||||
ReplaceNicks [][]string // all protocols
|
||||
RemoteNickFormat string // all protocols
|
||||
RunCommands []string // IRC
|
||||
Server string // IRC,mattermost,XMPP,discord,matrix
|
||||
SessionFile string // msteams,whatsapp
|
||||
ShowEmbeds bool // discord
|
||||
ShowJoinPart bool // all protocols
|
||||
ShowTopicChange bool // slack
|
||||
ShowUserTyping bool // slack
|
||||
ShowEmbeds bool // discord
|
||||
SkipTLSVerify bool // IRC, mattermost
|
||||
SkipVersionCheck bool // mattermost
|
||||
StripNick bool // all protocols
|
||||
StripMarkdown bool // irc
|
||||
StripNick bool // all protocols
|
||||
SyncTopic bool // slack
|
||||
TengoModifyMessage string // general
|
||||
Team string // mattermost, keybase
|
||||
TeamID string // msteams
|
||||
TenantID string // msteams
|
||||
TengoModifyMessage string // general
|
||||
Token string // gitter, slack, discord, api, matrix
|
||||
Topic string // zulip
|
||||
URL string // mattermost, slack // DEPRECATED
|
||||
UseAPI bool // mattermost, slack
|
||||
UseLocalAvatar []string // discord
|
||||
UseSASL bool // IRC
|
||||
UseTLS bool // IRC
|
||||
UseDiscriminator bool // discord
|
||||
UseFirstName bool // telegram
|
||||
UseUserName bool // discord, matrix, mattermost
|
||||
UseInsecureURL bool // telegram
|
||||
UseLocalAvatar []string // discord
|
||||
UserName string // IRC
|
||||
UseSASL bool // IRC
|
||||
UseTLS bool // IRC
|
||||
UseUserName bool // discord, matrix, mattermost
|
||||
VerboseJoinPart bool // IRC
|
||||
WebhookBindAddress 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)
|
||||
}
|
||||
|
||||
persistentMessageStorePath, usePersistent := gw.Config.GetString("PersistentMessageStorePath")
|
||||
persistentMessageStorePath := gw.BridgeValues().General.PersistentMessageStorePath
|
||||
usePersistent := persistentMessageStorePath != ""
|
||||
|
||||
if usePersistent {
|
||||
rootPath := fmt.Sprintf("%s/%s", persistentMessageStorePath, gw.Name)
|
||||
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) {
|
||||
_, usePersistent := gw.Config.GetString("PersistentMessageStorePath")
|
||||
usePersistent := gw.BridgeValues().General.PersistentMessageStorePath != ""
|
||||
if usePersistent {
|
||||
gw.setDestMessagesToStore(canonicalMsgID, msgIDs)
|
||||
} else {
|
||||
@ -101,7 +103,7 @@ func (gw *Gateway) SetMessageMap(canonicalMsgID string, msgIDs []*BrMsgID) {
|
||||
func (gw *Gateway) FindCanonicalMsgID(protocol string, mID string) string {
|
||||
ID := protocol + " " + mID
|
||||
|
||||
_, usePersistent := gw.Config.GetString("PersistentMessageStorePath")
|
||||
usePersistent := gw.BridgeValues().General.PersistentMessageStorePath != ""
|
||||
if usePersistent {
|
||||
return gw.getCanonicalMessageFromStore(ID)
|
||||
} 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 {
|
||||
var destID string
|
||||
|
||||
_, usePersistent := gw.Config.GetString("PersistentMessageStorePath")
|
||||
usePersistent := gw.BridgeValues().General.PersistentMessageStorePath != ""
|
||||
if usePersistent {
|
||||
destID = gw.getDestMessagesFromStore(msgID, dest, channel)
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user