Re: compose.php and HTML5's registerProtocolHandler

"Michael A. Puls II" <[email protected]>
Newsgroups gmane.mail.squirrelmail.devel
Message-ID <op.u55o8feb1ejg13@sandra-svwliu01>
On Sun, 11 Jan 2009 12:21:49 -0500, Michael A. Puls II  
<[email protected]> wrote:

> On Sat, 10 Jan 2009 14:07:15 -0500, Michael A. Puls II  
> <[email protected]> wrote:
>
>> Attached is mailto_protocol_handler2.php. I used mailto.php as a
>> reference.
>>
>> It produces the exact results I want it to. There are just 2 problems.
>>
>> 1. How do I load compose.php in the right frame AND get compose.php to
>> use ?send_to=&body= etc. like it does when not loaded in a frame?
>>
>> 2. When the user is not logged in, I want to redirect to login.php and
>> retain the send_to=&body= etc. data after the user logs in.
>>
>> mailto.php does these things, but it uses ?mailtodata=, which uses some
>> funky data format that's percent-encoded, which compose.php decodes etc.
>>
>> How do I make things work with "send_to=" etc. or how to I convert the
>> to, cc, bcc, body and subject percent-encoded hvalues that I've built
>> into something that ?mailtodata= understands?
>>
>> If you look at mailto.php, I basically want to support the
>> !$compose_only and $force_login features.
>>
>> I'm doing this with 1.4.x
>
> I figured it out. ?mailtodata= just wants a percent-encoded serialized  
> array of the to, cc, bcc, subject and body values(decoded).
>
> Attached is with everything working. It works much better with the  
> mailto link at  
> <http://shadow2531.com/opera/testcases/mailto/modern_mailto_uri_scheme.html#test>  
> than mailto.php does.

I updated the code a little to fix handling of '#' in mailto URIs per  
advice from <http://lists.w3.org/Archives/Public/public-iri/>.

The latest will always be at  
<http://shadow2531.com/sm/html5_mailto.php.zip>.

The php file used to be named mailto_protocol_handler.php, but I changed  
it to html5_mailto.php to better reflect what it does. (It's a version of  
mailto.php that accepts an HTML5 compose URI like gmail, fastmail and  
yandex do. Opera and Firefox generate these URIs and other browsers will  
eventually.)

I made it for my 1.4.x setup, so I'm not sure how it works with 1.5.x.

Have fun with it.

You can test it in Opera by editing "C:\Program  
Files\Opera\defaults\webmail_providers.ini" (while Opera is closed) and  
adding a new entry that will look like this:

[SquirrelMail]
ID=Previous ID + 1
URL=http://smserver.com/src/html5_mailto.php?uri=%s
ICON=http://smserver.com/favicon.ico

Then, you just goto "tools -> preferences -> advanced -> programs ->  
mailto -> edit" and select your new webmail entry. Then, clicking on  
mailto links will open in SquirrelMail. (Opera allows you to do this the  
old way with compose.php?sent_to= etc. and mailto.php too. Just look at  
the replacement key guide in the ini file)

For Firefox, see  
<https://developer.mozilla.org/en/Web-based_protocol_handlers> (and  
remember to temporarily enabled  
gecko.handlerService.allowRegisterFromDifferentHost in about:config if  
running the JS register code from a local page or javascript: URI.)

-- 
Michael

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
-----
squirrelmail-devel mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
List address: [email protected]
List archives: http://news.gmane.org/gmane.mail.squirrelmail.devel
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.