1
0
Fork 0

- refactored function related to post searching.

This commit is contained in:
cage 2024-11-29 09:54:29 +01:00
parent 15b9e82ba1
commit 6cf783bb39
1 changed files with 34 additions and 20 deletions

View File

@ -2479,6 +2479,28 @@ Metadata are:
(order-by= query '(:desc :message-index))
(fetch-single query)))
(defun search-next-message-by-status (timeline
folder
start-status-message-index
filter-status-column
filter-status-column-value
&key (account-id nil))
"Search the next unread message belonging
to `timeline' , `folder' and possibly `account-id', older than
`start-status-message-index'"
(let* ((filter-criteria `(:and := ,filter-status-column
,filter-status-column-value))
(query (make-filtered-message-select nil
timeline
folder
account-id
`(:and :> :status.message-index
,start-status-message-index)
filter-criteria)))
(order-by= query :message-index)
(fetch-single query)))
(defun search-next-unread-message (timeline
folder
start-status-message-index
@ -2486,16 +2508,12 @@ Metadata are:
"Search the next unread message belonging
to `timeline' , `folder' and possibly `account-id', older than
`start-status-message-index'"
(let* ((query (make-filtered-message-select nil
timeline
folder
account-id
`(:and :> :status.message-index
,start-status-message-index)
`(:and := :status.redp
,+db-false+))))
(order-by= query :message-index)
(fetch-single query)))
(search-next-message-by-status timeline
folder
start-status-message-index
:status.redp
+db-false+
:account-id account-id))
(defun search-next-undeleted-message (timeline
folder
@ -2504,16 +2522,12 @@ to `timeline' , `folder' and possibly `account-id', older than
"Search the next undeleted message belonging
to `timeline' , `folder' and possibly `account-id', older than
`start-status-message-index'"
(let* ((query (make-filtered-message-select nil
timeline
folder
account-id
`(:and :> :status.message-index
,start-status-message-index)
`(:and := :status.deletedp
,+db-false+))))
(order-by= query :message-index)
(fetch-single query)))
(search-next-message-by-status timeline
folder
start-status-message-index
:status.deletedp
+db-false+
:account-id account-id))
(defmacro with-add-account-id-to-query ((query query-body) account-id &body body)
`(let ((,query ,query-body))