Closed Bug 234541 Opened 21 years ago Closed 19 years ago

Handle command line urls

Categories

(Thunderbird :: Mail Window Front End, defect)

PowerPC
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird1.1

People

(Reporter: mscott, Assigned: mscott)

References

Details

(Whiteboard: fixed-aviary-1.0)

Attachments

(4 files)

You should be able to invoke thunderbird with just a url (could be mailto, news,
snews, etc) without passing in a commmand line handler.

this would help OSX properly load thunderbird when the user clicks on a mailto
url since the apple event always looks like:

./thunderbird-bin <url>

(FYI, on windows, we write the following key to the registry: 
   thunderbird -compose <url>
 which does work today)

See Bug #228484 for more details about the mac problems this bug causes.
Status: NEW → ASSIGNED
Target Milestone: --- → Thunderbird0.6
Some more polish work needs to happen here but you get the idea.

Don, you want to try this patch on your mac build? It should make things work
if thunderbird is already running and you click on a mailto url. i.e. the apple
event entry path. Not sure if it works for 

./thunderbird-bin mailto:test.com

so try that too.
OS: Windows XP → MacOS X
Hardware: PC → Macintosh
*** Bug 221077 has been marked as a duplicate of this bug. ***
I checked this into the 0.6 branch. It still needs to land in the trunk in some
form so I'll leave it open.

Feel free to verify in 0.6:

http://ftp.mozilla.org/pub/mozilla.org/thunderbird/nightly/latest-0.6/

Target Milestone: Thunderbird0.6 → Thunderbird0.7
this ports the same fix to the aviary 1.0 branch but with Thunderbird ifdefs
wrapped around the new code to ensure we don't break firefox with our new
behavior.
I just ported this to the 1.0 branch. leaving open and moving out so we can
figure out what to do on the trunk. 
Target Milestone: Thunderbird0.7 → Thunderbird0.9
This will also be an issue for GNOME.  I'd like to not put -compose in the
command string that's associated with mailto: because for the firefox 'Read
Mail' button I'd like to just invoke the mailto handler with no URL.  If that
includes -compose, it will bring up an empty compose window.
Whiteboard: fixed-aviary-1.0
Target Milestone: Thunderbird0.9 → Thunderbird1.1
*** Bug 291373 has been marked as a duplicate of this bug. ***
cc'ing the toolkit guys to help figure out what the right thing to do here is
for the trunk. 

The patch I made for the 1.0 branch that is shown here gets the apple event and
instead of calling OpenBrowserWindow, actually acts like the xremote service and
trys to 'open' the url, letting any open window that is registered for the
content type of the url handle it instead of forcing it into a browser window. 
Since tbird is now in charge of handling its own commandline args in
nsMailDefaultHandler.js, this shouldn't be too hard. See my comment at
http://lxr.mozilla.org/mozilla/source/mail/components/nsMailDefaultHandler.js#216
so maybe we just need to make sure the apple events end up going through this
and then modify it to handle the asynch call to openURI and hopefully all will
be well. 
on the trunk the apple events are still trying to create a browser instance
instead of going through the new command line handling code so we need to start
poking there first, getting it to go through nsMailDefaultHandler.js.
when the app is already running the apple event ends up triggering:

http://lxr.mozilla.org/mozilla/source/toolkit/xre/nsCommandLineServiceMac.cpp#293

which is still hard coded to look for navigator.xul instead of just trying to
open the URL.
this simple change fixes the case where we receive an apple event (i.e.
thunderbird is alread running) in nsCommandLineServicesMac::HandleEvent.

we set browser.chrome to the url for messengercompose.xul. Now HandleEvent
creates our chrome instead of trying to bring up navigator.xul.

We still aren't opening up a compose window when thunderbird is not already
running. I'm still debugging that.
Mac OS X passes "-url mailto:mscott@mozilla.org" into the command line when you
click on a mailto url in an application when thunderbird is not already
running. So I made the compose window command line handler process url in
addition to -compose (which is what windows passes in). This made the compose
handler jump up and handle the default args instead of flowing through the
default command line handler for mail.

If someone else in mail becomes interested in handling "-url <some url>" then
I'll have to make this change smarter by only trapping -url mailto:some url.
Attachment #182204 - Flags: review?(benjamin)
Comment on attachment 182194 [details] [diff] [review]
fix for the scenario where thunderbird is already running

this fixes the case where thunderbird is already running and we were coming in
through nsCommandLineMacServices::HandleEvent with a url. 

Instead of trying to open navigator.xul, use messengercompose.xul which knows
how to handle an argument.
Attachment #182194 - Flags: review?(benjamin)
Comment on attachment 182194 [details] [diff] [review]
fix for the scenario where thunderbird is already running

As a hack, this is fine... not ideal, and we should fix it to use the uriloader
at some point soon.
Attachment #182194 - Flags: review?(benjamin) → review+
Comment on attachment 182204 [details] [diff] [review]
fix for the scenario where thunderbird is not yet running

Again, we should probably replace this with uriloader calls in
nsMailCommandLineHandler.js, but it's a fine hack.
Attachment #182204 - Flags: review?(benjamin) → review+
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: