CamielBouchier / cb_thunderlink

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

No jumping to the message #19

Closed bepolymathe closed 3 years ago

bepolymathe commented 3 years ago

Hello,

Thank you for taking over this project. It is a daily tool that I missed. I would like to run it under Fedora 33. I would like to use it with my tasks in emacs org-mode. The solution proposed here worked very well with the old version but did not work with cb_thunderlink. I jump to the thunderbird window but not to the message. I don't get an error message... so I don't know how to help debugging. Any ideas?

CamielBouchier commented 3 years ago

You did run the cb_thunderlink register command from the same directory where you pick up the xpi file?

If you copy the link (like thunderlink:\\message. or cb_thunderlink:\\...) and paste using the cb_thunderlink button in thunderbird, it works?

tbruckmaier commented 3 years ago

Hi, I'm just posting a reply here instead of a new issue, since my experience is the same and I too run linux (manjaro in this case). @bepolymathe, hope this is ok and we can find a solution together!

I have followed the installation instructions, but when opening a thunderlink, the message is not selected in thunderbird. The command I run for testing is xdg-open 'thunderlink://messageid=1e7954be-aeb4-96d5-eaf1-39638335c2c9@xxx.de'

I do get some errors though, this is from the error console (side note: is there a better way to format this for pasting into github?):

handle_incoming_link thunderlink://messageid=1e7954be-aeb4-96d5-eaf1-39638335c2c9@xxx.de cb_background.js:231:13
WebExtensions: cb_show_message_from_msg_id 1e7954be-aeb4-96d5-eaf1-39638335c2c9@xxx.de three_pane 
Array []

Array []
cb_api.js:66
WebExtensions: Investigate me. the_message == null. collection: 
Object { _nounDef: {…}, items: [], _idMap: {}, _listener: {…}, query: {…}, deferredCount: -1, resolvedCount: 1, masterCollection: {…}, referencesByNounID: {…}, inverseReferencesByNounID: {…}, … }
cb_api.js:102

similar with cbthunderlink:

$ xdg-open 'cbthunderlink://MjAxNy0wMy0xM1QxMTo0Nzo0Mi4wMDBaO1hYWCA8eHh4QHh4eC5jb20+'
handle_incoming_link cbthunderlink://MjAxNy0wMy0xM1QxMTo0Nzo0Mi4wMDBaO1hYWCA8eHh4QHh4eC5jb20+ cb_background.js:231:13
Investigate me. the_message == null. ml: 
Object { id: null, messages: [] }
cb_background.js:272:21
    handle_incoming_link moz-extension://f1ce462b-e944-418a-b8eb-8d7224122825/cb_background.js:272

I have also removed the file global-messages-db.sqlite as you have suggested in another issue, but the error stays the same (though the file had 330MB and was last modified 6 months ago, and is now only 1.2MB?)

bepolymathe commented 3 years ago

Hello,

Sorry for my absence, I was bussy.

@CamielBouchier Yes I did it from the same folder...

@tbruckmaier Yes, let's try to find a solution.

bepolymathe commented 3 years ago

@tbruckmaier I have the same behaviour with the following command : thunderbird --cbthunderlink://MjAyMC0xMS0yNVQxMzowNDoxMC4wMDBaOyJbQUxMSVNTXSBMaW9uZWwgTGFycXXDqSIgPGRnQGFsbGlzcy5vcmc+

It "jump" to thunderbird but don’t select the message.

CamielBouchier commented 3 years ago

Hi, I'm just posting a reply here instead of a new issue, since my experience is the same and I too run linux (manjaro in this case). @bepolymathe, hope this is ok and we can find a solution together!

I have followed the installation instructions, but when opening a thunderlink, the message is not selected in thunderbird. The command I run for testing is xdg-open 'thunderlink://messageid=1e7954be-aeb4-96d5-eaf1-39638335c2c9@xxx.de'

I do get some errors though, this is from the error console (side note: is there a better way to format this for pasting into github?):

