mirror of
https://github.com/status-im/status-mobile.git
synced 2025-02-04 12:55:03 +00:00
receive group msg
Former-commit-id: b7ce3df93d43f59575831f63b09559575188fc80
This commit is contained in:
parent
d0f882d8a7
commit
d1180f9d4e
@ -102,6 +102,12 @@
|
|||||||
(create-chat chat-id [chat-id] false)
|
(create-chat chat-id [chat-id] false)
|
||||||
(signal-chat-updated chat-id))))
|
(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
|
(register-handler :acked-msg
|
||||||
(fn [db [_ from msg-id]]
|
(fn [db [_ from msg-id]]
|
||||||
(update-message! {:msg-id msg-id
|
(update-message! {:msg-id msg-id
|
||||||
@ -134,9 +140,9 @@
|
|||||||
(register-handler :send-group-chat-msg
|
(register-handler :send-group-chat-msg
|
||||||
(fn [db [action chat-id text]]
|
(fn [db [action chat-id text]]
|
||||||
(log/debug action "chat-id" chat-id "text" 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
|
{from :from} :msg} (api/send-group-user-msg {:group-id chat-id
|
||||||
:content text})
|
:content text})
|
||||||
msg {:msg-id msg-id
|
msg {:msg-id msg-id
|
||||||
:from from
|
:from from
|
||||||
:to nil
|
:to nil
|
||||||
|
@ -5,7 +5,8 @@
|
|||||||
[syng-im.db :as db]
|
[syng-im.db :as db]
|
||||||
[syng-im.utils.logging :as log]))
|
[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)
|
(when-not (r/exists? :msgs :msg-id msg-id)
|
||||||
(r/write
|
(r/write
|
||||||
(fn []
|
(fn []
|
||||||
|
@ -23,11 +23,13 @@
|
|||||||
(dispatch [:msg-delivery-failed msg-id]))
|
(dispatch [:msg-delivery-failed msg-id]))
|
||||||
:new-group-chat (let [{:keys [from group-id identities group-name]} event]
|
:new-group-chat (let [{:keys [from group-id identities group-name]} event]
|
||||||
(dispatch [:group-chat-invite-received from group-id identities group-name]))
|
(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]
|
;: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)))
|
; (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]
|
;: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-to-chat "group-chat" ":" (str (shorten from) " added " (shorten identity) " to group chat"))
|
||||||
; (add-identity-to-group-list identity))
|
; (add-identity-to-group-list identity))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user