Recent

Author Topic: Lazarus MailingList Reader  (Read 12985 times)

wp

  • Hero Member
  • *****
  • Posts: 6158
Lazarus MailingList Reader
« on: November 14, 2015, 05:38:47 pm »
The lazarus mailing list (see link in the left panel) is fully loaded with valuable information for both new and experienced users. Unfortunately, it is a bit difficult to access this information. There is an archive of previous mails (http://lists.lazarus.freepascal.org/pipermail/lazarus/), but it is a pain to open each mail one by one, and there are no searching capabilities.

Therefore, I wrote a little tool which downloads the archived mail threads into a searchable tree structure. Mails can be selected by month. The initial building-up of the tree takes some time, but the tree can be saved, and then subsequent loads are fast. Unfortunately the archived mails do not contain any attachments of the original mails.

Tested on Windows 7, but it should work on Linux as well.

Download of executable:
http://sourceforge.net/projects/wp-laz/files/Lazarus%20MailingList%20Reader/LazarusMailingListReader-0.1.zip/download

Download of source:
https://sourceforge.net/p/wp-laz/code/HEAD/tree/Lazarus%20MailingList%20Reader/

Compilation requires some third-party packages:
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

aradeonas

  • Hero Member
  • *****
  • Posts: 824
Re: Lazarus MailingList Reader
« Reply #1 on: November 14, 2015, 07:46:11 pm »
Very clean and usefully wp,Thanks.
Can you add better moving between mail topics and answers so we can go next and prev easier?
Also search seems don't work or cause crash.

wp

  • Hero Member
  • *****
  • Posts: 6158
Re: Lazarus MailingList Reader
« Reply #2 on: November 14, 2015, 08:34:21 pm »
Can you add better moving between mail topics and answers so we can go next and prev easier?
What are you thinking of?

Also search seems don't work or cause crash.
It is working here. If the search expression is not found after the current mail (or before it if search goes backward) nothing happens, maybe you interpret this as "don't work". I should say that search looks in the subject and name columns. If the button "Search Body" is down it looks also in the body part of the mail.

Can you be more specific how to reproduce the crash? What is the search expression? Which mails (month/year) are loaded? Which message is selected when you start the search? Is the search going forward or backward? Is "Search body" active?
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

aradeonas

  • Hero Member
  • *****
  • Posts: 824
Re: Lazarus MailingList Reader
« Reply #3 on: November 14, 2015, 08:49:27 pm »
Just downlod 2015 November and try to search "jwatlhelp32" and nothing happen.
this word is in first conversion with subject of "Kill running program by name" and forth email.
Also I played with next and prev search button and when I hit prev multiple time it will crash,just play with it and you will see.

For browsing next and prev button like navigator will be enough for now.

wp

  • Hero Member
  • *****
  • Posts: 6158
Re: Lazarus MailingList Reader
« Reply #4 on: November 14, 2015, 11:47:30 pm »
Just downlod 2015 November and try to search "jwatlhelp32" and nothing happen
Did you press the "Search Body" button (next to the search forward/backward buttons)?

An improved version is available for download from http://sourceforge.net/projects/wp-laz/files/Lazarus%20MailingList%20Reader/LazarusMailingListReader-trunk.zip/download
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

aradeonas

  • Hero Member
  • *****
  • Posts: 824
Re: Lazarus MailingList Reader
« Reply #5 on: November 15, 2015, 08:47:51 am »
Everything works now,Thanks.  ;D

aradeonas

  • Hero Member
  • *****
  • Posts: 824
Re: Lazarus MailingList Reader
« Reply #6 on: November 15, 2015, 08:58:20 am »
Also :
1- Search should has an option to serach multiple time in body.For example when you search "resize" one mail has this multiple time and it will be highlighted but if you hit next it go for the next topic but it should has an option for going to next occurrence.
2- Please and copy-past option to mail body.
3- Blue highlite seems gas a bug.
Just check the first mail from Michael and you see after "Greetings, it will be blue untill ://"
4- I think it good to send a announcement to mail list for this useful program,many one can read their old mails! If you want I can do this.
Again thanks.
« Last Edit: November 15, 2015, 09:01:35 am by aradeonas »

aradeonas

  • Hero Member
  • *****
  • Posts: 824
Re: Lazarus MailingList Reader
« Reply #7 on: November 15, 2015, 09:00:46 am »
@Others,
Check old messages it is fun to read.

Old_Dog

  • New Member
  • *
  • Posts: 28
Re: Lazarus MailingList Reader
« Reply #8 on: November 15, 2015, 09:49:34 am »
This is good too, all the emails in forum format, leledumbo put it up.

http://free-pascal-lazarus.989080.n3.nabble.com/

wp

  • Hero Member
  • *****
  • Posts: 6158
Re: Lazarus MailingList Reader
« Reply #9 on: November 15, 2015, 09:31:19 pm »
Replaced the http://sourceforge.net/projects/wp-laz/files/Lazarus%20MailingList%20Reader/LazarusMailingListReader-trunk.zip/download by an updated version covering aradeonas' requests:
  • In-body Search proceeds now to the next occurance within the mail text before the next matching mail is picked.
  • Clipboard copy was already there (CTRL+C, inherited from TSynEdit), but now there is also a toolbutton for it.
  • "Blue highlite seems gas a bug" - no idea what you mean by "gas"? Anyway - if you mean what I guess this is caused by incompleteness of the "mail highlighter": Lines beginning with "On..." and ending with a colon at line end belong to the next quotation level, I had used some preliminary condition to detect this in the syntax highlighter, but the end condition got falsely triggered by the colon of the time display. I removed this now, which causes the introductory "On...wrote:" of a citation being displayed in the wrong color, but Thunderbird has the same issue, so I leave it like that for the time being.
I started testing in Linux (Mint 17.1) and came across several issues, the most severe one being that the mail reader thread hangs after completion when it is destroyed. No idea what's wrong here (no - the "UseCThreads" is defined!). But I'll have to investigate further and will maybe post a separate question.

@Old_Dog: Thanks for this link, I did not know it before.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

aradeonas

  • Hero Member
  • *****
  • Posts: 824
Re: Lazarus MailingList Reader
« Reply #10 on: November 16, 2015, 10:25:05 am »
 :D
that was a typo,it has a bug! and now it solved.
Search is very good.

Thanks.

GetMem

  • Hero Member
  • *****
  • Posts: 3495
Re: Lazarus MailingList Reader
« Reply #11 on: November 16, 2015, 01:44:00 pm »
@wp

1. Very nicely done!
2. Please set the SplashForm Position from poDesktopCenter to poScreenCenter, because on dual monitor system half of the form is on the first monitor half on the second.
3. Thread issue:
    a. Add(procedure TMainForm.StartMailReaderThread)
           FreeOnTerminate := True;
           OnTerminate := @MailReaderThreadTerminate;
           OnMailLoad := @MailLoadedHandler;
   b. Remove(procedure MailReaderThreadTerminate)
          thread := TMailReaderThread(Sender);
          idx := thread.ThreadIndex;
         //  thread.Free;
         FThreadPool[idx] := nil;

wp

  • Hero Member
  • *****
  • Posts: 6158
Re: Lazarus MailingList Reader
« Reply #12 on: November 16, 2015, 04:18:34 pm »
Thanks, GetMem - you are answering one of the questions that I wanted to ask today. I'm not very experienced with threads, but what is wrong with Thread.FreeOnTerminate = false?
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

rvk

  • Hero Member
  • *****
  • Posts: 3813
Re: Lazarus MailingList Reader
« Reply #13 on: November 16, 2015, 06:09:45 pm »
At this point you have FreeOnTerminate := true;

In that case this code isn't really safe (in procedure TMainForm.StopMailReaderThreads):
Code: Pascal  [Select]
  1.   for i:=0 to High(FThreadPool) do
  2.     if FThreadPool[i] <> nil then
  3.     begin
  4.       FThreadPool[i].OnTerminate := nil;
  5.       FThreadPool[i].Terminate;
  6.       FThreadPool[i].WaitFor;
  7.       FreeAndNil(FThreadPool[i]);
  8.     end;

After FThreadPool.Terminate the FThreadPool will free itself and calling FThreadPool.WaitFor, and probably FreeAndNil too, can be dangerous.

Code: Pascal  [Select]
  1.   for i:=0 to High(FThreadPool) do
  2.     if FThreadPool[i] <> nil then
  3.     begin
  4.       FThreadPool[i].OnTerminate := nil;
  5.       FThreadPool[i].Terminate;
  6.       FThreadPool[i] := nil; // if you really want it to be nil but don't call WaitFor or Free after terminate with FreeOnTerminate := true
  7.       //FThreadPool[i].WaitFor;
  8.       //FreeAndNil(FThreadPool[i]);
  9.     end;

wp

  • Hero Member
  • *****
  • Posts: 6158
Re: Lazarus MailingList Reader
« Reply #14 on: November 16, 2015, 06:49:05 pm »
Hey, Rik, you are answering my questions faster than I can ask them...

Yes, after applying GetMem's idea of using FreeOnTerminate=true and thus no longer destroying the thread by myself, I ran into the problem that it was not possible any more to cancel a running thread by the corresponding toolbar button or by closing the application - and this reminds me of why I had introduced the FreeOnTerminate=false in the first place.

But with your suggestion, everything is fine, even in Linux. I'll be updating sourceforge shortly. The new version will also have fixes for some memory leaks.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10