CamielBouchier / cb_thunderlink

thunderlink replacement: Clickable, durable links to specific messages inside Thunderbird.
Mozilla Public License 2.0
68 stars 14 forks source link

thunderlink: and cbthunderlink: not working #10

Closed kgorlen closed 3 years ago

kgorlen commented 3 years ago

Version 0.6.0, Windows 10 version 2004, Thunderbird 68.12.1, Google Chrome Version 86.0.4240.111

Successfully installed cb_thunderlink.xpi and cb_thunderlink_windows:

2020-11-01 12:59:07,495 - 12548 - INFO - 82 : ==================================================================================================== 2020-11-01 12:59:07,496 - 12548 - INFO - 83 : Starting cb_thunderlink (['cb_thunderlink.exe', 'register']) 2020-11-01 12:59:07,499 - 12548 - INFO - 246 : Finishing cb_thunderlink 2020-11-01 12:59:07,500 - 12548 - INFO - 247 : ====================================================================================================

The add-on creates links, e.g.:

thunderlink://messageid=aade35ca-7d99-ab02-d224-91c3840b313b@comcast.net

cbthunderlink://MjAyMC0xMC0yOVQyMToyMDowMC4wMDBaO0tlaXRoIDxnb3JsZW5AY29tY2FzdC5uZXQ+

but these do not cause linked messages to open.

vlcinsky commented 3 years ago

There could be two types of reasons:

To test the link works, put the thunderlinks url (incl. the schema) into clipboard, go to Thunderbird and click the cb_thunderlink button. This should jump into the e-mail of interest. If it does not, the link is broken.

In my situation (Linux):

kgorlen commented 3 years ago

Both thunderlink and cb_thunderlink work.  Registration is broken on Windows 10.

On 11/1/2020 3:06 PM, Jan Vlčinský wrote:

There could be two types of reasons:

  • link: the link itself is broken
  • registration: the thunderlink/cthunderlink schema registration does not work

To test the link works, put the thunderlinks url (incl. the schema) into clipboard, go to Thunderbird and click the cb_thunderlink button. This should jump into the e-mail of interest. If it does not, the link is broken.

In my situation (Linux):

  • link for thunderlink is working
  • link for cb_thunderlink does not work
  • registration seems broken, but this might be a problem of my misunderstanding.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/CamielBouchier/cb_thunderlink/issues/10#issuecomment-720165999, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEDDVSZ462Y55ZBCJGU2IQDSNXSVTANCNFSM4TGY7WAA.

vlcinsky commented 3 years ago

I can confirm, that (on Linux) pasting generated links into Firefox address line opens the e-mail in all cases.

So I guess in my case all works as expected, the only issue I have is to finetune emacs org-mode integration, which is likely to cause the issue.

CamielBouchier commented 3 years ago

@kgorlen , let me try to help. I have it working myself on Windows 10.

(i) I understand the cut/paste-into-thunderbird works perfectly, so it is not a matter of broken or wrong links, correct? (ii) I understand you unpacked the cb_thunderlink_windows and have it somewhere permanently on your computer. I have it e.g. as c:\cb_thunderlink\...

If so, and hoping you have some regedit experience, can you search through your registry editor and cut/paste all entries that are thunderlink related?

Camiel B.

CamielBouchier commented 3 years ago

@vlcinsky,

(i) are you saying that on your linux cbthunderlink (without underscore!) is not working as a link into thunderbird? It should. (ii) Registration on Linux I am far more unsure to have it right in a generic way. Most certainly not. If you share your distribution I can try to find out about registration for it.

Camiel B.

kgorlen commented 3 years ago

OK, got it working.  Two problems:

  1. I installed cb_thunderlink from a network drive, which was not permanently accessible.  To solve this, the installation procedure should follow the standard practice of copying the necessary files to %PROGRAMFILES% or %PROGRAMFILES(X86)%.

  2. I then installed cb_thunderlink in C:\Program Files (x86)\Thunderlink\cb_thunderlink.  This didn't work either.  Examining some of the installed registry entries, I found that the path to the executable wasn't enclosed in "", which it needs to be because the path name contains a space. Rather than change the registry entries manually, I re-installed in C:\Thunderlink\cb_thunderlink to avoid the problem with spaces.  The register command should add the quotes.

