Add avandu-update-article function

* avandu.el (avandu-mark-article-read): Use `avandu-update-article'
  instead of calling `avandu--send-command'.
This commit is contained in:
Tom Willemsen 2012-08-04 20:39:59 +02:00
parent 7a7b7fb8b3
commit 0516b22b9a

View file

@ -391,6 +391,31 @@ There are some special feed IDs:
,@(when include-attachments `((include_attachments . ,include-attachments))) ,@(when include-attachments `((include_attachments . ,include-attachments)))
,@(when since-id `((since_id . ,since-id))))))))) ,@(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 ;; Commands
(defun avandu-browse-article () (defun avandu-browse-article ()
"Browse the current button's article url." "Browse the current button's article url."
@ -453,10 +478,7 @@ bounds of a button."
(interactive) (interactive)
(let* ((button (or button (button-at (point)))) (let* ((button (or button (button-at (point))))
(id (button-get button 'article-id))) (id (button-get button 'article-id)))
(avandu--send-command `((op . "updateArticle") (avandu-update-article id 0 2)
(article_ids . ,id)
(mode . 0)
(field . 2)))
(button-put button 'face 'avandu-overview-read-article)) (button-put button 'face 'avandu-overview-read-article))
(avandu-next-article)) (avandu-next-article))
@ -582,7 +604,6 @@ by feed."
;; (id . 109)) ;; (id . 109))
;; (login user password) ;; (login user password)
;; (update-article article-ids mode field data)
;; (get-article article-id) ;; (get-article article-id)
;; (get-config icons-dir icons-url daemon-is-running num-feeds) ;; (get-config icons-dir icons-url daemon-is-running num-feeds)
;; (update-feed feed-id) ;; (update-feed feed-id)