parent
d0f882d8a7
commit
d1180f9d4e
|
@ -102,6 +102,12 @@
|
|||
(create-chat chat-id [chat-id] false)
|
||||
(signal-chat-updated chat-id))))
|
||||
|
||||
(register-handler :group-received-msg
|
||||
(fn [db [action {chat-id :group-id :as msg}]]
|
||||
(log/debug action "msg" msg)
|
||||
(save-message chat-id msg)
|
||||
(signal-chat-updated db chat-id)))
|
||||
|
||||
(register-handler :acked-msg
|
||||
(fn [db [_ from msg-id]]
|
||||
(update-message! {:msg-id msg-id
|
||||
|
@ -134,9 +140,9 @@
|
|||
(register-handler :send-group-chat-msg
|
||||
(fn [db [action chat-id text]]
|
||||
(log/debug action "chat-id" chat-id "text" text)
|
||||
(let [{msg-id :msg-id
|
||||
(let [{msg-id :msg-id
|
||||
{from :from} :msg} (api/send-group-user-msg {:group-id chat-id
|
||||
:content text})
|
||||
:content text})
|
||||
msg {:msg-id msg-id
|
||||
:from from
|
||||
:to nil
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
[syng-im.db :as db]
|
||||
[syng-im.utils.logging :as log]))
|
||||
|
||||
(defn save-message [chat-id {:keys [from to msg-id content content-type outgoing] :or {outgoing false} :as msg}]
|
||||
(defn save-message [chat-id {:keys [from to msg-id content content-type outgoing] :or {outgoing false
|
||||
to nil} :as msg}]
|
||||
(when-not (r/exists? :msgs :msg-id msg-id)
|
||||
(r/write
|
||||
(fn []
|
||||
|
|
|
@ -23,11 +23,13 @@
|
|||
(dispatch [:msg-delivery-failed msg-id]))
|
||||
:new-group-chat (let [{:keys [from group-id identities group-name]} event]
|
||||
(dispatch [:group-chat-invite-received from group-id identities group-name]))
|
||||
:new-group-msg (let [{from :from
|
||||
group-id :group-id
|
||||
payload :payload} event]
|
||||
(dispatch [:group-received-msg (assoc payload :from from
|
||||
:group-id group-id)]))
|
||||
;:group-chat-invite-acked (let [{:keys [from group-id]} event]
|
||||
; (add-to-chat "group-chat" ":" (str "Received ACK for group chat invitation from " from " for group-id: " group-id)))
|
||||
;:new-group-msg (let [{from :from
|
||||
; {content :content} :payload} event]
|
||||
; (add-to-chat "group-chat" from content))
|
||||
;:group-new-participant (let [{:keys [group-id identity from]} event]
|
||||
; (add-to-chat "group-chat" ":" (str (shorten from) " added " (shorten identity) " to group chat"))
|
||||
; (add-identity-to-group-list identity))
|
||||
|
|
Loading…
Reference in New Issue