handle_incoming_link thunderlink://messageid=1e7954be-aeb4-96d5-eaf1-39638335c2c9@xxx.de cb_background.js:231:13
WebExtensions: cb_show_message_from_msg_id 1e7954be-aeb4-96d5-eaf1-39638335c2c9@xxx.de three_pane 
Array []

Array []
cb_api.js:66
WebExtensions: Investigate me. the_message == null. collection: 
Object { _nounDef: {…}, items: [], _idMap: {}, _listener: {…}, query: {…}, deferredCount: -1, resolvedCount: 1, masterCollection: {…}, referencesByNounID: {…}, inverseReferencesByNounID: {…}, … }
cb_api.js:102

similar with cbthunderlink:

$ xdg-open 'cbthunderlink://MjAyMC0xMS0yNVQwOToxNjowNS4wMDBaO0VsZW5hIE1lbGNoZXIgPGUubWVsY2hlckBub3Jkc3VlZGZvcnVtLmRlPg=='
handle_incoming_link cbthunderlink://MjAyMC0xMS0yNVQwOToxNjowNS4wMDBaO0VsZW5hIE1lbGNoZXIgPGUubWVsY2hlckBub3Jkc3VlZGZvcnVtLmRlPg== cb_background.js:231:13
Investigate me. the_message == null. ml: 
Object { id: null, messages: [] }
cb_background.js:272:21
    handle_incoming_link moz-extension://f1ce462b-e944-418a-b8eb-8d7224122825/cb_background.js:272

I have also removed the file global-messages-db.sqlite as you have suggested in another issue, but the error stays the same (though the file had 330MB and was last modified 6 months ago, and is now only 1.2MB?)

