PR Firefox QR Barcode Plugin Status Report 2

Since my last blog entry I completed the implementation of linkAnalyzer, qLauncherEncoder and the rest of qLink. Now it is possible to encode Web, image, mp3, iTunes, video, and mailto links as well as text.
In order to encode the links into the right format I had to analyze them.

For that I used the nsIURL interface to get the file extension of an URL on the one hand and regular expressions on the other. I developed the regular expressions using regexpal. You just put some test data in the bottom field and you can see the matches as you type the regular expression into the field above.

I thought it would be better not to hard-code which file extension or regular expression yields to a specific link type but to store that in the Preferences System. I recommend this tutorial on preferences. Unfortunately you can’t store arrays as preferences. The trick is to store all values in one string, separate them by a string (e.g. .NEXT.) and call split when you want to retrieve that array again.

Finally I want to mention this trick which helped me to parse mailto links.

  • Delicious
  • Facebook
  • Digg
  • Reddit
  • StumbleUpon
  • Twitter

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>