Download message only if it not in local mail

This commit is contained in:
Denis Zheleztsov 2017-10-03 10:46:43 +03:00
parent 7e1ed72435
commit 27987cb894

58
idec.el
View File

@ -184,7 +184,7 @@ Not used if `idec-smart-fetching' is not nil."
(defun check-message-in-echo (msg echo) (defun check-message-in-echo (msg echo)
"Check if exists message MSG in ECHO `idec-mail-dir'." "Check if exists message MSG in ECHO `idec-mail-dir'."
(not (file-exists-p (get-message-file echo msg)))) (not (f-file? (get-message-file echo msg))))
;; Message fields pasing ;; Message fields pasing
(defun trim-string (string) (defun trim-string (string)
@ -300,33 +300,35 @@ White space here is any of: space, tab, Emacs newline (line feed, ASCII 10)."
"Display new fetched messages from `new-messages-list'." "Display new fetched messages from `new-messages-list'."
(with-output-to-temp-buffer (get-buffer-create "*IDEC: New messages*") (with-output-to-temp-buffer (get-buffer-create "*IDEC: New messages*")
(switch-to-buffer "*IDEC: New messages*") (switch-to-buffer "*IDEC: New messages*")
(dolist (msg new-messages-list) (if (= (length new-messages-list) 0)
;; Write message subj (princ "No new messages.")
(insert-text-button (concat (get-message-field msg "subj") (dolist (msg new-messages-list)
(make-string ;; Write message subj
(- (get-longest-field "subj" new-messages-list) (insert-text-button (concat (get-message-field msg "subj")
(length (get-message-field msg "subj"))) (make-string
? )) (- (get-longest-field "subj" new-messages-list)
'help-echo "Read message" (length (get-message-field msg "subj")))
'plain-msg msg ? ))
'action (lambda (x) (display-message (button-get x 'plain-msg)))) 'help-echo "Read message"
;; Write message time and echo 'plain-msg msg
(princ (format " %s(%s)%s%s\t%s\n" 'action (lambda (x) (display-message (button-get x 'plain-msg))))
(get-message-field msg "author") ;; Write message time and echo
(get-message-field msg "address") (princ (format " %s(%s)%s%s\t%s\n"
(make-string (- (get-message-field msg "author")
(+ (get-message-field msg "address")
(get-longest-field "author" new-messages-list) (make-string (-
(get-longest-field "address" new-messages-list) (+
1) (get-longest-field "author" new-messages-list)
(+ (get-longest-field "address" new-messages-list)
(length (get-message-field msg "author")) 1)
(length (get-message-field msg "address"))) (+
) (length (get-message-field msg "author"))
? ) (length (get-message-field msg "address")))
(get-message-field msg "echo") )
(get-message-field msg "time"))) ? )
(add-to-invisibility-spec '(msg . t))))) (get-message-field msg "echo")
(get-message-field msg "time")))
(add-to-invisibility-spec '(msg . t))))))
(defun get-message-content (echo msg) (defun get-message-content (echo msg)
"Get ECHO MSG content from `idec-primary-node'." "Get ECHO MSG content from `idec-primary-node'."