msgthr user+dev discussion/patches/pulls/bugs/help
 help / color / Atom feed
From: Dimid Duchovny <dimidd@gmail.com>
To: msgthr-public <msgthr-public@80x24.org>
Subject: Feature Request: thread grouping
Date: Sun, 21 Jan 2018 11:40:41 +0200
Message-ID: <CANKvuDf7esPfy3eQ0B8aQjg4sTYTcxR_LNNWeDBcENFwmyC_3g@mail.gmail.com> (raw)

Hello Eric,

When using the library, I'd like to eventually know which mail belongs
to each thread
(The motivation is to use a Union-Find data structure).
Thus, I'm doing the following:
* adding messages
* threading
* ordering
* walking

I.e. something like this:
all_comms.each do |comm|
        [...]
        if in_reply_to && !in_reply_to.empty?
                refs = [in_reply_to]
        else
                refs = []
        end
        msgthr.add msg_id, refs, comm
end
msgthr.thread!
msgthr.order!{ |_| }
threads = {}

# We want to account for cases where the head of the thread is
missing, but still referenced.
last_thread = nil
msgthr.walk_thread do |level, container, index|
        msg = container.msg
        mid = container.mid
        if 0 == level
                threads[mid] = []
                last_thread = mid
        else
                threads[last_thread] << mid
        end
end

However, I realized that the last step (walking) is redundant,
since that could be done by the library itself in the threading or
ordering stages.
E.g. keeping track of each container's thread,
and when adding a message A as a child of message B, to point A's
thread to B's one.
We could use an array with a single element,
or some other solution to have pass-by-reference semantics.
Finally, all top-level containers should have their own msg_id as the thread,
and all their descendants will point to it as well.

Would you consider adding such a feature? If so, I'll be happy to work
out the details and submit a patch.

Thanks, and have a nice weekend.

             reply index

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-21  9:40 Dimid Duchovny [this message]
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
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 publically 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=CANKvuDf7esPfy3eQ0B8aQjg4sTYTcxR_LNNWeDBcENFwmyC_3g@mail.gmail.com \
    --to=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

msgthr user+dev discussion/patches/pulls/bugs/help

Archives are clonable: git clone --mirror https://80x24.org/msgthr-public

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.lang.ruby.msgthr
	nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.msgthr

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox