Closed Bug 627999 Opened 13 years ago Closed 13 years ago

Some "-compose" command line options won't work if they are the first or only argument

Categories

(MailNews Core :: Composition, defect)

defect
Not set
normal

Tracking

(thunderbird3.1 .10-fixed)

RESOLVED FIXED
Thunderbird 3.3a3
Tracking Status
thunderbird3.1 --- .10-fixed

People

(Reporter: marcoep, Assigned: rsx11m.pub)

References

(Blocks 2 open bugs)

Details

(Keywords: fixed-seamonkey2.0.14)

Attachments

(1 file, 1 obsolete file)

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...
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.
Confirmed on trunk as well as in Thunderbird, thus moving to MailNews Core.
Status: UNCONFIRMED → NEW
Component: MailNews: Composition → Composition
Ever confirmed: true
OS: Linux → All
Product: SeaMonkey → MailNews Core
QA Contact: mailnews-composition → composition
Hardware: x86_64 → All
Summary: command line "-compose 'bcc=foo@bar'" doesn't fill a "Bcc:" line → command line "-compose 'bcc=foo@bar'" doesn't fill a "Bcc:" line if it is the first or only argument
Version: unspecified → Trunk
Attached patch Ad-hoc fix (obsolete) — Splinter Review
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.
Attachment #506529 - Flags: review?(neil)
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
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.
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.
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.
Assignee: nobody → rsx11m.pub
(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 on attachment 506529 [details] [diff] [review]
Ad-hoc fix

Feel free to post a new patch if you want to support other parameters.
Attachment #506529 - Flags: review?(neil) → review+
(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.
Summary: command line "-compose 'bcc=foo@bar'" doesn't fill a "Bcc:" line if it is the first or only argument → Some "-compose" command line options won't work if they are the first or only argument
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.
Attachment #506529 - Attachment is obsolete: true
Attachment #507520 - Flags: review+
Keywords: checkin-needed
Whiteboard: [c-n: comm-central]
Checked in: http://hg.mozilla.org/comm-central/rev/e3022c07fb50
Status: NEW → RESOLVED
Closed: 13 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Whiteboard: [c-n: comm-central]
Target Milestone: --- → Thunderbird 3.3a3
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.
(actually, those would be two bugs: changing the option names to match the composition window, and expanding the commandline help to explain using them.)
Done, see #627999 and #630802.
oops, it's #630804, not 627999 of course...
Thanks, I've just confirmed both of them.
Blocks: 630802, 630804
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.
Attachment #507520 - Flags: approval-thunderbird3.1.9?
Attachment #507520 - Flags: approval-seamonkey2.0.13?
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.
Attachment #507520 - Flags: approval-seamonkey2.0.13? → approval-seamonkey2.0.13+
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?
Since Thunderbird didn't object, push for SeaMonkey 2.0.13 please.
Keywords: checkin-needed
Whiteboard: [c-n: comm-1.9.1, default branch]
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.
Attachment #507520 - Flags: approval-thunderbird3.1.10? → approval-thunderbird3.1.10+
Whiteboard: [c-n: comm-1.9.1, default branch] → [c-n: comm-1.9.1 and comm-1.9.2, default branches]
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.
Whiteboard: [c-n: comm-1.9.1 and comm-1.9.2, default branches] → [c-n: comm-1.9.1, default branches]
Thanks Mark.

Serge, Callek: Can you push this on comm-1.9.1 for SeaMonkey to pick up?
Whiteboard: [c-n: comm-1.9.1, default branches]
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
Attachment #507520 - Attachment description: Patch for check-in → Patch for check-in [Checked in: Comment 12 & 23 & 25]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: