aboutsummaryrefslogtreecommitdiff
path: root/shardweb/lib/channels
diff options
context:
space:
mode:
Diffstat (limited to 'shardweb/lib/channels')
-rw-r--r--shardweb/lib/channels/chat_channel.ex10
1 files changed, 7 insertions, 3 deletions
diff --git a/shardweb/lib/channels/chat_channel.ex b/shardweb/lib/channels/chat_channel.ex
index 25f1d09..7c8f1f9 100644
--- a/shardweb/lib/channels/chat_channel.ex
+++ b/shardweb/lib/channels/chat_channel.ex
@@ -44,6 +44,7 @@ defmodule ShardWeb.ChatChannel do
push(socket, "shout", %{
name: nick,
pk16: Shard.Keys.pk_display(pk),
+ fullpk: Base.encode16(pk),
message: msg,
})
end)
@@ -55,9 +56,11 @@ defmodule ShardWeb.ChatChannel do
{_ts, msg} = SData.term_unbin msgbin
nick = SApp.Identity.get_nick pk
Logger.info("#{inspect self()} :chat_recv #{inspect msg}")
- push socket, "shout", %{"name" => nick,
- "pk16" => Shard.Keys.pk_display(pk),
- "message" => msg}
+ push socket, "shout", %{
+ name: nick,
+ pk16: Shard.Keys.pk_display(pk),
+ fullpk: Base.encode16(pk),
+ message: msg}
SApp.Chat.mark_read(socket.assigns.pid)
{:noreply, socket}
end
@@ -80,6 +83,7 @@ defmodule ShardWeb.ChatChannel do
nick = SApp.Identity.get_nick pk
payload = Map.put(payload, "name", nick)
payload = Map.put(payload, "pk16", Shard.Keys.pk_display pk)
+ payload = Map.put(payload, "fullpk", Base.encode16 pk)
SApp.Chat.chat_send(socket.assigns.pid, pk, payload["message"])
broadcast socket, "shout", payload