1
0
mirror of https://codeberg.org/cage/tinmop/ synced 2025-02-16 08:00:35 +01:00

- added a configuration directive to update subscription to gemlogs at starts;

- added scheduled events when program starts;
- made update to gemlog less blocking;
- increased default history purging threshold.
This commit is contained in:
cage 2021-07-31 11:04:18 +02:00
parent 8a141c1707
commit 69ee5ab811
7 changed files with 51 additions and 8 deletions

View File

@ -29,7 +29,7 @@ reply-quoted-character = "> "
# delete the command history entries that are older than this number
# of days
purge-history-days-offset = -7
purge-history-days-offset = -30
# delete the cache entries that are older than this number of days
purge-cache-days-offset = -7
@ -37,6 +37,10 @@ purge-cache-days-offset = -7
# chosen editor (as shell command line) for compose a message
editor = "nano --locking"
# update gemlog subscriptions when program starts
# (default 'no', change to 'yes' if desired)
start.update.gemlog = no
# color parts of a displayed message according to a regular expression
# syntax is regular expression color attribute
# valid color are specified using RGB triplets as #RRGGBB or color names

View File

@ -72,8 +72,7 @@ etc.) happened"
(defun init-db ()
"Initialize the database"
(db-utils:with-ready-database (:connect t)
(db:purge-history)))
(db-utils:with-ready-database (:connect t)))
(defun change-folder ()
"Change folder, used in requests of a command line switch"

View File

@ -1115,6 +1115,7 @@
:gemini-downloading-animation
:suggestion-window-selected-item-colors
:gemini-default-favicon
:gemini-update-gemlog-at-start-p
:directory-symbol
:gemini-fetch-favicon-p
:gemini-link-colors

View File

@ -1293,8 +1293,17 @@
(defmethod process-event ((object gemlog-refresh-all-event))
(let ((all-subscribed-gemlogs (mapcar #'db:row-url (db:gemini-all-subscriptions))))
(loop for subscription in all-subscribed-gemlogs do
(gemini-subscription:refresh subscription))))
(mapcar (lambda (subscription)
(let* ((payload (lambda ()
(ui:notify (format nil
(_ "updating gemlog ~a")
subscription))
(gemini-subscription:refresh subscription)))
(event (make-instance 'function-event
:payload payload
:priority +minimum-event-priority+)))
(push-event event)))
all-subscribed-gemlogs)))
(defclass gemini-toc-jump-to-section (program-event)
((toc-win

View File

@ -34,6 +34,13 @@
(when (triggedp ticks ,frequency)
,@body-if-triggered)))
(defmacro gen-at-boot-function (name &body body)
`(let ((triggedp nil))
(defun ,(format-fn-symbol t "~a" name) ()
(when (null triggedp)
(setf triggedp t)
,@body))))
(gen-scheduler-function (refresh-all-chats-data
+refresh-all-chats-data-frequency+)
(ui:notify (_ "Updating all chats."))
@ -56,8 +63,17 @@
:chat (message-window:metadata *message-window*))))
(program-events:push-event show-event))))
(gen-at-boot-function purge-history
(db:purge-history))
(gen-at-boot-function refresh-gemlog-posts
(when (swconf:gemini-update-gemlog-at-start-p)
(ui:gemlog-refresh-all)))
(defun run-scheduled-events (ticks)
(refresh-all-chats-messages ticks)
(refresh-all-chats-data ticks)
(refresh-gemlog-subscriptions ticks)
(purge-gemlog-entries ticks))
(purge-gemlog-entries ticks)
(purge-history)
(refresh-gemlog-posts))

View File

@ -98,6 +98,8 @@
(define-constant +field-separator+ :field-separator :test #'eq)
(define-constant +false-values+ '("no" "false") :test #'equalp)
(defrule blank (or #\space #\Newline #\Tab)
(:constant nil))
@ -501,6 +503,7 @@
command-window
command-separator
gemini
gemlog
favicon
tree
branch
@ -523,6 +526,7 @@
unread
directory-symbol
fetch
update
password-echo-character
color-re
ignore-user-re
@ -576,6 +580,10 @@
;;;; interface
(defun false-value-p (v)
(or (null v)
(member v +false-values+ :test #'string=)))
(defun access-key->user-directive (key)
(join-with-strings (mapcar #'string-downcase key) "."))
@ -608,6 +616,13 @@
+key-gemini+
+key-favicon+))
(defun gemini-update-gemlog-at-start-p ()
(let ((value (access:accesses *software-configuration*
+key-start+
+key-update+
+key-gemlog+)))
(not (false-value-p value))))
(defun directory-symbol ()
(or (access:accesses *software-configuration*
+key-directory-symbol+)

View File

@ -1256,8 +1256,7 @@ certificate).
(program-events:push-event event))))
(defun gemlog-refresh-all ()
(with-blocking-notify-procedure ((_ "updating gemlog's subscriptions"))
(program-events:push-event (make-instance 'program-events:gemlog-refresh-all-event))))
(program-events:push-event (make-instance 'program-events:gemlog-refresh-all-event)))
(defun prompt-for-username (prompt complete-function event
notify-starting-message