From 0516b22b9a667ea4db0ec3129cca69f1d2c6868b Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Sat, 4 Aug 2012 20:39:59 +0200 Subject: [PATCH] Add avandu-update-article function * avandu.el (avandu-mark-article-read): Use `avandu-update-article' instead of calling `avandu--send-command'. --- avandu.el | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/avandu.el b/avandu.el index 92a1a6f..8ba638e 100644 --- a/avandu.el +++ b/avandu.el @@ -391,6 +391,31 @@ There are some special feed IDs: ,@(when include-attachments `((include_attachments . ,include-attachments))) ,@(when since-id `((since_id . ,since-id))))))))) +(defun avandu-update-article (article-ids mode field &optional data) + "Update the status of FIELD to MODE for the articles identified +by ARTICLE-IDS. + +ARTICLE-IDS should either be a single integer or a +comma-separated list of integers. + +MODE should be one of: + 0 -- Set to false + 1 -- Set to true + 2 -- Toggle + +FIELD should be one of: + 0 -- Starred + 1 -- Published + 2 -- Unread + 3 -- Article Note + +When updating FIELD 3 DATA functions as the note's contents." + (avandu--send-command `((op . "updateArticle") + (article_ids . ,article-ids) + (mode . ,mode) + (field . ,field) + ,@(when data `((data . ,data)))))) + ;; Commands (defun avandu-browse-article () "Browse the current button's article url." @@ -453,10 +478,7 @@ bounds of a button." (interactive) (let* ((button (or button (button-at (point)))) (id (button-get button 'article-id))) - (avandu--send-command `((op . "updateArticle") - (article_ids . ,id) - (mode . 0) - (field . 2))) + (avandu-update-article id 0 2) (button-put button 'face 'avandu-overview-read-article)) (avandu-next-article)) @@ -582,7 +604,6 @@ by feed." ;; (id . 109)) ;; (login user password) -;; (update-article article-ids mode field data) ;; (get-article article-id) ;; (get-config icons-dir icons-url daemon-is-running num-feeds) ;; (update-feed feed-id)