From e7e255682a81f4212171051bb59d0fedd0e88d3e Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Fri, 31 Aug 2018 22:30:20 +0200 Subject: Chat using Merkle search tree & block store, not yet 100% complete --- lib/cli/cli.ex | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'lib/cli') diff --git a/lib/cli/cli.ex b/lib/cli/cli.ex index 8928040..2fbf8c2 100644 --- a/lib/cli/cli.ex +++ b/lib/cli/cli.ex @@ -64,15 +64,10 @@ defmodule SCLI do end defp handle_command(pid, ["hist"]) do - case GenServer.call(pid, {:read_history, nil, 100}) do - {:ok, list, _rest} -> - list - |> Enum.reverse - |> Enum.each(fn {ts, nick, msg} -> - IO.puts "#{ts |> DateTime.from_unix! |> DateTime.to_iso8601} <#{nick}> #{msg}" + GenServer.call(pid, {:read_history, nil, 25}) + |> Enum.each(fn {{ts, nick, msg}, true} -> + IO.puts "#{ts |> DateTime.from_unix! |> DateTime.to_iso8601} <#{nick}> #{msg}" end) - _ -> nil - end pid end -- cgit v1.2.3