Last Comment Bug 627999 - Some "-compose" command line options won't work if they are the first or only argument
: Some "-compose" command line options won't work if they are the first or only...
Status: RESOLVED FIXED
: fixed-seamonkey2.0.14
Product: MailNews Core
Classification: Components
Component: Composition (show other bugs)
: Trunk
: All All
: -- normal (vote)
: Thunderbird 3.3a3
Assigned To: rsx11m
:
Mentors:
: 549058 (view as bug list)
Depends on:
Blocks: 630802 630804
  Show dependency treegraph
 
Reported: 2011-01-22 06:39 PST by sphakka
Modified: 2012-09-04 22:59 PDT (History)
4 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
.10-fixed


Attachments
Ad-hoc fix (1.16 KB, patch)
2011-01-24 14:25 PST, rsx11m
neil: review+
Details | Diff | Review
Patch for check-in [Checked in: Comment 12 & 23 & 25] (1.37 KB, patch)
2011-01-27 10:15 PST, rsx11m
rsx11m.pub: review+
standard8: approval‑thunderbird3.1.10+
kairo: approval‑seamonkey2.0.14+
Details | Diff | Review

Description sphakka 2011-01-22 06:39:02 PST
User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20110105 Gentoo/2.0.11-r2 SeaMonkey/2.0.11
Build Identifier: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20110105 Gentoo/2.0.11-r2 SeaMonkey/2.0.11

Hi there,
The command line 

  -compose 'bcc=foo@bar'" 

doesn't fill a "Bcc:" address line, as it happens with 'cc=foo@bar'.
Cheers,
  ^m'e

Reproducible: Always

Steps to Reproduce:
1. type on a console terminal "$ seamonkey -compose 'bcc=foo@bar'"

Actual Results:  
a mail compose window opens, but no 'Bcc:' address line is filled in.

Expected Results:  
a mail compose window opens with a 'Bcc:' address line showing 'foo@bar'.

Maybe the doc is incomplete here:

<https://developer.mozilla.org/en/Command_Line_Options#Syntax_Rules>

I'd actually expect that the command line option "-compose '<header>=blah'"
would correctly fill any available '<header>' field. It actually works only with 'to' and 'cc', *unless* a 'subject' field is provided as in:

  $ seamonkey -compose 'subject=blah,bcc=foo@bar.net'

weird...
Comment 1 rsx11m 2011-01-24 13:10:13 PST
I can reproduce on both Windows and Linux 2.0.11 releases, yet have to try on trunk. Note that the workaround with adding a Subject only does the trick if "subject=" comes before "bcc=", tried it the other way around and it didn't fill either of the Subject nor Bcc headings. Nothing in the Error Console.
Comment 2 rsx11m 2011-01-24 13:32:09 PST
Confirmed on trunk as well as in Thunderbird, thus moving to MailNews Core.
Comment 3 rsx11m 2011-01-24 14:25:53 PST
Created attachment 506529 [details] [diff] [review]
Ad-hoc fix

This is untested but should fix it. The underlying problem is that the begin of the argument for "-compose" is tested against a couple of expected strings, and that "bcc" is missing in this list. Thus, nsMsgComposeService::Handle() ignores the argument if it starts with "bcc=..." rather than any of the other strings.
Comment 4 sphakka 2011-01-24 23:55:26 PST
IMHO, the list of supported matching fields should be the same as that appearing in the compose window (to, cc, bcc, reply-to, ... -- please, provide a way to probe it, via, f.i., an option '-compose help'), irrespective of the order.
Ideally, if

  $ mozilla -copose help

says:

  supported fields:
    foo
    bar
    quux

then one should be able to call it like

  $ mozilla -compose 'quux=blah,bar=whatever,foo=...' ...

or, if multiple homonymous options are supported, like

  $ mozilla -compose 'quux=blah' -compose 'bar=whatever' -compose 'foo=...' ...

Thanks!

  ^m'e
Comment 5 rsx11m 2011-01-25 05:38:40 PST
Updating the command-line help across the board may be another bug, but I'm not even sure which other arguments for fields not given in that list may apply. "Reply-to" is usually set in the account identity.
Comment 6 rsx11m 2011-01-25 06:47:01 PST
I've tested some further arguments visible in the composition window, but
neither "newsgroup", "reply-to", "followup-to", or "from" does anything, even after a subject. Thus, "bcc" seems to be the only one that needs to be added.
Comment 7 rsx11m 2011-01-26 18:29:19 PST
While trying to find any existing tests for command-line options which I could expand I came across bug 540330, so nothing in this regards has been done yet and testing these functions is still waiting for a broader solution.

