From a80bd14c4c22bf5aeda7b37e6f0631a9f4912384 Mon Sep 17 00:00:00 2001 From: Abhiseck Paira Date: Mon, 17 Jan 2022 19:55:33 +0530 Subject: get account ID from user variables specified in the init file Get user account ID from the mastodon variables specified in the init file by introducing the function `mastodon-client-form-user-from-vars'. Return user account ID in the form "user@instance.com" when the values of `mastodon-active-user' and `mastodon-instance-url' are "user" and "https://instance.com" respectively. --- lisp/mastodon-client.el | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lisp') diff --git a/lisp/mastodon-client.el b/lisp/mastodon-client.el index 7a857a2..f7d06a5 100644 --- a/lisp/mastodon-client.el +++ b/lisp/mastodon-client.el @@ -116,6 +116,15 @@ Return plist without the KEY." (plstore-item (plstore-get plstore key))) (mastodon-client--remove-key-from-plstore plstore-item))) +(defun mastodon-client-form-user-from-vars () + "Create a username from user variable. Return that username. + +Username in the form user@instance.com is formed from the +variables `mastodon-instance-url' and `mastodon-active-user'." + (concat mastodon-active-user + "@" + (url-host (url-generic-parse-url mastodon-instance-url)))) + (defun mastodon-client () "Return variable client secrets to use for `mastodon-instance-url'. -- cgit v1.2.3