diff options
author | Tom Willemse | 2014-04-12 23:26:16 +0200 |
---|---|---|
committer | Tom Willemse | 2014-04-12 23:26:16 +0200 |
commit | 891a847b0fff0ec1abfa717ede28250a16d5c429 (patch) | |
tree | 75281ca88904803f37a3367ae8c382d0db3d50f8 | |
parent | 3438d383c241315001a87925df669880e453b0d0 (diff) | |
download | avandu-891a847b0fff0ec1abfa717ede28250a16d5c429.tar.gz avandu-891a847b0fff0ec1abfa717ede28250a16d5c429.zip |
Add unsubscribe command
-rw-r--r-- | avandu.el | 22 | ||||
-rw-r--r-- | doc/avandu.texinfo | 5 |
2 files changed, 27 insertions, 0 deletions
@@ -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. diff --git a/doc/avandu.texinfo b/doc/avandu.texinfo index 8e45904..da21dc1 100644 --- a/doc/avandu.texinfo +++ b/doc/avandu.texinfo @@ -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 |