Thanks for getting this critical add-on to work again!

On 11/2/2020 2:31 AM, Camiel B wrote:

@kgorlen https://github.com/kgorlen , let me try to help. I have it working myself on Windows 10.

(i) I understand the cut/paste-into-thunderbird works perfectly, so it is not a matter of broken or wrong links, correct? (ii) I understand you unpacked the cb_thunderlink_windows and have it somewhere /permanently/ on your computer. I have it e.g. as |c:\cb_thunderlink...|

If so, and hoping you have some |regedit| experience, can you search through your registry editor and cut/paste all entries that are thunderlink related?

Camiel B.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/CamielBouchier/cb_thunderlink/issues/10#issuecomment-720384702, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEDDVSYWY7YP2LI6XRQIJN3SN2C7PANCNFSM4TGY7WAA.

CamielBouchier commented 3 years ago

@kgorlen , thanks for the feedback.

The quoting in the registry should be piece of cake. I will follow-up on that one.

Having a full installation in C:\Program Files ... is not that trivial (certainly if it also must be executed automatically). Given that the workaround is rather trivial, I will consider but with low priority.

Camiel B.

tekvsakdan commented 3 years ago

I have the same problem on Ubuntu 20.10. Thunderbird 78.3.2. cb_thunderlink 0.6.0. thunderlink:// is working from Firefox (82.0), cbthunderlink:// is not working. I can not make it work from Google Chrome (86.0.4240.183), none of is working.

Edit: I have found out some cbthunderlink:// links are working and some are not.

Edit2: The same message WORKING xdg-open thunderlink://messageid=XY-t5oCfTI2TKr5Q8d334A@ismtpd0105p1iad2.xxxxxxx.net NOT WORKING xdg-open cbthunderlink://MjAyMC0xMS0wM1QwMTowMTowMy4wMDBaOyJTdGFjayBPdmVyZmxvdyIgPGRvLW5vdC1yZXBseUBzdGFja292ZXJmbG93LmVtYWlsPg==

CamielBouchier commented 3 years ago

@tekvsakdan, probably I will have tomorrow some time to launch a VM on Ubuntu 20.10 to try and reproduce.

However, can you be as precise as possible:

(i) Does the cut/paste approach (i.e. cut the link from wherever and paste it using the button in thunderbird) work always? Or does it work only for thunderlink:// and never for cbthunderlink:// ? (ii) If it does work for some cbthunderlink://, can you create a thunderlink:// from the same message it does not work for? I want to exclude it is a specific message it can't find. (might need a re-indexing then, I will explain) (iii) If you enable in thunderbird the developer tools, is there appearing any message in the console that sheds some light?

Only if above is clear (and working) it makes sense for me starting to look into the integration and xdg-open etc.

Camiel B.

tekvsakdan commented 3 years ago

I have found a button in Thunderbird. Here is the console.log.

Thunderlink working and cbthunderlink not working. The same message.

handle_incoming_link thunderlink://messageid=XY-t5oCfTI2TKr5Q8d334A@ismtpd0105p1iad2.sendgrid.net cb_background.js:231:13
WebExtensions: cb_show_message_from_msg_id XY-t5oCfTI2TKr5Q8d334A@ismtpd0105p1iad2.sendgrid.net new_tab cb_api.js:66
handle_incoming_link cbthunderlink://MjAyMC0xMS0wM1QwMTowMTowMy4wMDBaOyJTdGFjayBPdmVyZmxvdyIgPGRvLW5vdC1yZXBseUBzdGFja292ZXJmbG93LmVtYWlsPg== cb_background.js:231:13
Investigate me. the_message == null. ml: 
Object { id: null, messages: [] }
cb_background.js:271:21

Both working. The same message.


