msgthr user+dev discussion/patches/pulls/bugs/help
 help / color / Atom feed
* Feature Request: thread grouping
@ 2018-01-21  9:40 Dimid Duchovny
  2018-01-21 23:49 ` Eric Wong
  0 siblings, 1 reply; 12+ messages in thread
From: Dimid Duchovny @ 2018-01-21  9:40 UTC (permalink / raw)
  To: msgthr-public

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.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, back to index

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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/
       or Tor2web: https://www.tor2web.org/

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