aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/config.go1
-rw-r--r--ui/commands.go7
-rw-r--r--ui/messages/base.go2
-rw-r--r--ui/messages/expandedtextmessage.go2
-rw-r--r--ui/messages/filemessage.go4
-rw-r--r--ui/messages/htmlmessage.go2
-rw-r--r--ui/messages/redactedmessage.go2
-rw-r--r--ui/messages/textmessage.go2
8 files changed, 15 insertions, 7 deletions
diff --git a/config/config.go b/config/config.go
index b8ff74b..e8c7b1a 100644
--- a/config/config.go
+++ b/config/config.go
@@ -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.
diff --git a/ui/commands.go b/ui/commands.go
index 747be1e..a57a78d 100644
--- a/ui/commands.go
+++ b/ui/commands.go
@@ -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
diff --git a/ui/messages/base.go b/ui/messages/base.go
index e86b85c..58d9b6e 100644
--- a/ui/messages/base.go
+++ b/ui/messages/base.go
@@ -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
diff --git a/ui/messages/expandedtextmessage.go b/ui/messages/expandedtextmessage.go
index 424db79..c666613 100644
--- a/ui/messages/expandedtextmessage.go
+++ b/ui/messages/expandedtextmessage.go
@@ -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) {}
diff --git a/ui/messages/filemessage.go b/ui/messages/filemessage.go
index 3878b56..9fb3499 100644
--- a/ui/messages/filemessage.go
+++ b/ui/messages/filemessage.go
@@ -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()
}
}
diff --git a/ui/messages/htmlmessage.go b/ui/messages/htmlmessage.go
index e476bc9..ff49e57 100644
--- a/ui/messages/htmlmessage.go
+++ b/ui/messages/htmlmessage.go
@@ -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{
diff --git a/ui/messages/redactedmessage.go b/ui/messages/redactedmessage.go
index fc34682..56b4822 100644
--- a/ui/messages/redactedmessage.go
+++ b/ui/messages/redactedmessage.go
@@ -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) {}
diff --git a/ui/messages/textmessage.go b/ui/messages/textmessage.go
index 2e27e33..0bfa27b 100644
--- a/ui/messages/textmessage.go
+++ b/ui/messages/textmessage.go
@@ -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) {}