From de59162ff3b3af1979e620fc485d7dd87ebb850f Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 22 Feb 2018 19:32:51 +0100 Subject: [PATCH 1/3] Talk now only loads in messages from the last five days on first boot. Makes moons suffer less when connecting to old planets. --- app/talk.hoon | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/app/talk.hoon b/app/talk.hoon index 8ecc9a223..5e5d76607 100644 --- a/app/talk.hoon +++ b/app/talk.hoon @@ -29,9 +29,10 @@ |% ++ state :> application state $: :: messaging state :: - count/@ud :< (lent grams) grams/(list telegram) :< all history known/(map serial @ud) :< messages heard + last/@ud :< last heard + count/@ud :< (lent grams) sources/(set circle) :< our subscriptions :: circle details :: remotes/(map circle group) :< remote presences @@ -226,7 +227,9 @@ server :: %+ welp /circle/[inbox]/grams/config/group - ?:(=(0 count) ~ [(scot %ud count) ~]) + ?. =(0 last) + [(scot %ud last) ~] + [(scot %da (sub now.bol ~d5)) ~] == :: :> # @@ -367,7 +370,7 @@ ~&([%unexpected-circle-rumor -.rum] +>) :: $gram - (ta-learn gam.nev.rum) + (ta-open nev.rum) :: $config =+ cur=(fall (~(get by mirrors) cir.rum) *config) @@ -453,15 +456,16 @@ :: |= nes/(list envelope) ^+ +> - (ta-lesson (turn nes tail)) + ?~ nes +> + $(nes t.nes, +> (ta-open i.nes)) :: - ++ ta-lesson - :> learn all telegrams in a list. + ++ ta-open + :> learn message from an envelope. :: - |= gaz/(list telegram) + |= nev/envelope ^+ +> - ?~ gaz +> - $(gaz t.gaz, +> (ta-learn i.gaz)) + =? last (gth num.nev last) num.nev + (ta-learn gam.nev) :: ++ ta-learn :> save/update message @@ -2458,7 +2462,7 @@ == ?: =(a 'reset') ~& 'full reset incoming, hold on to your cli...' - :_ +>(grams ~, known ~, count 0) + :_ +>(grams ~, known ~, count 0, last 0) :~ [ost.bol %pull /server/client server ~] [ost.bol %pull /server/inbox server ~] peer-client From 6bb3a3f1964919500910361dc172b1276ca4759f Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 22 Feb 2018 19:44:13 +0100 Subject: [PATCH 2/3] Named magic number. --- app/talk.hoon | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/talk.hoon b/app/talk.hoon index 5e5d76607..b6f879da6 100644 --- a/app/talk.hoon +++ b/app/talk.hoon @@ -229,7 +229,8 @@ %+ welp /circle/[inbox]/grams/config/group ?. =(0 last) [(scot %ud last) ~] - [(scot %da (sub now.bol ~d5)) ~] + =+ history-days=~d5 + [(scot %da (sub now.bol history-days)) ~] == :: :> # From 62edfa5d210600481801604f71cac984ba417f25 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 22 Feb 2018 19:47:56 +0100 Subject: [PATCH 3/3] Be semantically correct. --- app/talk.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/talk.hoon b/app/talk.hoon index b6f879da6..d6553ce88 100644 --- a/app/talk.hoon +++ b/app/talk.hoon @@ -227,7 +227,7 @@ server :: %+ welp /circle/[inbox]/grams/config/group - ?. =(0 last) + ?. =(0 count) [(scot %ud last) ~] =+ history-days=~d5 [(scot %da (sub now.bol history-days)) ~]