少し変更。名前も決めなきゃな

ちょっと変更

  • コンフィグファイルを利用するように変更

(setq *hateda-user* "自分のID")とか入れれば使える

  • ID/PASSを問い合わせるようにした

コンフィグに入れると見られる可能性があるもんね

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; はてな AtomPub を使用してはてなダイアリーを編集する
;;
;; version:0.0.1
;; 作者   :arashi77(http://d.hatena.ne.jp/arashi77/)
;;
;; 依存ライブラリ:xml-paraser-modoki, atom-modoki, junk-lib
;;
;; TODO:
;;  - キーバインドの設定
;;  - 現在のエントリ一覧を取得して編集、削除ができるようにする
;;  - 起動時にエントリ一覧を自動取得(できたらいいな)
;;
;; History
;;
;; 0.0.1: 新規作成
;;        実行したバッファの中身をまるまる投稿する機能のみ。
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(require "atomm/publish")

(defvar *hateda-user* nil)
(defvar *hateda-password* nil)

(defvar *debug-mode* nil)

(defvar *base-directory* "~/.hateda-atompub")
(defvar *config-file* (merge-pathnames "config.l" *base-directory*))

(defun load-config ()
  (junk::load-config-file *config-file*))

(defun hateda-post (data)
  (let ((url nil))
	(setq url (format nil "http://d.hatena.ne.jp/~A/atom/blog" *hateda-user*))
	(when *debug-mode*
;	  (msgbox "~S" url)
	  (msgbox "~S" data))
;	(msgbox "~A" "debug")
	(atomm::atomm-post-entry url *hateda-user* *hateda-password* data)
	))

(defun hateda-post-entry ()
  (interactive "p")
  (load-config)
  (let ((title (read-string "Entry Title: ")) (data nil))
	(setq data (list
				(list
				"entry"
				 '(("xmlns" . "http://purl.org/atom/ns#"))
				 (cons "title" (cons nil (cons title nil)))
				 (cons "content" (cons nil (cons (buffer-substring (point-min) (point-max)) nil)))
				 )))
	(while (not *hateda-user*)
	  (setq *hateda-user* (read-string "はてな Username: ")))
	(while (not *hateda-password*)
	  (setq *hateda-password* (junk::read-password
						(format nil "Password (~A): " *hateda-user*))))

	(hateda-post data)
	))