diff options
Diffstat (limited to 'lib/app/chat.ex')
-rw-r--r-- | lib/app/chat.ex | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/app/chat.ex b/lib/app/chat.ex index 85f5265..e28e896 100644 --- a/lib/app/chat.ex +++ b/lib/app/chat.ex @@ -49,7 +49,7 @@ defmodule SApp.Chat do } } :redundant -> - exit(:normal) + exit(:redundant) end end @@ -171,7 +171,14 @@ defmodule SApp.Chat do end defp msg_cmp({ts1, nick1, msg1}, {ts2, nick2, msg2}) do - SData.MerkleList.cmp_ts_str({ts1, nick1<>"|"<>msg1}, - {ts2, nick2<>"|"<>msg2}) + cond do + ts1 > ts2 -> :after + ts1 < ts2 -> :before + nick1 > nick2 -> :after + nick1 < nick2 -> :before + msg1 > msg2 -> :after + msg1 < msg2 -> :before + true -> :duplicate + end end end |