Last Comment Bug 386919 - Support opening a message from the command line
: Support opening a message from the command line
Product: Thunderbird
Classification: Client Software
Component: General (show other bugs)
: Trunk
: All All
-- normal (vote)
: ---
Assigned To: David :Bienvenu
Depends on:
  Show dependency treegraph
Reported: 2007-07-04 19:52 PDT by David :Bienvenu
Modified: 2014-02-19 07:07 PST (History)
8 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---

work in progress (10.28 KB, patch)
2007-07-04 19:54 PDT, David :Bienvenu
no flags Details | Diff | Splinter Review
proposed fix (11.17 KB, patch)
2007-07-05 13:21 PDT, David :Bienvenu
mscott: superreview+
Details | Diff | Splinter Review

Description User image David :Bienvenu 2007-07-04 19:52:19 PDT
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>
Comment 1 User image David :Bienvenu 2007-07-04 19:54:17 PDT
Created attachment 270982 [details] [diff] [review]
work in progress

This basically works, though there are some potential refinements, like handling escape of the message id...
Comment 2 User image David :Bienvenu 2007-07-04 19:55:24 PDT
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.
Comment 3 User image Magnus Melin 2007-07-05 10:56:49 PDT
Bug 11076 should be at least partly dupe...
Comment 4 User image David :Bienvenu 2007-07-05 13:21:42 PDT
Created attachment 271112 [details] [diff] [review]
proposed fix

I'd like to land this on the trunk so developers can try it out...
Comment 5 User image David :Bienvenu 2007-07-05 13:23:17 PDT
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 6 User image Scott MacGregor 2007-07-11 23:04:44 PDT
Comment on attachment 271112 [details] [diff] [review]
proposed fix

ditch the braces here ? 

+        else
+        {
+          GetMsgDBHdrFromURI(nativeArg.get(), getter_AddRefs(msgHdr));
+        }
Comment 7 User image David :Bienvenu 2007-07-16 16:47:47 PDT
fixed on trunk.
Comment 8 User image Michel Loiseleur 2007-07-17 00:24:57 PDT
Thanks, I'll take a look at it.
Comment 9 User image 2007-07-20 04:28:19 PDT
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
Comment 10 User image rcarden 2012-11-23 07:38:31 PST
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.
Comment 11 User image Dominik 2014-02-19 07:07:51 PST
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)

Note You need to log in before you can comment on or make changes to this bug.