From 281be573c543f14c15e5c6c8cf3db2fa28885425 Mon Sep 17 00:00:00 2001 From: Denis Zheleztsov Date: Tue, 26 Jun 2018 14:22:32 +0300 Subject: [PATCH] Local DB answers fixed --- idec.el | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/idec.el b/idec.el index 4316226..b76286d 100644 --- a/idec.el +++ b/idec.el @@ -64,6 +64,20 @@ put cursor to CHECKPOINT." ;; END OF LOCAL MAIL FUNCTIONS ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun make-plain-text-message-from-hash(msg) + "Make standard plain text message from MSG hash." + (concat + (gethash "tags" msg) "\n" + (gethash "echo" msg) "\n" + (shell-command-to-string (concat "date -d '" (gethash "time" msg) "' +%s")) + (gethash "author" msg) "\n" + (gethash "address" msg) "\n" + (gethash "recipient" msg) "\n" + (gethash "subj" msg) "\n" + "\n" + (gethash "body" msg) "\n")) + + (defun make-message-header (msg) "Make message header from MSG hash." (concat @@ -77,6 +91,7 @@ put cursor to CHECKPOINT." (defun display-message-hash (msg) "Disaply message MSG in new buffer." (mark-message-read (gethash "id" msg) (gethash "echo" msg)) + (message (make-plain-text-message-from-hash 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)) @@ -86,7 +101,7 @@ put cursor to CHECKPOINT." (princ "[") (let (answer-hash) (setq answer-hash (make-hash-table :test 'equal)) - (puthash "content" (gethash "msg" msg) answer-hash) + (puthash "content" (make-plain-text-message-from-hash 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)