Skip to content

Commit 88cc6b0

Browse files
authored
Merge pull request normen#42 from cetinajero/feature/customizable-backlog-msg-qty
Setting for the # of messages per backlog
2 parents 8510dd4 + 646fed7 commit 88cc6b0

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

config/settings.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ type General struct {
2727
EnableNotifications bool
2828
UseTerminalBell bool
2929
NotificationTimeout int64
30+
BacklogMsgQuantity int
3031
}
3132

3233
type Keymap struct {
@@ -79,6 +80,7 @@ var Config = IniFile{
7980
EnableNotifications: false,
8081
UseTerminalBell: false,
8182
NotificationTimeout: 60,
83+
BacklogMsgQuantity: 10,
8284
},
8385
&Keymap{
8486
SwitchPanels: "Tab",

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ func PrintCommands() {
427427
fmt.Fprintln(textView, "[::b] "+cmdPrefix+"quit [::-]or[::b]", config.Config.Keymap.CommandQuit, "[::-] = Exit app")
428428
fmt.Fprintln(textView, "")
429429
fmt.Fprintln(textView, "[-::-]Chat[-::-]")
430-
fmt.Fprintln(textView, "[::b] "+cmdPrefix+"backlog [::-]or[::b]", config.Config.Keymap.CommandBacklog, "[::-] = load next 10 previous messages")
430+
fmt.Fprintln(textView, "[::b] "+cmdPrefix+"backlog [::-]or[::b]", config.Config.Keymap.CommandBacklog, "[::-] = load next "+config.Config.General.BacklogMsgQuantity+" previous messages")
431431
fmt.Fprintln(textView, "[::b] "+cmdPrefix+"read [::-]or[::b]", config.Config.Keymap.CommandRead, "[::-] = mark new messages in chat as read")
432432
fmt.Fprintln(textView, "[::b] "+cmdPrefix+"upload[::-] /path/to/file = Upload any file as document")
433433
fmt.Fprintln(textView, "[::b] "+cmdPrefix+"sendimage[::-] /path/to/file = Send image message")

messages/session_manager.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ func (sm *SessionManager) execCommand(command Command) {
279279
sm.uiHandler.PrintText("[" + config.Config.Colors.Negative + "]Unknown command: [-]" + cmd)
280280
case "backlog":
281281
if sm.currentReceiver != "" {
282-
count := 10
282+
count := config.Config.General.BacklogMsgQuantity
283283
if currentMsgs, ok := sm.db.textMessages[sm.currentReceiver]; ok {
284284
if len(currentMsgs) > 0 {
285285
firstMsg := currentMsgs[0]

0 commit comments

Comments
 (0)