Closed Bug 236774 Opened 20 years ago Closed 15 years ago

Support -compose mailto url

Categories

(MailNews Core :: Composition, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla1.8alpha1

People

(Reporter: mscott, Assigned: mscott)

References

Details

Attachments

(1 file, 1 obsolete file)

You should be able to invoke the suite with -compose followed by a mailto url. 

The fix for this comes in two parts:

1) nsAppShellService::LaunchTask needs to be modified. Currently, if you pass in
a command line app option like -compose or -mail it ignores any url argument you
may pass and always uses the default args for that command line handler. We need
to open this up and see if there is an argument after the command line handler
arg, if so, use it. Otherwise do what we used to do. Thunderbir already does
this and I just removed the bogus ifdef, cleaned up the code and it now works
for both seamonkey and thunderbird.

2) The second part just involves porting a small thunderbird patch back to
seamonkey for MsgComposeCommands.js. It adds a few lines of JS to handle a
mailto url as a window argument to the compose window.
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla1.7beta
Attached patch the fix (obsolete) — Splinter Review
Comment on attachment 143256 [details] [diff] [review]
the fix

See http://bugzilla.mozilla.org/show_bug.cgi?id=236774#c0
for a break down of the two components of this bug.
Attachment #143256 - Flags: superreview?(bienvenu)
Attachment #143256 - Flags: review?(neil.parkwaycc.co.uk)
Attachment #143256 - Flags: superreview?(bienvenu) → superreview+
Comment on attachment 143256 [details] [diff] [review]
the fix

>     if (window.arguments && window.arguments[0]) {
>       try {
>+      if (typeof window.arguments[0] == "string") 
>+        params = handleMailtoArgs(window.arguments[0]);
>+      else if (typeof window.arguments[0] == "object" && window.arguments[0] instanceof Components.interfaces.nsIMsgComposeParams)
>         params = window.arguments[0].QueryInterface(Components.interfaces.nsIMsgComposeParams);
>       }
>       catch(ex) { dump("ERROR with parameters: " + ex + "\n"); }
>+      
>+    // if still no dice, try and see if the params is an old fashioned list of string attributes
>+    // XXX can we get rid of this yet? 
>       if (!params)
>+    {
>         args = GetArgs(window.arguments[0]);
>     }
>+  }
This seems somewhat convoluted... probably the easiest way to simplify this is
to do the instanceof test first; then no typeof tests should be necessary. Also
note that instanceof implicitly calls QueryInterface.

>Index: xpfe/appshell/src/nsAppShellService.cpp
It is only possible for Thunderbird to hit this code on startup, unless someone
manually defines a pref general.startup.compose in which case they deserve what
they get...
Attachment #143256 - Flags: review?(neil.parkwaycc.co.uk) → review-
Is this new version of ComposeStartup more in lines with what you were talking
about Neil?

>It is only possible for Thunderbird to hit this code on startup, unless
someone
>manually defines a pref general.startup.compose in which case they deserve 
>what they get...

I have several bugs to make seamonkey register ~ -compose %1 to the windows
system registry and to use that key for invoking the suite when the user clicks
on a mailto link in another program. Thunderbird already supports this and this
bug is the first part of making this work for seamonkey. I have some other bugs
which actually change the registry key so this will work.
Attachment #143256 - Attachment is obsolete: true
Comment on attachment 143577 [details] [diff] [review]
updated patch addressing Neil's review comments

Neil, see 

http://bugzilla.mozilla.org/show_bug.cgi?id=236774#c4
Attachment #143577 - Flags: review?(neil.parkwaycc.co.uk)
Blocks: 202497
*** Bug 209403 has been marked as a duplicate of this bug. ***
Comment on attachment 143577 [details] [diff] [review]
updated patch addressing Neil's review comments

Much nicer; r+ ONLY for MsgComposeCommands.js

r- for nsAppShellService.cpp, details in test email.
Attachment #143577 - Flags: review?(neil.parkwaycc.co.uk) → review+
I checked in the first part of this patch which is to make the compose window
smart enough to handle a mailto argument.

