Bug 4457 - Allow mailto: link with other args
Summary: Allow mailto: link with other args
Status: NEW
Alias: None
Product: Claws Mail (GTK 2)
Classification: Unclassified
Component: Other (show other bugs)
Version: 3.18.0
Hardware: PC Linux
: P3 normal
Assignee: users
URL:
Depends on:
Blocks:
 
Reported: 2021-03-05 20:24 UTC by Avinash Sonawane
Modified: 2021-03-27 17:10 UTC (History)
1 user (show)

See Also:


Attachments
patch to allow mailto along with other args (1.40 KB, patch)
2021-03-05 20:24 UTC, Avinash Sonawane
no flags Details | Diff
Updated patch (1.40 KB, patch)
2021-03-27 17:06 UTC, Avinash Sonawane
no flags Details | Diff
Final patch (1.84 KB, patch)
2021-03-27 17:10 UTC, Avinash Sonawane
no flags Details | Diff

Description Avinash Sonawane 2021-03-05 20:24:10 UTC
Created attachment 2182 [details]
patch to allow mailto along with other args

Hello!

This patch allows mailto: links to be used with other args instead of having to be a standalone arg.

Thanks!
Comment 1 Ricardo Mones 2021-03-27 12:34:16 UTC
Ho Avinash,

Don't get what you wan't to achieve here. What's the point of passing two mailto: links, for example?
Comment 2 Paul 2021-03-27 12:55:51 UTC
Ricardo, I chatted with Avinash on IRC...

The patch allows, for example, adding --alternate-config-dir [DIR] when using a mailto link or command line. This was the itch which is scratched. However, I think the problem lies in being able to launch another c-m when --alternate-config-dir is used. You'll have two instances when you start with --alternate-config-dir and then without. Prohibiting a duplicate launch fails in this case. If that was fixed, then this patch is unnecessary.
Comment 3 Avinash Sonawane 2021-03-27 16:42:00 UTC
(In reply to Paul from comment #2)
The issue which this patch solves has nothing to do with multiple instances.

Let's say there will be only one instance. Now I want this to be that instance: `claws-mail mailto:a@b.com --alternate-config-dir [DIR]`. I can't do that with current implementation as current implementation only accepts mailto:a@b.com if it's only one argument (`-d` is exception as it's removed from argv)

Why this is needed?
Web browsers expose setting to set mailto: link handler which comes in handy as user simply clicks on any mailto link on the webpage and the mail client opens.

Claws-mail can't do that as present if user have config dir in some custom location as mailto: is being accepted if argc == 2.

This patch frees mailto: from that restriction and allows it to be combined with other command line options.
Comment 4 Avinash Sonawane 2021-03-27 16:51:48 UTC
Also `p && *p != '\0'` is unnecessary as if we are in `if ()` then we know it's going to be true. So I dropped that redundant check.

Then I also removed `p` - unnecessary ternary variable.
Comment 5 Avinash Sonawane 2021-03-27 17:06:46 UTC
Created attachment 2196 [details]
Updated patch

I just noticed redundant check and unnecessary ternary variable down the code. This patch includes above fix + removes the redundant code.
Comment 6 Avinash Sonawane 2021-03-27 17:10:39 UTC
Created attachment 2197 [details]
Final patch

Oops! Forgot to attach latest changes. Sorry!
Now this should be fixed. :)

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