aboutsummaryrefslogtreecommitdiff
path: root/shard/lib/cli
diff options
context:
space:
mode:
Diffstat (limited to 'shard/lib/cli')
-rw-r--r--shard/lib/cli/cli.ex15
1 files changed, 9 insertions, 6 deletions
diff --git a/shard/lib/cli/cli.ex b/shard/lib/cli/cli.ex
index 4f17aeb..d454a0b 100644
--- a/shard/lib/cli/cli.ex
+++ b/shard/lib/cli/cli.ex
@@ -8,8 +8,12 @@ defmodule SCLI do
end
def run() do
- for {_chid, %SApp.Chat.Manifest{}, chpid} <- Shard.Manager.list_shards do
- SApp.Chat.subscribe(chpid)
+ for {_chid, manifest, _} <- Shard.Manager.list_shards do
+ case manifest do
+ %SApp.Chat.Manifest{} ->
+ SApp.Chat.subscribe(Shard.Manager.find_or_start manifest)
+ _ -> nil
+ end
end
pk = Shard.Keys.get_any_identity
@@ -92,7 +96,7 @@ defmodule SCLI do
defp handle_command(state, ["list"]) do
IO.puts "List of known channels:"
- for {_chid, %SApp.Chat.Manifest{channel: chan}, _chpid} <- Shard.Manager.list_shards do
+ for {_chid, %SApp.Chat.Manifest{channel: chan}, _} <- Shard.Manager.list_shards do
IO.puts "##{chan}"
end
state
@@ -120,9 +124,8 @@ defmodule SCLI do
end
defp handle_command(state, ["pm" | people_list]) do
- known_people = for {_, %SApp.Identity.Manifest{pk: pk}, pid} <- Shard.Manager.list_shards() do
- info = SApp.Identity.get_info(pid)
- {pk, info.nick}
+ known_people = for {_, %SApp.Identity.Manifest{pk: pk}, _} <- Shard.Manager.list_shards() do
+ {pk, SApp.Identity.get_nick(pk)}
end
pk_list = for qname <- people_list do
candidates = for {pk, nick} <- known_people,