1
0
Fork 0

- added more parameters for each function that could be added to

`*skip-message-hook*';
  - changed unique constrains for TOFU table.
This commit is contained in:
cage 2020-06-27 10:50:40 +02:00
parent 15987cc5b2
commit 492eaf6f76
4 changed files with 14 additions and 5 deletions

View File

@ -353,7 +353,8 @@
;;; (note: it is commented out)
;; (hooks:add-hook 'hooks:*skip-message-hook*
;; (lambda (toot)
;; (lambda (toot timeline folder kind localp)
;; (declare (ignore timeline folder kind localp))
;; (when-let* ((text (html-utils:html->text (tooter:content toot)
;; :add-link-footnotes nil))
;; (trimmed (text-utils:trim-blanks text))

View File

@ -483,7 +483,7 @@
" hash TEXT NOT NULL, "
;; timestamp
" \"seen-at\" TEXT NOT NULL,"
" UNIQUE(hash) ON CONFLICT FAIL"
" UNIQUE(host) ON CONFLICT FAIL"
+make-close+)))
(defun build-all-indices ()
@ -496,7 +496,7 @@
(create-table-index +table-pagination-status+ '(:folder :timeline :status-id))
(create-table-index +table-conversation+ '(:id))
(create-table-index +table-cache+ '(:id :key))
(create-table-index +table-gemini-tofu-cert+ '(:hash)))
(create-table-index +table-gemini-tofu-cert+ '(:host)))
(defmacro gen-delete (suffix &rest names)
`(progn

View File

@ -84,4 +84,7 @@ non-nil.")
(defparameter *skip-message-hook* '()
"Run this hooks to check if a message must be skipped,
all hooks must returns nil for this message to be not skipped")
all hooks must returns nil for this message to be not skipped
Each function takes 4 parameters: status, timeline, folder, kind (:home :public)
localp")

View File

@ -326,7 +326,12 @@
(skip-this-status nil))
(when (or (and (db:user-ignored-p account-id)
(not (db:status-skipped-p status-id folder timeline-type)))
(hooks:run-hook-until-success 'hooks:*skip-message-hook* status))
(hooks:run-hook-until-success 'hooks:*skip-message-hook*
status
timeline-type
folder
kind
(localp object)))
(db:add-to-status-skipped status-id folder timeline-type)
(setf skip-this-status t)
(incf ignored-count))