Working local echoes
This commit is contained in:
parent
94ad808dcb
commit
dabc7bb048
|
@ -227,7 +227,7 @@ optionaly return cursor to CHECKPOINT."
|
||||||
;; Echo name with unread messages
|
;; Echo name with unread messages
|
||||||
;; ii.test.14 (5)*
|
;; ii.test.14 (5)*
|
||||||
(insert-button echo
|
(insert-button echo
|
||||||
'action (lambda (x) (browse-local-echo (button-get x 'echo)))
|
'action (lambda (x) (idec-browse-local-echo (button-get x 'echo)))
|
||||||
'echo echo
|
'echo echo
|
||||||
'(face nil))
|
'(face nil))
|
||||||
|
|
||||||
|
@ -266,7 +266,7 @@ optionaly return cursor to CHECKPOINT."
|
||||||
(goto-char checkpoint))
|
(goto-char checkpoint))
|
||||||
(idec-mode))
|
(idec-mode))
|
||||||
|
|
||||||
(defun browse-local-echo (&optional echo)
|
(defun idec-browse-local-echo (&optional echo)
|
||||||
"Get messages from local ECHO."
|
"Get messages from local ECHO."
|
||||||
(interactive)
|
(interactive)
|
||||||
(if (not echo)
|
(if (not echo)
|
||||||
|
@ -277,9 +277,10 @@ optionaly return cursor to CHECKPOINT."
|
||||||
(setq counter 0)
|
(setq counter 0)
|
||||||
(dolist (msg (get-echo-messages echo))
|
(dolist (msg (get-echo-messages echo))
|
||||||
(insert-button (concat (gethash "subj" msg) "\n")
|
(insert-button (concat (gethash "subj" msg) "\n")
|
||||||
'action (lambda (x) (message (button-get x 'subj)))
|
'action (lambda (x) (display-message-hash (button-get x 'msg)))
|
||||||
'subj (gethash "subj" msg)
|
'subj (gethash "subj" msg)
|
||||||
'help-echo (concat "Read message *" (gethash "subj" msg) "*") )
|
'help-echo (concat "Read message *" (gethash "subj" msg) "*")
|
||||||
|
'msg msg)
|
||||||
))
|
))
|
||||||
(idec-mode)))
|
(idec-mode)))
|
||||||
|
|
||||||
|
|
34
idec.el
34
idec.el
|
@ -64,6 +64,40 @@ put cursor to CHECKPOINT."
|
||||||
;; END OF LOCAL MAIL FUNCTIONS
|
;; END OF LOCAL MAIL FUNCTIONS
|
||||||
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
(defun make-message-header (msg)
|
||||||
|
"Make message header from MSG hash."
|
||||||
|
(concat
|
||||||
|
(concat "ID: " (gethash "id" msg) "\n")
|
||||||
|
(concat "From: " (gethash "author" msg) "[" (gethash "address" msg) "]" "\n")
|
||||||
|
(concat "To: " (gethash "recipient" msg) "\n")
|
||||||
|
(concat "Echo: " (gethash "echo" msg) "\n")
|
||||||
|
(concat "At: " (gethash "time" msg) "\n")
|
||||||
|
(concat "Subject: " (gethash "subj" msg) "\n")))
|
||||||
|
|
||||||
|
(defun display-message-hash (msg)
|
||||||
|
"Disaply message MSG in new buffer."
|
||||||
|
(mark-message-read (gethash "id" msg) (gethash "echo" msg))
|
||||||
|
(with-output-to-temp-buffer (get-buffer-create (concat "*IDEC: " (gethash "subj" msg) "*"))
|
||||||
|
(switch-to-buffer (concat "*IDEC: " (gethash "subj" msg) "*"))
|
||||||
|
(princ (make-message-header msg))
|
||||||
|
(princ (concat "__________________________________\n\n"
|
||||||
|
(gethash "body" msg)))
|
||||||
|
(princ "\n__________________________________\n")
|
||||||
|
(princ "[")
|
||||||
|
(let (answer-hash)
|
||||||
|
(setq answer-hash (make-hash-table :test 'equal))
|
||||||
|
(puthash "content" (gethash "msg" msg) answer-hash)
|
||||||
|
(insert-button "Answer"
|
||||||
|
'action (lambda (x) (edit-answer-without-quote (button-get x 'id) (button-get x 'msg-hash)))
|
||||||
|
'id (gethash "id" msg)
|
||||||
|
'msg-hash answer-hash))
|
||||||
|
(princ "]")
|
||||||
|
(princ "\t [")
|
||||||
|
(insert-button "Quote answer")
|
||||||
|
(princ "]")
|
||||||
|
(add-text-properties (point-min) (point-max) 'read-only))
|
||||||
|
(idec-mode))
|
||||||
|
|
||||||
(defun display-message (msg)
|
(defun display-message (msg)
|
||||||
"Display message MSG in new buffer in idec-mode."
|
"Display message MSG in new buffer in idec-mode."
|
||||||
(mark-message-read (gethash "id" msg) (get-message-field (gethash "msg" msg) "echo"))
|
(mark-message-read (gethash "id" msg) (get-message-field (gethash "msg" msg) "echo"))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user