This is an interesting piece of info. When you 'paste' the same link, using the cb_thunderlink button, does it have the same effect? When you generate an other link and 'paste' it using the cb_thunderlink button, does it have the same effect? I am inclined to think it is either a wrong link, either a corrupted global-messages-db.sqlite. Maybe you have to rebuild that once more (close thunderbird, remove the file, reopen thunderbird and wait long enough until global-messages-db.sqlite does not change anymore ...

Camiel B.

CamielBouchier commented 3 years ago

@tbruckmaier I have the same behaviour with the following command : thunderbird --cbthunderlink://MjAyMC0xMS0yNVQxMzowNDoxMC4wMDBaOyJbQUxMSVNTXSBMaW9uZWwgTGFycXXDqSIgPGRnQGFsbGlzcy5vcmc+

It "jump" to thunderbird but don’t select the message.

This is not supposed to work.

tbruckmaier commented 3 years ago

When you 'paste' the same link, using the cb_thunderlink button, does it have the same effect? When you generate an other link and 'paste' it using the cb_thunderlink button, does it have the same effect? I am inclined to think it is either a wrong link, either a corrupted global-messages-db.sqlite. Maybe you have to rebuild that once more (close thunderbird, remove the file, reopen thunderbird and wait long enough until global-messages-db.sqlite does not change anymore ...

Thanks for your feedback, I have tried the cb_thunderlink button, same error message.

Does cb_thunderlink find the messages from that sqlite database though? I had a look inside and the table messages is empty on my system? (i suspect that's where the mails should show up?). Thunderbird recreates the file if i delete it, but it just stays at 1.2MB with an empty messages table (I had thunderbird open now for several hours and the file hasn't changed noticeably)

CamielBouchier commented 3 years ago

Did you also try a fresh generated link (using e.g. the context menu when selecting a message) and paste it immediately? (maybe you can try as well an cbthunderlink:// as a thunderlink:// ?

No, cb_thunderlink does not use the sqlite database, it does use the API. But I am reasonably sure thunderbird does so. (and I fixed similar issues myself that way).

Camiel B.

tbruckmaier commented 3 years ago

I have just tried it again with several messages across several accounts, old mails (>6 months) and newer ones (the github notification for you last comment), thunderlink and cb_thunderlink, always the same result unfortunately.

Does the error message give you any clue? Investigate me. the_message == null. ml: Object { id: null, messages: [] } Is that something coming from thunderbird or the extension?

CamielBouchier commented 3 years ago

The message is coming from the extension and means that the message can not be found. In case of cbthunderlink the search is a combination of author and date. In case of thunderlink the search is a search for message-id.

I would recommend for further debugging we stick now to "thunderlink://...". It is very weird a message is never found. I do not have immediately ideas, but if you search the message with the built-in search of thunderbird (in this case maybe with date and author as parameters) does it find it?

Camiel B.

CamielBouchier commented 3 years ago

By the way, just a word of warning case you did not follow and do not realize : the cbthunderlink:// is a base 64 encoding of 'date' and 'author'. Please be aware of that when sharing a link.

Camiel B.

tbruckmaier commented 3 years ago

Ahhh I think I found the reason: in thunderbird preferences -> general, at the very end under "Indexing" the checkbox "enable Global Search and Indexer" was unticked (not sure why though, maybe that is the default state?). I have checked the box, restarted thunderbird and now the sqlite db is slowly growing. Under "tools -> activity manager" you can see the indexing progress, I tried cb_thunderlink again with a mail from an indexed folder and heureka, it works! From the button and also from outside via xdg-open!

So the addon works fine, maybe just the prequisite should be checked / mentioned in the readme? And also maybe an error message would be nice if thunderlink cannot find a requested message?

Thanks for your addon & help! @bepolymathe does the fix work for you too?

CamielBouchier commented 3 years ago

@tbruckmaier : Thanks! Great help. And somehow makes sense although I never would have thought about it.

Let me document (and see if an error message is actually possible other than in the log where it is already generated).

Camiel B.

bepolymathe commented 3 years ago

Glad it's working for you @tbruckmaier . But it's not working for me. This box was already checked (mbox as type).

bepolymathe commented 3 years ago

@tbruckmaier if i try a link like you, i have the following message.

gio: cbthunderlink://MjAyMC0xMS0yNlQwNzo1OTozMi4wMDBaO0VtbWFudWVsIFBvcnRlIDxlbW1hbnVlbC5wb3J0ZUBwYWxpbXBzZXN0ZXMubmV0Pg==: L’emplacement indiqué n’est pas pris en charge

CamielBouchier commented 3 years ago

Bonjour @tbruckmaier,

Si je comprends bien, le message indique un problème avec un accès réseau?

What do you do exactly 'when you try a link'. xdg-open 'cbthunderlink://...?

I would sugggest to follow next steps: 1) Is cb_thunderlink installed on a permanent, non-network location? 2) You did run the cb_thunderlink register command? 3) When copying/pasting the link using the cb_thunderlink button in 'thunderbird', does it work? (I assume it does, and hence it is an integration problem).

If all of above is clear and confirmed I might have to fire and initialize myself a Fedora 33 VM, but that's quite some work, so I like to avoid ...

Camiel B.

bepolymathe commented 3 years ago

Je cherche à pouvoir "sauter" d’un lien dans une note ou une tâche org-mode (emacs) vers le message dans thunderbird. Tout est installé en local (pas de VM).

image

I'm trying to reinstall...

bepolymathe commented 3 years ago

Now i have an other message... image

I tried to :

  1. run the register command
  2. reinstall the .xpi
  3. reload thunderbird
  4. try the link like this in terminal (to test before an integration to emacs) :xdg-open 'cbthunderlink://MjAyMC0xMS0yNVQxMjo1MToxMC4wMDBaOyJCT1VTUVVFVCwgS2F0eSAoREpFUFZBL0lOSkVQL01WRCkiIDxLYXR5LkJPVVNRVUVUQGpldW5lc3NlLXNwb3J0cy5nb3V2LmZyPg=='
bepolymathe commented 3 years ago

Well, I just reinstalled the extension again. I don't have the previous error message anymore but it doesn't "jump" on the message.

image

What information could help you ? Sorry but I don't understand what I did wrong. Thank you for your help.

tbruckmaier commented 3 years ago

@bepolymathe you could have a look at the thunderbird error console under "tools -> developer tools -> error console " or "ctrl+shift+j". Then try again the xdg-open command from a terminal and see what the error console says. Maybe then @CamielBouchier can help you

