aboutsummaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorAbhiseck Paira <abhiseckpaira@disroot.org>2022-01-17 19:31:55 +0530
committerAbhiseck Paira <abhiseckpaira@disroot.org>2022-01-17 19:31:55 +0530
commitcd03ff5319dc60b4aa4f6d42f57b737e002cd923 (patch)
tree9dcd9a8b1da405fdcaab6ac084d08691f7e44a6a /lisp
parent2d5717faf83d59d11a4f89ce96eb326a39a5ee56 (diff)
abstract plstore implementation details of getting value
Introduce a new function `mastodon-client--remove-key-from-plstore' which removes "key" part from a plstore item. Refactor `mastodon-client--read' to use `mastodon-client--remove-key-from-plstore'.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/mastodon-client.el8
1 files changed, 7 insertions, 1 deletions
diff --git a/lisp/mastodon-client.el b/lisp/mastodon-client.el
index 9fb45f7..04a26ce 100644
--- a/lisp/mastodon-client.el
+++ b/lisp/mastodon-client.el
@@ -97,11 +97,17 @@ Make `mastodon-client--fetch' call to determine client values."
(plstore-close plstore)
client))
+(defun mastodon-client--remove-key-from-plstore (plstore)
+ "Remove KEY from PLSTORE."
+ (cdr plstore))
+
+;; Actually it returns a plist with client-details if such details are
+;; already stored in mastodon.plstore
(defun mastodon-client--read ()
"Retrieve client_id and client_secret from `mastodon-client--token-file'."
(let* ((plstore (plstore-open (mastodon-client--token-file)))
(mastodon (plstore-get plstore (concat "mastodon-" mastodon-instance-url))))
- (cdr mastodon)))
+ (mastodon-client--remove-key-from-plstore mastodon)))
(defun mastodon-client ()
"Return variable client secrets to use for `mastodon-instance-url'.