Adds account switching
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
(require 'cl-lib)
|
||||
|
||||
(defvar noise-signal-cli-address)
|
||||
(defvar noise-account)
|
||||
|
||||
(define-error 'noise-rpc-error "signal-cli JSON-RPC error")
|
||||
|
||||
@@ -67,6 +68,16 @@ Signals `noise-rpc-error` on failure or connection error."
|
||||
result))
|
||||
(kill-buffer buf)))))
|
||||
|
||||
(defun noise-rpc-call-for-account (method &rest params)
|
||||
"Call signal-cli JSON-RPC METHOD with PARAMS for the configured account.
|
||||
Like `noise-rpc-call', but when `noise-account' is set the `account'
|
||||
parameter is added to the request. Account-scoped methods (such as
|
||||
listContacts or send) require it when the daemon serves multiple
|
||||
accounts."
|
||||
(if (and (boundp 'noise-account) noise-account)
|
||||
(apply #'noise-rpc-call method :account noise-account params)
|
||||
(apply #'noise-rpc-call method params)))
|
||||
|
||||
(defun noise-rpc--parse-response (raw)
|
||||
"Parse RAW JSON-RPC response body.
|
||||
Returns the `result` on success.
|
||||
|
||||
Reference in New Issue
Block a user