Thus, the patch in attachment 506529 [details] [diff] [review] remains for review as posted.
Comment 8 neil@parkwaycc.co.uk 2011-01-27 02:50:27 PST
(In reply to comment #6)
> I've tested some further arguments visible in the composition window, but
> neither "newsgroup", "reply-to", "followup-to", or "from" does anything, even
> after a subject. Thus, "bcc" seems to be the only one that needs to be added.

We support bodyislink, type, format, originalMsg, preselectid, identity, to, cc, bcc, newsgroups, subject, attachment, newshost, body. I'm not sure that they're all useful though.
Comment 9 neil@parkwaycc.co.uk 2011-01-27 02:51:58 PST
Comment on attachment 506529 [details] [diff] [review]
Ad-hoc fix

Feel free to post a new patch if you want to support other parameters.
Comment 10 rsx11m 2011-01-27 06:06:45 PST
(In reply to comment #8)
> We support bodyislink, type, format, originalMsg, preselectid, identity, to,
> cc, bcc, newsgroups, subject, attachment, newshost, body.

I didn't imagine that something as complex like "preselectid" would be needed to specify the "from" address. ;-) It works with "preselectid=id2" though not very intuitive (the user has to look up or guess the identity key).

I had used "newsgroup" as labeled instead of "newsgroups", the latter works and is certainly desired to allow for composing newsgroups articles.

The only other useful argument appears to be "format=1" (compose in HTML) vs. "format=2" (open in plain text) which could be used in an automated way.

I'll update the patch later today.
Comment 11 rsx11m 2011-01-27 10:15:38 PST
Created attachment 507520 [details] [diff] [review]
Patch for check-in
[Checked in: Comment 12 & 23 & 25]

Additions per comment #10, r=Neil from attachment 506529 [details] [diff] [review].
The strings are sorted to reflect their order in the composition window.

Please see comment #7 regarding open tests for command-line options.
This doesn't seem to need superreview, thus requesting push on trunk.
Comment 12 Mark Banner (:standard8) 2011-02-01 02:19:34 PST
Checked in: http://hg.mozilla.org/comm-central/rev/e3022c07fb50
Comment 13 rsx11m 2011-02-01 09:14:12 PST
Thanks, works fine in Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b11pre) Gecko/20110201 Thunderbird/3.3a3pre and Mozilla/5.0 (X11; Linux x86_64; rv:2.0b11pre) Gecko/20110201 Thunderbird/3.3a3pre nightly builds; SeaMonkey
nightly builds didn't pick the patch up yet, thus check tomorrow.

(In reply to comment #4)
> IMHO, the list of supported matching fields should be the same as that
> appearing in the compose window (to, cc, bcc, reply-to, ... -- please, provide
> a way to probe it, via, f.i., an option '-compose help'), irrespective of the
> order.

sphakka, if you want to please file a new bug on this suggestion, or I can file it on your behalf if you prefer.
Comment 14 rsx11m 2011-02-01 09:17:07 PST
(actually, those would be two bugs: changing the option names to match the composition window, and expanding the commandline help to explain using them.)
Comment 15 sphakka 2011-02-02 00:49:41 PST
Done, see #627999 and #630802.
Comment 16 sphakka 2011-02-02 00:51:01 PST
oops, it's #630804, not 627999 of course...
Comment 17 rsx11m 2011-02-02 06:21:52 PST
Thanks, I've just confirmed both of them.
Comment 18 rsx11m 2011-02-16 12:29:40 PST
Comment on attachment 507520 [details] [diff] [review]
Patch for check-in
[Checked in: Comment 12 & 23 & 25]

This works fine on trunk and should be safe for the release branches. No bugs related to command-line invocation or Simple MAPI (except for bug 631524 which has shown to be unrelated to this fix) have been filed over the last two weeks.

The patch applies cleanly to both comm-1.9.1 and comm-1.9.2; even though it's not strictly a security or stability fix, it should avoid any "Oops?" effect for users trying to utilize command-line arguments for composition while in turn not affecting existing scripts which are working around the issue already.
Comment 19 Robert Kaiser (not working on stability any more) 2011-02-16 16:34:22 PST
Comment on attachment 507520 [details] [diff] [review]
Patch for check-in
[Checked in: Comment 12 & 23 & 25]

I'm usually very reluctant to take anything in a stable branch that looks feature-ish but this looks very safe, so let's do it.
Comment 20 rsx11m 2011-02-16 18:37:23 PST
Mark, https://wiki.mozilla.org/Tree_Rules/comm-central hasn't been updated yet
to reflect that Thunderbird 3.0.x is no longer continued. Thus, Thunderbird shouldn't be affected by what's happening in SeaMonkey 2.0.x; meaning, is
KaiRo's branch approval sufficient to land this on comm-1.9.1 or will it have
to wait until branch approval is decided for Thunderbird 3.1.x as well?
Comment 21 rsx11m 2011-02-23 08:27:07 PST
Since Thunderbird didn't object, push for SeaMonkey 2.0.13 please.
Comment 22 rsx11m 2011-03-20 13:07:50 PDT
Ok, so this will probably be pushed back to SM 2.0.14 and TB 3.1.11 for the release branches, based on what I read in bug 643216.
Comment 23 Mark Banner (:standard8) 2011-03-29 11:49:59 PDT
Checked in for 3.1.10: http://hg.mozilla.org/releases/comm-1.9.2/rev/801fdd177a6b

You'll need a SeaMonkey person to do the 1.9.1 branch.
Comment 24 rsx11m 2011-03-29 12:21:58 PDT
Thanks Mark.

Serge, Callek: Can you push this on comm-1.9.1 for SeaMonkey to pick up?
Comment 25 Serge Gautherie (:sgautherie) 2011-03-29 18:56:46 PDT
Comment on attachment 507520 [details] [diff] [review]
Patch for check-in
[Checked in: Comment 12 & 23 & 25]

http://hg.mozilla.org/releases/comm-1.9.1/rev/7dfc717a9eac
Comment 26 Magnus Melin 2012-09-04 22:59:28 PDT
*** Bug 549058 has been marked as a duplicate of this bug. ***

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