Message signature
This commit is contained in:
parent
c8c7a9a78b
commit
853ec765b9
@ -104,12 +104,15 @@
|
||||
(switch-to-buffer (concat "*IDEC: New message to echo " echo "*"))
|
||||
(let ((msg (make-hash-table :test 'equal)))
|
||||
(puthash "body"
|
||||
(encode-coding-string (s-join "\n" (-drop-last 1 (-drop 4 (split-string (buffer-string) "\n"))))
|
||||
'utf-8)
|
||||
(encode-coding-string
|
||||
(s-join "\n" (-drop-last 1 (-drop 4 (split-string (buffer-string) "\n"))))
|
||||
'utf-8)
|
||||
msg)
|
||||
|
||||
(puthash "subj"
|
||||
(encode-coding-string (nth 1 (split-string (nth 2 (split-string (buffer-string) "\n")) "bj: "))
|
||||
'utf-8)
|
||||
(encode-coding-string
|
||||
(nth 1 (split-string (nth 2 (split-string (buffer-string) "\n")) "bj: "))
|
||||
'utf-8)
|
||||
msg)
|
||||
(puthash "echo" echo msg)
|
||||
(do-send-new-post-request msg)))
|
||||
@ -122,7 +125,7 @@
|
||||
"All"
|
||||
(gethash "subj" msg)
|
||||
""
|
||||
(gethash "body" msg)))
|
||||
(concat (gethash "body" msg) (idec-answers-insert-signature))))
|
||||
;; Encode message in Base64
|
||||
(post-message (base64url-encode-string (s-join "\n" point-message)))))
|
||||
|
||||
@ -135,7 +138,7 @@
|
||||
(gethash "subj" message)
|
||||
""
|
||||
(concat "@repto:" (gethash "id" message))
|
||||
(gethash "body" message)))
|
||||
(concat (gethash "body" message) (idec-answers-insert-signature))))
|
||||
;; Encode message in Base64
|
||||
(post-message (base64url-encode-string (encode-coding-string (s-join "\n" point-message) 'utf-8)))
|
||||
(kill-buffer (concat "*IDEC: answer to " (gethash "id" message) "*"))))
|
||||
@ -199,7 +202,6 @@
|
||||
(forward-line)
|
||||
(add-text-properties (point) (point-min) 'read-only)
|
||||
(setq p (point))
|
||||
|
||||
(insert "\n")
|
||||
(insert-text-button "[Send]"
|
||||
'action (lambda (x) (send-reply-message (button-get x 'msg)))
|
||||
@ -207,6 +209,12 @@
|
||||
(goto-char p)
|
||||
(idec)))
|
||||
|
||||
(defun idec-answers-insert-signature ()
|
||||
"Add signature to the message."
|
||||
(if idec-attach-message-signature
|
||||
(concat "\n\n" "// " idec-message-signature)
|
||||
""))
|
||||
|
||||
(defun idec-answers-get-author-for-quote (author)
|
||||
"Get AUTHOR."
|
||||
;; Parse author
|
||||
@ -244,8 +252,6 @@ receive string HEAD, list TAIL and original message AUTHOR."
|
||||
(car (get-message-field (gethash "content" msg-hash) "body"))
|
||||
(cdr (get-message-field (gethash "content" msg-hash) "body"))
|
||||
(idec-answers-get-author-for-quote (get-message-field (gethash "content" msg-hash) "author")))
|
||||
(insert "\n")
|
||||
|
||||
(setq p (- (point) 1))
|
||||
|
||||
;; [Send] button
|
||||
@ -270,17 +276,17 @@ receive string HEAD, list TAIL and original message AUTHOR."
|
||||
(defun edit-new-message (echo)
|
||||
"Edit new message to ECHO."
|
||||
(switch-to-buffer (get-buffer-create (concat "*IDEC: New message to echo " echo "*")))
|
||||
(insert (make-new-message-header echo))
|
||||
(forward-line)
|
||||
|
||||
(let (p)
|
||||
(insert (make-new-message-header echo))
|
||||
(setq p (point))
|
||||
(forward-line)
|
||||
|
||||
(insert "\n")
|
||||
(insert-text-button "[Send]"
|
||||
'action (lambda (x) (send-new-message (button-get x 'msg-echo)))
|
||||
'msg-echo echo)
|
||||
(goto-char p))
|
||||
(org-idec))
|
||||
(idec))
|
||||
|
||||
(provide 'idec-answers)
|
||||
|
||||
|
39
idec-mode.el
39
idec-mode.el
@ -97,6 +97,16 @@ Default to `idec-download-offset'"
|
||||
:type 'boolean
|
||||
:group 'idec)
|
||||
|
||||
(defcustom idec-message-signature "Sent from my GNU Emacs"
|
||||
"Message signatue."
|
||||
:type 'string
|
||||
:group 'idec)
|
||||
|
||||
(defcustom idec-attach-message-signature nil
|
||||
"Add or not signature to message."
|
||||
:type 'boolean
|
||||
:group 'idec)
|
||||
|
||||
(defgroup idec-accounts nil
|
||||
"IDEC accounts settings."
|
||||
:group 'idec)
|
||||
@ -146,12 +156,9 @@ Default to `idec-download-offset'"
|
||||
|
||||
(defvar idec-mode-hook nil)
|
||||
|
||||
(defvar idec-mode-map
|
||||
(defvar idec-mode-mode-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(define-key map "\C-c \C-c" 'kill-this-buffer)
|
||||
(define-key map "\C-c \C-n" 'idec-next-message)
|
||||
(define-key map "\C-c \C-b" 'idec-previous-message)
|
||||
(define-key map "\C-c \C-e" 'idec-new-message)
|
||||
(define-key map "n" 'idec-new-message)
|
||||
map)
|
||||
"Keymapping for IDEC mode.")
|
||||
|
||||
@ -179,7 +186,7 @@ Default to `idec-download-offset'"
|
||||
;; Mode function
|
||||
(define-generic-mode
|
||||
'idec
|
||||
'("//" ">" "ЗЫ" "# ")
|
||||
'("//" ">" "ЗЫ")
|
||||
'("ii://" "ID" "$subj" "сабж" "субж"
|
||||
"Subject" "From" "To" "Echo" "At")
|
||||
'(("=" . 'font-lock-operator)
|
||||
@ -190,7 +197,7 @@ Default to `idec-download-offset'"
|
||||
(define-derived-mode org-idec text-mode "IDEC"
|
||||
"Major mode for view and editing IDEC messages."
|
||||
:syntax-table idec-mode-syntax-table
|
||||
(setq-local comment-start "/{2} ")
|
||||
(setq-local comment-start "> ")
|
||||
(setq-local font-lock-defaults
|
||||
'(idec-font-lock-keywords))
|
||||
(use-local-map idec-mode-map)
|
||||
@ -199,15 +206,13 @@ Default to `idec-download-offset'"
|
||||
(setq mode-name "[IDEC]")
|
||||
(run-hooks 'idec-mode-hook))
|
||||
|
||||
(defun idec-mode ()
|
||||
(define-derived-mode idec-mode nil "idec-mode" ()
|
||||
"Major mode for view and editing IDEC messages."
|
||||
(interactive)
|
||||
:syntax-table idec-mode-syntax-table
|
||||
(kill-all-local-variables)
|
||||
;; Mode definition
|
||||
(set-syntax-table idec-mode-syntax-table)
|
||||
(use-local-map idec-mode-map)
|
||||
;; (font-lock-add-keywords 'idec-mode '(idec-font-lock-keywords))
|
||||
;; (set (make-local-variable 'font-lock-defaults) '(idec-font-lock-keywords))
|
||||
(setq major-mode 'idec-mode)
|
||||
(setq mode-name "[IDEC]")
|
||||
(setq imenu-generic-expression "*IDEC")
|
||||
@ -224,7 +229,6 @@ Default to `idec-download-offset'"
|
||||
"Browse local mail from `idec-mail-dir';
|
||||
optionaly return cursor to CHECKPOINT."
|
||||
(interactive)
|
||||
(get-buffer-create "*IDEC: INBOX*")
|
||||
(with-output-to-temp-buffer (get-buffer-create "*IDEC: INBOX*")
|
||||
(switch-to-buffer "*IDEC: INBOX*")
|
||||
(save-excursion
|
||||
@ -266,12 +270,11 @@ optionaly return cursor to CHECKPOINT."
|
||||
'echo echo
|
||||
'point (point))
|
||||
(princ "]\n"))
|
||||
(message (concat "IDEC: FUUUUUU <" echo ">")))
|
||||
))
|
||||
(put-text-property (beginning-of-buffer) (end-of-buffer) 'read-only nil))
|
||||
(if checkpoint
|
||||
(goto-char checkpoint))
|
||||
(idec))
|
||||
(message (concat "IDEC: FUUUUUU <" echo ">")))))
|
||||
(when checkpoint
|
||||
(goto-char checkpoint)))
|
||||
(idec-mode)
|
||||
(add-text-properties (beginning-of-buffer) (end-of-buffer) 'read-only))
|
||||
|
||||
(defun idec-browse-local-echo (&optional echo)
|
||||
"Get messages from local ECHO."
|
||||
|
Loading…
Reference in New Issue
Block a user