I haven't proven to myself that the 2nd part is not necessary. Leaving open
until I figure that out.

Target Milestone: mozilla1.7beta → mozilla1.8alpha
Hrm.  Checked this with 1.8a-0422 under Win2K.  The parsing of the mailto: URI 
is minimal -- it only susses out the to: address, it ignores such URIs as
  mailto:test@example.com?subject=foobar

Still, it's a good start.  For one thing, with this fix in place, using the 
-compose switch does not cause bug 204752 to manifest.
that's odd. It should be picking out all of the values as it uses our one and
only mailto url implementation which takes everything apart.

Argh!  You're right, full mailto parsing does work.  It was a configuration 
error on my end.
I'm gonna ask for the current trunk checkin (which is not the patch attached to 
this bug, I gather) for 1.7; it would be a shame for a such a simple fix to 
elude the new baseline.
Flags: blocking1.7?
I don' think we'd block the release for this.
Flags: blocking1.7? → blocking1.7-
Regarding comment 9 & comment 10 -- I must have erred when I tested, because 
full URL parsing seems to be working fine (1.8a2-0522).
Something has changed here.  Using Moz 1.8a3-0824, Win2K, this command line:

  Mozilla.exe -compose mailto:nobody@uu.net

opens a compose window but doesn't prefill the address.  I'm not sure when the 
change occurred.  I switched over to using TB in mid-August; prior to that I was 
using the 0806 build of Moz and I would have noticed a problem pretty quickly, 
I'm always using this feature.
Same for Mozilla 1.7.3. We again don't have any command line switch to send
mailto:-URLs to mozilla...
Also see: Bug 236774
Thanks for reminding me of this bug.  I just checked again, and I see that for 
1.8a4-0927 (that is, the official 1.8a4 build) -compose is working again.  I 
don't know what was wrong with the 1.8a3 build I was testing in comment 15, but 
it's right now.

The fix for this bug was never part of the 1.7 builds, so it's no surprise 
you're not seeing it.  The workaround in bug 220306 comment 3 is still valid.
Depends on: 214158
Product: MailNews → Core
If the fix for bug 202497 were tweaked so it applied to Mozilla Mail as well as 
Thunderbird, this bug probably could be closed.
*** Bug 311185 has been marked as a duplicate of this bug. ***
Assignee: mscott → nobody
Status: ASSIGNED → NEW
QA Contact: esther → composition
Product: Core → MailNews Core
(In reply to comment #18)
> If the fix for bug 202497 were tweaked so it applied to Mozilla Mail as well as 
> Thunderbird, this bug probably could be closed.

perhaps this is easy given bug 202497? 
wanted for TB3?  
surprising lack of dupes so far, but that might not be a good indicator hear of how much this might be needed. (I didn't search for unloved dupes.)
Flags: wanted-thunderbird3?
There's nothing here that Tb3 wants, because this bug was about two things: porting something Tb already had in pre-1.0 to the 1.8 suite, which landed in the spring of 2004, and cleaning up some commandline handling code in nsAppShellService.cpp which hasn't been in nsAppShellService.cpp since the fall of 2004. Any problem you may see which is not "|seamonkey.exe -compose "mailto:foo@example.com"| doesn't open a compose window with foo@example.com as the addressee" (exactly seamonkey.exe, not thunderbird.exe), is not this bug. If SeaMonkey still needs to register as the mailto handler on Windows, that needs a SeaMonkey bug. If someone sees some commandline handling code they want to clean up, that needs a different bug based on where the code they see currently lives.
Assignee: nobody → mscott
Status: NEW → RESOLVED
Closed: 15 years ago
Flags: wanted-thunderbird3?
Resolution: --- → FIXED
SeaMonkey 20.pre (and also afair the SeaMonkey 1.x.x Release-Builds) register the mailto: handler on Windows, so this Bug was fixed for SeaMonkey too.
You need to log in before you can comment on or make changes to this bug.