;; choose different qotd's after one has been selected. Also, be
;; able to view older qotd's.
;;
-;; o Find a way to pre-fill the subject header properly for writer's
-;; block.
-;;
;; o Rewrite the twitter code to use OAuth.
;;
;;
;;; Version:
-(defconst lj-version 1.24
+(defconst lj-version 1.25
"Version number of SXEmacs/LJ.")
;;; Code:
(let ((buf (get-buffer-create lj-qotd-buffer))
(bregexp "<!-- Content -->")
(eregexp "<p class='skiplinks'>")
- (qregexp "^<p class='qotd-archive-item-question'>\\(.*\\)</p><p")
- (dregexp "^<p class='qotd-archive-item-date'>\\(.*[0-9]+\\)</p>")
+ (qregexp "<p class='qotd-archive-item-question'>\\(.*\\)</p><p")
+ (dregexp
+ (concat "<div class=\"b-qotd-question\">"
+ "<p class='qotd-archive-item-date'>\\(.*[0-9]+\\)</p>"))
(idregexp "^.*qotd=\\([0-9]+\\).*\n.*$")
(url "http://www.livejournal.com/misc/qotdarchive.bml")
b e)
(match-string 1))
(make-string 72 ?=)) t))))))
+(defun lj-qotd-subject (qotd)
+ "Update the Subject header with title of QOTD."
+ (let ((url (format "http://www.livejournal.com/update.bml?qotd=%d"
+ qotd))
+ (subject))
+ (with-temp-buffer
+ (mm-url-insert url)
+ (goto-char (point-min))
+ (when (re-search-forward "Writer's Block: \\(.*\\)\" name="
+ nil t)
+ (setq subject (match-string 1))))
+ (lj-goto-subject)
+ (goto-char (point-at-eol))
+ (insert subject)
+ (goto-char (point-max))))
+
(defun lj-narrow-to-qotd (qotd)
"Narrow Writer's Block buffer to a single QOTD."
(let ((delim (make-string 72 ?=))
(switch-to-buffer "*LJ-Post*"))
(unless (zerop lj-qotd)
(insert (format "<lj-template name=\"qotd\" id=\"%d\" />\n\n"
- lj-qotd)))))
+ lj-qotd))
+ (lj-qotd-subject lj-qotd))))
(defun lj-cleanup-qotd ()
"Reset `lj-qotd' to zero and kill the qotd buffer."