diff --git a/data/scripts/get-following.lisp b/data/scripts/get-following.lisp index b83a422..8ffb793 100644 --- a/data/scripts/get-following.lisp +++ b/data/scripts/get-following.lisp @@ -28,9 +28,10 @@ (defun main () (connect) (db-utils:with-ready-database (:connect t) - (let* ((username (db:acct->id (swconf:config-username))) + (let* ((username (swconf:config-username)) (local-server-name (swconf:config-server-name)) - (follows-accounts (api-pleroma:get-following username))) + (user-acct (api-client:local-user-acct)) + (follows-accounts (api-client:get-following user-acct))) (loop for account in follows-accounts do (let ((acct (tooter:account-name account))) (if (scan "@" acct) diff --git a/src/api-client.lisp b/src/api-client.lisp index 213f1fc..12d0e89 100644 --- a/src/api-client.lisp +++ b/src/api-client.lisp @@ -588,6 +588,18 @@ database." (when user-id (tooter:reject-request *client* user-id))) +(defun-api-call get-following (user-id &optional (min-id nil) (accum '())) + "Get a list of accounts that user is following" + (let ((partial (sort-id< (tooter:get-following api-client:*client* + user-id + :max-id min-id)))) + (if partial + (get-following user-id (tooter:id (first partial)) (append partial accum)) + accum))) + +(defun local-user-acct () + (tooter:id (tooter:account *client*))) + (defclass conversation-tree () ((id :initform nil diff --git a/src/api-pleroma.lisp b/src/api-pleroma.lisp index d49b5f7..4d437db 100644 --- a/src/api-pleroma.lisp +++ b/src/api-pleroma.lisp @@ -135,29 +135,5 @@ media `media'. Returns a `chat-message' instance" (api-pleroma:post-chat-message api-client:*client* chat-id nil message) (api-pleroma:post-chat-message api-client:*client* chat-id message nil))) -(defmethod get-following-accounts ((client tooter:client) (id string) - &key - (max-id nil) - (min-id nil) - (since-id nil) - (limit 10) - (offset 0)) - (decode-account (tooter:query client - (format nil "/api/v1/accounts/~a/following" id) - :max-id max-id - :min-id min-id - :since-id since-id - :limit limit - :offset offset))) - (api-client:defun-api-call create-new-chat (user-id) (create-chat api-client:*client* user-id)) - -(api-client:defun-api-call get-following (user-id &optional (min-id nil) (accum '())) - "Get a list of accounts that user is following" - (let ((partial (api-client:sort-id< (get-following-accounts api-client:*client* - user-id - :max-id min-id)))) - (if partial - (get-following user-id (tooter:id (first partial)) (append partial accum)) - accum))) diff --git a/src/package.lisp b/src/package.lisp index 3d9427f..596ec8a 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -1785,7 +1785,6 @@ :get-chats :post-on-chat :create-new-chat - :get-following :instance-pleroma-p)) (defpackage :api-client @@ -1829,6 +1828,8 @@ :follow-requests :accept-follow-request :reject-follow-request + :get-following + :local-user-acct :conversation-tree :id :last-status