handle_incoming_link cbthunderlink://MjAyMC0xMS0wM1QwNDoyMjo0NS4wMDBaOzx6YWJiaXhAa2lzLnNpPg== cb_background.js:231:13
WebExtensions: cb_show_message_from_api_id 3 new_tab cb_api.js:40
handle_incoming_link thunderlink://messageid=8836eafd-0e6c-4630-b99e-79efa848a796@vsr-exch.kis-h2.si cb_background.js:231:13
WebExtensions: cb_show_message_from_msg_id 8836eafd-0e6c-4630-b99e-79efa848a796@vsr-exch.kis-h2.si new_tab 
cb_api.js:66```
CamielBouchier commented 3 years ago

@tekvsakdan Thanks for the input. It means there is really a problem with the core functionality, not with the integration. Just to be absolutely sure, in the first case both links point to the same message, correct? I will try to review the code guessing what might be wrong (I can't reproduce).

CamielBouchier commented 3 years ago

@tekvsakdan Sorry for my previous message, actually you confirmed it is the same message but I read it too fast as 'message in the console.log'. My mistake. I have the info I need for the moment.

Camiel B.

CamielBouchier commented 3 years ago

@tekvsakdan, can you help me for a moment? Can you close thunderbird and remove from the profile directory following file : global-messages-db.sqlite. Then you reopen thunderbird and observe for some time how that file rebuilds. With observe I mean that you wait until it does not grow anymore. Depending on your setup that can be minutes or hours. Once the global-messages-db.sqlite has been rebuilt completely, can you then try again?

Camiel B.

tekvsakdan commented 3 years ago

After 4 hours of rebuilding global-messages-db.sqlite (300 MB), the first case scenario is still NOT OK. Thunderlink is working and cbthunderlink is not working. The 2nd case was OK.

handle_incoming_link thunderlink://messageid=XY-t5oCfTI2TKr5Q8d334A@ismtpd0105p1iad2.sendgrid.net cb_background.js:231:13
WebExtensions: cb_show_message_from_msg_id XY-t5oCfTI2TKr5Q8d334A@ismtpd0105p1iad2.sendgrid.net new_tab cb_api.js:66
handle_incoming_link cbthunderlink://MjAyMC0xMS0wM1QwMTowMTowMy4wMDBaOyJTdGFjayBPdmVyZmxvdyIgPGRvLW5vdC1yZXBseUBzdGFja292ZXJmbG93LmVtYWlsPg== cb_background.js:231:13
Investigate me. the_message == null. ml: 
Object { id: null, messages: [] }
cb_background.js:271:21
handle_incoming_link cbthunderlink://MjAyMC0xMS0wM1QwNDoyMjo0NS4wMDBaOzx6YWJiaXhAa2lzLnNpPg== cb_background.js:231:13
WebExtensions: cb_show_message_from_api_id 3 new_tab cb_api.js:40
handle_incoming_link thunderlink://messageid=8836eafd-0e6c-4630-b99e-79efa848a796@vsr-exch.kis-h2.si cb_background.js:231:13
WebExtensions: cb_show_message_from_msg_id 8836eafd-0e6c-4630-b99e-79efa848a796@vsr-exch.kis-h2.si new_tab 
cb_api.js:66
CamielBouchier commented 3 years ago

@tekvsakdan, again thanks for your feedback. I would be glad helping you but as I currently cannot reproduce I have to help through code reading and guessing ...

Any chance there are preferred folders or to-be-avoided folders defined in the settings? Anything else that can shed some light?

If you use the thunderbird mechanism to search for the message using date and author (2020-11-03T01:01:03.000Z;"Stack Overflow" do-not-reply@stackoverflow.email), does it work?

Camiel B.

tekvsakdan commented 3 years ago

This search does not work :( 2020-11-03T01:01:03.000Z;"Stack Overflow" do-not-reply@stackoverflow.email

I have 3 different mail accounts. 2 of them are Exchange via IMAP and 1 of them is gmail account with custom domain (I'm hosting my domain on Google) via IMAP. I guess it is the same if you have free gmail account. cbthunderlink:// is working fine with exchange accounts, on the other hand, it does not work with (custom domain) gmail account. My conclusion is that gmail messages are treated differently than exchange.

EDIT: No, my conclusion is not correct. After I wrote this comment I have found some cbthunderlink:// in gmail account are working. Half of the messages are working and half are not working.

CamielBouchier commented 3 years ago

@tekvsakdan

(i) "does not work" means that you did use manually the thunderbird search capabilities to search for a message with that date and that sender?

(ii) gmail is likely not the problem. In fact I am working mostly on a gmail account without any issues.

I have some hunch it might be related to date/time issues, but the search in (i) might clarify that. Or not ...

Camiel B.

tekvsakdan commented 3 years ago

If I put this in search is not working. 2020-11-03T01:01:03.000Z;"Stack Overflow" do-not-reply@stackoverflow.email If I put without semicolon it works 2020-11-03T01:01:03.000Z "Stack Overflow" do-not-reply@stackoverflow.email

EDIT: Sorry. It found out your message from github. I'm too quick sometimes. The search doesn't find the correct message.

CamielBouchier commented 3 years ago

@tekvsakdan that is weird ... moreover I am not sure to follow exactly what you did and what are the results.

Maybe a small reset that helps you debugging the issue.

cbthunderlink works by finding messages on the combination 'message.author' and 'message.date'. Both are base64 encoded in the cbthunderlink. So if thunderbird itself, using its own search capabilities, would not be finding the message with correct author and date, then cbthunderlink won't either. Of course there is still the possibility that cbthunderlink, when generating the link, picked up a wrong date or author.

So the link you have problems with has base64 encoded : 2020-11-03T01:01:03.000Z;"Stack Overflow" do-not-reply@stackoverflow.email. Are these actually the correct data for the message to be found? In that case, thunderbird should find it in 'manual search mode' as well. What has the message in its headers?

Camiel B.

tekvsakdan commented 3 years ago
SELECT a.c1subject AS "SUBJECT",
       a.c3author AS "FROM",
       a.c4recipients AS "TO",
       b.date,
       c.folderURI AS "FOLDER_LOCATION",
       c.name AS "FOLDER_NAME"       
    FROM messagesText_content a
    INNER JOIN messages b ON a.docid=b.id
    INNER JOIN folderLocations c ON b.folderID=c.id
    WHERE a.c1subject LIKE ('1 new item in your Stack Exchange inbox%');

The result is: DATE=1604365263000000 FROM="Stack Overflow" <do-not-reply@stackoverflow.email>

tekvsakdan commented 3 years ago

If it helps. This works fine:

DATE=1604431428000000
FROM=Garmin Forums <noreply@garmin.com>
cbthunderlink://MjAyMC0xMS0wM1QxOToyMzo0OC4wMDBaO0dhcm1pbiBGb3J1bXMgPG5vcmVwbHlAZ2FybWluLmNvbT4=

This does not work:

DATE=1604365263000000
FROM="Stack Overflow" <do-not-reply@stackoverflow.email>
cbthunderlink://MjAyMC0xMS0wM1QwMTowMTowMy4wMDBaOyJTdGFjayBPdmVyZmxvdyIgPGRvLW5vdC1yZXBseUBzdGFja292ZXJmbG93LmVtYWlsPg==
tekvsakdan commented 3 years ago

I installed a fresh copy of Thunderbird 78.4 in Windows, added a Gmail account, and cbthunderlink:// is not working on some messages. I didn't find any pattern except it is working fine on Exchange accounts and partially on the Gmail account. As I inspect your code (background.js) it should work but I don't know why it is not working. thunderlink:// links are working fine. I just gave up.

tekvsakdan commented 3 years ago

I think I have found the problem. At least now I know why I have the problem. The problem is not the date, but the author (from). And not in all cases. The problem is the character "-" (hyphen). If the email contains "-" or the name of the sender has "hyphen" together, for example, "name-surname". It is connected somehow with Gmail (or similar services). If a user with "-" in their email address sends mail from Exchange to Gmail it is working fine. If the user with "-" sends from Gmail to Gmail or from Gmail to Exchange it is not working. Maybe Gmail "hyphen" is different than Exchange "hyphen". I really don't know. It's strange. At the moment I will try to change your code that will remove "-" from the author and I will see if this will help.

tekvsakdan commented 3 years ago

This solves my issue and now works perfectly:

cb_background.js line 243

let the_author = date_auth[1].replace(/-/g, ' ')

CamielBouchier commented 3 years ago

@tekvsakdan :

Hi, this is actually a great find! Thanks a lot. In some first tests I seem to be able reproducing it. I will do some further tests (especially on the impact on non-gmail accounts) and implement it.

Thanks again!

Camiel B.

CamielBouchier commented 3 years ago

Should be fixed with release 0.7