add name to group-invite msg

This commit is contained in:
michaelr 2016-04-04 16:59:01 +03:00
parent 47fe0fde28
commit ca254ca2f0
2 changed files with 21 additions and 18 deletions

View File

@ -102,7 +102,9 @@
:content-type default-content-type}})) :content-type default-content-type}}))
(defn start-group-chat (defn start-group-chat
[identities] ([identities]
(start-group-chat identities nil))
([identities group-name]
(let [group-topic (random/id) (let [group-topic (random/id)
keypair (new-keypair) keypair (new-keypair)
store (storage) store (storage)
@ -115,10 +117,10 @@
(save-group-admin store group-topic my-identity) (save-group-admin store group-topic my-identity)
(listen connection handle-incoming-whisper-msg {:topics [group-topic]}) (listen connection handle-incoming-whisper-msg {:topics [group-topic]})
(doseq [ident identities :when (not (= ident my-identity))] (doseq [ident identities :when (not (= ident my-identity))]
(let [{:keys [msg-id msg]} (init-group-chat-msg ident group-topic identities keypair)] (let [{:keys [msg-id msg]} (init-group-chat-msg ident group-topic identities keypair group-name)]
(add-pending-message msg-id msg {:internal? true}) (add-pending-message msg-id msg {:internal? true})
(post-msg connection msg))) (post-msg connection msg)))
group-topic)) group-topic)))
(defn group-add-participant (defn group-add-participant
"Only call if you are the group-admin" "Only call if you are the group-admin"

View File

@ -25,11 +25,12 @@
(post-msg (connection) msg) (post-msg (connection) msg)
new-msg)) new-msg))
(defn init-group-chat-msg [to group-topic identities keypair] (defn init-group-chat-msg [to group-topic identities keypair group-name]
(make-msg {:from (state/my-identity) (make-msg {:from (state/my-identity)
:to to :to to
:payload {:type :init-group-chat :payload {:type :init-group-chat
:group-topic group-topic :group-topic group-topic
:group-name group-name
:identities identities :identities identities
:keypair keypair}})) :keypair keypair}}))