msgthr user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: Dimid Duchovny <dimidd@gmail.com>
Cc: msgthr-public@80x24.org
Subject: Re: Feature Request: thread grouping
Date: Tue, 23 Jan 2018 22:03:03 +0000	[thread overview]
Message-ID: <20180123220303.GA7222@80x24.org> (raw)
In-Reply-To: <CANKvuDdpnbZdp-L1OQBhF5pHSxukRuO_DfdnvVm1cqxXrVFkug@mail.gmail.com>

Dimid Duchovny <dimidd@gmail.com> wrote:
> > You're right. In my case the flow was: read emails from storage ->
> > group to threads -> add thread field to storage.
> > However, I guess it's an edge-case.
> > On second thought, maybe it'd be better to have a more general solution.
> > E.g. let the client run an arbitrary callback after adding a child.

OK, I guess you managed to fit skeletons of all your messages in memory?

> > Here's a quick POC:
> > https://github.com/dimidd/msgthr/commit/1c701717d10879d492d8b55fb8ca2f1c53d7e13f

(truncated output of "git show 1c701717d10879d492d8b55fb8ca2f1c53d7e13f"

>     add callback to Msgthr#add
>     
>     The motivation is to allow the client to have a custom code executed,
>         whenever a child is added.
> 
> --- a/lib/msgthr.rb
> +++ b/lib/msgthr.rb
> @@ -166,12 +166,16 @@ class Msgthr
>        # but do not change existing links or loop
>        if prev && !cont.parent && !cont.has_descendent(prev)
>          prev.add_child(cont)
> +        yield(prev, cont) if block_given?
>        end
>        prev = cont
>      end
>  
>      # set parent of this message to be the last element in refs
> -    prev.add_child(cur) if prev
> +    if prev
> +      prev.add_child(cur)
> +      yield(prev, cur) if block_given?
> +    end
>    end
>  end

OK, that seems generic enough and we can probably support it
long-term, so I'm somewhat inclined to accept it...

However, APIs encouraging/supporting folks to load their entire
collection(*) of messages (even skeletons) into memory feels
wrong to me.

Can you come up with a use case where this is useful for
a subset of messages?


(*) I work with millions of emails

> > P.S. I hope you don't mind I uploaded my fork to github.

That's fine, I just add a new remote(*) to my .git/config, fetch
and show.

What I won't accept about GitHub is having it as a centralized
and proprietary messaging system which forces participants to
accept their ToS.  I can't accept that; no single entity
controls email, so that's what I stick with.


(*) added this to my .git/config
==> .git/config <==
[remote "dimidd"]
	url = https://github.com/dimidd/msgthr
	fetch = refs/heads/*:refs/remotes/dimidd/*

  reply	other threads:[~2018-01-23 22:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-21  9:40 Feature Request: thread grouping Dimid Duchovny
2018-01-21 23:49 ` Eric Wong
2018-01-23 21:04   ` Dimid Duchovny
2018-01-23 21:12     ` Dimid Duchovny
2018-01-23 22:03       ` Eric Wong [this message]
2018-01-24 10:28         ` Dimid Duchovny
2018-01-24 19:18           ` Eric Wong
2018-01-24 21:14             ` Dimid Duchovny
2018-01-24 22:49               ` Eric Wong
2018-01-25  8:16                 ` Dimid Duchovny
2018-01-25  8:38                   ` Eric Wong
2018-02-08 13:06                     ` Dimid Duchovny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://80x24.org/msgthr/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180123220303.GA7222@80x24.org \
    --to=e@80x24.org \
    --cc=dimidd@gmail.com \
    --cc=msgthr-public@80x24.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/msgthr.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).