bepolymathe commented 3 years ago

Hi @tbruckmaier

Good idea. It return this: 

image

It’s the same message for you when it works ?

CamielBouchier commented 3 years ago

@tbruckmaier: thanks for the helping hand.

@bepolymathe: That is weird ... Actually it is exactly what I expect to happen. It shows your integration works. There is no subsequent message in the log?!? Can you remind me on what version of tb you are?

Camiel B.

bepolymathe commented 3 years ago

Hello,

No there are no other messages in the logs. I use Thunderbird 78.4.0 (64 bits) the following configuration:  image

It’s strange...

bepolymathe commented 3 years ago

I understood where the problem comes from. In fact, it doesn't only work on messages from a particular account. This account is an outlook OWA professional account that I integrate in Thunderbird thanks to the chouette extension... Since I'm using a unified inbox I didn't pay attention to the choice of the account for my previous attempts. Well, now it is necessary to understand why. I'm going to look at the account structure...

bepolymathe commented 3 years ago

A precision! Actually it doesn't work with this account only for cbthunderlink. Thunderlink links actually work fine.

CamielBouchier commented 3 years ago

@bepolymathe: that might make some sense. Still strange there is no further error message. In crystal ball mode I would guess the two extensions just don't live well together ... I am interested in more info if you would find it. So I can at least try and warn.

Camiel B.

bepolymathe commented 3 years ago

All right. I'll dig a little deeper and give you information if I find any. Thank you for your help @CamielBouchier (and @tbruckmaier )

chemmi commented 3 years ago

Hey @bepolymathe , I got my org-mode working an old approach from here with help from abo-abo.

The following code registers thunderlinks in org-mode and opens them using xdg-open or open on mac. So basically "jumping" to that message.

(require 'org)

(defun counsel-locate-action-extern (x)
  "Use xdg-open shell command on X."
  (call-process shell-file-name nil
                nil nil
                shell-command-switch
                (format "%s %s"
                        (if (eq system-type 'darwin)
                            "open"
                          "xdg-open")
                        (shell-quote-argument x))))

(org-add-link-type "thunderlink" 'org-thunderlink-open)
(defun org-thunderlink-open (path)
  "Opens a specified email in Thunderbird with the help of the add-on ThunderLink."
  ;;(start-process "open thunderlink" nil "/usr/lib/thunderbird/thunderbird" "-thunderlink" (concat "thunderlink:" path))
  (counsel-locate-action-extern (concat "thunderlink:" path)))

(provide 'org-thunderlink)
aseyq commented 1 year ago

Thanks all for the very useful comments. I got it running on my emacs on Windows.

Here is my cbthunderlink adaptation of @chemmi's solution for Windows users:

(defun counsel-locate-action-extern (x)
  "Use xdg-open shell command on X."
  (call-process shell-file-name nil
                nil nil
                shell-command-switch
                (format "%s %s"
                        "powershell start" 
                        (shell-quote-argument x))))

(org-add-link-type "cbthunderlink" 'org-cbthunderlink-open)

(defun org-cbthunderlink-open (path)
  "Opens a specified email in Thunderbird with the help of the add-on ThunderLink."
  ;;(start-process "open thunderlink" nil "/usr/lib/thunderbird/thunderbird" "-thunderlink" (concat "thunderlink:" path))
  (counsel-locate-action-extern (concat "cbthunderlink:" path)))

(provide 'org-cbthunderlink)
pedro-nonfree commented 10 months ago

I am not seeing any org-link-set-parameters here, so I will post here my solution using emacs org-mode vanilla tooling:

(org-link-set-parameters
 "cbthunderlink"
 :follow (lambda (query) (shell-command (concat "xdg-open cbthunderlink:" query))))

in this case, links woud be like cbthunderlink://blablabla

for more information such as changing the color style check this wonderful/powerful blogpost which includes a demo-video https://kitchingroup.cheme.cmu.edu/blog/2016/11/04/New-link-features-in-org-9/