about summary refs log tree commit diff
path: root/configs/shared/emacs/.emacs.d/elpa/slack-20180913.651/slack-user-message.el
blob: a79edb9de110dec3596b5be657f4a7f2f8fe25ee (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
;;; package --- Summary
;;; Commentary:

;;; Code:

(require 'eieio)
(require 'slack-message-formatter)
(require 'slack-message-reaction)
(require 'slack-message-editor)

(defvar slack-user-message-keymap
  (let ((keymap (make-sparse-keymap)))
    keymap))

(defmethod slack-message-sender-equalp ((m slack-user-message) sender-id)
  (string= (oref m user) sender-id))

(defmethod slack-message-header ((m slack-user-message) team)
  (with-slots (ts deleted-at) m
    (let* ((name (slack-message-sender-name m team))
           (status (slack-user-status (slack-message-sender-id m) team))
           (time (slack-message-time-to-string ts))
           (edited-at (slack-message-time-to-string (slack-message-edited-at m)))
           (deleted-at (slack-message-time-to-string deleted-at))
           (header (or (and status (< 0 (length status))
                            (format "%s %s" name status))
                       (format "%s" name))))
      (if deleted-at
          (format "%s deleted_at: %s" header deleted-at)
        (if edited-at
            (format "%s edited_at: %s" header edited-at)
          header)))))

(provide 'slack-user-message)
;;; slack-user-message.el ends here