1
0
mirror of https://codeberg.org/cage/tinmop/ synced 2025-02-01 04:26:47 +01:00

- allowed skipping posts using language type.

This commit is contained in:
cage 2021-10-13 15:01:15 +02:00
parent f3f825bc0f
commit dff23fe909
4 changed files with 28 additions and 3 deletions

View File

@ -37,6 +37,10 @@ purge-cache-days-offset = -7
# chosen editor (as shell command line) for compose a message
editor = "nano --locking"
# allowed languages post, if the regex does not match the post's language the post is discarded
post-allowed-language = ".*"
# update gemlog subscriptions when program starts
# (default 'no', change to 'yes' if desired)
start.update.gemlog = yes

View File

@ -1214,6 +1214,7 @@
:tree-config-rendering-values
:make-tree-colormap
:left-arrow
:config-post-allowed-language
:config-purge-history-days-offset
:config-purge-cage-days-offset
:config-notification-life

View File

@ -375,11 +375,15 @@
(loop for status in statuses do
(let ((account-id (tooter:id (tooter:account status)))
(status-id (tooter:id status))
(language (tooter:language status))
(skip-this-status nil))
(when force-saving-of-ignored-status-p
(db:remove-from-status-ignored status-id folder timeline-type))
(when (or (and (db:user-ignored-p account-id)
(not (db:status-skipped-p status-id folder timeline-type)))
(and language
(cl-ppcre:scan (swconf:config-post-allowed-language)
language))
(hooks:run-hook-until-success 'hooks:*skip-message-hook*
status
timeline-type

View File

@ -25,11 +25,13 @@
;; | SERVER-ASSIGN
;; | USERNAME-ASSIGN
;; | OPEN-LINK-HELPER
;; | POST-ALLOWED-LANGUAGE
;; | GENERIC-ASSIGN)
;; COMMENT*
;; SERVER-ASSIGN := SERVER-KEY BLANKS ASSIGN BLANKS GENERIC-VALUE BLANKS
;; USERNAME-ASSIGN := USERNAME-KEY BLANKS WITH BLANKS GENERIC-VALUE BLANKS
;; OPEN-LINK-HELPER := OPEN-LINK-HELPER-KEY BLANKS ASSIGN BLANKS REGEXP PROGRAM-NAME BLANKS USE-CACHE? NOWAIT?
;; OPEN-LINK-HELPER := OPEN-LINK-HELPER-KEY BLANKS ASSIGN BLANKS
;; REGEXP PROGRAM-NAME BLANKS USE-CACHE? NOWAIT?
;; GENERIC-ASSIGN := (and key blanks assign blanks
;; (or quoted-string
;; hexcolor
@ -39,6 +41,7 @@
;; IGNORE-USER-RE-ASSIGN := IGNORE-USER-RE-KEY ASSIGN REGEXP
;; COLOR-RE-ASSIGN := COLOR-RE-KEY ASSIGN REGEXP FG-COLOR (? ATTRIBUTE-VALUE)
;; USE-FILE := (AND USE BLANKS FILEPATH BLANKS)
;; POST-ALLOWED-LANGUAGE := "post-allowed-language" BLANKS ASSIGN REGEXP
;; KEY := FIELD (FIELD-SEPARATOR KEY)*
;; BLANKS := (BLANK)*
;; FILEPATH := QUOTED-STRING
@ -360,6 +363,10 @@
(elt args 6)
(elt args 8)
:wait (not (elt args 9)))))))
(defrule post-allowed-language (and "post-allowed-language" blanks assign regexp)
(:function remove-if-null))
(defrule filepath quoted-string)
(defparameter *already-included-files* ())
@ -382,6 +389,7 @@
server-assign
username-assign
open-link-helper
post-allowed-language
generic-assign)
(* comment))
(:function second))
@ -537,6 +545,7 @@
password-echo-character
color-re
ignore-user-re
post-allowed-language
purge-history-days-offset
purge-cache-days-offset)
@ -556,7 +565,8 @@
(cond
((or (eq +key-color-re+ key)
(eq +key-ignore-user-re+ key)
(eq +key-open-link-helper+ key))
(eq +key-open-link-helper+ key)
(eq +key-post-allowed-language+ key))
(setf (access:accesses *software-configuration* key)
(append (access:accesses *software-configuration* key)
(list value))))
@ -879,6 +889,11 @@
(,transform-value-fn (access:accesses *software-configuration*
,@keys))))
(gen-simple-access (post-allowed-language
:transform-value-fn
(lambda (a) (cl-ppcre:create-scanner a :case-insensitive-mode t)))
+key-post-allowed-language+)
(gen-simple-access (purge-history-days-offset
:transform-value-fn
(lambda (a)
@ -1369,6 +1384,7 @@
#'message-window-locked-account-mark
#'message-window-unlocked-account-mark
#'message-window-line-mark-values
#'message-window-attachments-header)
#'message-window-attachments-header
#'config-post-allowed-language)
do
(funcall fn)))