Mark by asterisk unreaded message in local echo

This commit is contained in:
Denis Zheleztsov 2018-06-29 11:50:43 +03:00
parent df722b5b6f
commit a54bc3db9a
Signed by: Difrex
GPG Key ID: B047A0E62A285621

View File

@ -34,9 +34,9 @@
:group 'network) :group 'network)
;; Not used ;; Not used
(defcustom idec-nodes-list (defcustom idec-nodes-list ""
"http://idec.spline-online.tk/,https://ii-net.tk/ii/ii-point.php?q=/; "List(comma separated) of IDEC nodes;
List(comma separated) of IDEC nodes; http://idec.spline-online.tk/,https://ii-net.tk/ii/ii-point.php?q=/;
Currently not used." Currently not used."
:type 'string :type 'string
:group 'idec) :group 'idec)
@ -71,11 +71,11 @@ Not used if `idec-smart-fetching' is not nil."
:group 'idec) :group 'idec)
(defcustom idec-echo-subscriptions "idec.talks,pipe.2032" (defcustom idec-echo-subscriptions "idec.talks,pipe.2032"
"List of subribes echoes." "List(comma separated string) of subribes echoes."
:type 'string :type 'string
:group 'idec) :group 'idec)
(defcustom idec-mail-dir (concat user-emacs-directory "/idec-mail") (defcustom idec-mail-dir (concat user-emacs-directory "idec-mail")
"Directory to store mail." "Directory to store mail."
:type 'string :type 'string
:group 'idec) :group 'idec)
@ -279,21 +279,27 @@ optionaly return cursor to CHECKPOINT."
(if (not echo) (if (not echo)
(setq echo (read-string "Enter echo name: "))) (setq echo (read-string "Enter echo name: ")))
(let (longest) (let (longest)
(setq longest (longest-local-echo-subj echo)) (setq longest (+ 1 (longest-local-echo-subj echo)))
(with-output-to-temp-buffer (get-buffer-create (concat "*IDEC: INBOX->(" echo ")") ) (with-output-to-temp-buffer (get-buffer-create (concat "*IDEC: INBOX->(" echo ")") )
(switch-to-buffer (concat "*IDEC: INBOX->(" echo ")")) (switch-to-buffer (concat "*IDEC: INBOX->(" echo ")"))
(let (counter) (let (counter)
(setq counter 0) (setq counter 0)
(dolist (msg (get-echo-messages echo)) (dolist (msg (get-echo-messages echo))
(setq subj-length (length (gethash "subj" msg)))
(insert-button (gethash "subj" msg) (insert-button (gethash "subj" msg)
'action (lambda (x) (display-message-hash (button-get x 'msg-hash))) 'action (lambda (x) (display-message-hash (button-get x 'msg-hash)))
'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-hash msg) 'msg-hash msg)
(princ (make-string
(- longest ;; Mark by asterisk unread message
(length (gethash "subj" msg))) (if (= 1 (gethash "unread" msg))
? )) (and
(princ "*")
(if (> longest subj-length)
(setq subj-length (+ subj-length 1)))))
(princ (make-string (- longest subj-length) ? ))
(princ (concat " " (gethash "time" msg))) (princ (concat " " (gethash "time" msg)))
(princ (concat "\t" (gethash "author" msg) "\n"))) (princ (concat "\t" (gethash "author" msg) "\n")))
(idec-mode))))) (idec-mode)))))