More features
This commit is contained in:
+15
-6
@@ -9,6 +9,7 @@
|
||||
|
||||
(require 'noise-db)
|
||||
(require 'noise-new-chat)
|
||||
(require 'noise-conversation)
|
||||
(require 'cl-lib)
|
||||
|
||||
(defvar noise-chat-list-mode-map
|
||||
@@ -113,21 +114,29 @@ CONV is a hash table with string keys from noise-db."
|
||||
preview-str " "
|
||||
(propertize time-str 'face 'shadow))))
|
||||
|
||||
(defun noise-chat-list--conversation-at-point ()
|
||||
"Return the conversation on the current line, or nil."
|
||||
(let ((conversations (noise-db-get-all-conversations))
|
||||
(idx (1- (line-number-at-pos))))
|
||||
(nth idx conversations)))
|
||||
|
||||
(defun noise-chat-list-open ()
|
||||
"Open the conversation at point."
|
||||
(interactive)
|
||||
(let* ((conversations (noise-db-get-all-conversations))
|
||||
(idx (1- (line-number-at-pos)))
|
||||
(conv (nth idx conversations)))
|
||||
(let ((conv (noise-chat-list--conversation-at-point)))
|
||||
(if conv
|
||||
(message "Open conversation: %s (not yet implemented)"
|
||||
(gethash "name" conv))
|
||||
(noise-conversation-open (gethash "id" conv))
|
||||
(message "No conversation on this line."))))
|
||||
|
||||
(defun noise-chat-list-mark-read ()
|
||||
"Mark the conversation at point as read."
|
||||
(interactive)
|
||||
(message "Mark read: not yet connected to signal-cli"))
|
||||
(let ((conv (noise-chat-list--conversation-at-point)))
|
||||
(if conv
|
||||
(progn
|
||||
(noise-db-mark-conversation-read (gethash "id" conv))
|
||||
(noise-chat-list--render))
|
||||
(message "No conversation on this line."))))
|
||||
|
||||
(defun noise-chat-list-refresh ()
|
||||
"Refresh the chat list (re-render from database)."
|
||||
|
||||
Reference in New Issue
Block a user