command toggle downloads
This commit is contained in:
parent
8b68140dc9
commit
41e7b018c1
@ -47,6 +47,7 @@ type UserPreferences struct {
|
||||
DisableEmojis bool `yaml:"disable_emojis"`
|
||||
DisableMarkdown bool `yaml:"disable_markdown"`
|
||||
DisableHTML bool `yaml:"disable_html"`
|
||||
DisableDownloads bool `yaml:"disable_downloads"`
|
||||
}
|
||||
|
||||
// Config contains the main config of gomuks.
|
||||
|
@ -570,6 +570,13 @@ func cmdToggle(cmd *Command) {
|
||||
} else {
|
||||
cmd.Reply("Enabled Markdown input")
|
||||
}
|
||||
case "downloads":
|
||||
cmd.Config.Preferences.DisableDownloads = !cmd.Config.Preferences.DisableDownloads
|
||||
if cmd.Config.Preferences.DisableDownloads {
|
||||
cmd.Reply("Disabled Downloads input")
|
||||
} else {
|
||||
cmd.Reply("Enabled Downloads input")
|
||||
}
|
||||
default:
|
||||
cmd.Reply("Usage: /toggle <rooms/users/baremessages/images/typingnotif/emojis>")
|
||||
return
|
||||
|
@ -36,7 +36,7 @@ type MessageRenderer interface {
|
||||
NotificationContent() string
|
||||
PlainText() string
|
||||
CalculateBuffer(prefs config.UserPreferences, width int, msg *UIMessage)
|
||||
RegisterMatrix(matrix ifc.MatrixContainer)
|
||||
RegisterMatrix(matrix ifc.MatrixContainer, prefs config.UserPreferences)
|
||||
Height() int
|
||||
Clone() MessageRenderer
|
||||
String() string
|
||||
|
@ -89,4 +89,4 @@ func (msg *ExpandedTextMessage) Draw(screen mauview.Screen) {
|
||||
}
|
||||
}
|
||||
|
||||
func (msg *ExpandedTextMessage) RegisterMatrix(matrix ifc.MatrixContainer) {}
|
||||
func (msg *ExpandedTextMessage) RegisterMatrix(matrix ifc.MatrixContainer, prefs config.UserPreferences) {}
|
||||
|
@ -66,10 +66,10 @@ func (msg *FileMessage) Clone() MessageRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
func (msg *FileMessage) RegisterMatrix(matrix ifc.MatrixContainer) {
|
||||
func (msg *FileMessage) RegisterMatrix(matrix ifc.MatrixContainer, prefs config.UserPreferences) {
|
||||
msg.matrix = matrix
|
||||
|
||||
if len(msg.data) == 0 {
|
||||
if len(msg.data) == 0 && !prefs.DisableDownloads {
|
||||
go msg.updateData()
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ func NewHTMLMessage(evt *event.Event, displayname string, root html.Entity) *UIM
|
||||
})
|
||||
}
|
||||
|
||||
func (hw *HTMLMessage) RegisterMatrix(matrix ifc.MatrixContainer) {}
|
||||
func (hw *HTMLMessage) RegisterMatrix(matrix ifc.MatrixContainer, prefs config.UserPreferences) {}
|
||||
|
||||
func (hw *HTMLMessage) Clone() MessageRenderer {
|
||||
return &HTMLMessage{
|
||||
|
@ -65,4 +65,4 @@ func (msg *RedactedMessage) Draw(screen mauview.Screen) {
|
||||
}
|
||||
}
|
||||
|
||||
func (msg *RedactedMessage) RegisterMatrix(matrix ifc.MatrixContainer) {}
|
||||
func (msg *RedactedMessage) RegisterMatrix(matrix ifc.MatrixContainer, prefs config.UserPreferences) {}
|
||||
|
@ -102,4 +102,4 @@ func (msg *TextMessage) Draw(screen mauview.Screen) {
|
||||
}
|
||||
}
|
||||
|
||||
func (msg *TextMessage) RegisterMatrix(matrix ifc.MatrixContainer) {}
|
||||
func (msg *TextMessage) RegisterMatrix(matrix ifc.MatrixContainer, prefs config.UserPreferences) {}
|
||||
|
Loading…
Reference in New Issue
Block a user