Add unsubscribe command
This commit is contained in:
parent
3438d383c2
commit
891a847b0f
2 changed files with 27 additions and 0 deletions
22
avandu.el
22
avandu.el
|
@ -476,6 +476,15 @@ There are a number of special category IDs:
|
|||
,@(when limit `((limit . ,limit)))
|
||||
,@(when offset `((offset . ,offset))))))
|
||||
|
||||
(defun avandu--all-feeds-hash ()
|
||||
"Get a hashtable of all feeds subsrcibed to in tt-rss."
|
||||
(let ((hash (make-hash-table :test 'equal)))
|
||||
(mapc (lambda (feed)
|
||||
(setf (gethash (cdr (assq 'title feed)) hash)
|
||||
(cdr (assq 'id feed))))
|
||||
(avandu-feeds -3))
|
||||
hash))
|
||||
|
||||
(defun avandu-headlines (feed-id &rest plist)
|
||||
"Get a list of headlines from Tiny Tiny RSS.
|
||||
|
||||
|
@ -742,6 +751,19 @@ If BUTTON is nil, try to use a button at `point'."
|
|||
(message "Succesfully subscribed to feed")
|
||||
(message "Could not subscribe to feed"))))
|
||||
|
||||
;;;###autoload
|
||||
(defun avandu-unsubscribe-from-feed (id)
|
||||
"Unsubscribe from ID."
|
||||
(interactive (let ((feeds (avandu--all-feeds-hash)))
|
||||
(list (gethash (completing-read "Feed: " feeds nil t)
|
||||
feeds))))
|
||||
(let ((status (avu-prop (avandu--send-command-sync
|
||||
`((op . "unsubscribeFeed")
|
||||
(feed_id . ,id))) status)))
|
||||
(if (string= status "OK")
|
||||
(message "Succesfully unsubscribed from feed")
|
||||
(message "Could not unsubscribe from feed"))))
|
||||
|
||||
(defun avandu-view-possibly-external (start end)
|
||||
"Maybe execute a command on the region between START and END.
|
||||
|
||||
|
|
|
@ -334,3 +334,8 @@ the id of the category as known in Tiny Tiny RSS.
|
|||
When used interactively the user will be prompted for both, and
|
||||
completions will be offered for @var{category} to make things easier.
|
||||
@end deffn
|
||||
|
||||
@deffn Command avandu-unsubscribe-from-feed id
|
||||
Ask Tiny Tiny RSS to unsubscribe from the feed identified with
|
||||
@var{id}. Completion is provided to make selection easier.
|
||||
@end deffn
|
||||
|
|
Loading…
Reference in a new issue