aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tom Willemsen2012-08-04 20:39:59 +0200
committerGravatar Tom Willemsen2012-08-04 20:39:59 +0200
commit0516b22b9a667ea4db0ec3129cca69f1d2c6868b (patch)
tree40e39d98adf67ec5410dd0495d1b589cdb2e37bd
parent7a7b7fb8b348bc51da3c66343ceb2a8230fbff5d (diff)
downloadavandu-0516b22b9a667ea4db0ec3129cca69f1d2c6868b.tar.gz
avandu-0516b22b9a667ea4db0ec3129cca69f1d2c6868b.zip
Add avandu-update-article function
* avandu.el (avandu-mark-article-read): Use `avandu-update-article' instead of calling `avandu--send-command'.
-rw-r--r--avandu.el31
1 files 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)