Closed Bug 386919 Opened 13 years ago Closed 13 years ago

Support opening a message from the command line


(Thunderbird :: General, defect)

Not set


(Not tracked)



(Reporter: Bienvenu, Assigned: Bienvenu)



(2 files)

We should be able to open a message from the command line. The command line should be something like:

thunderbird -mail mailbox-message://user@host/<folder>#msgkey


thunderbird -mail mailbox-message://user@host/<folder>?messageId=<message id>
Attached patch work in progressSplinter Review
This basically works, though there are some potential refinements, like handling escape of the message id...
And perhaps we should have case-insensitive parsing of "messageId", and perhaps have a pref for whether we open the new message in a stand-alone window, or in the  3-pane ui.
Bug 11076 should be at least partly dupe...
Attached patch proposed fixSplinter Review
I'd like to land this on the trunk so developers can try it out...
Attachment #271112 - Flags: superreview?(mscott)
We may also want to make it so messages open in a new tab, though I don't know how we're going to communicate that from nsMessengerBootstap.cpp to msgMail3PaneWindow.js. Some extra param in the array that gets passed to it, I guess.
Comment on attachment 271112 [details] [diff] [review]
proposed fix

ditch the braces here ? 

+        else
+        {
+          GetMsgDBHdrFromURI(nativeArg.get(), getter_AddRefs(msgHdr));
+        }
Attachment #271112 - Flags: superreview?(mscott) → superreview+
fixed on trunk.
Closed: 13 years ago
Resolution: --- → FIXED
Thanks, I'll take a look at it.
Comment on attachment 271112 [details] [diff] [review]
proposed fix

>+        if (queryIndex > 0)
>+        {
>+          nsCString messageId, folderUri;
>+          nativeArg.Right(messageId, nativeArg.Length() - queryIndex - 11);
>+          nativeArg.Left(folderUri, queryIndex);
>+          folderUri.Cut(folderUri.Find("-message"), 8);
>+          return OpenMessengerWindowForMessageId(folderUri, messageId);
>+        }
>+        else
>+        {
>+          GetMsgDBHdrFromURI(nativeArg.get(), getter_AddRefs(msgHdr));
>+        }
Nit: unnecessary else after return
Related to this bug:  what is the correct URL format for thunderbird and openURL?  

Another question, in the regular scheme should special characters be an issue.  I get an error if a I use -mail to open a message with the following messageId: 

The error is illegal value.  If I change the dollar symbols to %24, I still get an error.
I tried to use it with

thunderbird.exe -console -mail mailbox-message://user@host/<folder>?messageId=<message id>

but in the console there's this error:

Unrecognized URL: mailbox-message://user@host/<folder>?messageId=<message id>

(The "Thunderbird console" shows up only if started with first instance of Thunderbird)
You need to log in before you can comment on or make changes to this bug.