Bug 2327 - 'Help/Set as default client' hangs
Summary: 'Help/Set as default client' hangs
Status: NEW
Alias: None
Product: Claws Mail (Windows)
Classification: Unclassified
Component: default (show other bugs)
Version: 3.7.8
Hardware: PC Windows XP
: P3 normal
Assignee: users
URL:
Depends on:
Blocks:
 
Reported: 2010-12-15 23:42 UTC by Theodor Ciobanu
Modified: 2011-01-06 16:26 UTC (History)
0 users

See Also:


Attachments
'default client' fix suggestion (3.16 KB, patch)
2010-12-15 23:43 UTC, Theodor Ciobanu
Details | Diff
2nd suggestion (3.80 KB, patch)
2010-12-16 08:32 UTC, Theodor Ciobanu
Details | Diff

Description Theodor Ciobanu 2010-12-15 23:42:18 UTC
I was never able to set Claws Mail as the default mail handler from itself, as it just hanged the app. This attachment tries to fix that:
- it properly registers the client in HKEY_LOCAL_MACHINE instead of HKEY_CURRENT_USER so it would show up for manual selection in 'Internet Properties/Programs'
- it broadcasts the change using PostMessage instead of SendMessage (this was the actual cause of the hang, as SendMessage waits for the msg to be processed by all the top windows vs PostMessage that just puts the msg in queue and returns).
Comment 1 Theodor Ciobanu 2010-12-15 23:43:25 UTC
Created attachment 926 [details]
'default client' fix suggestion
Comment 2 Colin Leroy 2010-12-16 07:35:27 UTC
Hi,

Using HKLM probably fails if the user's not an administrator, doesn't it ?
Comment 3 Theodor Ciobanu 2010-12-16 08:32:14 UTC
Created attachment 927 [details]
2nd suggestion

For a limited user, it probably does; but the very first registry value that CM tries to write is a restricted one, with the following comment:
	/* Try to set the Mail Start menu item to Claws. It may fail if we're not root; we don't care */
So I just went with it. Plus, there doesn't seem to be a way around it. According to MSDN, we need to write to HKLM\Software\Clients\Mail\Claws Mail for the info to be visible (and this makes sense, as you couldn't set the system-wide mail client to one that is installed for just one user - none of  the other users would have the settings for it):
http://msdn.microsoft.com/en-us/library/dd203067%28v=vs.85%29.aspx

I'm adding another patch that changes the order in which the registry keys are written a bit - it first tries to register the mail client (HKLM); if this doesn't fail, it tries to set CM as the Start Menu Email app for the current user (HKCU). If this also succeeds, mailto: handler registry keys are written as well (HKCU). And last but definitely not least, if everything worked OK so far, it tries to set CM as the system wide email app (HKLM).

I guess the proper way would be to treat separately these 3 cases - mailto: handler, current user's start menu email app and global email client. But the last two require access to HKLM\Software\Clients\Mail to at least register CM with Windows.

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