diff options
author | jao <jao@gnu.org> | 2020-06-24 02:59:13 +0100 |
---|---|---|
committer | jao <jao@gnu.org> | 2020-06-24 02:59:13 +0100 |
commit | 17d47ba312d559eee5373ec18ce57ef0e36ee4a7 (patch) | |
tree | b4d7f8fe043cf61f92a6079456d8f18b7f9b78e2 /net | |
parent | 348c39d0d7f76fe2ec0d62e729e7e11e1e9ec073 (diff) | |
download | elibs-17d47ba312d559eee5373ec18ce57ef0e36ee4a7.tar.gz elibs-17d47ba312d559eee5373ec18ce57ef0e36ee4a7.tar.bz2 |
signel
Diffstat (limited to 'net')
-rw-r--r-- | net/signel.org | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/net/signel.org b/net/signel.org index d8b54c2..b429b21 100644 --- a/net/signel.org +++ b/net/signel.org @@ -248,7 +248,6 @@ Or, in elisp: (defun signel--filter (proc str) (signel--ordinary-insertion-filter proc str) (let ((str (concat signel--line-buffer str))) - (message "signel: processing: '%s'" str) (if-let ((msg (signel--msg-contents str))) (let ((source (signel--msg-source msg)) (stamp (signel--msg-timestamp msg)) @@ -379,7 +378,15 @@ With that, we're finally ready to insert messages in our signel chat buffers: #+begin_src emacs-lisp -(defvar signel-report-deliveries t) +(defcustom signel-report-deliveries nil + "Whether to show message delivery notices." + :group 'signel + :type 'boolean) + +(defcustom signel-report-read t + "Whether to show message read notices." + :group 'signel + :type 'boolean) (defun signel--prompt-and-notify () (insert (signel--prompt)) @@ -404,13 +411,15 @@ buffers: (let ((is-delivery (or (signel--msg-is-delivery msg) (signel--msg-is-receipt msg))) (is-read (signel--msg-is-read msg))) - (when (and (or rec-stamp stamp) - (not (string= source signel-cli-user)) - signel-report-deliveries) - (insert (signel--timestamp "*" (or rec-stamp stamp) "* ") - (signel--notice (if is-read "(read)" "(delivered)")) - "\n") - (signel--prompt-and-notify)))) + (if (and (or rec-stamp stamp) + (not (string= source signel-cli-user)) + (or signel-report-deliveries + (and signel-report-read is-read))) + (progn (insert (signel--timestamp "*" (or rec-stamp stamp) "* ") + (signel--notice (if is-read "(read)" "(delivered)")) + "\n") + (signel--prompt-and-notify)) + (insert (signel--prompt))))) (end-of-line)))) #+end_src @@ -471,7 +480,9 @@ when the buffer was created." (goto-char (point-max)) (beginning-of-line) (let* ((p (point)) - (msg (buffer-substring (+ p (length signel-prompt)) (point-max)))) + (plen (length signel-prompt)) + (msg (buffer-substring (+ p plen) (point-max)))) + (delete-char plen) (signel--send-message signel-user msg) (insert (signel--timestamp (format-time-string "(%H:%M) "))) (fill-region p (point-max)) |