Like bricks in the skyhttp://patrick.cloke.us/2017-09-13T17:15:00-04:00RSS Feeds for Wikipedia Current Events and NHL News2017-05-26T08:13:00-04:002017-09-13T17:15:00-04:00Patrick Cloketag:patrick.cloke.us,2017-05-26:/posts/2017/05/26/rss-feeds-for-wikipedia-and-nhl/<p>I subscribe to a fair amount of feeds for news, blogs, articles, etc. I&#8217;m
currently subscribed to 122 feeds, some of which have tens of articles a day
(news sites), some of which are dead. <a class="footnote-reference" href="#id3" id="id1">[1]</a> Unfortunately there&#8217;s still a few
sites that I was visiting manually each …</p><p>I subscribe to a fair amount of feeds for news, blogs, articles, etc. I&#8217;m
currently subscribed to 122 feeds, some of which have tens of articles a day
(news sites), some of which are dead. <a class="footnote-reference" href="#id3" id="id1">[1]</a> Unfortunately there&#8217;s still a few
sites that I was visiting manually each day to get updates from because they
don&#8217;t offer any feeds. This&nbsp;included:</p>
<ul class="simple">
<li>The <a class="reference external" href="https://en.wikipedia.org/wiki/Portal:Current_events">Wikipedia Current Events portal</a>, which usually has a nice daily summary
of interesting worldwide stories. <a class="footnote-reference" href="#id4" id="id2">[2]</a></li>
<li>The <a class="reference external" href="https://www.nhl.com/news"><span class="caps">NHL</span> News</a> (and specifically the <a class="reference external" href="https://www.nhl.com/islanders/news">Islanders News</a>) pages. (I still
follow a <a class="reference external" href="http://islanders.nhl.com/rss/news.xml">broken feed</a> from the older site, but it seems one of the redesigns
of the <span class="caps">NHL</span> team sites broke this&nbsp;feed.)</li>
</ul>
<p>Having the Wikipedia Current Events as a feed is a pretty specific thing that&#8217;s
outside of the scope of <a class="reference external" href="https://www.mediawiki.org/">MediaWiki</a>, so I can understand why that doesn&#8217;t
exist. The <span class="caps">NHL</span> not having news feeds over <span class="caps">RSS</span> or Atom though? That shocks me! I
hope I&#8217;ve just been unable to find them and that they do exist. Please point me
to them if they&nbsp;do!</p>
<div class="section" id="wikipedia-current-events">
<h2>Wikipedia Current&nbsp;Events</h2>
<p>The Wikipedia Current Events feed is <a class="reference external" href="https://www.to-rss.xyz/wikipedia/current_events/">publically available</a>, code can be found
in the GitHub repository: <a class="reference external" href="https://github.com/clokep/wp-current-events-rss">clokep/wp-current-events-rss</a>. Note that this pulls
data on demand and thus always serves the most up-to-date versions of the
articles. This works&nbsp;by:</p>
<ol class="arabic simple">
<li>Pulling the last 7 days of Wikipedia&#8217;s current event articles (e.g. like
<a class="reference external" href="https://en.wikipedia.org/wiki/Portal:Current_events/2017_May_8">this one</a>) using <a class="reference external" href="http://python-requests.org/">requests</a>. Each of these is processed individually as a
separate article in the <span class="caps">RSS</span>&nbsp;feed.</li>
<li>The <a class="reference external" href="https://en.wikipedia.org/wiki/Help:Wiki_markup">wikicode</a> for each article is converted to an <a class="reference external" href="https://en.wikipedia.org/wiki/Abstract_syntax_tree"><span class="caps">AST</span></a> using
<a class="reference external" href="http://mwparserfromhell.readthedocs.io/">mwparserfromhell</a></li>
<li>Some of the headers and templates are removed from each&nbsp;article.</li>
<li>It then converts each article <em>back</em> to <span class="caps">HTML</span>. (This was the surprisingly
hard part. I couldn&#8217;t find a good library to do this and ended up
<a class="reference external" href="https://github.com/clokep/wp-current-events-rss/blob/7a6e2eb12d7fbe6efae6659dda65e2ad24e89611/parser.py#L23-L193">writing this myself</a>.)</li>
<li>The articles are then turned into an <span class="caps">RSS</span> feed using <a class="reference external" href="https://github.com/getpelican/feedgenerator/">feedgenerator</a>.</li>
<li>The feed itself is served via <a class="reference external" href="http://flask.pocoo.org/">Flask</a>.</li>
</ol>
<p>Feel free to <a class="reference external" href="https://www.to-rss.xyz/wikipedia/">check it out</a> and <a class="reference external" href="https://github.com/clokep/wp-current-events-rss/issues/new">let me know of any issues</a>!</p>
</div>
<div class="section" id="nhl-news">
<h2><span class="caps">NHL</span>&nbsp;News</h2>
<p>After building the above, I figured there was no reason not to do the same for
the <span class="caps">NHL</span> News section (and specifically for the Islanders). You can <a class="reference external" href="https://www.to-rss.xyz/nhl/news/">see the <span class="caps">NHL</span>
feed</a> or <a class="reference external" href="https://www.to-rss.xyz/nhl/">pick your favorite team</a>. Again, the code is available on GitHub:
<a class="reference external" href="https://github.com/clokep/nhl-news-rss">clokep/nhl-news-rss</a>. The stack is pretty similar to the above, it works&nbsp;by:</p>
<ol class="arabic simple">
<li>Pulling the current <span class="caps">NHL</span> News&nbsp;page.</li>
<li>Parsing the <span class="caps">HTML</span> with <a class="reference external" href="https://www.crummy.com/software/BeautifulSoup/bs4/">BeautifulSoup4</a> to pull out each article&#8217;s title,
date, author, and short summary. (Note that the full article isn&#8217;t
available, we could get it by loading each article individually, but I
didn&#8217;t implement&nbsp;that.)</li>
<li>The articles are then turned into an <span class="caps">RSS</span> feed using <a class="reference external" href="https://github.com/getpelican/feedgenerator/">feedgenerator</a>.</li>
<li>The feed itself is served via <a class="reference external" href="http://flask.pocoo.org/">Flask</a>.</li>
</ol>
<p>Luckily the <span class="caps">NHL</span> News site and the news page for each team are in the same
format, so it&#8217;s just loading different URLs to get the different articles. It
was pretty trivial to get the full list of teams and add support for all of
them, so that&#8217;s included too! Articles are pulled during page load, so should
always be up to&nbsp;date.</p>
<p>I hope one (or both) of these are useful to people! Again, please
<a class="reference external" href="https://github.com/clokep/nhl-news-rss/issues/new">let me know if you have any issues or ideas</a>!</p>
<table class="docutils footnote" frame="void" id="id3" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id1">[1]</a></td><td><p class="first">I recently switched from using <a class="reference external" href="http://thunderbird.net">Thunderbird</a> to <a class="reference external" href="https://feedly.com">Feedly</a> in order to
get cross device read status syncing on articles, but that&#8217;s not really
related to the rest of this article. Switching has mostly worked out
well, but I do miss the filtering capabilities of&nbsp;Thunderbird!</p>
<p class="last">I also tried a few other services (e.g. <a class="reference external" href="https://theoldreader.com">The Old Reader</a>), but most had
too many weird social features. I just wanted to read&nbsp;feeds.</p>
</td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id4" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id2">[2]</a></td><td>I do know that Wikipedia page updates can be consumed via <span class="caps">RSS</span>, but I
don&#8217;t want to know every time the article is updated, just the state of
the article at the end of the day. (It also doesn&#8217;t work for the current
events article since it&#8217;s dynamically generated from a bunch of
templates.)</td></tr>
</tbody>
</table>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p>An update, as of September 13,&nbsp;2017:</p>
<ol class="last arabic simple">
<li>The links to each <span class="caps">RSS</span> feed were&nbsp;updated.</li>
<li>These apps are now hosted together on <a class="reference external" href="https://www.to-rss.xyz">https://www.to-rss.xyz</a>.</li>
<li>These projects are no longer being updated on GitHub. The combined site
might be open sourced in the&nbsp;future.</li>
</ol>
</div>
</div>
Google Summer of Code 2017: Matrix protocol for Instantbird and Thunderbird2017-05-05T11:20:00-04:002017-05-05T11:20:00-04:00Patrick Cloketag:patrick.cloke.us,2017-05-05:/posts/2017/05/05/google-summer-of-code-2017-matrix-protocol/<p>I&#8217;ll be mentoring Pavan Karthik on his <a class="reference external" href="https://summerofcode.withgoogle.com/projects/#6473832528347136">project for Google Summer of Code 2017</a>
entitled &#8220;Matrix Protocol Support for Instantbird&#8221;. <a class="reference external" href="http://matrix.org/">Matrix</a> is a new(er)
protocol that is an open, decentralized network with some unique features.
Initial support for this landed in <a class="reference external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1315926">bug 1315926</a>, but it is not feature …</p><p>I&#8217;ll be mentoring Pavan Karthik on his <a class="reference external" href="https://summerofcode.withgoogle.com/projects/#6473832528347136">project for Google Summer of Code 2017</a>
entitled &#8220;Matrix Protocol Support for Instantbird&#8221;. <a class="reference external" href="http://matrix.org/">Matrix</a> is a new(er)
protocol that is an open, decentralized network with some unique features.
Initial support for this landed in <a class="reference external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1315926">bug 1315926</a>, but it is not feature
rich-enough to turn on for users. Pavan will work to finish Matrix support so we
can enable it for all users! The brief description of his proposal is&nbsp;below:</p>
<blockquote>
Matrix is an open, decentralized protocol for instant messaging (and more!)
It has bridges to many other networks and protocol, e.g. <span class="caps">IRC</span>, Slack, and
more. Initial support for Matrix was added in bug 1199855, but there&#8217;s a lot
to do still : Support more features from the Matrix <span class="caps">SDK</span> (video/audio calls,
room topics, typing notifications, read receipts and a lot more.) Support
one-on-one conversations. Add tests specific to Matrix. Improve the Matrix
<span class="caps">JS</span>-<span class="caps">SDK</span> that Instantbird and Thunderbird depend on. Improving and expanding
shared code and APIs used by all JavaScript protocol plugins (<span class="caps">IRC</span>, <span class="caps">XMPP</span>,
Yahoo and Twitter). Improving documentation of the process for adding a
protocol to Instantbird/Thunderbird. Using the Matrix protocol on a
day-to-day basis to dog-food the code.</blockquote>
<p>I&#8217;m super excited to finalize support for Matrix in both Instantbird and
Thunderbird! You can also checkout the full 25 projects that
<a class="reference external" href="https://summerofcode.withgoogle.com/organizations/6421332469219328/">Mozilla accepted</a>.</p>
“Adding Two-Factor Authentication to Django (with django-allauth)” Lightning Talk2017-04-06T21:14:00-04:002017-04-06T21:14:00-04:00Patrick Cloketag:patrick.cloke.us,2017-04-06:/posts/2017/04/06/django-allauth-2fa-lightning-talk/<p>A bit late on this article, but better late than never! Back on October 27th,
2016 I gave a talk at <a class="reference external" href="http://www.meetup.com/djangoboston/">Django Boston</a> entitled &#8220;Adding Two-Factor
Authentication to Django (with <tt class="docutils literal"><span class="pre">django-allauth</span></tt>)&#8221;. It was a ~20 minute talk on
integrating the <a class="reference external" href="https://github.com/percipient/django-allauth-2fa/">django-allauth-2fa</a> package into a <a class="reference external" href="https://www.djangoproject.com/">Django</a> project. The
package (which I …</p><p>A bit late on this article, but better late than never! Back on October 27th,
2016 I gave a talk at <a class="reference external" href="http://www.meetup.com/djangoboston/">Django Boston</a> entitled &#8220;Adding Two-Factor
Authentication to Django (with <tt class="docutils literal"><span class="pre">django-allauth</span></tt>)&#8221;. It was a ~20 minute talk on
integrating the <a class="reference external" href="https://github.com/percipient/django-allauth-2fa/">django-allauth-2fa</a> package into a <a class="reference external" href="https://www.djangoproject.com/">Django</a> project. The
package (which I should note is maintained by my employer and used in production
on <a class="reference external" href="https://strongarm.io">Strongarm</a>) expands the excellent <a class="reference external" href="http://www.intenct.nl/projects/django-allauth/">django-allauth</a> package by adding
<a class="reference external" href="https://en.wikipedia.org/wiki/Multi-factor_authentication">two-factor authentication</a> using <a class="reference external" href="https://en.wikipedia.org/wiki/Time-based_One-time_Password_Algorithm"><span class="caps">TOTP</span></a> (and backup&nbsp;codes).</p>
<p>Integrating this into your project is (mostly) just some configuration changes
to your <tt class="docutils literal">settings.py</tt>, and <span class="caps">URL</span> configuration! It takes advantage of the awesome
<a class="reference external" href="http://django-allauth.readthedocs.io/en/latest/advanced.html">adapter</a> methodology, the <a class="reference external" href="https://bitbucket.org/psagers/django-otp/">django-otp</a> package to do all the <span class="caps">2FA</span> bits, and
some custom middleware to enforce <span class="caps">2FA</span> during&nbsp;login.</p>
<p>You can view a <a class="reference external" href="http://files.patrick.cloke.us/boston-django-20161027/">rendered version</a> of the slides online (use the arrow keys to
navigate) or check out the <a class="reference external" href="https://github.com/percipient/talks/tree/master/boston_django_10_27_2016/adding-two-factor-authentication-to-django">source</a>. We&#8217;re always look for more contributors to
<a class="reference external" href="https://github.com/percipient/django-allauth-2fa/">django-allauth-2fa</a>, there&#8217;s plenty to do,&nbsp;including:</p>
<ul class="simple">
<li>More testing needed (different configurations, interaction with social&nbsp;accounts).</li>
<li>Support for more device types (e.g. <span class="caps">HOTP</span>, YubiKey, Twilio). (<a class="reference external" href="https://github.com/percipient/django-allauth-2fa/issues/23">#23</a>)</li>
<li>Support for multiple devices per user. (<a class="reference external" href="https://github.com/percipient/django-allauth-2fa/issues/36">#36</a>)</li>
<li>Improving the documentation (e.g. add a quickstart&nbsp;document).</li>
<li>Setting up and adding&nbsp;translations.</li>
<li>Any other feedback you might&nbsp;have!</li>
</ul>
<p>You can also check out the open <a class="reference external" href="https://github.com/percipient/django-allauth-2fa/issues">issues on GitHub</a> or <a class="reference external" href="http://patrick.cloke.us/pages/contact.html">reach out</a> directly if
you&#8217;re&nbsp;interested!</p>
Windows Mobile (or Windows Phone) and FastMail2016-07-24T13:19:00-04:002016-07-24T13:19:00-04:00Patrick Cloketag:patrick.cloke.us,2016-07-24:/posts/2016/07/24/windows-mobile-or-windows-phone-and-fastmail/
<p>I’ve been a big fan of Windows Phone (now Windows Mobile) for a while and have
had a few phones across versions 7, 8, and now 10. A while ago I switched to
<a class="reference external" href="https://www.fastmail.com/">FastMail</a> as my e-mail provider <a class="footnote-reference" href="#id5" id="id1">[1]</a>, but had been stuck using Google as my
calendar provider …</p>
<p>I’ve been a big fan of Windows Phone (now Windows Mobile) for a while and have
had a few phones across versions 7, 8, and now 10. A while ago I switched to
<a class="reference external" href="https://www.fastmail.com/">FastMail</a> as my e-mail provider <a class="footnote-reference" href="#id5" id="id1">[1]</a>, but had been stuck using Google as my
calendar provider still (and my contacts were on my Windows Live account). I had
a desire to move all these onto a single account, but Windows 10 Mobile only
officially supports e-mail from arbitrary providers. Calendar and contacts are
limited to a few special providers.</p>
<p>Below I’ve outlined how I’ve gotten all three services (email, contacts, and
calendar) from my FastMail account onto my Windows Mobile device.</p>
<div class="section" id="email">
<h2><a class="toc-backref" href="#id9">Email</a></h2>
<p>Email is the easy one, FastMail even has a
<a class="reference external" href="https://www.fastmail.com/help/clients/winphone.html">guide to setting up email on Windows Phone</a>. This guide did not handle sending
emails with a custom domain name, if you don’t have that situation, probably
just use the FastMail guide.</p>
<ol class="arabic simple">
<li>Add a new account, choose “other account”.</li>
<li>Type in your email address (e.g. <tt class="docutils literal">you@yourcustomdomain.com</tt>) and password.</li>
<li>It will complain about being unable to find proper account settings. Click
“try again”.</li>
<li>It will complain again, but not give you an option for “advanced”, click it.</li>
<li>Choose “Internel email account”.</li>
<li>Enter any “Account name” and “Your name” that you want.</li>
<li>Choose “<span class="caps">IMAP4</span>” as the “Account type”.</li>
<li>Change the incoming mail server to <tt class="docutils literal">mail.messagingengine.com</tt>.</li>
<li>Change the username to your FastMail username (e.g. <tt class="docutils literal">you@fastmail.com</tt>).</li>
<li>Change the outgoing mailserver to <tt class="docutils literal">mail.messagingengine.com</tt>.</li>
</ol>
<p>Now when you send email it should show up properly as
<tt class="docutils literal">you@yourcustomdomain.com</tt>, but be sent via FastMail’s servers!</p>
</div>
<div class="section" id="contacts">
<h2><a class="toc-backref" href="#id10">Contacts</a></h2>
<p>FastMail <a class="reference external" href="https://blog.fastmail.com/2015/08/21/carddav-your-contacts-everywhere-you-need-them/">added support for CardDAV last year</a> and Windows Phone
<a class="reference external" href="https://blogs.windows.com/windowsexperience/2013/01/30/syncing-google-services-with-windows-phone/">added support back in 2013</a>, so why is this hard? Well…turns out that there
isn’t a way to make a CardDAV account on Windows Mobile, it’s just used for
certain account types. Luckily, there is a <a class="reference external" href="http://www.emaildiscussions.com/showthread.php?t=70967">forum post</a> about hooking up
CardDAV via a hack. Steps are reproduced below:</p>
<ol class="arabic simple">
<li>Add a new account, choose “iCloud”.</li>
<li>Type in your FastMail username, but add <tt class="docutils literal">+Default</tt> before the <tt class="docutils literal">@</tt> (e.g.
<tt class="docutils literal">you+Default@fastmail.com</tt>), note that this isn’t anything special, just
the <a class="reference external" href="https://www.fastmail.com/help/clients/iphone.html#contacts">scheme FastMail uses for CardDAV usernames</a>.</li>
<li>Put in your password. <a class="footnote-reference" href="#id6" id="id2">[2]</a></li>
<li>Click “sign in”, it will fail.</li>
<li>Go back into the account settings (click “Manage”) and modify the advanced
settings (“Change mailbox sync settings”). Choose manually for when to
download new email. Disable syncing of email and calendar.</li>
<li>Go to “Advanced account settings”. Change the “Incoming email server”,
“Outgoing (<span class="caps">SMTP</span>) email server” and “Calendar server (CalDAV)” to
<tt class="docutils literal">localhost</tt>. <a class="footnote-reference" href="#id7" id="id3">[3]</a></li>
<li>Change “Contacts server (CardDAV)” to
<tt class="docutils literal">carddav.messagingengine.com:443/dav/addressbooks/user/you@fastmail.com/Default</tt>,
changing <tt class="docutils literal">you@fastmail.com</tt> to your FastMail username.</li>
<li>Click “Done”!</li>
</ol>
<p>Your contacts should eventually appear in your address book! I couldn’t figure
out a way to force my phone to sync contacts, but they appeared fairly quickly.</p>
</div>
<div class="section" id="calendar">
<h2><a class="toc-backref" href="#id11">Calendar</a></h2>
<p>FastMail <a class="reference external" href="https://blog.fastmail.com/2014/01/23/calendar-now-available-on-beta-fastmail-fm-for-testing/">added support for CalDAV</a> back in the beginning of 2014 <a class="footnote-reference" href="#id8" id="id4">[4]</a>. These
steps are almost identical to the <a class="reference internal" href="#contacts">Contacts</a> section above, but using
information from the <a class="reference external" href="https://www.fastmail.com/help/clients/maccalendar.html">guide for setting up Calendar.app</a>.</p>
<ol class="arabic simple">
<li>Add a new account, choose “iCloud”.</li>
<li>Type in your FastMail username (e.g. <tt class="docutils literal">you@fastmail.com</tt>).</li>
<li>Put in your password.</li>
<li>Click “sign in”, it will fail.</li>
<li>Go back into the account settings (click “Manage”) and modify the advanced
settings (“Change mailbox sync settings”). Choose manually for when to
download new email. Disable syncing of email and contacts.</li>
<li>Go to “Advanced account settings”. Change the “Incoming email server”,
“Outgoing (<span class="caps">SMTP</span>) email server” and “Contacts server (CardDAV)” to
<tt class="docutils literal">localhost</tt>.</li>
<li>Change “Calendar server (CalDAV)” to
<tt class="docutils literal">caldav.messagingengine.com/dav/principals/user/you@fastmail.com/</tt>,
changing <tt class="docutils literal">you@fastmail.com</tt> to your FastMail username.</li>
<li>Click “Done”!</li>
</ol>
<p>My default calendar appeared very quickly, but additional calendars took a bit
to sync onto my phone.</p>
<p>Good luck and let me know if there are any errors, easier ways, or other tricks
to getting the most of FastMail on a Windows Mobile device!</p>
<table class="docutils footnote" frame="void" id="id5" rules="none">
<colgroup><col class="label"></col><col></col></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id1">[1]</a></td><td>There are a variety of reasons why I switched, I had
<a class="reference external" href="http://patrick.cloke.us/posts/2014/07/03/new-blog/">recently bought a domain name</a> to get better control over my online
presence (email, website, etc.). I was also tired of my email being used
to server me advertisements and various other issues with free webmail.
I highly recommend FastMail, they have awesome <a class="reference external" href="https://www.fastmail.com/help/ourservice/security.html">security</a> and <a class="reference external" href="https://www.fastmail.com/about/privacy.html">privacy</a>
policies. They also have <em>amazing</em> support, give back to (a lot) to open
source and a whole slew of other things.</td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id6" rules="none">
<colgroup><col class="label"></col><col></col></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id2">[2]</a></td><td>I put a dummy one in and then changed it after I updated the servers in
step 6. This was to not send my password to iCloud servers. The password
is hopefully encrypted and hashed, but I don’t know for sure.</td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id7" rules="none">
<colgroup><col class="label"></col><col></col></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id3">[3]</a></td><td>We’re just ensuring that our credentials for these other services will
not hit Apple servers for any reason.</td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id8" rules="none">
<colgroup><col class="label"></col><col></col></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id4">[4]</a></td><td>That article talks about beta.fastmail.fm, but this is now available on
the production FastMail servers too!</td></tr>
</tbody>
</table>
</div>
Google Summer of Code 2016 projects2016-05-20T09:15:00-04:002016-05-20T09:15:00-04:00Patrick Cloketag:patrick.cloke.us,2016-05-20:/posts/2016/05/20/google-summer-of-code-2016-projects/<p>I&#8217;d like to introduce the 13 students that are being mentored by Mozilla this
year as part of <a class="reference external" href="https://summerofcode.withgoogle.com/">Google Summer of Code 2016</a>! Currently the &#8220;community bonding&#8221;
period is ongoing, but we are on the cusp of the &#8220;coding period&#8221;&nbsp;starting.</p>
<p>As part of Google Summer of Code (GSoC …</p><p>I&#8217;d like to introduce the 13 students that are being mentored by Mozilla this
year as part of <a class="reference external" href="https://summerofcode.withgoogle.com/">Google Summer of Code 2016</a>! Currently the &#8220;community bonding&#8221;
period is ongoing, but we are on the cusp of the &#8220;coding period&#8221;&nbsp;starting.</p>
<p>As part of Google Summer of Code (GSoC), we ask students to provide weekly
updates of their progress in a public area (usually a blog). If you&#8217;re
interested in a particular project, please follow along! Lastly, remember that
GSoC is a community effort: if a student is working in an area where you
consider yourself knowledgable, please introduce yourself and offer to provide
help and/or&nbsp;advice!</p>
<p>Below is a listing of each student&#8217;s project (linked to their weekly updates),
the name of each student and the name of their&nbsp;mentor(s).</p>
<table border="1" class="docutils">
<colgroup>
<col width="61%" />
<col width="15%" />
<col width="24%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">Project</th>
<th class="head">Student</th>
<th class="head">Mentor(s)</th>
</tr>
</thead>
<tbody valign="top">
<tr><td><a class="reference external" href="http://krishnakannan.github.io/">Download app assets at runtime</a> (Firefox for Android)</td>
<td>Krish</td>
<td>skaspari</td>
</tr>
<tr><td><a class="reference external" href="https://github.com/izgzhen/gsoc-file-support">File <span class="caps">API</span> Support</a> (Servo)</td>
<td>izgzhen</td>
<td>Manishearth</td>
</tr>
<tr><td><a class="reference external" href="http://myveryownsummerofcode.blogspot.fr/">Implement <span class="caps">RFC7512</span> <span class="caps">PKCS</span>#11 <span class="caps">URI</span> support and system integration</a> (<span class="caps">NSS</span>)</td>
<td>varunnaganathan</td>
<td>Bob Relyea, David Woodhoue</td>
</tr>
<tr><td><a class="reference external" href="http://creativcoder.xyz/">Implementing Service Worker Infrastructure in Servo Browser Engine</a></td>
<td>creativcoder</td>
<td>jdm</td>
</tr>
<tr><td><a class="reference external" href="https://wiki.mozilla.org/User:Abdelrhman/gsoc16">Improving and expanding the JavaScript <span class="caps">XMPP</span> Implementation</a></td>
<td>Abdelrhman Ahmed</td>
<td>aleth, nhnt11</td>
</tr>
<tr><td><a class="reference external" href="https://blog.mozilla.org/calendar/tag/gsoc/">Mozilla Calendar – Event in a Tab</a></td>
<td>paulmorris</td>
<td>Philipp Kewisch</td>
</tr>
<tr><td><a class="reference external" href="https://drive.google.com/folderview?id=0Bzvo3C7XKc_wVzVQWG5xaHo0NTA">Mozilla Investigator (<span class="caps">MIG</span>): Auditd integration</a></td>
<td>Arun</td>
<td>kang</td>
</tr>
<tr><td><a class="reference external" href="http://blog.varun-joshi.com/">Prevent Failures due to Update Races</a> (Balrog)</td>
<td>varunjoshi</td>
<td>Ben Hearsum</td>
</tr>
<tr><td><a class="reference external" href="https://mikelingblog.wordpress.com/">Proposal of Redesign <span class="caps">SETA</span></a></td>
<td>MikeLing</td>
<td>Joel Maher</td>
</tr>
<tr><td><a class="reference external" href="http://martiansideofthemoon.github.io/archive.html">Schedule TaskCluster Jobs in Treeherder</a></td>
<td>martianwars</td>
<td>armenzg</td>
</tr>
<tr><td><a class="reference external" href="https://wiki.mozilla.org/User:Anindyapandey">Thunderbird - Implement mbox -&gt; maildir converter</a></td>
<td>Shiva</td>
<td>mkmelin</td>
</tr>
<tr><td><a class="reference external" href="http://graphpanovr.blogspot.fr/">Two Projects to Make A-Frame More Useful, Accessible, and Exciting</a></td>
<td>bryik</td>
<td>Diego Marcos</td>
</tr>
<tr><td><a class="reference external" href="http://baygeldin.name/gsoc-2016/">Web-based <span class="caps">GDB</span> Frontend</a></td>
<td>baygeldin</td>
<td>jonasfj</td>
</tr>
</tbody>
</table>
Thoughts on Appyling to Google Summer of Code2016-03-07T09:18:00-05:002016-03-07T09:18:00-05:00Patrick Cloketag:patrick.cloke.us,2016-03-07:/posts/2016/03/07/thoughts-on-applying-to-gsoc/
<!-- -->
<blockquote>
<p>Over the past few years I’ve been involved in <a class="reference external" href="https://developers.google.com/open-source/gsoc/">Google Summer of Code</a>
(GSoC), a program that sponsors students to write code for open-source
projects, as part of Mozilla. I’ve been both a mentor and administrator,
<a class="reference external" href="http://blog.queze.net/">Florian Quèze</a> and I frequently get asked questions about what students
should …</p></blockquote>
<!-- -->
<blockquote>
<p>Over the past few years I’ve been involved in <a class="reference external" href="https://developers.google.com/open-source/gsoc/">Google Summer of Code</a>
(GSoC), a program that sponsors students to write code for open-source
projects, as part of Mozilla. I’ve been both a mentor and administrator,
<a class="reference external" href="http://blog.queze.net/">Florian Quèze</a> and I frequently get asked questions about what students
should do to apply to GSoC. This post aims to give some resources and
answers to those questions. (I should note that each open-source
organization is different and this is based on my experiences at Mozilla.
Your mileage may vary.)</p>
<p>Remember that none of this is meant as a guarantee for acceptance, it is
just a few things that can help get you ready and improve your chances!</p>
</blockquote>
<p>If you haven’t heard yet, then Mozilla has been accepted into
<a class="reference external" href="https://developers.google.com/open-source/gsoc/">Google Summer of Code</a> (GSoC) 2016, this will be our 10th time participating
in GSoC mentoring Organizations. Overally, the best way to prepare yourself for
applying to GSoC is to get involved with the community you would like to work
with. Some particular resources to help you in applying to GSoC are:</p>
<ol class="arabic simple">
<li>Go read the <a class="reference external" href="https://developers.google.com/open-source/gsoc/">Google Summer of Code</a> website. Every part of it. Particular
pages to point out are the:<ul>
<li><a class="reference external" href="http://en.flossmanuals.net/GSoCStudentGuide/">Student Guide</a>: Written by a variety of people in the GSoC community,
it covers topics from contacting an organization, to applying, to not
being accepted.</li>
<li><a class="reference external" href="https://developers.google.com/open-source/gsoc/faq"><span class="caps">FAQ</span></a>: If you still have questions after reading the above (or whenever
you have a question), check here for answers <em>before</em> asking anyone. (In
particular this includes questions about how to apply.)</li>
<li>The final important page to internalize is the <a class="reference external" href="https://summerofcode.withgoogle.com/how-it-works/">schedule</a>. It is a
student’s responsibility to meet each of the deadlines.</li>
</ul>
</li>
<li>Mozilla has some good <a class="reference external" href="https://wiki.mozilla.org/Community:SummerOfCode16#Application_Advice">application advice</a> on the idea page. I’ve
included/expanded on this below:<ul>
<li>Talk to the mentor. Contact them on <span class="caps">IRC</span>/e-mail/Slack/whatever that
project uses. If you have trouble contacting a mentor, contact the
organization administrators.</li>
<li>Read <a class="reference external" href="http://blog.gerv.net/2006/05/how_not_to_apply_for_summer_of/">How Not To Apply For Summer Of Code</a>
and avoid doing the things listed there.</li>
<li>Read our examples of good applications:
<a class="reference external" href="https://wiki.mozilla.org/SummerOfCode/SampleApplications/1">1</a>
<a class="reference external" href="https://wiki.mozilla.org/SummerOfCode/SampleApplications/2">2</a>
<a class="reference external" href="https://wiki.mozilla.org/SummerOfCode/SampleApplications/3">3</a></li>
<li>It is entirely acceptable to apply for 2 or 3 projects, if more than one
catches your eye; if the applications are high quality, that can improve
your chances. However, more than 3 seems like spam.</li>
<li>Note that if a project suggests it would be helpful to know a technology
you don’t know (e.g. <span class="caps">XUL</span>), you may be able to get away with learning on
the job. Don’t be put off from applying if the project otherwise looks
right for you.</li>
</ul>
</li>
</ol>
<div class="section" id="picking-an-organization">
<h2><a class="toc-backref" href="#id4">Picking an Organization</a></h2>
<p>Pick an organization you’re truly interested in helping. I really can’t stress
this enough. “Truly interested in helping” might mean many things:</p>
<ul class="simple">
<li>You believe in an organization on a philosophical ground.</li>
<li>You use the program/library/service/etc. that the organization produces.</li>
<li>…many other things…</li>
</ul>
<p>Throughout this post I use “organization” and “community” synonymously, but
organizations likely have smaller communities within them, each with their own
culture, beliefs, etc. Even within a small community, members will not share all
the same opinions!</p>
<!-- -->
<blockquote>
A pet peeve of mine is that a student should use (or at the very least
<em>try</em>) the product the community makes. It is difficult (if not impossible)
to understand the needs and wants of a community without utilizing what
they’ve poured their time and energy into.</blockquote>
<div class="section" id="introductions">
<h3><a class="toc-backref" href="#id5">Introductions</a></h3>
<p>Different communities interact in different ways (and frequently a single
community interacts in multiple ways). Common ways include:</p>
<ul class="simple">
<li>Instant messaging (<span class="caps">IRC</span>, <span class="caps">XMPP</span>, Slack, hipChat, etc.) for day-to-day chatter,
help, and off-topic banter.</li>
<li>E-mail / mailing lists / newsgroups for project wide discussion,
announcements, etc.</li>
<li>Bug trackers (Bugzilla, GitHub, Trac) for technical discussion and reviewing code.</li>
</ul>
<p>Choose whichever way of introducting yourself that you’re comfortable with. It
can be useful to “idle” before introducing yourself (i.e. watch how a community interacts).</p>
<p>This can be important to figuring out a communities culture, e.g. how friendly
is the community to new-comers? Are they open to helping or do they just expect
patches to be submitted? Remember that it’s important for you to feel
comfortable with a community, you’ll be spending a significant amount of time
interacting with them!</p>
<p>If none of the above seem appropriate, or you’re unsure, contact the
organization administrator directly. I’d suggest asking pointed questions, as an
organization administrator is much more likely to respond quickly in that case.</p>
</div>
</div>
<div class="section" id="getting-accepted">
<h2><a class="toc-backref" href="#id6">Getting Accepted</a></h2>
<p>We’re frequently asked how a student can improve their chances of getting
accepted by an organization. GSoC is a very <strong>self-driven</strong> program, especially
if your mentor is a volunteer. Being a self starter can be a boon for being accepted.</p>
<ul class="simple">
<li>Find a project you’re interested in doing and talk to the mentor / community responsible.</li>
<li>Ensure you have a development environment set-up (for example, make sure you
can build Firefox, understand what needs to be done after making changes, etc.).</li>
<li>Figure out where resources are for the project (i.e. Where are technical
discussions? Where can you find documentation?)</li>
<li>Find minor bugs related to the project you’re interested in and work on
fixing them. (This might be more difficult if your project would add an
entirely new piece of code!)</li>
<li>Get used to the way the community works and functions.</li>
</ul>
<div class="section" id="building-an-application">
<h3><a class="toc-backref" href="#id7">Building an Application</a></h3>
<p>The above should help feed into your application. In particular, it should help
to build a realistic schedule for your application. (Scheduling is difficult
even for seasoned engineers, but the above work should help make a more accurate schedule.)</p>
<ul class="simple">
<li>Develop a plan for splitting your work into discrete chunks that can be
merged separately. Smaller changes are easier to review, can (generally)
land faster, and are easier to test. Of course, each project is different,
but work with your (potential) mentor.</li>
<li>Estimate the amount of work each part of the project will take (you’ll have
some experience in the code base already, leverage that).</li>
<li>Estimate how long reviews will take. (All code at Mozilla must go through a
review process before it is merged into a product. You might even need
multiple reviewers if your code touches many different parts of a codebase!
Different people review code on different schedules, etc.)</li>
<li>Understand how quickly your changes would be merged and released. (How
quickly will your code hit a larger audience?)</li>
<li>Understand the pieces <strong>besides</strong> code that you might be asked to do. Will
you need to add/update documentation? Add new tests? Keep an old <span class="caps">API</span> intact?</li>
</ul>
</div>
</div>
<div class="section" id="summary">
<h2><a class="toc-backref" href="#id8">Summary</a></h2>
<p>This is just a few ideas of what I look for when reviewing a Google Summer of
Code application. To repeat, try to understand an organization’s members, get
involved and gain experience, try to build an accurate schedule. An additional
thing I’d like to add is to <a class="reference external" href="http://patrick.cloke.us/posts/2014/07/09/mentoring-and-time/">respect your mentors time</a>, especially for GSoC,
many mentors are volunteers! You’ll likely be working on their project <strong>more</strong>
than they do during GSoC!</p>
<p>Please let me know if you have any additions or comments! If you have specific
questions that pertain to your application at Mozilla, please
<a class="reference external" href="http://patrick.cloke.us/pages/contact.html">contact</a> me individually.</p>
</div>
IRC Client Usage Share on moznet2015-09-23T17:07:00-04:002015-09-24T07:18:00-04:00Patrick Cloketag:patrick.cloke.us,2015-09-23:/posts/2015/09/23/irc-client-usage-share-on-moznet/
<div class="section" id="background">
<h2><a class="toc-backref" href="#id13">Background</a></h2>
<p>The usage share of <span class="caps">IRC</span> clients has always been something I’m interested in. This
is partially to see how many people are using <a class="reference external" href="http://instantbird.com/">Instantbird</a> or <a class="reference external" href="https://www.mozilla.org/en-US/thunderbird/">Mozilla
Thunderbird</a> for <span class="caps">IRC</span> (as I’ve written much of the <span class="caps">IRC</span> code for those clients).
<a class="reference external" href="http://en.wikipedia.org/wiki/Usage_share_of_web_browsers">Usage share of browsers</a> is quite a …</p></div>
<div class="section" id="background">
<h2><a class="toc-backref" href="#id13">Background</a></h2>
<p>The usage share of <span class="caps">IRC</span> clients has always been something I’m interested in. This
is partially to see how many people are using <a class="reference external" href="http://instantbird.com/">Instantbird</a> or <a class="reference external" href="https://www.mozilla.org/en-US/thunderbird/">Mozilla
Thunderbird</a> for <span class="caps">IRC</span> (as I’ve written much of the <span class="caps">IRC</span> code for those clients).
<a class="reference external" href="http://en.wikipedia.org/wiki/Usage_share_of_web_browsers">Usage share of browsers</a> is quite a researched topic, but I’ve never come
across this data for <span class="caps">IRC</span>. Most <a class="footnote-reference" href="#id7" id="id1">[1]</a> <span class="caps">IRC</span> clients implement a part of the <a class="reference external" href="http://www.irchelp.org/irchelp/rfc/ctcpspec.html"><span class="caps">CTCP</span></a>
protocol which allows a client to query another client for their version.
Thinking of this as a <a class="reference external" href="http://en.wikipedia.org/wiki/User_agent">user agent</a> is probably a good analogue. I don’t think
this would imply that there is much of an issue with <a class="reference external" href="http://en.wikipedia.org/wiki/Usage_share_of_web_browsers#User_agent_spoofing">user agent spoofing</a>, as
there would be for web browser statistics since (as far as I know), no one uses
the version response to do capability negotiation. It also is not used by servers.</p>
</div>
<div class="section" id="technical-bits">
<h2><a class="toc-backref" href="#id14">Technical Bits</a></h2>
<p>So how’d we do this? I wrote an <a class="reference external" href="https://bitbucket.org/clokep/irc-extras/src/tip/stats/">extension</a> for Instantbird which handled both
the backend and the display of the results. I think that this really showcases
the extensibility of Instantbird and the effort we’ve put into ensuring their
are generic APIs available for developers. In particular this uses the <a class="reference external" href="http://dxr.mozilla.org/comm-central/source/chat/protocols/irc/ircHandlers.jsm"><span class="caps">IRC</span>
handler <span class="caps">API</span></a> and the <a class="reference external" href="http://hg.mozilla.org/comm-central/file/dbab5a531594/im/content/tabbrowser.xml#l432">add panel <span class="caps">API</span></a> (added by <a class="reference external" href="http://blog.nhnt11.com/">one of our GSoC students</a> a
couple of years ago.)</p>
<p>Anyway, at the actual protocol level, I simply send a <tt class="docutils literal"><span class="caps">CTCP</span> <span class="caps">VERSION</span></tt> query to
each user I know of on the <span class="caps">IRC</span> network (based on who is in the same channels as
me) and then record the responses. I tried to be nice to the network here and
rate-limited myself to 1 query per second. No one complained after ~100 queries
and I didn’t seem to have any <tt class="docutils literal">fakelag</tt> issues. I then dumped the results and
made a pretty(-ish) plot of this. (If you’re a network administrator reading
this and think this is insane, I’d be very curious to hear a better way to do this!)</p>
</div>
<div class="section" id="results">
<h2><a class="toc-backref" href="#id15">Results</a></h2>
<p>In order to get some results I hooked my client up to <a class="reference external" href="https://wiki.mozilla.org/IRC">moznet</a> on July 23rd,
2015 and let it run on many channels (pretty much anything with more than 20
users) for a few hours <a class="footnote-reference" href="#id8" id="id2">[2]</a>. I was in Europe and started early in the morning
and let it run through the evening, so it should encompass some “normal” usage
by Mozillians. I would expect a bit of skew in these results toward
Mozilla-esque <span class="caps">IRC</span> clients (Instantbird, Thunderbird and <a class="reference external" href="http://chatzilla.hacksrus.com/">ChatZilla</a>).</p>
<p>Of course these numbers are just a single sampling and I have no idea how much
variance there is day-to-day or over time, but I found the (un-scientific)
results to be interesting!</p>
<div class="section" id="responses">
<h3><a class="toc-backref" href="#id16">Responses</a></h3>
<p>The first thing I noticed is the large amount of information some version
responses gave (in no particular order):</p>
<ul class="simple">
<li><tt class="docutils literal">KVIrc 4.3.1 <span class="pre">svn-6313</span> 'Aria' 20120701 - build <span class="pre">2013-02-14</span> 17:47:33 <span class="caps">UTC</span> - Windows 7 Ultimate (x64) Service Pack 1 (Build 7601)</tt></li>
<li><tt class="docutils literal">xchat 2.8.8 Linux <span class="pre">3.17.4-1-<span class="caps">ARCH</span></span> [x86_64/2.90GHz/<span class="caps">SMP</span>]</tt></li>
<li><tt class="docutils literal">HexChat 2.10.1 [x64] / Windows 7 <span class="caps">SP1</span> [4.09GHz]</tt></li>
</ul>
<p>I don’t understand the rationale behind sharing a user’s operating system and
<span class="caps">CPU</span> speed. Most clients responded with a simple <tt class="docutils literal">&lt;software&gt; &lt;version number&gt;</tt>,
although quite a few also include a <span class="caps">URL</span>.</p>
<p>Additionally, some bouncers respond in weird ways which might skew the results:</p>
<ul class="simple">
<li><span class="caps">ZNC</span> responds only if there are no clients connected <span class="caps">OR</span>, depending on the
version, it appends itself to the client response. <a class="footnote-reference" href="#id9" id="id3">[3]</a></li>
<li>bip responds with it’s own version if no one is connected <span class="caps">OR</span> the version of
all connected clients. <a class="footnote-reference" href="#id10" id="id4">[4]</a></li>
</ul>
<p>Lastly, some clients just don’t respond (or respond with an empty string). The
results below aren’t really a count of “users”, but a count of “clients” where
some users might be counted multiple times.</p>
</div>
<div class="section" id="client-summary">
<h3><a class="toc-backref" href="#id17">Client Summary</a></h3>
<p>Initially I visualized the data by plotting it two serparate ways: first by
showing the count of each version response and then grouping by “client family”.
The first plot had too many columns to reasonably show in this post: thus I’ve
only included a plot of the client families <a class="footnote-reference" href="#id11" id="id5">[5]</a>. There are two plots, the first
shows a subset of the data by cutting the tail (arbitrarily including families
with at least 10 users).</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p>A “client family” is counting all versions of the same client together. This
was calculated by taking the text up to the first whitespace or digit and
converting to lowercase:</p>
<div class="last"><div class="highlight"><pre><span></span><span class="nx">family</span> <span class="o">=</span> <span class="nx">version</span><span class="p">.</span><span class="nx">split</span><span class="p">(</span><span class="sr">/[\s\d]/</span><span class="p">)[</span><span class="mi">0</span><span class="p">].</span><span class="nx">toLowerCase</span><span class="p">()</span>
</pre></div>
</div></div>
<style type="text/css">
#family-all-count, #family-count {
width: 100%;
height: 300px;
}
</style>
<script src="/js/flotr2.min.js" type="text/javascript"></script>
<script type="text/javascript">
function createPlot(aId, aTitle, aData) {
// Put the data in order from biggest to smallest.
var data = []
for (var d of aData.entries())
data.push(d);
data.sort(function(a, b) { return a[1] < b[1]; });
// Re-arrange the data to be plotted into two arrays: one is a set of points
// of x-index to value, the other is x-index to label.
var labels = [];
for (var i = 0; i < data.length; i++) {
// Sometimes the labels are stupid long.
labels[i] = [i, (data[i][0] || "undefined").slice(0, 25)];
data[i] = [i, data[i][1]];
}
var options = {
title: aTitle,
HtmlText: false,
bars: {
show: true,
shadowSize: 0,
barWidth: 0.5
},
mouse: {
track: true,
relative: true
},
xaxis: {
ticks: labels,
labelsAngle: 90
},
yaxis: {
min: 0,
autoscaleMargin: 1,
title: "Count",
titleAngle: 90
}
};
var plot = document.getElementById(aId);
Flotr.draw(plot, [data], options);
}
document.addEventListener("DOMContentLoaded", function() {
var raw_data = [["instantbird", 21], ["thunderbird", 39], ["xchat", 77], ["colloquy", 33], ["limechat", 61], ["irssi", 204], ["irccloud", 520], ["znc", 161], ["icedove", 3], ["chatzilla", 59], ["bip-", 11], ["hexchat", 61], ["mozbot", 3], ["miranda", 6], ["mirc", 31], ["textual", 44], ["weechat", 76], ["kvirc", 6], ["purple", 70], ["x-chat", 8], ["xchat-wdk", 1], ["dircproxy", 1], ["konversation", 12], ["quassel", 69], ["linkinus", 3], ["\x02erc\x02", 6], ["leroooooy", 1], ["elitebnc", 1], ["fu,", 1], ["anope-", 1], [">", 2], ["telepathy-idle", 3], ["rcirc", 3], ["mrgiggles:", 1], ["ircii", 1], ["http://www.mibbit.com", 4], ["shout", 7], ["yaaic", 2], ["karen", 1], ["", 3], ["sceners", 1], ["uberscript", 1], ["tiarra:", 3], ["snak", 1], ["wuunyan", 1], ["adiirc", 1], ["n/a", 1], ["pircbotx", 3], ["none", 1], ["yes", 1], ["nettalk", 1], ["riece/", 1], ["unknown", 1], ["version", 1], ["circ", 3], ["request", 1], ["forrest,", 1], ["trillian", 1], ["\x03", 2], ["smuxi-frontend-gnome", 1], ["some", 1], ["\x02\x03", 1], ["oh", 1], ["\u201Cnever", 1], ["this", 1], ["nochat", 1], ["wee", 1], ["foadirc", 1], ["smuxi-server", 1], ["aperture", 1], ["internet", 1], ["supybot", 1], ["ejabberd", 2], ["dxirc", 1], ["ircle", 1], ["infobot", 1], ["exovenom", 1], ["nsa-irc", 1]];
var families = new Map();
for (var data of raw_data)
families.set(data[0], data[1]);
// Count the totals, used in reporting not actually displayed.
var total = 0;
for (var family of families.entries())
total += family[1];
// Update the plots.
createPlot("family-all-count",
"All Families (Total: " + total + ")", families);
// Remove all families that have less than 10 hits.
for (var family of families.entries()) {
if (family[1] < 10) {
families.delete(family[0])
total -= family[1];
}
}
createPlot("family-count",
"Families with at Least 10 Users (Total: " + total + ")",
families);
});
</script>
<div id="family-count"></div>
<div id="family-all-count"></div></div>
<div class="section" id="points-of-note">
<h3><a class="toc-backref" href="#id18">Points of Note</a></h3>
<p>I have to admit that I was fairly shocked by the number of IRCCloud users as I
found it pretty unusable when messing with it <a class="footnote-reference" href="#id12" id="id6">[6]</a>. I suspect it being an 'easy'
bouncer draws many people to it. The bouncer-like software (IRCCloud, <span class="caps">ZNC</span>, bip)
represents almost half of the users surveyed (692 / 1549 ≈ 45%)!</p>
<p>I'm surprised so many people are using <tt class="docutils literal">purple</tt> as their <span class="caps">IRC</span> client, as the
support there is really barebones. (It makes sense if you're already using
Pidgin and don't want another client.) I think we've made a significant amount
of improvements in Instantbird's <span class="caps">IRC</span> support to make it simpler for a user to
get started (give it a try if you haven't!).</p>
<p>The last thing I'll note is that, when taken together, Instantbird, Thunderbird,
and Icedove, come in as part of the top 10 (63 users, right before ChatZilla)!
There's a lot of great clients out there and I'm happy to say I've helped to
create one of the more popular ones (on moznet, at least!).</p>
<p>Let me know if I missed a great insight!</p>
<table class="docutils footnote" frame="void" id="id7" rules="none">
<colgroup><col class="label"></col><col></col></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id1">[1]</a></td><td>"Most" is a wild accusation here. But...from the numbers I've seen, it
seems like a reasonable statement.</td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id8" rules="none">
<colgroup><col class="label"></col><col></col></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id2">[2]</a></td><td>While running this I had a few users question what I was doing over
private messages or in a channel. I'm <em>shocked</em> that clients bother
their users by showing them they received a <tt class="docutils literal"><span class="caps">VERSION</span></tt> request. (Most)
users just won't care! Why show that low-level of the protocol?!</td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id9" rules="none">
<colgroup><col class="label"></col><col></col></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id3">[3]</a></td><td>As corrected by DarthGandalf on <span class="caps">IRC</span>: "Before 1.6, <span class="caps">ZNC</span> version is
returned iff no clients are connected. After 1.6, it's also appended to
the client's response (but still one line per connected client)"</td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id10" rules="none">
<colgroup><col class="label"></col><col></col></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id4">[4]</a></td><td><a class="reference external" href="https://twitter.com/dioxmat/status/646815252898803712">Source</a>, have
I mentioned yet in this article that I hate bouncers?</td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id11" rules="none">
<colgroup><col class="label"></col><col></col></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id5">[5]</a></td><td>I stole the code to plot this from the <a class="reference external" href="https://bitbucket.org/clokep/irc-extras/src/41a9572caf957ab8ae3969a145834bcd5be74abe/stats/content/ircStats.js?at=default#cl-55">plotting code</a> in the extension
I wrote for this. When actually using that extension, something similar
to this appears as a tab and refreshes as results come in. It uses
<a class="reference external" href="http://humblesoftware.com/flotr2/">Flotr2</a> to do the plotting in JavaScript, I've been pretty happy with
it.</td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id12" rules="none">
<colgroup><col class="label"></col><col></col></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id6">[6]</a></td><td>Although in retrospect I shouldn't be since Mozilla runs their own
<a class="reference external" href="https://irccloud.mozilla.com/">IRCCloud instance</a>.</td></tr>
</tbody>
</table>
</div>
</div>
Boston Python: Twisted async networking framework2015-08-28T08:42:00-04:002015-08-28T08:42:00-04:00Patrick Cloketag:patrick.cloke.us,2015-08-28:/posts/2015/08/28/boston-python-twisted-talk/<p>Yesterday, <a class="reference external" href="http://stephendicato.com/">Stephen DiCato</a> and I gave a talk for <a class="reference external" href="http://www.meetup.com/bostonpython/">Boston Python</a> titled:
<a class="reference external" href="http://www.meetup.com/bostonpython/events/221406450/">Twisted async networking framework</a>. It was an introduction to intermediate
level talk about using the <a class="reference external" href="https://twistedmatrix.com/">Twisted networking framework</a> based on our
experiences at <a class="reference external" href="https://percipientnetworks.com/">Percipient Networks</a>.</p>
<p>The talk, available <a class="reference external" href="https://github.com/percipient/talks/tree/master/boston_python_08_27_2015">on our GitHub</a> (<a class="reference external" href="https://github.com/percipient/talks/raw/master/boston_python_08_27_2015/boston_python_08_27_2015.pdf"><span class="caps">PDF</span></a>) covered a few basic&nbsp;topics:</p>
<ol class="arabic simple">
<li>What …</li></ol><p>Yesterday, <a class="reference external" href="http://stephendicato.com/">Stephen DiCato</a> and I gave a talk for <a class="reference external" href="http://www.meetup.com/bostonpython/">Boston Python</a> titled:
<a class="reference external" href="http://www.meetup.com/bostonpython/events/221406450/">Twisted async networking framework</a>. It was an introduction to intermediate
level talk about using the <a class="reference external" href="https://twistedmatrix.com/">Twisted networking framework</a> based on our
experiences at <a class="reference external" href="https://percipientnetworks.com/">Percipient Networks</a>.</p>
<p>The talk, available <a class="reference external" href="https://github.com/percipient/talks/tree/master/boston_python_08_27_2015">on our GitHub</a> (<a class="reference external" href="https://github.com/percipient/talks/raw/master/boston_python_08_27_2015/boston_python_08_27_2015.pdf"><span class="caps">PDF</span></a>) covered a few basic&nbsp;topics:</p>
<ol class="arabic simple">
<li>What is asynchronous&nbsp;programming?</li>
<li>What is <a class="reference external" href="https://twistedmatrix.com/">Twisted</a>?</li>
<li>When/why to use&nbsp;Twisted?</li>
<li>What is the event loop&nbsp;(reactor)?</li>
<li>What are <a class="reference external" href="https://twistedmatrix.com/documents/current/core/howto/defer.html">Deferreds</a> and how do you use&nbsp;them?</li>
<li>What are protocols (and related objects) and how do you use&nbsp;them?</li>
</ol>
<p>Additionally there was a &#8216;bonus&#8217; section: Using Twisted to build systems <span class="amp">&amp;</span>&nbsp;services.</p>
<p>We used an example of a very simple chat server (NetCatChat: where the official
client is netcat) to demonstrate these principles. All of our (working!) demo
code is included in the <a class="reference external" href="https://github.com/percipient/talks/tree/master/boston_python_08_27_2015">repository</a>.</p>
<p>There was a great turn out (almost 100 people showed up) and I greatly enjoyed
the experience. Thanks to everyone who came, the sponsors for the night,
<a class="reference external" href="http://www.meetup.com/bostonpython/">Boston Python</a> for setting this up, and Stephen for co-presenting! Please let
us know if you have any questions or&nbsp;comments.</p>
New Position in Cyber Security at Percipient Networks2015-05-30T13:59:00-04:002015-05-30T13:59:00-04:00Patrick Cloketag:patrick.cloke.us,2015-05-30:/posts/2015/05/30/new-position-in-cyber-security-at-percipient-networks/<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If you&#8217;re hitting this from <a class="reference external" href="http://planet.mozilla.org/">planet mozilla</a>, this doesn&#8217;t mean I&#8217;m leaving
the Mozilla Community since I&#8217;m not (nor was I ever) a Mozilla&nbsp;employee.</p>
</div>
<p>After working for <a class="reference external" href="https://www.mitre.org">The <span class="caps">MITRE</span> Corporation</a> for a bit over four years, I left a
few weeks ago to begin …</p><div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If you&#8217;re hitting this from <a class="reference external" href="http://planet.mozilla.org/">planet mozilla</a>, this doesn&#8217;t mean I&#8217;m leaving
the Mozilla Community since I&#8217;m not (nor was I ever) a Mozilla&nbsp;employee.</p>
</div>
<p>After working for <a class="reference external" href="https://www.mitre.org">The <span class="caps">MITRE</span> Corporation</a> for a bit over four years, I left a
few weeks ago to begin work at a cyber security start-up: <a class="reference external" href="https://percipientnetworks.com/">Percipient
Networks</a>. Currently our main product is <a class="reference external" href="https://strongarm.percipientnetworks.com"><span class="caps">STRONGARM</span></a>: an intelligent <span class="caps">DNS</span>
blackhole. Usually <span class="caps">DNS</span> blackholes are set-up to block known bad domains by
sending requests for those domains to a non-routable or localhost. <span class="caps">STRONGARM</span>
redirects that traffic for identification and analysis. You could
<a class="reference external" href="https://strongarm.percipientnetworks.com">give it a try</a> and let us know of any feedback you might have! Much of my
involvement has been in the <a class="reference external" href="https://strongarm.percipientnetworks.com/help/tech/">design and creation of the blackhole</a>, including
writing protocol parsers for both standard protocols and&nbsp;malware.</p>
<p>So far, I&#8217;ve been greatly enjoying my new position. There&#8217;s been a renewed focus
on technical work, while being in a position to greatly influence both <span class="caps">STRONGARM</span>
and Percipient Networks. My average day involves many more activities now,
including technical work: reverse engineering, reviewing/writing code, or
reading RFCs; as well as other work: mentoring <a class="footnote-reference" href="#id4" id="id1">[1]</a>, user support, writing
documentation, and putting desks together <a class="footnote-reference" href="#id5" id="id2">[2]</a>. I&#8217;ve been thoroughly enjoying the
varied&nbsp;activities!</p>
<p>Shifting software stacks has also been nice. I&#8217;m now writing mostly Python code,
instead of mostly <span class="caps">MATLAB</span>, Java and C/C++ <a class="footnote-reference" href="#id6" id="id3">[3]</a>. It has been great how many ready
to use packages are available for Python! I&#8217;ve been very impressed with the
ecosystem, and been encouraged to feed back into the open-source community,
where&nbsp;appropriate.</p>
<table class="docutils footnote" frame="void" id="id4" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id1">[1]</a></td><td>We currently have four interns, so there&#8217;s always some mentoring to do!</td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id5" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id2">[2]</a></td><td>We got a delivery of 10 <a class="reference external" href="http://www.ergodepot.com/Jarvis_Desk_s/566.htm">desks</a> a couple of weeks ago and spent the
evening putting them together.</td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id6" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id3">[3]</a></td><td>I originally titled this post &#8220;xx days since my last semi-colon!&#8221;, since
that has gone from being a common key press of mine to a rare one.
Although now I just get confused when switching between Python and
JavaScript. Since semicolons are optional in both, but encouraged in
JavaScript and discouraged in Python&#8230;</td></tr>
</tbody>
</table>
Google Summer of Code 2015 Project Ideas for Mozilla2015-01-21T13:18:00-05:002015-01-21T13:18:00-05:00Patrick Cloketag:patrick.cloke.us,2015-01-21:/posts/2015/01/21/google-summer-of-code-2015-project-ideas-for-mozilla/<p>As <a class="reference external" href="http://blog.queze.net/post/2015/01/22/Project-ideas-wanted-for-Summer-of-Code-2015">Florian announced</a> last Thursday, <strong>now</strong> is the time to brainstorm and
discuss project ideas for <a class="reference external" href="http://google-opensource.blogspot.fr/2014/10/google-summer-of-code-2015-and-google.html">Google Summer of Code 2015</a>. Mozilla has
participated in every previous Google Summer of Code (GSoC), and hopes to
participate again this year! In order to help ensure we&#8217;re selected, we need
project …</p><p>As <a class="reference external" href="http://blog.queze.net/post/2015/01/22/Project-ideas-wanted-for-Summer-of-Code-2015">Florian announced</a> last Thursday, <strong>now</strong> is the time to brainstorm and
discuss project ideas for <a class="reference external" href="http://google-opensource.blogspot.fr/2014/10/google-summer-of-code-2015-and-google.html">Google Summer of Code 2015</a>. Mozilla has
participated in every previous Google Summer of Code (GSoC), and hopes to
participate again this year! In order to help ensure we&#8217;re selected, we need
project ideas before February 20th,&nbsp;2015!</p>
<p>There are always projects that we&#8217;re passionate about, but keep getting pushed
down our ever growing to-do lists. GSoC is a great opportunity to introduce a
new member to your team, and have a student work full time on a project for 3&nbsp;months.</p>
<dl class="docutils">
<dt>What makes a good&nbsp;project?</dt>
<dd><ul class="first last simple">
<li>A project you&#8217;re passionate about and has a clear&nbsp;mentor.</li>
<li>It should take (<em>a student</em>) roughly 3 months to design, code, test,
review,&nbsp;etc.</li>
<li>It should not be in the critical path to your next&nbsp;release/milestone.</li>
<li>Is related to any Mozilla project (e.g. Firefox, Firefox <span class="caps">OS</span>, Thunderbird,
Instantbird, SeaMonkey, Bugzilla, l10n, <span class="caps">NSS</span>, <span class="caps">QA</span>, <span class="caps">SUMO</span>, Rust, and many&nbsp;more!)</li>
</ul>
</dd>
</dl>
<p>Please add ideas you might have to the <a class="reference external" href="https://wiki.mozilla.org/Community:SummerOfCode15:Brainstorming">brainstorming page</a>, eventually these
ideas will move to the <a class="reference external" href="https://wiki.mozilla.org/Community:SummerOfCode15">formal ideas page</a>. Please ensure you read the
directions at the top of the&nbsp;page.</p>
<p>I&#8217;d also like to thank <a class="reference external" href="http://blog.gerv.net/">Gerv</a> for doing an awesome job for the past 10 years as
the organization administrator. He is now passing the reins off to Florian and
I, who are the new points of contact for GSoC at Mozilla. If you have any
questions about GSoC, please check the <a class="reference external" href="https://www.google-melange.com/gsoc/document/show/gsoc_program/google/gsoc2015/help_page"><span class="caps">FAQ</span></a> and, if it is still not answered,
please contact Florian or I&nbsp;directly.</p>
<div class="section" id="for-students">
<h2>For&nbsp;Students</h2>
<p>The application period for students is March 16th, 2015 to March 27th, 2015. It
is not too soon to start discussing ideas with a potential mentor/community,
however. If you have an idea of what you&#8217;d like to work on, feel free to seek
out that area of the community, introduce yourself and maybe find a <a class="reference external" href="http://www.joshmatthews.net/bugsahoy/">mentored
bug</a> to work&nbsp;on.</p>
</div>
Thunderbird Summit 20142014-11-14T18:37:00-05:002014-11-14T18:37:00-05:00Patrick Cloketag:patrick.cloke.us,2014-11-14:/posts/2014/11/14/thunderbird-summit-2014/<p>Last month (Oct. 15th to Oct. 18th, to be precise), <a class="reference external" href="https://wiki.mozilla.org/Thunderbird:Summit_2014#Invited_Attendees">twenty volunteers</a>
descended on Mozilla&#8217;s Toronto office to discuss <a class="reference external" href="https://www.mozilla.org/en-US/thunderbird/">Mozilla Thunderbird</a>. This
included Mozilla employees, Thunderbird contributors of all sorts (developers,
user interface designers, add-on reviewers), Lightning contributors, and
chat/<a class="reference external" href="http://instantbird.com/">Instantbird</a>&nbsp;contributors.</p>
<!-- -->
<blockquote class="center">
<a class="reference external image-reference" href="http://patrick.cloke.us/images/chat-tb-summit/IMG_6516.jpg"><img alt="The entire group of volunteers." src="/thumbnails/chat-tb-summit/IMG_6516_small.jpg" /></a>
</blockquote>
<p>It was great to spend some quality …</p><p>Last month (Oct. 15th to Oct. 18th, to be precise), <a class="reference external" href="https://wiki.mozilla.org/Thunderbird:Summit_2014#Invited_Attendees">twenty volunteers</a>
descended on Mozilla&#8217;s Toronto office to discuss <a class="reference external" href="https://www.mozilla.org/en-US/thunderbird/">Mozilla Thunderbird</a>. This
included Mozilla employees, Thunderbird contributors of all sorts (developers,
user interface designers, add-on reviewers), Lightning contributors, and
chat/<a class="reference external" href="http://instantbird.com/">Instantbird</a>&nbsp;contributors.</p>
<!-- -->
<blockquote class="center">
<a class="reference external image-reference" href="http://patrick.cloke.us/images/chat-tb-summit/IMG_6516.jpg"><img alt="The entire group of volunteers." src="/thumbnails/chat-tb-summit/IMG_6516_small.jpg" /></a>
</blockquote>
<p>It was great to spend some quality hacking time with <a class="reference external" href="http://blog.queze.net/">Florian</a> and to meet
<a class="reference external" href="http://blog.nhnt11.com/">Nihanth</a>, both Instantbird guys who I talk to most days on <span class="caps">IRC</span>! I also had the
pleasure of re-meeting a few people from the Mozilla Summit last year (I
attended in Toronto) and to meet some brand new&nbsp;people!</p>
<!-- -->
<blockquote class="center">
<a class="reference external image-reference" href="http://patrick.cloke.us/images/chat-tb-summit/IMG_6408.jpg"><img alt="Nihanth hacking." src="/thumbnails/chat-tb-summit/IMG_6408_small.jpg" /></a>
<a class="reference external image-reference" href="http://patrick.cloke.us/images/chat-tb-summit/IMG_6426.jpg"><img alt="The chat contributors: me, Florian and Nihanth." src="/thumbnails/chat-tb-summit/IMG_6426_small.jpg" /></a>
<a class="reference external image-reference" href="http://patrick.cloke.us/images/chat-tb-summit/IMG_6508.jpg"><img alt="Daniel joining us over Vidyo." src="/thumbnails/chat-tb-summit/IMG_6508_small.jpg" /></a>
<p>A few pictures of the chat contributors: Nihanth; me, Florian and Nihanth;
and Daniel (dialing&nbsp;in!)</p>
</blockquote>
<p>It was really nice to actually sit down for a few days and work on
Instantbird/Thunderbird without the distractions of &#8220;real life&#8221;. I,
unfortunately, spent the first day fixing an Instantbird <a class="reference external" href="http://hg.mozilla.org/comm-central/rev/05bb70d5b231">bustage</a> (from a
mozilla-central change that removed some <span class="caps">NSS</span> symbols&#8230;why, I have no idea). But
after that, we got some really exciting work done! We started cleaning up and
finalizing some patches from Google Summer of Code 2014 to add <a class="reference external" href="http://www.webrtc.org/">WebRTC</a> support
to <a class="reference external" href="http://xmpp.org/"><span class="caps">XMPP</span></a>! You can check out the progress in <a class="reference external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1018060">bug 1018060</a>.</p>
<!-- -->
<blockquote class="center">
<a class="reference external image-reference" href="http://patrick.cloke.us/images/chat-tb-summit/IMG_6394.jpg"><img alt="First working call over Instantbird WebRTC." src="/thumbnails/chat-tb-summit/IMG_6394_small.jpg" /></a>
<a class="reference external image-reference" href="http://patrick.cloke.us/images/chat-tb-summit/webrtc_preview.jpg"><img alt="Screenshot of first working call over Instantbird WebRTC." src="/thumbnails/chat-tb-summit/webrtc_preview_small.jpg" /></a>
<p>First working call over Instantbird&nbsp;WebRTC.</p>
</blockquote>
<!-- -->
<blockquote class="center">
<a class="reference external image-reference" href="http://patrick.cloke.us/images/chat-tb-summit/IMG_6594.jpg"><img alt="Eating some poutine!" src="/thumbnails/chat-tb-summit/IMG_6594_small.jpg" /></a>
<p>Other highlights of the trip include eating the &#8220;Canadian delicacy&#8221; of
poutine (with pulled pork on&nbsp;it)!</p>
</blockquote>
How I Got Involved in Mozilla2014-10-07T09:31:00-04:002014-10-07T09:31:00-04:00Patrick Cloketag:patrick.cloke.us,2014-10-07:/posts/2014/10/07/how-i-got-involved-in-mozilla/<p>This is discussed very briefly on my <a class="reference external" href="http://patrick.cloke.us/pages/about.html">about page</a>, but I figured it could use a
bit of a longer discussion. I generally consider myself to have joined the
<a class="reference external" href="https://www.mozilla.org/">Mozilla</a> community in ~2006. I know that I was using Mozilla Firefox, Mozilla
Thunderbird, <em>and</em> Mozilla Sunbird way before that (probably …</p><p>This is discussed very briefly on my <a class="reference external" href="http://patrick.cloke.us/pages/about.html">about page</a>, but I figured it could use a
bit of a longer discussion. I generally consider myself to have joined the
<a class="reference external" href="https://www.mozilla.org/">Mozilla</a> community in ~2006. I know that I was using Mozilla Firefox, Mozilla
Thunderbird, <em>and</em> Mozilla Sunbird way before that (probably since ~2004, which
is when I built my own computer). But I was just an enthusiast then, running
beta builds, then alpha and eventually nightly builds. (This was way back when
things were more dangerous to run: Minefield and&nbsp;Shredder.)</p>
<p>Anyway, back to 2006&#8230;I initially got involved in a more technical fashion by
writing extensions (or maybe it was <a class="reference external" href="http://www.greasespot.net/">GreaseMonkey</a> scripts). I don&#8217;t really have
anyway to prove this though &#8212; I don&#8217;t seem to have any of that code. (This was
before widespread distributed version control.) Anyway, let&#8217;s just assume this
2006 date is&nbsp;correct.</p>
<p>My <a class="reference external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=468020">first patch</a> was in 2008 to move a function from the <a class="reference external" href="https://addons.mozilla.org/en-us/thunderbird/addon/provider-for-google-calendar/">Provider for Google
Calendar</a> to the calendar core so that I could use it in <a class="reference external" href="https://bitbucket.org/clokep/thundershows">Thundershows</a>: a
calendar provider for <span class="caps">TV</span> shows <a class="footnote-reference" href="#id6" id="id1">[1]</a> <a class="footnote-reference" href="#id7" id="id2">[2]</a>. (As far as I know, I&#8217;m one of a
handful of people to actually implement a <a class="reference external" href="https://wiki.mozilla.org/Calendar:Creating_an_Extension#Provider_Extensions">calendar provider</a>.) I found the
calendar project much easier to get involved in than other aspects of Mozilla
since it was so much smaller. (I also <a class="reference external" href="https://bitbucket.org/clokep/microblog-mailnews">toyed</a> with adding an entire new protocol
to Thunderbird, which <a class="reference external" href="http://mesquilla.com/">R Kent James</a> has <a class="reference external" href="https://bitbucket.org/rkentjames/skinkglue">now done</a> successfully! <a class="footnote-reference" href="#id8" id="id3">[3]</a> <a class="footnote-reference" href="#id9" id="id4">[4]</a>)</p>
<p>I then came across <a class="reference external" href="http://www.instantbird.com/">Instantbird</a> in ~2008 (sometime in the Instantbird 0.1 era).
I thought this was great &#8212; Mozilla was finally making an instant messaging
client! Well, I was kind of right&#8230;Instantbird is not an official Mozilla
project, but it was exactly what I wanted! The guys (mostly <a class="reference external" href="http://blog.queze.net/">Florian Quèze</a>) in
the <a class="reference external" href="irc://irc.mozilla.org/#instantbird">#instantbird</a> <span class="caps">IRC</span> channel were awesome: kind, patient, helpful, and
welcoming. They were the ones that really introduced me into the Mozilla way of
doing things. I fixed my first bug for Instantbird in <a class="reference external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=953935">2010</a> and haven&#8217;t stopped
since! I&#8217;ve since added <a class="reference external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=953944"><span class="caps">IRC</span> support</a> via JavaScript (instead of libpurple) and
am now one of the lead developers. I&#8217;ve mentored Google Summer of Code students
twice (2013 and 2014), contribute to Thunderbird and am a peer of the <a class="reference external" href="https://wiki.mozilla.org/Modules/Chat">chat
code</a> shared between Instantbird and Thunderbird. (I do also occassionally
contribute to other projects. <a class="footnote-reference" href="#id10" id="id5">[5]</a>)</p>
<table class="docutils footnote" frame="void" id="id6" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id1">[1]</a></td><td>This was my first project to really have other users, I had people filing
bugs, asking for new features, etc. It was great! I even had someone
(years later) tell me in <a class="reference external" href="irc://irc.mozilla.org/#instantbird">#instantbird</a> that they had loved
Thundershows!</td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id7" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id2">[2]</a></td><td>My <a class="reference external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=469477">second bug</a> dealt with the same set of code and had tests committed
(by me) over 5 years after the initial patch. Oops!</td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id8" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id3">[3]</a></td><td>My work was based off of some experiments <a class="reference external" href="http://quetzalcoatal.blogspot.com/">Joshua Cranmer</a> did to add
support for <a class="reference external" href="http://quetzalcoatal.blogspot.com/2010/01/developing-new-account-types-part-0.html">web forums</a> to Thunderbird. After all this time, I still
want that extension.</td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id9" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id4">[4]</a></td><td>Oh, also rkent did <a class="reference external" href="http://mesquilla.com/extensions/tweequilla/"><span class="caps">EXACTLY</span></a> what I wanted years later: which is add
Twitter to Thunderbird.</td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id10" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id5">[5]</a></td><td>But not Firefox. After seven years (and over 1800 commits), I&#8217;ve never
fixed a bug in Firefox; although I have had <a class="reference external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=884319">code</a> committed to
<tt class="docutils literal"><span class="pre">mozilla-central</span></tt>.</td></tr>
</tbody>
</table>
Adding an Auxiliary Audio Input to a 2005 Subaru Outback2014-08-30T17:34:00-04:002014-08-30T17:34:00-04:00Patrick Cloketag:patrick.cloke.us,2014-08-30:/posts/2014/08/30/adding-an-auxiliary-audio-input-to-a-2005-subaru-outback/<p>I own a <a class="reference external" href="http://en.wikipedia.org/wiki/Subaru_Legacy#Fourth_generation_.282003.E2.80.932009.29_-_BL.2C_BP">2005 (fourth generation) Subaru Outback</a>, I&#8217;ve had it since the fall
of 2006 and it has been great. I have a little over 100,000 miles and do not
plan to sell it anytime&nbsp;soon.</p>
<p>There is one thing that just <em>kills</em> me though. You cannot …</p><p>I own a <a class="reference external" href="http://en.wikipedia.org/wiki/Subaru_Legacy#Fourth_generation_.282003.E2.80.932009.29_-_BL.2C_BP">2005 (fourth generation) Subaru Outback</a>, I&#8217;ve had it since the fall
of 2006 and it has been great. I have a little over 100,000 miles and do not
plan to sell it anytime&nbsp;soon.</p>
<p>There is one thing that just <em>kills</em> me though. You cannot (easily <a class="footnote-reference" href="#id7" id="id1">[1]</a>) change
the radio in it&#8230;and it is <em>just</em> old enough <a class="footnote-reference" href="#id8" id="id2">[2]</a> to have neither BlueTooth nor
an auxiliary audio input. I&#8217;ve been carrying around a book of CDs with me for
the past 8 years. I decided it was time to change&nbsp;that.</p>
<p>I knew that it was possible to &#8220;modify&#8221; the radio to accept an auxiliary input,
but it <a class="reference external" href="http://www.jazzyengineering.com/product_info.php?cPath=21&amp;products_id=28">involved always playing a silent <span class="caps">CD</span></a>, which I did not find adequate. I
recently <a class="reference external" href="http://snackeyes.blogspot.com/2011/06/2005-subaru-outback-aux-in-hack-via.html">came across</a> a post of how to do this in such a way that the radio
functions as normal, but when you plug in a device to the auxiliary port it cuts
out the radio and plays from the device. <a class="reference external" href="http://www.subaruoutback.org/forums/69-audio-video-security-navigation/36606-2005-outback-aux-hack-via-radio-module-success.html">Someone else</a> had also confirmed that
it worked for them.&nbsp;Cool!</p>
<p>I vaguely followed the directions, but made a few changes here and there. Also,
everyone online seems to make it seem like the radio is <em>super</em> easy to get
out&#8230;I seriously think I spent at least two hours on it. There were <a class="reference external" href="https://www.youtube.com/watch?v=7W7otDaBwJk">two</a>
<a class="reference external" href="https://www.youtube.com/watch?v=EzoGJBNMwmU">videos</a> and a <a class="reference external" href="http://www.metraonline.com/files/products/INST99-8901.pdf"><span class="caps">PDF</span></a> I found useful for this&nbsp;task.</p>
<!-- -->
<blockquote class="center">
<a class="reference external image-reference" href="http://patrick.cloke.us/images/subaru-outback-radio/uninstall-front.jpg"><img alt="Front view of my uninstalled 2005 Subaru Outback stereo." src="/thumbnails/subaru-outback-radio/uninstall-front_small.jpg" /></a>
<a class="reference external image-reference" href="http://patrick.cloke.us/images/subaru-outback-radio/uninstall-right.jpg"><img alt="Right view of my uninstalled 2005 Subaru Outback stereo." src="/thumbnails/subaru-outback-radio/uninstall-right_small.jpg" /></a>
<a class="reference external image-reference" href="http://patrick.cloke.us/images/subaru-outback-radio/uninstall-back.jpg"><img alt="Back view of my uninstalled 2005 Subaru Outback stereo." src="/thumbnails/subaru-outback-radio/uninstall-back_small.jpg" /></a>
<p>A few images of the uninstalled stereo before any disassembly. (So I could
remember how to reassemble&nbsp;it!)</p>
</blockquote>
<p>I wouldn&#8217;t say that this modification was extremely difficult, but it does&nbsp;involve:</p>
<ul class="simple">
<li>Soldering to surface mount components (I&#8217;m not awesome a soldering, but I have
had a good amount of&nbsp;experience).</li>
<li>The willingness to potentially trash a&nbsp;radio.</li>
<li>Basic understanding of electrical diagrams and how switches&nbsp;work.</li>
<li>A lot of time! I spent ~13 hours total working on&nbsp;this.</li>
</ul>
<p>Total cost of components, however, was &lt; $5.00 (and that&#8217;s probably
overestimating.) Really the only component I didn&#8217;t have was the <a class="reference external" href="http://www.radioshack.com/product/index.jsp?productId=2103451">switching
audio jack</a>, which I got at my local RadioShack for $2.99. (I also picked up
wire, heatshrink, etc. so&#8230;$5.00 sounded reasonable.) The actual list of parts
and tools I used&nbsp;was:</p>
<ul class="simple">
<li>1/8&#8221; Stereo Panel-Mount Phone Jack [$2.99, RadioShack&nbsp;#274-246]</li>
<li>~2 feet of each of green and red 22 gauge wire, ~1 foot of black 22 gauge&nbsp;wire.</li>
<li>Soldering iron /&nbsp;Solder</li>
<li>3 x Alligator clip testing wires (1 black, 1 red, 1&nbsp;green)</li>
<li>Multimeter</li>
<li>Hot glue gun / Hot&nbsp;glue</li>
<li>Various sizes of flat/slotted and Phillips head screw&nbsp;drivers</li>
<li><a class="reference external" href="http://en.wikipedia.org/wiki/File:Wire_stripper.jpg">Wire&nbsp;strippers</a></li>
<li>Wire&nbsp;cutter</li>
<li>Needle nosed&nbsp;pliers</li>
<li><a class="reference external" href="http://www.streamlight.com/product/product.aspx?pid=133">Flashlight</a></li>
<li>Drill with 1/4&#8221; drill bit and a 1/2&#8221; spade bit (plus some smaller sized drill
bits for pilot&nbsp;holes)</li>
</ul>
<p>Anyway, once you have the radio out you can disassemble it down to it&#8217;s bare
components. (It is held together with a bunch of screws and tabs, I took
pictures along each step of the way to ensure I could put it back&nbsp;together.)</p>
<!-- -->
<blockquote class="center">
<a class="reference external image-reference" href="http://patrick.cloke.us/images/subaru-outback-radio/disassembly-front.jpg"><img alt="The front of the stereo after removing the control unit." src="/thumbnails/subaru-outback-radio/disassembly-front_small.jpg" /></a>
<a class="reference external image-reference" href="http://patrick.cloke.us/images/subaru-outback-radio/disassembly-front-reverse.jpg"><img alt="The reverse of the control unit." src="/thumbnails/subaru-outback-radio/disassembly-front-reverse_small.jpg" /></a>
<a class="reference external image-reference" href="http://patrick.cloke.us/images/subaru-outback-radio/disassembly-top.jpg"><img alt="The top of the unit with the cover removed showing the CD drive." src="/thumbnails/subaru-outback-radio/disassembly-top_small.jpg" /></a>
<p>The initial steps of disassembly: the front after removing the controls, the
reverse of the control unit, a top-down view after removing the top of the
unit <a class="footnote-reference" href="#id9" id="id3">[3]</a>.</p>
</blockquote>
<!-- -->
<blockquote class="center">
<a class="reference external image-reference" href="http://patrick.cloke.us/images/subaru-outback-radio/disassembly-motherboard.jpg"><img alt="The main circuit board of the unit." src="/thumbnails/subaru-outback-radio/disassembly-motherboard_small.jpg" /></a>
<a class="reference external image-reference" href="http://patrick.cloke.us/images/subaru-outback-radio/disassembly-motherboard-reverse.jpg"><img alt="The reverse of the main circuit board of the unit." src="/thumbnails/subaru-outback-radio/disassembly-motherboard-reverse_small.jpg" /></a>
<p>The actual circuit board of the stereo unit. You can see the radio module on
the&nbsp;left.</p>
</blockquote>
<p>The radio module connects to the motherboard with a 36-pin connector. Pin 31 is
the right audio channel and pin 32 is left audio channel. I verified this by
connected the disassembled radio to the car and testing with alligator clips
hooked up to my phones audio output <a class="footnote-reference" href="#id10" id="id4">[4]</a>. I already knew these were the pins
from the directions, but I verified by completing the circuit to these pins and
ensuring I heard mixed audio with my phone and the&nbsp;radio.</p>
<p>The direction suggested cutting the pin and bending it up to solder to it. I
didn&#8217;t have any cutting tool small enough to get in between the pins&#8230;so I
flipped the board over and did sketchier things. I scored the board to remove
the traces <a class="footnote-reference" href="#id11" id="id5">[5]</a> that connected the radio module to the rest of the board. I then
soldered on either side of this connection to put it through the audio&nbsp;connector.</p>
<!-- -->
<blockquote class="center">
<a class="reference external image-reference" href="http://patrick.cloke.us/images/subaru-outback-radio/soldered-connections.jpg"><img alt="Soldered leads to the bottom of the stereo board." src="/thumbnails/subaru-outback-radio/soldered-connections_small.jpg" /></a>
<a class="reference external image-reference" href="http://patrick.cloke.us/images/subaru-outback-radio/soldered-ground.jpg"><img alt="Soldered ground to the top of the radio unit." src="/thumbnails/subaru-outback-radio/soldered-ground_small.jpg" /></a>
<p>Five soldered connections are required, four to the bottom of the board <a class="footnote-reference" href="#id12" id="id6">[6]</a>
and one to the ground at the top of the&nbsp;unit.</p>
</blockquote>
<p>Now, the way that this works is that the audio connector output (pins 2 and 5)
is <em>always</em> connected. If nothing is in the jack, it is connected as a
passthrough to the inputs (pins 3 and 4, respectively). If an audio connector is
plugged in, input redirects to the jack. (Pin 1 is ground.) For reference, red
is right audio and green is left audio (black is&nbsp;ground).</p>
<!-- -->
<blockquote class="center">
<a class="reference external image-reference" href="http://patrick.cloke.us/images/subaru-outback-radio/diagrams.jpg"><img alt="Wiring diagrams of the connections." src="/thumbnails/subaru-outback-radio/diagrams_medium.jpg" /></a>
<p>A few of the diagrams necessary to do this. The top two diagram is simple
the connectors two states: no plug and plug. The bottom two diagrams are a
normal 1/8&#8221; audio plug and the physical pin-out and measurements of the&nbsp;jack.</p>
<p>To reiterate, pins 2 and 5 connect to the &#8220;stereo side&#8221; of the scored pins
31 and 32 of the radio module. (I.e. They are the output from the connector
back to what will be played by the stereo.) Pins 3 and 4 are the inputs from
the radio module side of pins 31 and 32 to the&nbsp;connector.</p>
</blockquote>
<p>So after soldering for connections (and some hot glue), we have the ability to
intercept the signal. At this point I took the bare motherboard and tested this
in my car with alligator clips to ensure the radio still worked, I then
connected the alligator clips to a cut audio plug to ensure everything&nbsp;worked.</p>
<!-- -->
<blockquote class="center">
<a class="reference external image-reference" href="http://patrick.cloke.us/images/subaru-outback-radio/hot-glued-connections.jpg"><img alt="Hot glued wires to the board as strain relief." src="/thumbnails/subaru-outback-radio/hot-glued-connections_small.jpg" /></a>
<a class="reference external image-reference" href="http://patrick.cloke.us/images/subaru-outback-radio/testing-alligator-clips.jpg"><img alt="Testing with alligator clips. (after reassembly)." src="/thumbnails/subaru-outback-radio/testing-alligator-clips_small.jpg" /></a>
<p>The wires were also hot glued to the circuit board as strain relief. After
reassembly I tested again with alligator&nbsp;clips.</p>
</blockquote>
<p>At this point, I reassembled the radio case and ran the wires out through holes
in the side / bottom toward the front of the unit. I noticed there was an empty
spot in the top left of the unit which looked like it would fit the panel mount
audio jack. After doing some measurements I deemed my chances good enough to
drill a hole here for the connector. Some tips on drilling plastic, if you
haven&#8217;t done it much: use the lowest speed you can; start with very small bits
and work your way up (I used 4 stages of bits); and cover both sides in masking
tape to avoid&nbsp;scratches.</p>
<!-- -->
<blockquote class="center">
<a class="reference external image-reference" href="http://patrick.cloke.us/images/subaru-outback-radio/drilled-setup.jpg"><img alt="Taped and measurements for drilling the hole from the front." src="/thumbnails/subaru-outback-radio/drilled-setup_small.jpg" /></a>
<a class="reference external image-reference" href="http://patrick.cloke.us/images/subaru-outback-radio/drilled-setup-reverse.jpg"><img alt="Taped and measurements for drilling the hole from the reverse." src="/thumbnails/subaru-outback-radio/drilled-setup-reverse_small.jpg" /></a>
<p>Another benefit of tape is you can write anywhere you want. These
measurements were taken initially on the back and transcribed to the front
(where I drilled&nbsp;from).</p>
</blockquote>
<p>The plastic was actually too think for the panel mount connector to reach
through, which is where the 1/2&#8221; spade bit came in handy. I use it to drill
through roughly half the thickness of the plastic (a little at a time with lots
of testing). The connector was able to nestle inside the thinner plastic and
reach all the way&nbsp;through.</p>
<!-- -->
<blockquote class="center">
<a class="reference external image-reference" href="http://patrick.cloke.us/images/subaru-outback-radio/drilled-hole.jpg"><img alt="The 1/4&quot; hole drilled through the plastic." src="/thumbnails/subaru-outback-radio/drilled-hole_small.jpg" /></a>
<a class="reference external image-reference" href="http://patrick.cloke.us/images/subaru-outback-radio/drilled-hole-reverse.jpg"><img alt="The thinning of the plastic from the 1/2&quot; spade bit." src="/thumbnails/subaru-outback-radio/drilled-hole-reverse_small.jpg" /></a>
<a class="reference external image-reference" href="http://patrick.cloke.us/images/subaru-outback-radio/drilled-hole-assembly.jpg"><img alt="The assembled connector in the hole" src="/thumbnails/subaru-outback-radio/drilled-hole-assembly_small.jpg" /></a>
<p>After the initial hole was drilled, the tape on the back was removed to thin
the&nbsp;plastic.</p>
</blockquote>
<p>The last bit was soldering the five connections onto the audio connector,
applying a coating of hot glue (for strain relief and to avoid shorts). Once
the connector was soldered, the front panel was carefully reassembled. Finally,
the completed unit was reinstalled back into the car and voila, I now have an
auxiliary audio input! Can&#8217;t wait to test it out on a long car&nbsp;trip.</p>
<!-- -->
<blockquote class="center">
<a class="reference external image-reference" href="http://patrick.cloke.us/images/subaru-outback-radio/soldered-switch.jpg"><img alt="The soldered jack." src="/thumbnails/subaru-outback-radio/soldered-switch_small.jpg" /></a>
<a class="reference external image-reference" href="http://patrick.cloke.us/images/subaru-outback-radio/hot-glued-switch.jpg"><img alt="The hot-glued jack." src="/thumbnails/subaru-outback-radio/hot-glued-switch_small.jpg" /></a>
<p>The soldered and hot-glued audio&nbsp;jack.</p>
</blockquote>
<!-- -->
<blockquote class="center">
<a class="reference external image-reference" href="http://patrick.cloke.us/images/subaru-outback-radio/install-1.jpg"><img alt="The installed unit." src="/thumbnails/subaru-outback-radio/install-1_small.jpg" /></a>
<a class="reference external image-reference" href="http://patrick.cloke.us/images/subaru-outback-radio/install-2.jpg"><img alt="Close-up of the new jack." src="/thumbnails/subaru-outback-radio/install-2_small.jpg" /></a>
<p>The final installed stereo&nbsp;unit.</p>
</blockquote>
<p>One caveat of doing this (and I&#8217;m unsure if this is because I didn&#8217;t cut the
pins as suggested or if this is just a fact of doing it this way&#8230;). If you
have an auxiliary input device playing <span class="caps">AND</span> play a <span class="caps">CD</span>, the audio mixes instead of
being replaced by the auxiliary device. It works fine on radio though, so just
remember to set the stereo to <span class="caps">FM</span>.</p>
<table class="docutils footnote" frame="void" id="id7" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id1">[1]</a></td><td>The head unit of the stereo is directly built into the dashboard and
includes the heat / air conditioning controls. <a class="reference external" href="http://www.metraonline.com/part/Subaru_Legacy_Dash_kit_99-8901">People</a> do sell kits to
convert the dash into one that can accept an aftermarket radio&#8230;but
where&#8217;s the fun in that?</td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id8" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id2">[2]</a></td><td>The 2007 edition had an option for a stereo with satellite radio and an
<span class="caps">AUX</span> input. I probably could have bought this stereo and installed it,
but I was quoted $285 last time I asked about changing my radio.</td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id9" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id3">[3]</a></td><td>You can see I actually had a <span class="caps">CD</span> in the <span class="caps">CD</span> player when I removed the
radio. Oops! Luckily it was just a copy of one of my CDs (I never take
originals in my car). I didn&#8217;t end up scratching it or anything either!</td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id10" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id4">[4]</a></td><td>Playing one of my favorite albums: <a class="reference external" href="http://en.wikipedia.org/wiki/No_Control_%28Bad_Religion_album%29"><em>No Control</em></a> by <a class="reference external" href="http://en.wikipedia.org/wiki/Bad_Religion">Bad Religion</a></td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id11" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id5">[5]</a></td><td>This might seem insane, but I was fairly certain I&#8217;d be able to solder a
jumper back into place if everything didn&#8217;t work, so I actually felt
more comfortable doing this than cutting the pin.</td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id12" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id6">[6]</a></td><td>Please don&#8217;t judge my soldering! Two of the four connections were a
little sloppy (I had to add solder to those instead of just tinning the
wires). I did ensure there were no shorts with a multimeter (and had to
resolder one connection).</td></tr>
</tbody>
</table>
Mentoring and Time2014-07-09T17:32:00-04:002014-07-09T17:32:00-04:00Patrick Cloketag:patrick.cloke.us,2014-07-09:/posts/2014/07/09/mentoring-and-time/<p>No, this is not about being late places, it&#8217;s about respecting people&#8217;s time. I
won&#8217;t go deep into why this is important as, <a class="reference external" href="https://plus.google.com/118086293667040637133">Michael Haggerty</a> wrote an
awesome <a class="reference external" href="http://softwareswirl.blogspot.fr/2014/03/my-secret-tip-for-gsoc-success.html">article</a> on this. His thoughts boiled down to a single line of&nbsp;advice:</p>
<blockquote>
<strong><span class="caps">DON</span>&#8217;T <span class="caps">WASTE</span> <span class="caps">OTHER</span> <span class="caps">PEOPLE</span>&#8217;S …</strong></blockquote><p>No, this is not about being late places, it&#8217;s about respecting people&#8217;s time. I
won&#8217;t go deep into why this is important as, <a class="reference external" href="https://plus.google.com/118086293667040637133">Michael Haggerty</a> wrote an
awesome <a class="reference external" href="http://softwareswirl.blogspot.fr/2014/03/my-secret-tip-for-gsoc-success.html">article</a> on this. His thoughts boiled down to a single line of&nbsp;advice:</p>
<blockquote>
<strong><span class="caps">DON</span>&#8217;T <span class="caps">WASTE</span> <span class="caps">OTHER</span> <span class="caps">PEOPLE</span>&#8217;S <span class="caps">TIME</span></strong></blockquote>
<p>I think this applies to any type of mentoring, and not only open source work,
but any formal or informal mentoring! This advice isn&#8217;t meant just for GSoC
students, for interns or new employees, but also things I&#8217;d like to remind
myself to do when someone is helping&nbsp;me.</p>
<p>To make this sound positive, I&#8217;d reword the above advice&nbsp;as:</p>
<blockquote>
<strong>Respect other people&#8217;s time!</strong></blockquote>
<p>Someone is willing to help you, so assume some good faith, but help them help
you! Some actions to focus&nbsp;on:</p>
<ul class="simple">
<li>Ask <strong>focused questions</strong>! If you do not understand an answer, do not <em>re-ask</em>
the same question, but ask <em>followup</em> question. Show you&#8217;ve researched the
original answer and attempted to understand it. Write sample code, play with
it, etc. If you think the answer given doesn&#8217;t apply to your question,
<em>reword</em> your question: your mentor probably did not&nbsp;understand.</li>
<li>Be cognizant of <strong>timezones</strong>: if you&#8217;d like a question answered (in realtime),
ask it when the person is awake! (And this includes realizing if they have
just woken up or are going to&nbsp;bed.)</li>
<li>Your mentor may not have the <strong>context</strong> you do: they might be helping many
people at once, or even working on something totally different than you!
Try not to get frustrated if you have to explain your context to them multiple
times or have to clarify your question. You are living and breathing the code
you&#8217;re working in; they are&nbsp;not.</li>
<li>Don&#8217;t be afraid to <strong>share code</strong>. It&#8217;s much easier to ask a question when
there&#8217;s a specific example in front of you. Be specific and don&#8217;t talk&nbsp;theoretically.</li>
<li>Don&#8217;t be upset if you&#8217;re asked to change code (e.g. receive an r-)! Part of
helping you to grow is telling you what you&#8217;re doing&nbsp;wrong.</li>
<li>Working <em>remotely</em> is hard. It requires effort to <strong>build a level of trust</strong>
between people. Don&#8217;t just assume it will come in time, but work at it and try
to get to know and understand your&nbsp;mentor.</li>
<li><strong>Quickly respond</strong> to both feedback and questions. Your mentor is taking
their precious time to help you. If they ask you a question or ask something
of you, do it <span class="caps">ASAP</span>. If you can&#8217;t answer their question immediately, at least
let them know you received it and will soon look at&nbsp;it.</li>
<li>If there are multiple people helping you, assume that they communicate
(without your knowledge). Don&#8217;t&#8230;<ul>
<li>&#8230;try to get each of them to do separate parts of a project for&nbsp;you.</li>
<li>&#8230;ask the same question to multiple people hoping for different&nbsp;answers.</li>
</ul>
</li>
</ul>
<p>The above is a lot to consider. I know that I have a tendency to do some of
the above. Using your mentors time efficiently will not only make your mentor
happy, but it will probably cause them to want to give you <em>more</em> of their&nbsp;time.</p>
<hr class="docutils" />
<p>Mentoring is also hard and a skill to practice. Although I&#8217;ve talked a lot
about what a mentee needs to do, it is also important that a mentor makes
h(im|er)self available and open. A few thoughts on interacting as a&nbsp;mentor:</p>
<ul class="simple">
<li>Be cognizant of <em>culture</em> and <em>language</em> (as in, the level at which a mentor
and mentee share a common language). In particular, colloquialisms should be
avoided whenever possible. At least until a level of trust is&nbsp;reached.</li>
<li>Be tactful when <em>giving feedback</em>. Thank people for submitting a patch, give
good, <em>actionable</em> feedback quickly. Concentrate more on overall code design
and algorithms than nits. (Maybe even point out nits, but fix them yourself
for an initial&nbsp;patch.)</li>
</ul>
New Blog: Serving the Content2014-07-06T18:36:00-04:002014-07-06T18:36:00-04:00Patrick Cloketag:patrick.cloke.us,2014-07-06:/posts/2014/07/06/new-blog-serving-the-content/
<p>In the <a class="reference external" href="http://patrick.cloke.us/posts/2014/07/03/new-blog/">first part</a> of this blog post I talked about using Pelican to create a
blog, this is a bit more about how I got it up and running.</p>
<div class="section" id="getting-a-domain">
<h2><a class="toc-backref" href="#id3">Getting a Domain</a></h2>
<p>The most exciting part! Getting a domain! I used <a class="reference external" href="https://www.gandi.net/">gandi.net</a>, it was
recommended to me by …</p></div>
<p>In the <a class="reference external" href="http://patrick.cloke.us/posts/2014/07/03/new-blog/">first part</a> of this blog post I talked about using Pelican to create a
blog, this is a bit more about how I got it up and running.</p>
<div class="section" id="getting-a-domain">
<h2><a class="toc-backref" href="#id3">Getting a Domain</a></h2>
<p>The most exciting part! Getting a domain! I used <a class="reference external" href="https://www.gandi.net/">gandi.net</a>, it was
recommended to me by <a class="reference external" href="http://blog.queze.net/">Florian</a> as “awesome, but a bit expensive”. I liked that
they actually explain <a class="reference external" href="https://www.gandi.net/domain/interface">exactly</a> what I was getting by registering a domain
through them. Nowhere else I looked was this explicit.</p>
<p>Once you get your domain you’ll need to set up your <a class="reference external" href="https://en.wikipedia.org/wiki/CNAME"><span class="caps">CNAME</span></a> record to forward to
wherever you’re serving your content. I found it pretty interesting that gandi
essentially gives you an <a class="reference external" href="https://en.wikipedia.org/wiki/DNS_zone"><span class="caps">DNS</span> zone</a> file to modify. I ended up making a few modifications:</p>
<ul class="simple">
<li>Created a patrick subdomain (patrick.cloke.us)</li>
<li>Redirected the apex domain (cloke.us) to the patrick subdomain</li>
<li>Redirected the www subdomain to the patrick subdomain</li>
</ul>
<p>I also created a few email aliases which forward to the email accounts I already own.</p>
</div>
<div class="section" id="serving-the-content">
<h2><a class="toc-backref" href="#id4">Serving the Content</a></h2>
<p><span class="caps">OK</span>, we have a domain! We have content! How do we actually link them!? I used
<a class="reference external" href="https://pages.github.com/">GitHub Pages</a>, cause I’m cheap and don’t like to pay for things. The quick version:</p>
<ul class="simple">
<li>Create a repository that is named <tt class="docutils literal">&lt;your account <span class="pre">name&gt;.github.io</span></tt></li>
<li>Push whatever <span class="caps">HTML</span> content you want into the master branch</li>
<li>Voila it’s available as &lt;your account name&gt;.github.io</li>
</ul>
<p>Personally, I store my Pelican code in a separate <a class="reference external" href="https://github.com/clokep/clokep.github.io">source</a> branch <a class="footnote-reference" href="#id2" id="id1">[1]</a> and use
<a class="reference external" href="https://github.com/davisp/ghp-import">ghp-import</a> to actually publish my content. I’ve automated a lot of the tasks by
<a class="reference external" href="https://github.com/clokep/clokep.github.io/blob/source/fabfile.py">extending</a> the default <a class="reference external" href="http://www.fabfile.org/">fabfile.py</a> that is generated with the quickstart. My
workflow looks something like:</p>
<div class="highlight"><pre><span></span>komodo content/new-article.rst
<span class="c1"># &lt;edit article&gt;</span>
<span class="c1"># &lt;check it out in a browser using fab build/serve/regenerate&gt;</span>
git add content/ <span class="o">&amp;&amp;</span> git commit -m <span class="s2">"Add 'New Article!'."</span>
fab publish <span class="c1"># Which runs "ghp-import -p -b master output" underneath!</span>
git push origin <span class="nb">source</span>
</pre></div>
<p>One other thing you’ll need to do is add a <span class="caps">CNAME</span> file that has the domain of
your host in it (and only the domain). I found the GitHub documents on this
extremely confusing, but it’s pretty simple:</p>
<ul class="simple">
<li>Create a file called <span class="caps">CNAME</span> somewhere you have static files in Pelican (mine is
at content/static/<span class="caps">CNAME</span>)</li>
<li>Add a line to your pelicanconf.py to have this file end up in the root:</li>
</ul>
<div class="highlight"><pre><span></span><span class="c1"># Set up static content and output locations.</span>
<span class="n">STATIC_PATHS</span> <span class="o">=</span> <span class="p">[</span>
<span class="s1">'images'</span><span class="p">,</span>
<span class="s1">'static/CNAME'</span>
<span class="p">]</span>
<span class="n">EXTRA_PATH_METADATA</span> <span class="o">=</span> <span class="p">{</span>
<span class="s1">'static/CNAME'</span><span class="p">:</span> <span class="p">{</span><span class="s1">'path'</span><span class="p">:</span> <span class="s1">'CNAME'</span><span class="p">},</span>
<span class="p">}</span>
</pre></div>
<p>It took 10 - 20 minutes for this to “kick in” on GitHub, until that time I had a
404 GitHub page.</p>
</div>
<div class="section" id="redirect-blogger">
<h2><a class="toc-backref" href="#id5">Redirect Blogger</a></h2>
<p>This is the really fun part. How the hell do we redirect blogger links to
actually go to the new location of each blog post? With some hackery, some luck,
and some magic.</p>
<p>I found some help in an article about <a class="reference external" href="http://www.labnol.org/internet/switch-from-blogger-to-wordpress/9707/">switching to WordPress from Blogger</a> and
modified the template they had there. On the Blogger dashboard, choose
“Template”, scroll to the bottom and click “Revert to Classic Template”. Then
use something like the following template:</p>
<div class="highlight"><pre><span></span><span class="nt">&lt;html&gt;</span>
<span class="nt">&lt;head&gt;</span>
<span class="nt">&lt;title&gt;</span><span class="err">&lt;</span>$BlogPageTitle$&gt;<span class="nt">&lt;/title&gt;</span>
<span class="nt">&lt;script&gt;</span>
<span class="nt">&lt;MainOrArchivePage&gt;</span>
window.location.href = "http://patrick.cloke.us/";
<span class="nt">&lt;/MainOrArchivePage&gt;</span>
<span class="nt">&lt;Blogger&gt;</span>
<span class="nt">&lt;ItemPage&gt;</span>
// This is the full permalink.
var permalink = "<span class="err">&lt;</span>$BlogItemPermalinkURL$&gt;";
// Split up each part by the slash.
var parts = permalink.split("/");
// Take the last part (the page) and strip off the .html.
var slug = parts.slice(-1)[0].slice(0, -5);
var article = "http://patrick.cloke.us/posts/<span class="nt">&lt;BlogDateHeader&gt;</span><span class="err">&lt;</span>$BlogDateHeaderDate$&gt;<span class="nt">&lt;/BlogDateHeader&gt;</span>/" + slug;
window.location.href = article;
window.onload = function() {
document.getElementById("linkrel").href = article;
document.getElementById("simplelink").href = article;
}
<span class="nt">&lt;/ItemPage&gt;</span>
<span class="nt">&lt;/Blogger&gt;</span>
<span class="nt">&lt;/script&gt;</span>
<span class="nt">&lt;MainPage&gt;</span>
<span class="nt">&lt;link</span> <span class="na">rel=</span><span class="s">"canonical"</span> <span class="na">href=</span><span class="s">"http://patrick.cloke.us/"</span> <span class="nt">/&gt;</span>
<span class="nt">&lt;/MainPage&gt;</span>
<span class="nt">&lt;Blogger&gt;</span>
<span class="nt">&lt;ItemPage&gt;</span>
<span class="nt">&lt;link</span> <span class="na">id=</span><span class="s">"linkrel"</span> <span class="na">rel=</span><span class="s">"canonical"</span> <span class="nt">/&gt;</span>
<span class="nt">&lt;/ItemPage&gt;</span>
<span class="nt">&lt;/Blogger&gt;</span>
<span class="nt">&lt;/head&gt;</span>
<span class="nt">&lt;body&gt;</span>
<span class="nt">&lt;MainOrArchivePage&gt;</span>
<span class="nt">&lt;h1&gt;&lt;a</span> <span class="na">href=</span><span class="s">"http://patrick.cloke.us"</span><span class="nt">&gt;</span><span class="err">&lt;</span>$BlogTitle$&gt;<span class="nt">&lt;/a&gt;&lt;/h1&gt;</span>
<span class="nt">&lt;/MainOrArchivePage&gt;</span>
<span class="nt">&lt;Blogger&gt;</span>
<span class="nt">&lt;ItemPage&gt;</span>
<span class="nt">&lt;h1&gt;</span>
<span class="nt">&lt;a</span> <span class="na">id=</span><span class="s">"simplelink"</span><span class="nt">&gt;</span>
<span class="err">&lt;</span>$BlogItemTitle$&gt;
<span class="nt">&lt;/a&gt;</span>
<span class="nt">&lt;/h1&gt;</span>
<span class="err">&lt;</span>$BlogItemBody$&gt;
<span class="nt">&lt;/ItemPage&gt;</span>
<span class="nt">&lt;/Blogger&gt;</span>
<span class="nt">&lt;/body&gt;</span>
<span class="nt">&lt;/html&gt;</span>
</pre></div>
<p>Obviously you’ll need to change the URLs, but the key parts here are that we’re
generating a <span class="caps">URL</span> based on the date and the full article name. The magic comes in
generating the date. The get it in the format I wanted (<span class="caps">YYYY</span>/<span class="caps">MM</span>/<span class="caps">DD</span>) I modified a
the “Date Header Format” in “Settings” &gt; “Language and formatting”. This matches
how I formatted my URLs in my pelicanconf.py. The <tt class="docutils literal">slug</tt> that gets generated
needs to match the slug you used in your template so the link will work. (I had
<a class="reference external" href="https://support.google.com/blogger/answer/42095">some</a> <a class="reference external" href="http://www.elizabethcastro.com/blogvqj/extras/templatetags.html">help</a> in figuring out these template tags.)</p>
<p>I’d suggest you check the links to all your articles! A couple of the dates were
messed up in mine (the day was off by one, causing the forwarded location to be broken).</p>
<p>The last thing to do is to redirect the Atom/<span class="caps">RSS</span> feed (if anyone is using that).
Go to “Settings” &gt; “Other” &gt; “Post Feed Redirect <span class="caps">URL</span>” and set it to your new
Atom feed <span class="caps">URL</span> (wherever that might be).</p>
<table class="docutils footnote" frame="void" id="id2" rules="none">
<colgroup><col class="label"></col><col></col></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id1">[1]</a></td><td>Pro-tip: You can <a class="reference external" href="https://help.github.com/articles/setting-the-default-branch">change the “default” branch</a> of your repository in the
settings page on GitHub.</td></tr>
</tbody>
</table>
</div>
New Blog2014-07-03T23:04:00-04:002014-07-06T18:24:00-04:00Patrick Cloketag:patrick.cloke.us,2014-07-03:/posts/2014/07/03/new-blog/
<p>If you’re reading this you might have noticed that I have a shiny new blog! I
had been pretty disappointed in <a class="reference external" href="https://www.blogger.com/">Blogger</a> practically since I started using it.
But it was free, I was a poor college student, etc. I finally managed to get
myself a <a class="reference external" href="http://patrick.cloke.us">domain name</a> and …</p>
<p>If you’re reading this you might have noticed that I have a shiny new blog! I
had been pretty disappointed in <a class="reference external" href="https://www.blogger.com/">Blogger</a> practically since I started using it.
But it was free, I was a poor college student, etc. I finally managed to get
myself a <a class="reference external" href="http://patrick.cloke.us">domain name</a> and set up a more proper blog!</p>
<p>I was between a few different pieces of blog software (namely <a class="reference external" href="https://wordpress.com/">WordPress</a>,
<a class="reference external" href="http://dotclear.org/">DotClear</a> and <a class="reference external" href="http://jekyllrb.com/">Jekyll</a>) and couldn’t really decide. I loved the idea of the
simplicity of Jekyll, but it’s <a class="reference external" href="http://www.ruby-lang.org/">Ruby</a>. (Who’s got time for that?) I wanted
something I could read the code of and understand if necessary. (And it has
been necessary!) My main requirements for blog software were:</p>
<ul class="simple">
<li>Easy to use and set up.</li>
<li>Free.</li>
<li>Support for syntax highlighted code blocks. (This was the only “hard” one to
come by.)</li>
<li>Support for <a class="reference external" href="https://en.wikipedia.org/wiki/RSS"><span class="caps">RSS</span></a> feeds.</li>
</ul>
<p>After a quick Google search for “<a class="reference external" href="https://www.google.com/search?q=jekyll+python">jekyll python</a>“, I ended up on <a class="reference external" href="https://hyde.github.io/">Hyde</a>. It
seemed alright, but no one seemed to use it. Farther down the page I came across
<a class="reference external" href="http://arunrocks.com/moving-blogs-to-pelican/">a blog</a> talking about moving to <a class="reference external" href="http://getpelican.com/">Pelican</a>. I was hooked. (Note that I don’t
necessarily agree with all the ideas in that post, it just introduced me to Pelican.)</p>
<div class="section" id="set-up-pelican">
<h2><a class="toc-backref" href="#id1">Set up Pelican</a></h2>
<p>(Since I dislike writing my own descriptions:)</p>
<blockquote>
“Pelican is a static site generator, written in <a class="reference external" href="http://www.python.org/">Python</a>, that requires no
database or server-side logic.”</blockquote>
<p>Cool! Sounds real simple to use! And it was. Mostly.</p>
<p>I pretty much followed the <a class="reference external" href="http://docs.getpelican.com/en/3.4.0/quickstart.html">quickstart</a>:</p>
<div class="highlight"><pre><span></span>mkdir -p blog/blog <span class="c1"># The first blog is to store other repos, etc.</span>
<span class="nb">cd</span> blog/blog
git init <span class="o">&amp;&amp;</span> git checkout -b <span class="nb">source</span> <span class="c1"># Explained later on.</span>
brew install pandoc <span class="c1"># If you're not on Mac you'll need to do something else.</span>
mkvirtualenv blog
pip install pelican markdown Fabric ghp_import feedparser
pelican-quickstart
</pre></div>
<p>I’ll let you read the rest of the quickstart guide, but it was super quick to
get up and running! (I also referenced another <a class="reference external" href="http://terriyu.info/blog/posts/2013/07/pelican-setup/">blog post</a> I found that had some
good information!) I, of course, had no content…but wait I did, it was just
in Blogger!</p>
</div>
<div class="section" id="importing-content-from-blogger">
<h2><a class="toc-backref" href="#id2">Importing Content from Blogger</a></h2>
<p>Pelican does not directly support importing from Blogger (<em>Edit: Seems someone
just put up a `pull request`_ to support Blogger natively!</em>), but it supports
<a class="reference external" href="http://docs.getpelican.com/en/3.4.0/importer.html">importing from a <span class="caps">RSS</span> feed</a>. The first time I did this it missed a couple of
articles (which I didn’t notice right away), so make sure you bump up the max
amount in the <span class="caps">URL</span> like so (this also outputs in the folder “content”):</p>
<pre class="literal-block">
pelican-import --feed http://clokep.blogspot.com/feeds/posts/default\?alt\=rss\&amp;max-results\=240 -o content
</pre>
<p>No import is ever perfect and I had to clean up a bunch of stuff by hand including:</p>
<ul class="simple">
<li>The slugs did not match the ones from Blogger (this is important later on!)</li>
<li>Some of the dates were strangely wrong</li>
<li>Some <span class="caps">HTML</span> formatting was included (in particular around &lt;code&gt;/&lt;pre&gt; blocks I
had added).</li>
<li>Some formatting was messed up.</li>
<li>The (single) image I had on my blog had to be manually downloaded and added.</li>
<li>I had bolded things I really wanted to be headers. (This is my fault!)</li>
</ul>
<p>I probably spent a couple of hours cleaning all the reStructuredText content up,
but now I feel that I have a portable set of all of my blog posts, which I’m
pretty happy about!</p>
</div>
<div class="section" id="customizing-pelican">
<h2><a class="toc-backref" href="#id3">Customizing Pelican</a></h2>
<p>I tried a few different themes for Pelican, but eventually settled on just using
and modifying the default theme. I, frankly, haven’t tried it on too many
different systems, so hopefully it doesn’t totally break on small screen sizes
or something. I’m not <span class="caps">HTML</span> expert, so I’d rather talk about the other stuff I
modified. (Although, if you’re curious, the main elements I <em>did</em> modify are
adding the sidebar to the left and the organization of the archives page.)</p>
<p>Blogger has a concept of “labels”, Pelican has a concept of “category” and
“tags”. I <em>hate</em> this. What’s the difference? Anyway, I wanted to eradicate the
concept of a “category” (and “authors” since I’m the only one on my blog!), so I
added a few things to my pelicanconf.py:</p>
<div class="highlight"><pre><span></span><span class="c1"># Disable categories.</span>
<span class="n">DISPLAY_CATEGORIES_ON_MENU</span> <span class="o">=</span> <span class="bp">False</span>
<span class="n">DISPLAY_CATEGORY_ON_ARTICLE</span> <span class="o">=</span> <span class="bp">False</span>
<span class="n">CATEGORY_FEED_ATOM</span> <span class="o">=</span> <span class="bp">None</span>
<span class="n">CATEGORY_SAVE_AS</span> <span class="o">=</span> <span class="s1">''</span>
<span class="n">CATEGORIES_SAVE_AS</span> <span class="o">=</span> <span class="s1">''</span>
<span class="c1"># Disable author pages.</span>
<span class="n">AUTHOR_SAVE_AS</span> <span class="o">=</span> <span class="s1">''</span>
<span class="n">AUTHORS_SAVE_AS</span> <span class="o">=</span> <span class="s1">''</span>
</pre></div>
<p>Note that <tt class="docutils literal">DISPLAY_CATEGORY_ON_ARTICLE</tt> is actually a variable I added and
used in the template to not show categories above the list of tags on each article.</p>
<p>This is getting pretty long so I’ll leave how I’m actually serving this content
to my next article!</p>
</div>
Google Summer of Code 20142014-07-01T08:03:00-04:002014-07-01T08:03:00-04:00Patrick Cloketag:patrick.cloke.us,2014-07-01:/posts/2014/07/01/google-summer-of-code-2014-file/<p>I&#8217;m again mentoring for <a class="reference external" href="https://www.google-melange.com/gsoc/homepage/google/gsoc2014">Google Summer of Code</a> 2014, this year my student is
<a class="reference external" href="http://sawrubh.tumblr.com/">Saurabh Anand</a> (sawrubh), who has been working on a few related&nbsp;things:</p>
<ul class="simple">
<li>Adding a <a class="reference external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1024023">file transfer mechanism for <span class="caps">XMPP</span></a></li>
<li>Hooking up libpurple&#8217;s file transfer code to&nbsp;Instantbird</li>
<li>Integrating <a class="reference external" href="https://support.mozilla.org/en-US/kb/filelink-large-attachments">FileLink</a> as a fallback to in-protocol …</li></ul><p>I&#8217;m again mentoring for <a class="reference external" href="https://www.google-melange.com/gsoc/homepage/google/gsoc2014">Google Summer of Code</a> 2014, this year my student is
<a class="reference external" href="http://sawrubh.tumblr.com/">Saurabh Anand</a> (sawrubh), who has been working on a few related&nbsp;things:</p>
<ul class="simple">
<li>Adding a <a class="reference external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1024023">file transfer mechanism for <span class="caps">XMPP</span></a></li>
<li>Hooking up libpurple&#8217;s file transfer code to&nbsp;Instantbird</li>
<li>Integrating <a class="reference external" href="https://support.mozilla.org/en-US/kb/filelink-large-attachments">FileLink</a> as a fallback to in-protocol file&nbsp;transfers</li>
</ul>
<p>Sorry for the way overdue post (as it&#8217;s already past mid-term for&nbsp;GSoC)!</p>
Extending JavaScript Maps (or other built-in objects)2014-04-27T13:46:00-04:002014-04-27T13:46:00-04:00Patrick Cloketag:patrick.cloke.us,2014-04-27:/posts/2014/04/27/extending-javascript-maps-or-other/
<p>Finally another technical post, this one is about my adventures in
attempting to extend the built-in <a class="reference external" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map">Map</a> object in JavaScript to extend
the functionality. As background, there are two reasons we’d want this:</p>
<ol class="arabic">
<li><p class="first">In the chat backend we currently use JavaScript <a class="reference external" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">objects</a> (<tt class="docutils literal">{}</tt>) as
hashes/maps to keep track of …</p></li></ol>
<p>Finally another technical post, this one is about my adventures in
attempting to extend the built-in <a class="reference external" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map">Map</a> object in JavaScript to extend
the functionality. As background, there are two reasons we’d want this:</p>
<ol class="arabic">
<li><p class="first">In the chat backend we currently use JavaScript <a class="reference external" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">objects</a> (<tt class="docutils literal">{}</tt>) as
hashes/maps to keep track of various things (i.e. there’s a <a class="reference external" href="https://mxr.mozilla.org/comm-central/source/chat/protocols/irc/irc.js#789">hash of
conversations</a> which map from conversation name to prplIConversation
objects in the <span class="caps">IRC</span> code). Whenever checking to see if something is in
this map we have to use <a class="reference external" href="https://mxr.mozilla.org/comm-central/source/chat/protocols/irc/irc.js#1509">hasOwnProperty</a>. This has to be the
<a class="reference external" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty">version from Object.prototype</a> in case the map has a conversation
named hasOwnProperty. This is <a class="reference external" href="https://mxr.mozilla.org/comm-central/source/chat/modules/imXPCOMUtils.jsm#166">super simple code</a>, but annoying:</p>
<blockquote>
<div class="highlight"><pre><span></span><span class="c1">// Similar to Object.hasOwnProperty, but doesn't fail if the object</span>
<span class="c1">// has a hasOwnProperty property set.</span>
<span class="kd">function</span> <span class="nx">hasOwnProperty</span><span class="p">(</span><span class="nx">aObject</span><span class="p">,</span> <span class="nx">aPropertyName</span><span class="p">)</span>
<span class="nb">Object</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">hasOwnProperty</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="nx">aObject</span><span class="p">,</span> <span class="nx">aPropertyName</span><span class="p">)</span>
</pre></div>
</blockquote>
<p><a class="reference external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=955366">Replacing these custom objects with a Map</a> would alleviate this
funky dance.</p>
</li>
<li><p class="first">Frequently in the chat backend we have to “normalize” <a class="footnote-reference" href="#id4" id="id1">[1]</a> strings
(e.g. #INsTanTBIrd and #instantbird are the same on <span class="caps">IRC</span> <a class="footnote-reference" href="#id5" id="id2">[2]</a>). This is
almost always done for sane storage of data received from the network
(or from the user). I figured it’d be great if, instead of having to
<a class="reference external" href="https://mxr.mozilla.org/comm-central/source/chat/protocols/irc/irc.js#1510">manually</a> <a class="reference external" href="https://mxr.mozilla.org/comm-central/source/chat/protocols/irc/irc.js#1514">handle</a> <a class="reference external" href="https://mxr.mozilla.org/comm-central/source/chat/protocols/irc/irc.js#1528">this</a> normalization each time we tried to
access data, the keys were magically normalized when accessing the
data.
(Note that although normalization is generally more complicated, just
consider to be <a class="reference external" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase">String.prototype.toLowerCase()</a> for the rest of this post!)</p>
</li>
</ol>
<p>This has been explored before by <a class="reference external" href="http://perfectionkills.com/how-ecmascript-5-still-does-not-allow-to-subclass-an-array/">others</a>, but generally in the
context of web sites / cross browser compatibility. Which are concerns
that don’t really limit us for backend code.</p>
<div class="section" id="goals">
<h2><a class="toc-backref" href="#id7">Goals</a></h2>
<ol class="arabic simple">
<li>Replace objects with Maps for safe access. This is pretty easily
fixed by switching all <tt class="docutils literal"><span class="pre">obj["foo"]</span></tt> calls to <tt class="docutils literal"><span class="pre">obj.get("foo")</span></tt> (or the
appropriate other method: set, delete, etc.)</li>
<li>Automatically “normalize” keys in the some user defined way, e.g.
such that <tt class="docutils literal"><span class="pre">obj.get("foo")</span></tt> and <tt class="docutils literal"><span class="pre">obj.get("FoO")</span></tt> return the same value.</li>
</ol>
</div>
<div class="section" id="first-approach-setting-proto-to-map-prototype">
<h2><a class="toc-backref" href="#id8">First Approach (setting __proto__ to Map.prototype)</a></h2>
<p>My first naive approach was to create an object with <tt class="docutils literal">__proto__</tt> set
to Map.prototype and overwrite anything that uses keys to appropriately
call a normalization function.</p>
<div class="highlight"><pre><span></span><span class="kd">function</span> <span class="nx">NormalizedMap</span><span class="p">()</span> <span class="p">{</span> <span class="p">}</span>
<span class="nx">NormalizedMap</span><span class="p">.</span><span class="nx">prototype</span> <span class="o">=</span> <span class="p">{</span>
<span class="nx">__proto__</span><span class="o">:</span> <span class="nx">Map</span><span class="p">.</span><span class="nx">prototype</span><span class="p">,</span>
<span class="nx">_normalize</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">aStr</span><span class="p">)</span> <span class="nx">aStr</span><span class="p">.</span><span class="nx">toLowerCase</span><span class="p">(),</span>
<span class="nx">get</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">aStr</span><span class="p">)</span> <span class="nx">Map</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">get</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">_normalize</span><span class="p">(</span><span class="nx">aStr</span><span class="p">)),</span>
<span class="nx">set</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">aStr</span><span class="p">,</span> <span class="nx">aVal</span><span class="p">)</span> <span class="nx">Map</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">set</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">_normalize</span><span class="p">(</span><span class="nx">aStr</span><span class="p">),</span> <span class="nx">aVal</span><span class="p">)</span>
<span class="p">};</span>
<span class="kd">let</span> <span class="nx">m</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">NormalizedMap</span><span class="p">();</span>
<span class="nx">m</span><span class="p">.</span><span class="nx">set</span><span class="p">(</span><span class="s2">"foo"</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> <span class="c1">// Throws TypeError: set method called on incompatible Object</span>
<span class="nx">m</span> <span class="k">instanceof</span> <span class="nx">Map</span><span class="p">;</span> <span class="c1">// true . . . wat . . .</span>
</pre></div>
<p>This throws an error and does not work. Apparently there are plans to
<a class="reference external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=838540">support something like this</a>. The totally fun thing, in my opinion, is
that m is an instance of a Map!</p>
</div>
<div class="section" id="second-approach-modifying-proto-after-instance-creation">
<h2><a class="toc-backref" href="#id9">Second Approach (modifying __proto__ after instance creation)</a></h2>
<p>My second approach was to generate a real Map and then override the
<tt class="docutils literal">__proto__</tt> to give it the properties I wanted:</p>
<div class="highlight"><pre><span></span><span class="kd">function</span> <span class="nx">NormalizedMap</span><span class="p">()</span> <span class="p">{</span>
<span class="kd">let</span> <span class="nx">m</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Map</span><span class="p">();</span> <span class="nx">m</span><span class="p">.</span><span class="nx">__proto__</span> <span class="o">=</span> <span class="nx">NormalizedMap</span><span class="p">.</span><span class="nx">prototype</span><span class="p">;</span>
<span class="k">return</span> <span class="nx">m</span><span class="p">;</span>
<span class="p">}</span>
<span class="nx">NormalizedMap</span><span class="p">.</span><span class="nx">prototype</span> <span class="o">=</span> <span class="p">{</span>
<span class="nx">__proto__</span><span class="o">:</span> <span class="nx">Map</span><span class="p">.</span><span class="nx">prototype</span><span class="p">,</span>
<span class="nx">_normalize</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">aStr</span><span class="p">)</span> <span class="nx">aStr</span><span class="p">.</span><span class="nx">toLowerCase</span><span class="p">(),</span>
<span class="nx">get</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">aStr</span><span class="p">)</span> <span class="nx">Map</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">get</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">_normalize</span><span class="p">(</span><span class="nx">aStr</span><span class="p">)),</span>
<span class="nx">set</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">aStr</span><span class="p">,</span> <span class="nx">aVal</span><span class="p">)</span> <span class="nx">Map</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">set</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">_normalize</span><span class="p">(</span><span class="nx">aStr</span><span class="p">),</span> <span class="nx">aVal</span><span class="p">)</span>
<span class="p">};</span>
<span class="kd">let</span> <span class="nx">m</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">NormalizedMap</span><span class="p">();</span>
<span class="nx">m</span><span class="p">.</span><span class="nx">set</span><span class="p">(</span><span class="s2">"foo"</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
<span class="nx">m</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s2">"FOO"</span><span class="p">);</span> <span class="c1">// 1</span>
<span class="nx">m</span> <span class="k">instanceof</span> <span class="nx">Map</span><span class="p">;</span> <span class="c1">// true</span>
</pre></div>
<p>This actually works! But will <a class="reference external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=963519">throw a warning</a> each time it is
created since changing an objects <tt class="docutils literal">__proto__</tt> is generally a bad idea.
I also thought of overriding individual methods, but this seemed
cumbersome and would increase the time in the constructor calls. (Which
occur during the start up of each account and is generally a resource
constrained time. No, I didn’t profile this, it just seemed like bad design.)</p>
</div>
<div class="section" id="solution-wrapping-a-map">
<h2><a class="toc-backref" href="#id10">Solution (wrapping a Map)</a></h2>
<p>Finally I settled on the simple solution of just wrapping the Map in a
custom object. Initially I thought this would be frustrating to
re-declare every function (and prone to breakage in the future if new
methods are added), but there’s a nice magic method
<a class="reference external" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/noSuchMethod">__noSuchMethod__</a> that fixes this! (Note that this is a
non-standard feature of SpiderMonkey.) <tt class="docutils literal">__noSuchMethod__</tt> allows an
object to intercept a call to a non-existent method (and in this case
call that same method on the internal Map object).</p>
<p>Below is the final version that seems to act magically like a Map when
necessary (e.g. iterating the map works, all functions and properties
exist, the constructor works <a class="footnote-reference" href="#id6" id="id3">[3]</a>). I need to thank aleth (another chat
developer) who helped out quite a bit with this (and will ultimately be
reviewing this code)!</p>
<div class="highlight"><pre><span></span><span class="c1">// A Map that automatically normalizes keys before accessing the values.</span>
<span class="kd">function</span> <span class="nx">NormalizedMap</span><span class="p">(</span><span class="nx">aNormalizeFunction</span><span class="p">,</span> <span class="nx">aIt</span> <span class="o">=</span> <span class="p">[])</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="k">typeof</span><span class="p">(</span><span class="nx">aNormalizeFunction</span><span class="p">)</span> <span class="o">!=</span> <span class="s2">"function"</span><span class="p">)</span>
<span class="k">throw</span> <span class="s2">"NormalizedMap must have a normalize function!"</span><span class="p">;</span>
<span class="k">this</span><span class="p">.</span><span class="nx">_normalize</span> <span class="o">=</span> <span class="nx">aNormalizeFunction</span><span class="p">;</span>
<span class="k">this</span><span class="p">.</span><span class="nx">_map</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Map</span><span class="p">([[</span><span class="k">this</span><span class="p">.</span><span class="nx">_normalize</span><span class="p">(</span><span class="nx">key</span><span class="p">),</span> <span class="nx">val</span><span class="p">]</span> <span class="k">for</span> <span class="p">([</span><span class="nx">key</span><span class="p">,</span> <span class="nx">val</span><span class="p">]</span> <span class="k">of</span> <span class="nx">aIt</span><span class="p">)]);</span>
<span class="p">}</span>
<span class="nx">NormalizedMap</span><span class="p">.</span><span class="nx">prototype</span> <span class="o">=</span> <span class="p">{</span>
<span class="nx">_map</span><span class="o">:</span> <span class="kc">null</span><span class="p">,</span>
<span class="c1">// The function to apply to all keys.</span>
<span class="nx">_normalize</span><span class="o">:</span> <span class="kc">null</span><span class="p">,</span>
<span class="c1">// Anything that accepts a key as an input needs to be manually overridden.</span>
<span class="k">delete</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">aKey</span><span class="p">)</span> <span class="k">this</span><span class="p">.</span><span class="nx">_map</span><span class="p">.</span><span class="k">delete</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_normalize</span><span class="p">(</span><span class="nx">aKey</span><span class="p">)),</span>
<span class="nx">get</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">aKey</span><span class="p">)</span> <span class="k">this</span><span class="p">.</span><span class="nx">_map</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_normalize</span><span class="p">(</span><span class="nx">aKey</span><span class="p">)),</span>
<span class="nx">has</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">aKey</span><span class="p">)</span> <span class="k">this</span><span class="p">.</span><span class="nx">_map</span><span class="p">.</span><span class="nx">has</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_normalize</span><span class="p">(</span><span class="nx">aKey</span><span class="p">)),</span>
<span class="nx">set</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">aKey</span><span class="p">,</span> <span class="nx">aValue</span><span class="p">)</span> <span class="k">this</span><span class="p">.</span><span class="nx">_map</span><span class="p">.</span><span class="nx">set</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_normalize</span><span class="p">(</span><span class="nx">aKey</span><span class="p">),</span> <span class="nx">aValue</span><span class="p">),</span>
<span class="c1">// Properties must be manually forwarded.</span>
<span class="nx">get</span> <span class="nx">size</span><span class="p">()</span> <span class="k">this</span><span class="p">.</span><span class="nx">_map</span><span class="p">.</span><span class="nx">size</span><span class="p">,</span>
<span class="c1">// Here's where the magic happens. If a method is called that isn't defined</span>
<span class="c1">// here, just pass it to the internal _map object.</span>
<span class="nx">__noSuchMethod__</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">aId</span><span class="p">,</span> <span class="nx">aArgs</span><span class="p">)</span> <span class="k">this</span><span class="p">.</span><span class="nx">_map</span><span class="p">[</span><span class="nx">aId</span><span class="p">].</span><span class="nx">apply</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_map</span><span class="p">,</span> <span class="nx">aArgs</span><span class="p">)</span>
<span class="p">}</span>
</pre></div>
<p>The one downside of see of this is that properties must be declared
manually to forward to the internal <tt class="docutils literal">_map</tt> object. Maybe there is a
matching <tt class="docutils literal">__noSuchProperty__</tt> method I’m missing? Overall, I’m happy
with this solution, but please leave a comment if you can think of an
easier / better way to do this! (Or see a glaring way this will break!)</p>
<table class="docutils footnote" frame="void" id="id4" rules="none">
<colgroup><col class="label"></col><col></col></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id1">[1]</a></td><td>This is always a little bit of a sore subject in <a class="reference external" href="irc://irc.mozilla.org/#instantbird">#instantbird</a>
since we’ve had a variety of issues with this over the years. I think
we’ve fixed most of them at this point though!</td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id5" rules="none">
<colgroup><col class="label"></col><col></col></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id2">[2]</a></td><td>As I’ve <a class="reference external" href="http://patrick.cloke.us/posts/2011/03/08/so-called-irc-specifications/">written before</a>, <span class="caps">IRC</span> tends to have crazy specifications.
In <span class="caps">IRC</span>, <a class="reference external" href="https://tools.ietf.org/html/rfc2812#section-2.2">the characters of A-Z[]\~ are considered the upper case of a-z{}|^</a>
(“because of <span class="caps">IRC</span>’s Scandinavian origin”). Oh, also this can
change based on an <a class="reference external" href="http://tools.ietf.org/html/draft-brocklesby-irc-isupport-03#section-3.1"><span class="caps">ISUPPORT</span> response</a> from the server to pure <span class="caps">ASCII</span> or
<span class="caps">RFC</span> 1459 casemapping (A-Z[]\ map to a-z{}|). It seems like this could
theoretically change at any point on a live server too, although that
would be <span class="caps">INSANE</span> and I hope no one ever does that.</td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id6" rules="none">
<colgroup><col class="label"></col><col></col></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id3">[3]</a></td><td>I wrote some xpcshell tests to ensure these properties work as
expected, but they’re uhh…not up anywhere yet though. Oops.</td></tr>
</tbody>
</table>
</div>
Community and Volunteers2014-04-16T12:34:00-04:002014-04-16T12:34:00-04:00Patrick Cloketag:patrick.cloke.us,2014-04-16:/posts/2014/04/16/community-and-volunteers/<p>It was suggested that I cross-post this from mozilla.dev.planning onto
my blog. This is in reply to a thread entitled &#8220;<a class="reference external" href="https://groups.google.com/forum/#%21topic/mozilla.dev.planning/P8oHKTCWSiQ">Proposal: Move
Thunderbird and SeaMonkey to mozilla-central</a>&#8221; about (essentially)
merging comm-central back into mozilla-central. There have been many
technical concerns raised in the thread (that I&#8217;m not …</p><p>It was suggested that I cross-post this from mozilla.dev.planning onto
my blog. This is in reply to a thread entitled &#8220;<a class="reference external" href="https://groups.google.com/forum/#%21topic/mozilla.dev.planning/P8oHKTCWSiQ">Proposal: Move
Thunderbird and SeaMonkey to mozilla-central</a>&#8221; about (essentially)
merging comm-central back into mozilla-central. There have been many
technical concerns raised in the thread (that I&#8217;m not going to rehash
here). What I&#8217;m more interested in is the lack of community feeling
there. As Nicholas Nethercote said in that&nbsp;thread:</p>
<blockquote>
&#8220;I am surprised [&#8230;] by how heartless the discussion has been.&#8221;</blockquote>
<p>I should note that I did have some help editing this down from my
original post. Turns out I tend to write inflammatory statements that
don&#8217;t help get me point across. Who knew? Anyway, thanks to all of you
who helped me out&nbsp;there!</p>
<p>My full post is below (with a few links added and plaintext formatting
converted to <span class="caps">HTML</span>&nbsp;formatting):</p>
<blockquote>
<p>On Monday, April 14, 2014 4:52:53 <span class="caps">PM</span> <span class="caps">UTC</span>-4, Nicholas Nethercote&nbsp;wrote:</p>
<p>&gt; The technical aspects of this decision have been discussed to death,
&gt; so I won&#8217;t say anything about that. I am surprised, however, by how
&gt; heartless the discussion has&nbsp;been.</p>
<p>I agree, the technical bitshere seem to have solutions suggested by
Joshua and others, but the non-technical parts of this discussion
have left mefeeling disheartened and confused with the Mozilla&nbsp;community.</p>
<p>I find it ironic/amusing/sad/upsetting that a few threads above this
is a thread entitled &#8220;<a class="reference external" href="https://groups.google.com/forum/#!topic/mozilla.dev.planning/1kbZsYoQcng">Contributor pathways, engagement points and
bug mentoring</a>&#8221; while in this thread I see community contributors
being blocked at every&nbsp;turn!</p>
<p>Here I don&#8217;t see people attempting to foster a community by putting
their best foot forward. I see people trying to get their <strong>job</strong>
done; with an attitude of &#8220;if this doesn&#8217;t help me, get it outta my
way!&#8221; I don&#8217;t think this is the right way to grow a community. I
don&#8217;t think this is how Mozilla <span class="caps">HAS</span> grown it&#8217;s community. I don&#8217;t
think it&#8217;s in line with what Mozilla expects from it&#8217;s community
members (both employees and&nbsp;volunteers!)</p>
<p>Personally, I dislike the amount of Mozilla <strong>Corporation</strong> goals
focus in this thread. Can we have a discussion aspart ofa larger
community? Why must it focus on Corporate goals? I&#8217;m not part of the
corporation, I don&#8217;t really care what its goals are or are not. I
care about Mozilla, I care about providing high-quality, free, open
source softwareto improve the experience of the Internet for
everyone. And no, I&#8217;m not talking about Firefox. I&#8217;m talking about
Thunderbird. I understand that Mozilla&#8217;s goals arecurrently Firefox
and Firefox <span class="caps">OS</span>, but these are not my personal&nbsp;goals.</p>
<p>At the Summit I had a few conversations with people about
&#8220;on-boarding&#8221; new employees and getting them to understand how the
community works and that interacting with the community in a
positive manner is an important part of Mozilla. I don&#8217;t remember
the exact context, but part of it wasthat it is important that new
employees don&#8217;t think of it as &#8220;How can I <em>use</em> the community?&#8221;, for
that implies taking advtange of them, but &#8220;How can I work with the&nbsp;community?&#8221;</p>
<p>Please don&#8217;t see this as an &#8220;employees vs. volunteers&#8221; argument. I
believe that I&#8217;m expected to live up to these same goals. If I, as a
volunteer, can help an employee achieve his goals; I&#8217;m
<span class="strike">more than willing</span>, no&#8230;I&#8217;m <span class="caps">EXPECTED</span> to do that. I think
this is a two-way relationship that must be fostered. It has seemed
to me that over the past couple of years that I&#8217;ve been hanging
around here there&#8217;s been less and less focus on the community and
more and more on the&nbsp;Corporation.</p>
<p>I understand Thunderbird and SeaMonkey may not be important to you,
but it is important tome! (And otherswho contribute
totheThunderbird/SeaMonkey community, including employees who
contribute on their spare time.) When Mozilla stopped directly
supporting development of Thunderbird it was widely announced that
&#8220;Thunderbird is dead!&#8221;. We, as part of the Mozilla community, have
been fighting to prove this wrong.Could you please respect our
efforts? Merging c-c into m-c will help us focus our efforts on
building a great product instead of spending significant effort on
keeping a dying one on life-support. (And prove to all that
&#8220;Thunderbird is dead!&#8221; was just a sensational&nbsp;headline.)</p>
</blockquote>
<p>I don&#8217;t have much else to say beyond that (besides thanks for reading
this&nbsp;far!)</p>
GSoc Lessons: Part Deux: The Arms Race2013-12-04T09:17:00-05:002013-12-04T09:17:00-05:00Patrick Cloketag:patrick.cloke.us,2013-12-04:/posts/2013/12/04/gsoc-lessons-part-deux-arms-race/<p>This post title might be a little excessive, but I&#8217;ll blame <a class="reference external" href="http://en.wikipedia.org/wiki/The_Sum_of_All_Fears_%28film%29">The Sum
of All Fears</a> that I was watching last night. This is the second part
of a set of posts about ideas I heard at the Google Summer of Code 2013
Mentor Summit (you can read <a class="reference external" href="http://patrick.cloke.us/posts/2013/12/02/gsoc-lessons-part-1-application-period/">the …</a></p><p>This post title might be a little excessive, but I&#8217;ll blame <a class="reference external" href="http://en.wikipedia.org/wiki/The_Sum_of_All_Fears_%28film%29">The Sum
of All Fears</a> that I was watching last night. This is the second part
of a set of posts about ideas I heard at the Google Summer of Code 2013
Mentor Summit (you can read <a class="reference external" href="http://patrick.cloke.us/posts/2013/12/02/gsoc-lessons-part-1-application-period/">the first part about the application
process</a>).</p>
<p>This will explore an interesting anecdote I heard about the
interaction between applicants from another organization that, on
reflection, seemed to resonate somewhat with what I had seen in my
corner of the Mozilla&nbsp;community.</p>
<p>The organization these students were applying to required patches to
be fixed for a student&#8217;s application to be accepted (as discussed in my
previous post). For a particular project there existed multiple highly
motivated and skilled students, but only one slot. Thus, a &#8220;patch race&#8221;
of sorts occurred where the students competed by continually providing
more patches that were increasingly complex. (Note that this wasn&#8217;t a in
response to a challenge from community members, it was a spontaneous
situation.) Once a single student started to submit extra patches the
other students felt they must also submit more patches to be considered
equal/superior (hence my allusion to an &#8220;<a class="reference external" href="http://en.wikipedia.org/wiki/Arms_race#Nuclear_arms_race">arms race</a>&#8220;).
Interestingly, they would also sometimes work on the same bug in a sort
of race to see who could fix it&nbsp;first.</p>
<p>There&#8217;s a couple things I took away from&nbsp;this:</p>
<ol class="arabic simple">
<li>Great, the project just had a lot of things&nbsp;fixed!</li>
<li>The students were investing escalating amounts of time <em>during the
application phase</em>.</li>
<li>The students were not working in an open&nbsp;manner.</li>
</ol>
<p>I won&#8217;t really expand much more about the first point, it&#8217;s always
good to fix&nbsp;things.</p>
<p>Although submitting patches might showcase a student&#8217;s skill, it also
relates to how much time the student is willing and able to put into the
application period. This, in particular, matters since different areas
of the world end their school year at different times. A student that
has already finished his semester during the application period may have
a lot of free time to attempt to get a GSoC slot (but will most likely
not have as much time during the actual summer!) This something that
mentors should keep in mind while reviewing&nbsp;applications.</p>
<p>A downside of increasing amounts of time invested is that the
rejection is that much harder for both the mentor (especially if the
student is now part of the community!), as well as for the student who
has now vested a large amount of time in the&nbsp;project.</p>
<p>The realization that actually upset me, however, is that these
students were not working in an open manner! Instead of collaborating,
they were competing! To me, this would set off a very poor tone for the
rest of GSoC. In fact, one of the biggest challenges I&#8217;ve had with GSoC
students is getting them to work in the open (i.e. &#8220;show me the code&#8221;,
anyone in <a class="reference external" href="irc://irc.mozilla.org/#instantbird">#instantbird</a> is probably tired of hearing me say&nbsp;that).</p>
<p>At this point you <em>might</em> think this is a hypothetical case I made up!
Upon letting it sink in and reflecting on it&#8230;I realized I had actually
seen similar situations during the application periods I&#8217;ve been
involved with. This year, we found a bug in Instantbird&#8217;s <span class="caps">IRC</span> code (<span class="caps">CTCP</span>
quoting and dequoting); after referencing some <a class="reference external" href="http://patrick.cloke.us/posts/2011/03/08/so-called-irc-specifications/">specifications</a>, I was
pretty quickly able to figure out the vague areas where people should
look for a fix. A couple of GSoC students in the room started looking
into it and exhibited a greatly reduced form of the behavior I discussed
above. The students were sharing information, but were not comfortable
sharing code. Unfortunately, this led to some very vague questions which
I was unable to answer (or answered incorrectly) and led to me coining
my catchphrase from&nbsp;above.</p>
<p>I by no means think this reflects poorly on our students! I think this
is some what natural and expected for most students unfamiliar with open
development. (Extrapolating from my experiences in school&#8230;) Students
generally work individually (or in small groups) on projects and are
directly competing for grades (at least if the course is graded on a
curve). This would foster a sense of competition as opposed to
cooperation! Luckily the students working with us understood (with very
little prompting, I might add!) that we&#8217;d prefer they work together and
help each other. We were able to successfully fix the dequoting bug
(which then caused a bug in the quoting code to be&nbsp;visible&#8230;sigh&#8230;).</p>
<p>My <strong>short take away</strong> from all this: remember that students are not
yet a community and they&#8217;re competing with each other until they&#8217;ve been
accepted. (And that they&#8217;re used to competing, e.g. homework and exams,
not collaborating!) I don&#8217;t really know whether I feel the above
situation is good or bad, but it&#8217;s certainly an interesting effect from
the way the GSoC process&nbsp;works.</p>
GSoC Lessons: Part 1: Application Period2013-12-02T20:55:00-05:002013-12-02T20:55:00-05:00Patrick Cloketag:patrick.cloke.us,2013-12-02:/posts/2013/12/02/gsoc-lessons-part-1-application-period/<p>I briefly talked about <a class="reference external" href="http://patrick.cloke.us/posts/2013/10/20/google-summer-of-code-mentor-summit-2013/">my experiences</a> at the Google Summer of Code
2013 Mentor Summit. I&#8217;ve been pretty remiss in sharing what was actually
discussed there and for that I must apologize! This will hopefully be
one of a few posts about what I learned and discussed at the …</p><p>I briefly talked about <a class="reference external" href="http://patrick.cloke.us/posts/2013/10/20/google-summer-of-code-mentor-summit-2013/">my experiences</a> at the Google Summer of Code
2013 Mentor Summit. I&#8217;ve been pretty remiss in sharing what was actually
discussed there and for that I must apologize! This will hopefully be
one of a few posts about what I learned and discussed at the&nbsp;Summit.</p>
<p>The first part I&#8217;d like to talk about is the application period:
welcoming students, requirements for student applications, etc. Much of
what I say on here is just ideas I&#8217;ve heard other organizations
implement (with my personal opinion on them, please don&#8217;t think this
represents what Mozilla is suggesting students do, or even what I&#8217;m
suggesting Mozilla should ask students to&nbsp;do!)</p>
<p>I had many separate conversations about what is required for an
application to be accepted. It seems that Mozilla is actually on the
side of one of the easier organizations to apply to. We don&#8217;t (to my
knowledge) require that students have contributed at all to the
community beforehand. It is possible that some smaller communities
inside of Mozilla require more than just an application, but there does
not seem to be any rule across Mozilla. I said I wouldn&#8217;t offer my
opinion above&#8230;but I lied: I think Mozilla should make it clearer to
applicants what is expected of them before the&nbsp;application.</p>
<p>There seem to be a variety of things different organizations &#8220;require&#8221;
before accepting a student application, for&nbsp;example:</p>
<ul class="simple">
<li>A patch / pull&nbsp;request</li>
<li><span class="caps">IRC</span> / email involvement /&nbsp;idling</li>
<li>File a bug (I mean this in the &#8220;Mozilla&#8221; sense: an actual bug, a
feature request,&nbsp;etc.)</li>
<li>Fix a bug / make a&nbsp;commit</li>
</ul>
<p>I think all of these have pros and cons and making any a hard and fast
rule would probably be a bad idea. Personally for Instantbird, we
greatly encourage students to idle on <span class="caps">IRC</span> and get to know us; and to fix
a minor bug or two or three. What I&#8217;m always looking for is: use,
passion, and&nbsp;skill.</p>
<p>Asking for a <strong>patch / pull request</strong> (I include these together since
they really just depend on how an organization accepts changes) can be a
bit intimidating for a new user. I think this can be a pretty rough
thing to ask for new contributors that might not want to share their
work publicly with a large group of people (on a mailing list, public
bug tracker, etc.) where they might be wrong. Even after being part of
the community, I find that GSoC students are often very unwilling to
publicly share code unless it&#8217;s &#8220;perfect&#8221;, but I digress. Anyway, if
you&#8217;re considering &#8220;requiring&#8221; this, I think it should be pretty clear
that this changeset doesn&#8217;t need to be <em>perfect</em>, it just needs to show
that the student is able to read code, understand a bug report, provide
a fix and test&nbsp;it.</p>
<p>I think it&#8217;s perfect reasonable to ask students to <strong>idle on <span class="caps">IRC</span> and
join mailing lists</strong>. They should definitely be trying to understand the
community before attempting to join it. It isn&#8217;t just a matter of if the
community thinks the student would be a good fit, but also the student
must ensure they can fit into the&nbsp;community.</p>
<p><strong>Filing a bug</strong> is a great way for a student to show a few different
things: they&#8217;ve used your software; they&#8217;ve used your software enough to
find a bug in it (and there most likely is one!); they&#8217;re able to
express themselves in a clear and concise matter. If you&#8217;re lucky
they&#8217;ll find something that actually annoys them and fix it&nbsp;themselves!</p>
<p>I have <strong>fix a bug</strong> listed last. You might ask how this differs from
submitting a patch&#8230;and it does! Fixing a bug requires a patch to go
through whatever review process your project uses, but builds upon just
submitting a patch. My thoughts on this are pretty similar to just
submitting a patch, but it depends on how large the bug&nbsp;is.</p>
<p>Something I found interesting is that almost everyone I talked to
didn&#8217;t treat their GSoC students any differently than they would treat a
new contributor to their project. They still had to prove they were
worthy of commit access, etc. Is there anything else you ask of your
students before they apply to GSoC? I&#8217;d love to hear&nbsp;it!</p>
<p>Some other topics I&#8217;ll hopefully find some time to write about
include: community lessons, and handling a failing student. The
community one will be very not-GSoC focused and could apply to just
trying to incorporate new contributors&#8230;but I&#8217;ll include it in this&nbsp;series.</p>
Google Summer of Code Mentor Summit 20132013-10-20T22:18:00-04:002013-10-20T22:18:00-04:00Patrick Cloketag:patrick.cloke.us,2013-10-20:/posts/2013/10/20/google-summer-of-code-mentor-summit-2013/<p>Not only was I lucky enough to mentor a great student for this year&#8217;s
Google Summer of Code, but Mozilla asked me to represent them at the
Google Summer of Code Mentor Summit!&nbsp; This was located at Google&#8217;s
offices in Mountain View, California this past weekend (Friday, Oct …</p><p>Not only was I lucky enough to mentor a great student for this year&#8217;s
Google Summer of Code, but Mozilla asked me to represent them at the
Google Summer of Code Mentor Summit!&nbsp; This was located at Google&#8217;s
offices in Mountain View, California this past weekend (Friday, Oct.
18th - Sunday, Oct. 20th,&nbsp;2013).</p>
<p>Before actually heading over to the Summit, <a class="reference external" href="http://mykzilla.org/">Myk Melez</a> and <a class="reference external" href="http://nickdesaulniers.github.io/">Nick
Desaulniers</a> were kind enough to show me around the Mozilla Mountain
View office!&nbsp; (Thanks to Daniel Holbert for setting that&nbsp;up!)</p>
<p>The GSoC Mentor Summit is run as an &#8220;unconference&#8221;, the open sessions
were chosen by conference attendees and run as discussions with no
keynote speakers.&nbsp; This was an interesting experience and how good each
session was varied quite a bit by who was taking part in the discussion,
but overall it was great to hear the experiences of other projects with
their GSoC students, as well as to hear about lots of projects I had
never heard of before!&nbsp; In general the session I attended were about
community building and managing GSoC students, I took lots of notes and
will digest all of this in further detail at some&nbsp;point.</p>
<p>I was able to meet lots of great people from different projects, just
a few of which were: <a class="reference external" href="http://pidgin.im/">Pidgin</a>, <a class="reference external" href="http://www.debian.org/">Debian</a>, <a class="reference external" href="http://buildbot.net/">Buildbot</a>, the <a class="reference external" href="http://www.opendmx.net/">Open
Lighting Project</a>, the <a class="reference external" href="https://www.torproject.org/">Tor Project</a>, <a class="reference external" href="https://www.phpbb.com/%E2%80%8E">phpBB</a>, etc.&nbsp; Unfortunately
being from Mozilla, most people already know what you do&#8230;or they think
you do at least!&nbsp; Many people were surprised when I said I work on
Thunderbird and Instantbird.&nbsp; I heard &#8220;Thunderbird is dead&#8221; at least
twenty times, which was quite disappointing that those in the open
source community don&#8217;t even understand the current status of
Thunderbird.&nbsp; Many were happy to hear that it is still being maintained
and developed by the community, however.&nbsp; I even had some people thank
me (which I don&#8217;t really deserve) for helping to continue maintain
Thunderbird!&nbsp; It was great to hear things like this at the Mozilla
Summit, but it was really invigorating to hear people outside of the
Mozilla community excited that their favorite email client was still
being&nbsp;developed.</p>
<p>People were further surprised to hear that Thunderbird now includes
instant messaging / chat (since Thunderbird 15 or 17) and that there is
a Gecko based instant messaging client: Instantbird.&nbsp; It seemed like
some people were excited by this and hopefully they&#8217;ll try it&nbsp;out!</p>
<p>Anyway, I&#8217;ve gone a little off-topic, but overall the Mentor Summit
was great and I&#8217;d like to thank both Mozilla and Google for giving me
this opportunity.&nbsp; If I find any really great gems in my notes I&#8217;ll
write further blog posts about&nbsp;them.</p>
Yahoo Protocol Google Summer of Code Round-up2013-10-06T09:18:00-04:002013-10-06T09:18:00-04:00Patrick Cloketag:patrick.cloke.us,2013-10-06:/posts/2013/10/06/yahoo-protocol-google-summer-of-code/<p>I have to apologize to my student, <a class="reference external" href="http://phaseshiftsoftware.com/blog/">Quentin</a> (aka qheaden on <span class="caps">IRC</span>),
for taking so long to write this&#8230;but anyway: Google Summer of Code
2013 is over!&nbsp; Quentin has done a great job working at implementing the
Yahoo Protocol for Instantbird (and Thunderbird) in JavaScript
(henceforth called &#8220;<span class="caps">JS</span>-Yahoo …</p><p>I have to apologize to my student, <a class="reference external" href="http://phaseshiftsoftware.com/blog/">Quentin</a> (aka qheaden on <span class="caps">IRC</span>),
for taking so long to write this&#8230;but anyway: Google Summer of Code
2013 is over!&nbsp; Quentin has done a great job working at implementing the
Yahoo Protocol for Instantbird (and Thunderbird) in JavaScript
(henceforth called &#8220;<span class="caps">JS</span>-Yahoo&#8221;).&nbsp; It&#8217;s at the point where it has mostly
reached feature-parity with the libpurple plug-in.&nbsp; Before <a class="reference external" href="https://bugzilla.instantbird.org/show_bug.cgi?id=2135">turning this
on as default</a> there are a few minor bugs that still need to be fixed,
but most of them have patches that just need another couple&nbsp;iterations.</p>
<div class="section" id="where-do-we-go-from-here">
<h2>Where do we go from&nbsp;here?</h2>
<p>Once the last few bugs are fixed we&#8217;ll enable Yahoo by default in the nightly
builds and, assuming we have no issues, it will be enabled by default in the
upcoming Instantbird 1.5. If there are no major issues in 1.5, we&#8217;ll remove the
libpurple Yahoo implementation for Instantbird&nbsp;1.next.</p>
</div>
<div class="section" id="how-do-i-try-this-now">
<h2>How do I try this&nbsp;now?!</h2>
<p>You can already easily enable <span class="caps">JS</span>-Yahoo in <a class="reference external" href="http://nightly.instantbird.im/">Instantbird nightly builds</a>:</p>
<ol class="arabic simple">
<li>Type /about config in a conversation tab&#8217;s&nbsp;textbox</li>
<li>Type &#8220;forcePurple&#8221; in the search&nbsp;box</li>
<li>Remove &#8220;prpl-yahoo&#8221; and &#8220;prpl-yahoojp&#8221; from this comma separated list
of values (you can also remove prpl-jabber if you want to always use
the <span class="caps">JS</span>-<span class="caps">XMPP</span> implementation from GSoC 2011! Note that this doesn&#8217;t
support <a class="reference external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=14328"><span class="caps">DNS</span> <span class="caps">SRV</span></a>,&nbsp;however.)</li>
<li>Restart&nbsp;Instantbird!</li>
</ol>
<p>You should now be using the <span class="caps">JS</span>-Yahoo protocol.&nbsp; Hopefully you don&#8217;t
notice anything different, but <a class="reference external" href="https://bugzilla.instantbird.org/"><span class="caps">PLEASE</span> file bugs</a> if you see any&nbsp;issues.</p>
</div>
<div class="section" id="how-come-i-can-t-use-this-in-thunderbird">
<h2>How come I can&#8217;t use this in&nbsp;Thunderbird?!</h2>
<p>Because Instantbird and comm-central development don&#8217;t happen in the same
Mercurial repository.&nbsp; I&#8217;m working on <a class="reference external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=920801">syncing the chat/ folder of these
repositories</a> currently and <span class="caps">JS</span>-Yahoo should be in Daily soon to be
included in the next Thunderbird release (i.e. Thunderbird&nbsp;31).</p>
<p>The whole Instantbird community has been super happy with the progress
Quentin made and we hope that Quentin has learned a lot! Thanks for a
great summer qheaden and hopefully we&#8217;ll see you around&nbsp;still!</p>
</div>
Mentoring Google Summer of Code 20132013-06-28T18:05:00-04:002013-06-28T18:05:00-04:00Patrick Cloketag:patrick.cloke.us,2013-06-28:/posts/2013/06/28/mentoring-google-summer-of-code-2013/<p>I&#8217;m officially a mentor this year for <a class="reference external" href="http://www.google-melange.com/gsoc/homepage/google/gsoc2013">2013&#8217;s Google Summer of Code</a>.
I&#8217;m a bit late on posting this, but oh well! My student this year is
<a class="reference external" href="http://phaseshiftsoftware.com/">Quentin Headen</a> who is <a class="reference external" href="http://www.google-melange.com/gsoc/project/google/gsoc2013/qheaden/26001">working on</a> a <a class="reference external" href="http://en.wikipedia.org/wiki/Yahoo!_Messenger_Protocol">Yahoo! Messenger protocol</a>
for the Instantbird chat/ backend (so it&#8217;ll also be …</p><p>I&#8217;m officially a mentor this year for <a class="reference external" href="http://www.google-melange.com/gsoc/homepage/google/gsoc2013">2013&#8217;s Google Summer of Code</a>.
I&#8217;m a bit late on posting this, but oh well! My student this year is
<a class="reference external" href="http://phaseshiftsoftware.com/">Quentin Headen</a> who is <a class="reference external" href="http://www.google-melange.com/gsoc/project/google/gsoc2013/qheaden/26001">working on</a> a <a class="reference external" href="http://en.wikipedia.org/wiki/Yahoo!_Messenger_Protocol">Yahoo! Messenger protocol</a>
for the Instantbird chat/ backend (so it&#8217;ll also be usable via
Thunderbird). You can see <a class="reference external" href="http://phaseshiftsoftware.com/blog/category/gsoc-2013-logs/">an account of his trials, successes and
trepidations</a> (<a class="reference external" href="http://phaseshiftsoftware.com/blog/category/gsoc-2013-logs/feed/"><span class="caps">RSS</span></a>) or follow his <a class="reference external" href="https://bitbucket.org/qheaden/instantbird-gsoc-2013">code repository</a>. He&#8217;s made
great progress so far and is able to connect, download all the buddies
and start private conversations! Not too bad for a few weeks of work!
We&#8217;ve been keeping a <a class="reference external" href="https://etherpad.mozilla.org/ELTNA6O44F"><span class="caps">TODO</span> list</a> of things to be supported, please
don&#8217;t edit it without discussing it with us&nbsp;first.</p>
<p>Our hope is to get this checked into Instantbird by the end of summer
and run it in parallel (behind an <a class="reference external" href="about:config">about:config</a> preference) with the
current libpurple Yahoo implementation. Once we&#8217;re satisified that it
has feature parity we&#8217;ll remove the libpurple version and enable this by&nbsp;default!</p>
<p>Instantbird is also supporting two other&nbsp;projects:</p>
<ul class="simple">
<li>The <a class="reference external" href="http://www.google-melange.com/gsoc/project/google/gsoc2013/nhnt11/7001">&#8220;Awesometab&#8221;</a> is being done by <a class="reference external" href="http://awesometab.blogspot.com/">Nihanth Subramanya</a>
(<a class="reference external" href="http://awesometab.blogspot.com/feeds/posts/default?alt=rss"><span class="caps">RSS</span></a>)
and being mentored by Benedikt Pfeifer, his code is <a class="reference external" href="https://bitbucket.org/nhnt11/instantbird-addons">available</a> and
some has already been <a class="reference external" href="http://hg.instantbird.org/instantbird/rev/55009d68c4ec">checked</a> <a class="reference external" href="http://hg.instantbird.org/instantbird/rev/46ee5c836e48">into</a> <a class="reference external" href="http://hg.instantbird.org/instantbird/rev/52401d522970">Instantbird</a> <a class="reference external" href="http://hg.instantbird.org/instantbird/rev/ea36babac4be">nightlies</a>!</li>
<li><a class="reference external" href="http://www.google-melange.com/gsoc/project/google/gsoc2013/atuljangra/68001">FileLinks in <span class="caps">IM</span></a> is being worked on by <a class="reference external" href="http://atuljangra.tumblr.com/">Atul Jangra</a> (or <a class="reference external" href="http://gsoc-mozilla.tumblr.com/">maybe</a>)
(<a class="reference external" href="http://atuljangra.tumblr.com/rss"><span class="caps">RSS</span></a> /
<a class="reference external" href="http://gsoc-mozilla.tumblr.com/rss"><span class="caps">RSS</span></a>) and being mentored by
Florian Quèze, check out the <a class="reference external" href="https://bitbucket.org/atuljangra/instantbird-gsoc-2013">repository</a>.</li>
</ul>
<p>You can find any of us in #instantbird on irc.mozilla.org, my nick is
clokep, Quentin&#8217;s is qheaden, Nihanth&#8217;s: nhnt11, Atul&#8217;s: atuljangra,
Benedikt goes by Mic and Florian goes by something starting with&nbsp;&#8220;flo&#8221;.</p>
<p>Thanks also go out to Mozilla for letting us participate in Google
Summer of Code with them again! You can see all of the accepted projects
in <a class="reference external" href="http://blog.gerv.net/2013/06/gsoc-2013-project-list/">Gerv&#8217;s blogpost</a>.</p>
Instantbird 1.4 Released!2013-05-20T16:45:00-04:002013-05-20T16:45:00-04:00Patrick Cloketag:patrick.cloke.us,2013-05-20:/posts/2013/05/20/instantbird-14-released/<p>After a bunch of l10n build problems, we&#8217;ve finally released
Instantbird 1.4, which includes updates to libpurple 2.10.7 and Mozilla
20.&nbsp; In particular this&nbsp;includes:</p>
<ul class="simple">
<li>Updated Twitter code that uses v1.1 of their <span class="caps">API</span> (v1.0 will be
disabled on June 11th,&nbsp;2013).</li>
<li>Better character …</li></ul><p>After a bunch of l10n build problems, we&#8217;ve finally released
Instantbird 1.4, which includes updates to libpurple 2.10.7 and Mozilla
20.&nbsp; In particular this&nbsp;includes:</p>
<ul class="simple">
<li>Updated Twitter code that uses v1.1 of their <span class="caps">API</span> (v1.0 will be
disabled on June 11th,&nbsp;2013).</li>
<li>Better character counter for Twitter (it now takes into account if
URLs are&nbsp;embedded).</li>
<li>Updated log viewer which organizes logs by date (and nests them by
week, month,&nbsp;etc.)</li>
<li>Better support for <span class="caps">IRC</span>&nbsp;bouncers.</li>
<li>Support for overriding self-signed/invalid/out-of-date certificates
for <span class="caps">IRC</span>.</li>
</ul>
<p>If you&#8217;ve been using some other instant messaging client (e.g. Pidgin
or Adium); I&#8217;d highly suggest giving Instantbird a try, especially if
you also go on <span class="caps">IRC</span>. Instantbird has great <span class="caps">IRC</span> support! (And&#8230;if you do
have issues, feel free to ping me in #instantbird on irc.mozilla.org and
let me know what your issue&nbsp;is.)</p>
<p>You can download it <a class="reference external" href="http://www.instantbird.com/download-all.html">here</a>, or view the full <a class="reference external" href="http://www.instantbird.com/release-notes.html">release notes</a>.</p>
JavaScript typed arrays pain2012-11-28T23:11:00-05:002012-11-28T23:11:00-05:00Patrick Cloketag:patrick.cloke.us,2012-11-28:/posts/2012/11/28/javascript-typed-arrays-pain/<p>If you&#8217;ve ever tried to deal with binary data in JavaScript you know
it isn&#8217;t much fun and you usually resort to using strings lots of
charCodeAt and related functions.&nbsp; <a class="reference external" href="https://developer.mozilla.org/en-US/docs/JavaScript_typed_arrays">Typed arrays</a> are supposed to solve
this though!&nbsp; The typed array <span class="caps">API</span> consists of creating a buffer of …</p><p>If you&#8217;ve ever tried to deal with binary data in JavaScript you know
it isn&#8217;t much fun and you usually resort to using strings lots of
charCodeAt and related functions.&nbsp; <a class="reference external" href="https://developer.mozilla.org/en-US/docs/JavaScript_typed_arrays">Typed arrays</a> are supposed to solve
this though!&nbsp; The typed array <span class="caps">API</span> consists of creating a buffer of bytes
(called an <a class="reference external" href="https://developer.mozilla.org/en-US/docs/JavaScript_typed_arrays/ArrayBuffer">ArrayBuffer</a>) and then manipulating those bytes via
different views (<a class="reference external" href="https://developer.mozilla.org/en-US/docs/JavaScript_typed_arrays/ArrayBufferView">ArrayBufferView</a>s).&nbsp; You can have multiple views of
the same buffer, starting at different offsets, of different lengths and
types&#8230;which is all neat from a technical point of view, but is it
really useful?&nbsp; It is kind of nice working with the views as if they
were normal arrays&nbsp;though.</p>
<p>I&#8217;ve been playing with these ArrayBuffers quite a bit as I&#8217;m working
on an implementation of the <a class="reference external" href="http://en.wikipedia.org/wiki/OSCAR_protocol"><span class="caps">OSCAR</span> protocol</a> (used for <a class="reference external" href="http://en.wikipedia.org/wiki/AOL_Instant_Messenger"><span class="caps">AOL</span> Instant
Messenger</a> and <a class="reference external" href="http://en.wikipedia.org/wiki/ICQ"><span class="caps">ICQ</span></a>) in the chat backend (for Instantbird /
Thunderbird).&nbsp; (As an aside, the <span class="caps">OSCAR</span> protocol Wikipedia page has
surprisingly good documentation of some of the underlying data
structures of the protocol&#8230;)&nbsp; I started by writing some test code
using ArrayBuffers and views, which have been around a while: since
Gecko 2.0 in fact!&nbsp; I quickly ran into some tedious issues with
repetitive code such&nbsp;as:</p>
<div class="highlight"><pre><span></span><span class="cm">/*</span>
<span class="cm"> * A TLV (Type, Length and Value) data structure:</span>
<span class="cm"> * Unsigned Short type Describes what the value represents.</span>
<span class="cm"> * Unsigned Short length The length of the data block.</span>
<span class="cm"> * Bytes value The raw payload.</span>
<span class="cm"> *</span>
<span class="cm"> * The overall length of a TlvBlock is length + 4.</span>
<span class="cm"> *</span>
<span class="cm"> * The inputs to this are:</span>
<span class="cm"> * aType The type of the TLV Block.</span>
<span class="cm"> * aValue An ArrayBuffer containing the data.</span>
<span class="cm"> */</span>
<span class="kd">function</span> <span class="nx">TlvBlock</span><span class="p">(</span><span class="nx">aType</span><span class="p">,</span> <span class="nx">aValue</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">let</span> <span class="nx">data</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">ArrayBuffer</span><span class="p">(</span><span class="nx">aValue</span><span class="p">.</span><span class="nx">byteLength</span> <span class="o">+</span> <span class="mi">4</span><span class="p">);</span>
<span class="c1">// The first two bytes are unsigned shorts.</span>
<span class="kd">let</span> <span class="nx">view</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Uint16Array</span><span class="p">(</span><span class="nx">data</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">);</span>
<span class="nx">view</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="nx">aType</span><span class="p">;</span>
<span class="nx">view</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="nx">aValue</span><span class="p">.</span><span class="nx">byteLength</span><span class="p">;</span>
<span class="c1">// The rest just gets the data copied into it.</span>
<span class="nx">view</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Uint8Array</span><span class="p">(</span><span class="nx">data</span><span class="p">,</span> <span class="mi">4</span><span class="p">);</span>
<span class="nx">view</span><span class="p">.</span><span class="nx">set</span><span class="p">(</span><span class="k">new</span> <span class="nx">Uint8Array</span><span class="p">(</span><span class="nx">aValue</span><span class="p">));</span>
<span class="k">return</span> <span class="nx">data</span><span class="p">;</span>
<span class="p">}</span>
</pre></div>
<p>This actually illustrates two annoying issues I&nbsp;have:</p>
<ol class="arabic simple">
<li>I end up with extra lines of code defining a new view every time I
switch data&nbsp;types.</li>
<li>There&#8217;s no simple way to copy an ArrayBuffer into a part of an
ArrayBuffer. In the above example I create a Uint8Array view of the
target location, a Uint8Array view of the source location and then
set the source to the target. Seems simple once you figure it out,
but it took a while to figure&nbsp;out.</li>
</ol>
<p>(As an aside, some of you might find the following function helpful,
it is essentially a <a class="reference external" href="http://en.cppreference.com/w/cpp/string/byte/memcpy">memcpy</a> for ArrayBuffers&#8230;this isn&#8217;t really
tested heavily at all,&nbsp;however.)</p>
<div class="highlight"><pre><span></span><span class="cm">/*</span>
<span class="cm"> * aTarget / aSource are ArrayBuffers</span>
<span class="cm"> */</span>
<span class="kd">function</span> <span class="nx">copyBytes</span><span class="p">(</span><span class="nx">aTarget</span><span class="p">,</span> <span class="nx">aSource</span><span class="p">,</span> <span class="nx">aTargetOffset</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span> <span class="nx">aSourceOffset</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span> <span class="nx">aLength</span> <span class="o">=</span> <span class="nx">aSource</span><span class="p">.</span><span class="nx">byteLength</span><span class="p">)</span> <span class="p">{</span>
<span class="c1">// The rest just gets the data copied into it.</span>
<span class="kd">let</span> <span class="nx">view</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Uint8Array</span><span class="p">(</span><span class="nx">aTarget</span><span class="p">,</span> <span class="nx">aTargetOffset</span><span class="p">);</span>
<span class="nx">view</span><span class="p">.</span><span class="nx">set</span><span class="p">(</span><span class="k">new</span> <span class="nx">Uint8Array</span><span class="p">(</span><span class="nx">aSource</span><span class="p">,</span> <span class="nx">aSourceOffset</span><span class="p">,</span> <span class="nx">aLength</span><span class="p">));</span>
<span class="p">}</span>
</pre></div>
<p><span class="caps">OK</span>, so typed arrays seem good, but kind of annoying, right?
Wrong&#8230;the <span class="caps">OSCAR</span> protocol is a &#8220;network order&#8221; protocol (aka it is big
endian). At this point you&#8217;re probably thinking &#8220;<span class="caps">OK</span>, so the ArrayBuffer
constructor must take an endianess flag!&#8221;&nbsp; Wrong, it does no such
thing.&nbsp; &#8220;Hmmm&#8230;Well do the ArrayBufferViews take an endianess flag?&#8221;
Nope, wrong again.&nbsp; The only way to specify the endianess of the data is
to use a <a class="reference external" href="https://developer.mozilla.org/en-US/docs/JavaScript_typed_arrays/DataView">DataView</a>, a slightly different interface to the underlying
bytes.&nbsp; It offers an <span class="caps">API</span> to individually set different data elements via
their offset and endianess.&nbsp; (If you&#8217;re too lazy to read the
documentation all the way through, DataView assumes big endian: makes my
life&nbsp;easier!)</p>
<p>For the curious, JavaScript typed arrays use the system endianess,
which in my opinion is pretty much useless (at least if you plan on
sharing data) since you can never guarantee the endianess to be either
big or little endian.&nbsp; (The fun part is that this isn&#8217;t even documented,
I found it on <a class="reference external" href="http://stackoverflow.com/questions/7869752/javascript-typed-arrays-and-endianness">Stack Overflow</a> and&nbsp;verified.)</p>
<p>So, in summary&#8230;if you plan on networking at all with ArrayBuffers,
don&#8217;t use ArrayBufferViews, use DataViews.&nbsp; (Although Uint8Arrays and
Int8Arrays should work&nbsp;fine!)</p>
<p>And to not rant the <em>entire</em> time, working with typed arrays certainly
does beat strings +&nbsp;charCodeAt!</p>
Instantbird 1.3 Released!!!2012-11-16T06:42:00-05:002012-11-16T06:42:00-05:00Patrick Cloketag:patrick.cloke.us,2012-11-16:/posts/2012/11/16/instantbird-13-released/<p>Well we finally got our release process down a bit better and were
able to do a quicker release (from 1.2 to 1.3, compared to our previous
few releases). This is great news, as it gives incremental changes to
our users faster!&nbsp; There&#8217;s some new features available …</p><p>Well we finally got our release process down a bit better and were
able to do a quicker release (from 1.2 to 1.3, compared to our previous
few releases). This is great news, as it gives incremental changes to
our users faster!&nbsp; There&#8217;s some new features available, which are mostly
covered on the <a class="reference external" href="http://blog.instantbird.org/2012/11/instantbird-1-3-released/">Instantbird blog</a>, but&nbsp;quickly:</p>
<ul class="simple">
<li><span class="caps">IRC</span> now supports <span class="caps">SASL</span> authentication, which is required by Freenode
when connecting from Tor or certain <span class="caps">IP</span>&nbsp;ranges.</li>
<li>Long messages over <span class="caps">IRC</span> are now smartly chopped and sent as multiple
messages (instead of being&nbsp;truncated).</li>
<li>The &#8220;Show Nick&#8221; add-on was integrated: this allows styling of a
mentioned nick in a conversation (and is extremely useful for
following multiple&nbsp;conversations).</li>
<li>Various other minor&nbsp;improvements&#8230;</li>
</ul>
<p>Instantbird 1.3 is based off of Mozilla 16.0.2, but I believe we&#8217;re
hoping to update to mozilla-central soon in order to benefit from cool
new technologies, like WebRTC!&nbsp; You should <a class="reference external" href="http://www.instantbird.com/download-all.html">check out Instantbird</a>&nbsp;now!</p>
On Status2012-10-16T21:33:00-04:002012-10-16T21:33:00-04:00Patrick Cloketag:patrick.cloke.us,2012-10-16:/posts/2012/10/16/on-status/<p>Something that comes up often about Instantbird is why we only support
three statuses: Available, Unavailable and Offline.&nbsp; (We do actually
support a fourth one too, Idle, but that is set automatically, not
chosen by the user.)&nbsp; Frequently this discussion is in the context of
wanting an &#8220;Invisible&#8221; status, but …</p><p>Something that comes up often about Instantbird is why we only support
three statuses: Available, Unavailable and Offline.&nbsp; (We do actually
support a fourth one too, Idle, but that is set automatically, not
chosen by the user.)&nbsp; Frequently this discussion is in the context of
wanting an &#8220;Invisible&#8221; status, but I&#8217;ll get to that&nbsp;later&#8230;</p>
<p>Many users have talked to us on <span class="caps">IRC</span>, email or via bugs and complained
about wanting an &#8220;Away&#8221; status or a &#8220;Do Not Disturb&#8221; status.&nbsp; There&#8217;s a
few issues with&nbsp;this:</p>
<ol class="arabic simple">
<li>What&#8217;s really the difference between &#8220;Unavailable&#8221;, &#8220;Away&#8221; and &#8220;Do
Not Disturb&#8221;?&nbsp; Do you really need to choose them individually?
(Other things that fit into here: &#8220;Not at my desk&#8221;, &#8220;on the phone&#8221;,
&#8220;busy&#8221;, &#8220;stepped out&#8221;.&nbsp; It is amazing how some protocols have so many
ways to describe being&nbsp;unavailable!)</li>
<li>A technical issue that we often run into is trying to shoehorn
different protocol implementations into our abstract protocol
interface.&nbsp; (We already have some fairly complicated interfaces
around joining chat rooms, creating different account, etc. because
of&nbsp;this.)</li>
<li>Setting yourself as &#8220;Away&#8221; or &#8220;Invisible&#8221; is a lie.&nbsp; Perhaps this is
me being overly idealistic, but why would you set yourself as
&#8220;Away&#8221;?&nbsp; It seems that this is something that should be done
automatically (when you lock your display, perhaps?).&nbsp; You can&#8217;t be
&#8220;Away&#8221; and using your computer at the same time!
Again, perhaps being idealistic, but what is the point of the
&#8220;Invisible&#8221; status?&nbsp; If you wish to be hidden from someone
(everyone?) why not just block those users.&nbsp; Or ignore them when they
send you a message.&nbsp; If you are busy, set yourself to &#8220;Unavailable&#8221;
and people should understand that they should not talk to you&#8230;if
they don&#8217;t, well&#8230;do you really want them talking to you ever?&nbsp; (Are
they really your friend?&nbsp; I guess you don&#8217;t get to choose your
co-workers, but still.)&nbsp; Now, perhaps this is just my opinion as
being someone who never really hard an &#8220;Invisible&#8221; status (I actually
remember it being added to the <span class="caps">AIM</span> client at some&nbsp;point).</li>
</ol>
<p>At this point you probably don&#8217;t believe me that there&#8217;s really <em>that</em>
many different protocol statuses out there, so I figured I&#8217;d illustrate
a few protocols in a matrix.&nbsp; Note that this isn&#8217;t meant to be
exhaustive, just to show how complicated of a situation this really is.
All protocols can obviously be &#8220;offline&#8221; as well, but that&#8217;s not shown
in the&nbsp;table.</p>
<table border="1" class="docutils">
<colgroup>
<col width="30%" />
<col width="13%" />
<col width="21%" />
<col width="17%" />
<col width="19%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">&nbsp;</th>
<th class="head">Available</th>
<th class="head">Unavailable</th>
<th class="head">Phone</th>
<th class="head">Invisible</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>Oscar (<span class="caps">AIM</span>/<span class="caps">ICQ</span>)</td>
<td>Online</td>
<td>Away</td>
<td>&nbsp;</td>
<td>Invisible</td>
</tr>
<tr><td><span class="caps">IRC</span></td>
<td>Online</td>
<td>Away</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr><td>Microsoft Lync</td>
<td>Online</td>
<td><ul class="first last simple">
<li>Busy</li>
<li>Away</li>
<li>In a&nbsp;meeting</li>
</ul>
</td>
<td>In a call</td>
<td>&nbsp;</td>
</tr>
<tr><td>Yahoo! Messenger</td>
<td>Available</td>
<td><ul class="first last simple">
<li>Busy</li>
<li>Stepped&nbsp;out</li>
<li>Be right&nbsp;back</li>
<li>Not at my&nbsp;desk</li>
</ul>
</td>
<td>On the phone</td>
<td>&nbsp;</td>
</tr>
<tr><td>Windows Live Messenger</td>
<td>Online</td>
<td><ul class="first last simple">
<li>Busy</li>
<li>Away</li>
<li>Be Right&nbsp;Back</li>
<li>Out to&nbsp;lunch</li>
</ul>
</td>
<td>On the phone</td>
<td>Appear offline</td>
</tr>
<tr><td><span class="caps">XMPP</span> (e.g. Google Talk)</td>
<td>Available</td>
<td>Busy</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
Instantbird 1.2 Released (with awesome new IRC features)!2012-08-08T13:08:00-04:002012-08-08T13:08:00-04:00Patrick Cloketag:patrick.cloke.us,2012-08-08:/posts/2012/08/08/instantbird-12-released-with-awesome/<p>If you haven&#8217;t seen the announcement&#8230;<a class="reference external" href="http://blog.instantbird.org/2012/08/instantbird-1-2-released/">Instantbird 1.2 has been
released</a>!&nbsp; It&#8217;s got a ton of great new features that I&#8217;m excited for:
<a class="reference external" href="http://blog.instantbird.org/2012/08/tab-completion-in-instantbird-1-2/">better tab complete</a>, a marker showing the last viewed messages,
support for Bonjour and more.&nbsp; But the most exciting bits to me are …</p><p>If you haven&#8217;t seen the announcement&#8230;<a class="reference external" href="http://blog.instantbird.org/2012/08/instantbird-1-2-released/">Instantbird 1.2 has been
released</a>!&nbsp; It&#8217;s got a ton of great new features that I&#8217;m excited for:
<a class="reference external" href="http://blog.instantbird.org/2012/08/tab-completion-in-instantbird-1-2/">better tab complete</a>, a marker showing the last viewed messages,
support for Bonjour and more.&nbsp; But the most exciting bits to me are our
JavaScript implementations of <a class="reference external" href="http://lxr.instantbird.org/instantbird/source/chat/protocols/xmpp/"><span class="caps">XMPP</span></a> (used for <a class="reference external" href="http://lxr.instantbird.org/instantbird/source/chat/protocols/facebook/">Facebook Chat</a> and
<a class="reference external" href="http://lxr.instantbird.org/instantbird/source/chat/protocols/gtalk/">GTalk</a>, so far) and <a class="reference external" href="http://lxr.instantbird.org/instantbird/source/chat/protocols/irc/"><span class="caps">IRC</span></a>!</p>
<p>Why am I so excited for them? Mostly because they&#8217;re extendable!
(Well&#8230;and I guess because I wrote most of the <span class="caps">IRC</span> code.) I&#8217;ve
<a class="reference external" href="http://patrick.cloke.us/posts/2012/06/11/irc-auto-performs/">written</a> a bit about this before for <span class="caps">IRC</span>&#8230;but it will let add-ons do
whatever they want to the <span class="caps">IRC</span> protocol.&nbsp; You should check out the
implementations (links above), they&#8217;re very hackable.&nbsp; Hopefully we can
remove libpurple <span class="caps">XMPP</span> and fully switch to Instantbird&#8217;s <span class="caps">XMPP</span> for the
next release, once a few <a class="reference external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=14328">Mozilla bugs</a> are&nbsp;fixed.</p>
<p>Did I also mention that these implementations (including the raw <span class="caps">XMPP</span>
and Twitter, which Instantbird has supported since 1.0) are going to be
included in <a class="reference external" href="http://www.mozilla.org/en-US/thunderbird/">Thunderbird</a>15, as part of it&#8217;s new <a class="reference external" href="https://wiki.mozilla.org/Modules/Chat">chat feature</a>?
Florian has done a great job of integrating our chat code there and it
gives quite a different user experience than Instantbird, so don&#8217;t be
worried about Instantbird going&nbsp;away!</p>
<p>Now of course, we always think of the future here (after all,
releasing itself isn&#8217;t really exciting when most of the features have
been in nightly builds&#8230;forever), so we started making a list of some
of the stuff we&#8217;d like to implement in future Instantbirds, you can
check it out <a class="reference external" href="https://etherpad.mozilla.org/ib-1-3">here</a>. Some of them are very exciting, feel free to grab
one and work on&nbsp;it.</p>
IRC Auto-Performs2012-06-11T22:25:00-04:002012-06-11T22:25:00-04:00Patrick Cloketag:patrick.cloke.us,2012-06-11:/posts/2012/06/11/irc-auto-performs/
<p>There have been a <a class="reference external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=742675">few</a> <a class="reference external" href="https://bugzilla.instantbird.org/show_bug.cgi?id=1101">requests</a> to support “auto-performs”
(sending commands to the <span class="caps">IRC</span> server after connection that the user types
into a box or whatever). Personally I find this to be:</p>
<ol class="arabic simple">
<li>A fairly awful user experience.</li>
<li>Confusing to new users.</li>
<li>Unnecessary.</li>
</ol>
<p>I additionally don’t like this idea since …</p>
<p>There have been a <a class="reference external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=742675">few</a> <a class="reference external" href="https://bugzilla.instantbird.org/show_bug.cgi?id=1101">requests</a> to support “auto-performs”
(sending commands to the <span class="caps">IRC</span> server after connection that the user types
into a box or whatever). Personally I find this to be:</p>
<ol class="arabic simple">
<li>A fairly awful user experience.</li>
<li>Confusing to new users.</li>
<li>Unnecessary.</li>
</ol>
<p>I additionally don’t like this idea since it requires us to have
commands for all the common tasks you’d want to do in an auto-perform
(or support sending absolutely raw messages to the server, which we
actually do already in the /quote command). Essentially what I just
described is writing our own scripting language…that seems pointless
(and frankly, I have better things to do). I’m hoping to convince you
with this post (and maybe a series of posts) that auto-performs aren’t
necessary and a trivial restartless extension can replace them.</p>
<div class="section" id="design">
<h2><a class="toc-backref" href="#id1">Design</a></h2>
<p>Part of the desire to <a class="reference external" href="http://patrick.cloke.us/posts/2011/04/30/why-rewrite-irc-protocol-plugin-part-2/">replace the libpurple <span class="caps">IRC</span> protocol plugin</a>
with a new JavaScript one built specifically for Instantbird (which is
also now used in Thunderbird!) was to make the protocol fully
extensible. There are <a class="reference external" href="http://patrick.cloke.us/posts/2011/03/08/so-called-irc-specifications/">many revisions and unofficial extensions to <span class="caps">IRC</span></a>
and we might not necessarily want to support them all (especially if
they only apply to a single network). Allowing all parts of the protocol
implementation to be touched and extended seemed like a great way to
handle this.</p>
<p>Initially I tried to do this by making the <span class="caps">IRC</span> account into an <span class="caps">XPCOM</span>
component (well it is one already, it’s an prplIAccount, but I meant an
<span class="caps">IRC</span> specific one: implementing ircIAccount, if you will). Unfortunately,
this seemed to have a lot of overhead and got complicated extremely
quickly. Anything I’d want to touch from a message handler (wait,
wait…what’s a handler?! I’ll get back to that) would need to have
methods written and exposed to access internal data of the
account…does that sound very extensible to you? Well, it doesn’t to me…</p>
<p>Onto design two! (Well actually my first design…) Lots of JavaScript
objects! The entire protocol is implemented as a set of JavaScript
objects and the handlers directly touch and modify the account’s data
(of course there’s methods for abstraction, etc.). This means that an
extension has absolutely <span class="caps">FULL</span> access to every about an account…this
also means an extension could seriously mess with and cause the protocol
to stop working or do really crazy things, etc. Unfortunately there
isn’t really a way to avoid that. Hopefully people write good code.</p>
</div>
<div class="section" id="messages">
<h2><a class="toc-backref" href="#id2">Messages</a></h2>
<p>I’m going to go into an aside about messages right now, even though it
doesn’t quite seem relevent yet. It will. <span class="caps">IRC</span> has a bunch of
sub-protocols embedded within the <span class="caps">IRC</span> protocol (see the link above about
unofficial extensions). We attempt to parse all the string messages and
make pretty JavaScript objects out of them. I’ve actually identified
five (yes, count that: five) different sub-“protocols” within <span class="caps">IRC</span> that
we deal:</p>
<ol class="arabic simple">
<li><span class="caps">IRC</span> itself (i.e. <a class="reference external" href="http://tools.ietf.org/html/rfc1459"><span class="caps">RFC</span> 1459</a> / <a class="reference external" href="http://tools.ietf.org/html/rfc2812"><span class="caps">RFC</span> 2812</a> / various numeric extensions)</li>
<li><a class="reference external" href="http://www.irchelp.org/irchelp/rfc/ctcpspec.html"><span class="caps">CTCP</span> (the Client-to-Client Protocol)</a>,embedded in <span class="caps">PRIVMSG</span> commands
of <span class="caps">IRC</span></li>
<li><span class="caps">DCC</span> (Direct Client-to-Client), a subprotocol of <span class="caps">CTCP</span></li>
<li><a class="reference external" href="http://tools.ietf.org/html/draft-brocklesby-irc-isupport-03"><span class="caps">ISUPPORT</span></a> (also known as Numeric 005), a method of negotiating
capabilities between a client and server</li>
<li>And finally, handling of <span class="caps">IRC</span> Services (there’s a lot of them and no
specification, but we treat them specially)</li>
</ol>
<p>Briefly what happens when we receive a raw message over the wire, we
create an <a class="reference external" href="http://hg.instantbird.org/instantbird/file/b8d8b6e60aef/chat/protocols/irc/irc.js#l14">ircMessage object out of it using a variety of regular
expressions</a>. This object has a variety of fields (see the link for
details), including the command, who sent the message and the parameters.</p>
<p>If the message is identified as a <span class="caps">CTCP</span> message, we then morph the
ircMessage into a <a class="reference external" href="http://hg.instantbird.org/instantbird/file/b8d8b6e60aef/chat/protocols/irc/ircCTCP.jsm#l44">CTCPMessage</a>, which can be morphed into a
<a class="reference external" href="http://hg.instantbird.org/instantbird/file/b8d8b6e60aef/chat/protocols/irc/ircDCC.jsm#l20">DCCMessage</a>. Additionally, a 005 reply can be parsed into a
<a class="reference external" href="http://hg.instantbird.org/instantbird/file/b8d8b6e60aef/chat/protocols/irc/ircISUPPORT.jsm#l22">isupportMessage</a>. And last, but not least, a received <span class="caps">PRIVMSG</span> can also
be parsed into a <a class="reference external" href="http://hg.instantbird.org/instantbird/file/b8d8b6e60aef/chat/protocols/irc/ircServices.jsm#l19">ServiceMessage</a>. Each of these extends the <span class="caps">IRC</span>
message without destroying information. (Yes, I’m realizing now that my
choice of whether to use capitals is all messed up…)</p>
<p>Well, why do we care…? By preparsing the strings into objects (as
defined by any “specifications” that exist), we keep extensions from
having to parse messages over and over again from strings.</p>
</div>
<div class="section" id="handlers">
<h2><a class="toc-backref" href="#id3">Handlers</a></h2>
<p>A handler is simply what I call the object that contains the methods
to deal with an incoming message. Pretty much, you get to say “Only send
me <span class="caps">ISUPPORT</span> messages!” or “Only send me <span class="caps">CTCP</span> messages!” and voila, you
only get that type of message. Each message type has a field that is
used to choose the method to run (for the <span class="caps">IRC</span> messages, the “command”,
for <span class="caps">CTCP</span> the “<span class="caps">CTCP</span> command”, <span class="caps">ISUPPORT</span> the “parameter”, etc.) This sounds
a lot more complicated than it is, I think a brief <a class="reference external" href="https://bitbucket.org/clokep/irc-extras/src/6f778f17172a/example/bootstrap.js">example</a> is in order:</p>
<div class="highlight"><pre><span></span><span class="kd">var</span> <span class="nx">ircSimpleExample</span> <span class="o">=</span> <span class="p">{</span>
<span class="c1">// The name here is really only used in error messages.</span>
<span class="nx">name</span><span class="o">:</span> <span class="s2">"IRC Simple Example"</span><span class="p">,</span>
<span class="c1">// Slightly above the default priority so we run before the main IRC handler.</span>
<span class="nx">priority</span><span class="o">:</span> <span class="nx">ircHandlers</span><span class="p">.</span><span class="nx">DEFAULT_PRIORITY</span> <span class="o">+</span> <span class="mi">10</span><span class="p">,</span>
<span class="c1">// Run this for all accounts (note that the 'this' object in this method is</span>
<span class="c1">// the JavaScript account object.</span>
<span class="nx">isEnabled</span><span class="o">:</span> <span class="kd">function</span><span class="p">()</span> <span class="kc">true</span><span class="p">,</span>
<span class="c1">// The commands we want to handle. For each of these, the account object is</span>
<span class="c1">// bound to 'this' and the single parameter is of the type that you've</span>
<span class="c1">// registered your handle.</span>
<span class="nx">commands</span><span class="o">:</span> <span class="p">{</span>
<span class="s2">"001"</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">aMessage</span><span class="p">)</span> <span class="p">{</span>
<span class="c1">// At the 001 response we've successfully connected to the server.</span>
<span class="c1">// Send an IDENTIFY command to NickServ.</span>
<span class="k">this</span><span class="p">.</span><span class="nx">sendMessage</span><span class="p">(</span><span class="s2">"PRIVMSG"</span><span class="p">,</span> <span class="p">[</span><span class="s2">"NickServ"</span><span class="p">,</span> <span class="s2">"IDENTIFY &lt;your password&gt;"</span><span class="p">]);</span>
<span class="c1">// Return false so the default handler still runs.</span>
<span class="k">return</span> <span class="kc">false</span><span class="p">;</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
</pre></div>
<p>Just like that we’ve designed a handler! Whenever the 001 method is
received from the server, this function will run and attempt to identify
with the NickServ (of course this could use a bit more security on it,
but it’s to demonstrate the possibilities). (The sendMessage function
takes the command to send and an array of parameters to send.)</p>
<p>As this is already a long post, I think I’ll cut this off now and
continue this at another time, but I hope I’m beginning to convince you
that allowing directy access to the account and protocol implementation
is a more powerful (and even simpler in many ways, in my opinion)
alternative to “auto-performs”. The one major downside I see to this, is
that it requires a bit more understanding of the actual protocol level
implementation, I don’t feel that knowing you need to use “<span class="caps">PRIVMSG</span>” as a
command instead of /msg is a huge issue, however.</p>
</div>
Instantbird Contact List Hack #22012-01-15T10:00:00-05:002012-01-15T10:00:00-05:00Patrick Cloketag:patrick.cloke.us,2012-01-15:/posts/2012/01/15/instantbird-contact-list-hack-2/<p>There was a <a class="reference external" href="https://bugzilla.instantbird.org/show_bug.cgi?id=987">request</a> on the Instantbird Bugzilla to always show
contacts in the contact list as the &#8220;big&#8221; contact (as shown when a
contact is selected).&nbsp; Similarly to my <a class="reference external" href="http://patrick.cloke.us/posts/2011/10/31/instantbird-contact-list-hack/">last post</a>, this can easily be
done with userChrome.css.&nbsp; See the post if you don&#8217;t know what
userChrome …</p><p>There was a <a class="reference external" href="https://bugzilla.instantbird.org/show_bug.cgi?id=987">request</a> on the Instantbird Bugzilla to always show
contacts in the contact list as the &#8220;big&#8221; contact (as shown when a
contact is selected).&nbsp; Similarly to my <a class="reference external" href="http://patrick.cloke.us/posts/2011/10/31/instantbird-contact-list-hack/">last post</a>, this can easily be
done with userChrome.css.&nbsp; See the post if you don&#8217;t know what
userChrome.css&nbsp;is.</p>
<p>Again, we&#8217;re simply going to always apply a specific <span class="caps">CSS</span> style to the
contacts, namely we&#8217;ll be modifying the behavior of <a class="reference external" href="http://lxr.instantbird.org/instantbird/source/instantbird/content/blist.css#38">blist.css</a>.&nbsp; I&#8217;m
sure you don&#8217;t really care about that and just want the code, well I&#8217;ll&nbsp;oblige:</p>
<div class="highlight"><pre><span></span><span class="cm">/* Expand all contacts to the big contact. */</span>
<span class="nx">contact</span> <span class="p">{</span>
<span class="o">-</span><span class="nx">moz</span><span class="o">-</span><span class="nx">binding</span><span class="o">:</span> <span class="nx">url</span><span class="p">(</span><span class="s2">&quot;chrome://instantbird/content/contact.xml#contact-big&quot;</span><span class="p">)</span> <span class="o">!</span><span class="nx">important</span><span class="p">;</span>
<span class="o">-</span><span class="nx">moz</span><span class="o">-</span><span class="nx">box</span><span class="o">-</span><span class="nx">orient</span><span class="o">:</span> <span class="nx">vertical</span> <span class="o">!</span><span class="nx">important</span><span class="p">;</span>
<span class="o">-</span><span class="nx">moz</span><span class="o">-</span><span class="nx">box</span><span class="o">-</span><span class="nx">align</span><span class="o">:</span> <span class="nx">stretch</span> <span class="o">!</span><span class="nx">important</span><span class="p">;</span>
<span class="p">}</span>
</pre></div>
<p>And that&#8217;s it!&nbsp; Restart Instantbird and you should always have big
contacts.&nbsp; I haven&#8217;t seen any issues of using this (missing or wrong
behavior), but of course your mileage might vary.&nbsp; Have&nbsp;fun!</p>
Instantbird Contact List Hack2011-10-31T20:20:00-04:002011-10-31T20:20:00-04:00Patrick Cloketag:patrick.cloke.us,2011-10-31:/posts/2011/10/31/instantbird-contact-list-hack/<p>A friend of mine asked me if there was a way to have selected contacts
in the contact list <span class="caps">NOT</span> expand to two lines (where the status goes onto
the second line) in&nbsp;Instantbird.</p>
<p>There&#8217;s actually no option to do this in Instantbird, but with a
little <a class="reference external" href="http://www-archive.mozilla.org/unix/customizing.html">userChrome</a> tweak …</p><p>A friend of mine asked me if there was a way to have selected contacts
in the contact list <span class="caps">NOT</span> expand to two lines (where the status goes onto
the second line) in&nbsp;Instantbird.</p>
<p>There&#8217;s actually no option to do this in Instantbird, but with a
little <a class="reference external" href="http://www-archive.mozilla.org/unix/customizing.html">userChrome</a> tweak, we can easily get this behavior (although
with a couple caveats).&nbsp; You should be able to add a new folder <a class="reference external" href="http://instantbird.com/faq.html#profilefolder">inside
your profile</a> called chrome.&nbsp; Inside of this make a new file called
userChrome.css and place the&nbsp;following:</p>
<div class="highlight"><pre><span></span><span class="p">#</span><span class="nn">buddylistbox</span><span class="p">:</span><span class="nd">focus</span> <span class="o">&gt;</span> <span class="nt">contact</span><span class="o">[</span><span class="nt">selected</span><span class="o">]</span> <span class="p">{</span>
<span class="kp">-moz-</span><span class="n">binding</span><span class="p">:</span> <span class="nb">url</span><span class="p">(</span><span class="s2">&quot;chrome://instantbird/content/contact.xml#contact&quot;</span><span class="p">)</span> <span class="cp">!important</span><span class="p">;</span>
<span class="kp">-moz-</span><span class="n">box-orient</span><span class="p">:</span> <span class="kc">horizontal</span> <span class="cp">!important</span><span class="p">;</span>
<span class="p">}</span>
</pre></div>
<p>Save the file and restart&#8230;and that&#8217;s it! Now your selected contacts
should be on one line, just like your unselected&nbsp;contacts.</p>
<p>I did mention there was a caveat though! If you want to expand a
contact (to see all the protocols, etc. that you&#8217;ve merged together)
you&#8217;ll need to use the arrow keys: right arrow expands a contact, left
arrow collapses a contact.&nbsp; (You need to do this since the chevron icon
that lets you expand/collapse isn&#8217;t shown on a non-selected&nbsp;contact.)</p>
<p>(Some more technical details: we&#8217;re forcing the standard contact
template to be used instead of the contact-big template, even when the
contact is expanded; i.e. we&#8217;re overwriting the command given
<a class="reference external" href="http://lxr.instantbird.org/instantbird/source/instantbird/content/blist.css#44">blist.css</a>.)</p>
Adding a protocol to Instantbird (Part 2)2011-09-03T10:31:00-04:002011-09-03T10:31:00-04:00Patrick Cloketag:patrick.cloke.us,2011-09-03:/posts/2011/09/03/adding-protocol-to-instantbird-part-2/
<p>I had <a class="reference external" href="http://patrick.cloke.us/posts/2011/06/18/adding-new-protocol-sipeoffice/">previously talked about adding a protocol to Instantbird</a>,
that focused on adding <span class="caps">SIPE</span> (Microsoft Office Communicator support).
Since then I’ve been slowly working on defeating <span class="caps">SIPE</span>. Fortunately I
found a few flags that help us compile it easily in Instantbird: we can
declare that we do <em>not …</em></p>
<p>I had <a class="reference external" href="http://patrick.cloke.us/posts/2011/06/18/adding-new-protocol-sipeoffice/">previously talked about adding a protocol to Instantbird</a>,
that focused on adding <span class="caps">SIPE</span> (Microsoft Office Communicator support).
Since then I’ve been slowly working on defeating <span class="caps">SIPE</span>. Fortunately I
found a few flags that help us compile it easily in Instantbird: we can
declare that we do <em>not</em> have gmime and the standard libpurple <span class="caps">MIME</span>
functions will be used (they might not be as good, but it keeps from
adding &gt;10 <span class="caps">MB</span> of source to Instantbird).</p>
<p>Some modifications to the <span class="caps">SIPE</span> source were made to compile it in
Instantbird (note that most of the changes were probably more based on
using <span class="caps">MSVC</span>, than having to do with Instantbird). The code is also
broken up into a few different sections the core, api, and purple are
ones we care about (they’re working on making a general Office
Communicator protocol library, so the purple folder contains the
libpurple bindings that use the api, while the core is private).</p>
<div class="section" id="purple">
<h2><a class="toc-backref" href="#id1">Purple</a></h2>
<p>Changes to purple consisted mostly of ifdefs that remove some header
files not supported on Windows. For example, I encountered a few of:</p>
<pre class="literal-block">
#include &lt;unistd.h&gt;
</pre>
<p>Luckily there was already a define <tt class="docutils literal">HAVE_UNISTD_H</tt>, so I just needed
to add:</p>
<pre class="literal-block">
#ifdef HAVE_UNISTD_H
#include &lt;unistd.h&gt;
#endif
</pre>
<p>Easy! There were also a couple other issues, but those were rather trivial.</p>
</div>
<div class="section" id="core">
<h2><a class="toc-backref" href="#id2">Core</a></h2>
<p>There isn’t a specific issue in the core I’d like to highlight, it did
use a few glib functions which we didn’t have (we removed the files, as
they were unused), they were all reimplemented in libpurple though, so
we were able to just define the function calls to the libpurple variants.</p>
</div>
<div class="section" id="api">
<h2><a class="toc-backref" href="#id3"><span class="caps">API</span></a></h2>
<p>This had similar issues the core (in particular, there was a function
which used <tt class="docutils literal">g_usleep</tt>, which is blocking and a definite no-no for a
protocol plug-in, I’ve removed that…hopefully it doesn’t break
anything!) In addition to that, we needed to use the libpurple l10n
system instead of glib’s gi18n.h, this was easily copied from
libpurple’s internal <span class="caps">API</span> though.</p>
<p>So at this point…I have a copy of <span class="caps">SIPE</span> compiled! Unfortunately
since I’m using Visual Studio Express I cannot compile on my computer
and deploy to other computers for testing (a Mozilla issue with how it
uses some of the header files, etc., I believe). I’m looking into
trying to get this to work though, apparently using the exact same copy
of <span class="caps">MSVC</span> Redistributable might help. Once this is tested, hopefully
it’ll land in Instantbird for use!</p>
</div>
<div class="section" id="sametime-support">
<h2><a class="toc-backref" href="#id4">Sametime support</a></h2>
<p>Unrelated to <span class="caps">SIPE</span>, but recently I landed a patch in Instantbird to add
back Sametime support (Sametime is Lotus Notes’ equivalent to Office
Communicator). You can see the gory details in <a class="reference external" href="https://bugzilla.instantbird.org/show_bug.cgi?id=102">bug 102</a>, but in
general it’s similar to what I’ve (not gone into great detail about)
here. Most of getting Sametime to work was rewriting some C code
that doesn’t compile in <span class="caps">MSVC</span>. There’s also a <a class="reference external" href="https://bugzilla.instantbird.org/attachment.cgi?id=797&amp;action=diff">diff</a> of all the
changes I made to the libpurple Sametime plugin and the external library
(called <a class="reference external" href="http://meanwhile.sourceforge.net/">Meanwhile</a>) to get it to work. Once I get Monotone (a version
control system) set up I’ll look into getting these changes pushed back
to libpurple to avoid diverging code bases.</p>
</div>
Shared Lightning profile across Linux and Windows2011-07-08T20:46:00-04:002011-07-08T20:46:00-04:00Patrick Cloketag:patrick.cloke.us,2011-07-08:/posts/2011/07/08/shared-lightning-profile-across-linux/<p>In <a class="reference external" href="irc://irc.mozilla.org/calendar">#calendar on Mozilla <span class="caps">IRC</span></a> the past few days a user has been
asking about using a shared profile on Thunderbird between Linux and
Windows (&#8220;shared&#8221; meaning a dual boot system of Linux/Windows, but not
at the same time, obviously).&nbsp; Generally this isn&#8217;t a big deal <span class="caps">UNLESS</span>
you …</p><p>In <a class="reference external" href="irc://irc.mozilla.org/calendar">#calendar on Mozilla <span class="caps">IRC</span></a> the past few days a user has been
asking about using a shared profile on Thunderbird between Linux and
Windows (&#8220;shared&#8221; meaning a dual boot system of Linux/Windows, but not
at the same time, obviously).&nbsp; Generally this isn&#8217;t a big deal <span class="caps">UNLESS</span>
you have a binary extension, in which case you&#8217;d have to reinstall the
extension every time! That&#8217;s awfully&nbsp;lame.</p>
<p><span class="caps">BUT</span> there should be a way to make a unified extension for all
operating systems.&nbsp; In fact <a class="reference external" href="https://wiki.mozilla.org/User:Ssitter/UnifiedLightning">ssitter had written an article to do
that</a>.&nbsp; It needs some updating to account for the Mozilla 2 <span class="caps">XPCOM</span>
changes,&nbsp;however.</p>
<p>The steps are mostly the same, with some&nbsp;added.</p>
<ol class="arabic simple">
<li>Download whatever versions you want (<a class="reference external" href="http://releases.mozilla.org/pub/mozilla.org/calendar/lightning/releases/1.0b4/">perhaps 1.0b4</a>?).</li>
<li>Unzip them all and choose which one will be your &#8220;unified&#8221;&nbsp;version.</li>
<li>Find the &lt;em:targetPlatform&gt; section in the install.rdfs and include
all the necessary&nbsp;ones.</li>
<li>Find the libcalbasecomps.* (where * is dll, dylib, so, etc. for
your platform) inside the components&nbsp;directories.</li>
<li>Copy the libraries together into one&nbsp;directory.</li>
<li>Copy the lines from each components.manifest together into one&nbsp;manifest.</li>
<li>For some systems you&#8217;ll need to specify the <span class="caps">ABI</span> (and possibly change
the path), note that the <span class="caps">ABI</span> is just what was inside the&nbsp;&lt;em:targetPlatform&gt;.</li>
<li>Rezip this up into an <span class="caps">XPI</span> and you should be good to&nbsp;go!</li>
</ol>
<p>In my test I ended up with an <span class="caps">XPI</span> that was approximately 10% bigger
after combining Mac (x86 and x64), Linux (x86 and x64), Win32, Solaris
Sparc and Solaris x86.&nbsp; Why is this not done by default?&nbsp; Probably just
cause no one has done it&#8230;there is a <a class="reference external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=352543">bug about it</a> though.&nbsp; One issue
that might be encountered using this method is pre-processing of some
script files (as is discussed in that big) but hopefully it should
&#8220;mostly&#8221; work.&nbsp; (Note that this is mostly&nbsp;untested.)</p>
<p><strong>Edit:</strong> I should also mention that you would need to do something
similar with the themes folders if they differ dramatically (it seems
there&#8217;s <a class="reference external" href="http://mxr.mozilla.org/comm-central/source/calendar/lightning/themes/">just two</a>: winstripe and pinstripe: i.e. Windows <span class="amp">&amp;</span> Mac; Linux
and Solaris most likely also use&nbsp;winstripe).</p>
Adding a new protocol (SIPE/Office Communicator) to Instantbird (part 1)2011-06-18T21:53:00-04:002011-06-18T21:53:00-04:00Patrick Cloketag:patrick.cloke.us,2011-06-18:/posts/2011/06/18/adding-new-protocol-sipeoffice/<p><a class="reference external" href="http://en.wikipedia.org/wiki/Office_Communicator">Microsoft Office Communicator</a> is an instant messaging client that
integrates into the <a class="reference external" href="http://en.wikipedia.org/wiki/Microsoft_Exchange_Server">Exchange Messaging Server</a> (the protocol behind it
is an extended version of <span class="caps">SIP</span>/<span class="caps">SIMPLE</span>).&nbsp; Anyway, there&#8217;s a <a class="reference external" href="http://developer.pidgin.im/wiki/WhatIsLibpurple">libpurple</a>
(i.e. the backend of <a class="reference external" href="http://instantbird.com/">Instantbird</a> and <a class="reference external" href="http://pidgin.im/">Pidgin</a>) protocol plug-in for
<span class="caps">OCS</span> (Office Communicator Server) called <a class="reference external" href="http://sipe.sourceforge.net/"><span class="caps">SIPE</span></a>.&nbsp; (It&#8217;s …</p><p><a class="reference external" href="http://en.wikipedia.org/wiki/Office_Communicator">Microsoft Office Communicator</a> is an instant messaging client that
integrates into the <a class="reference external" href="http://en.wikipedia.org/wiki/Microsoft_Exchange_Server">Exchange Messaging Server</a> (the protocol behind it
is an extended version of <span class="caps">SIP</span>/<span class="caps">SIMPLE</span>).&nbsp; Anyway, there&#8217;s a <a class="reference external" href="http://developer.pidgin.im/wiki/WhatIsLibpurple">libpurple</a>
(i.e. the backend of <a class="reference external" href="http://instantbird.com/">Instantbird</a> and <a class="reference external" href="http://pidgin.im/">Pidgin</a>) protocol plug-in for
<span class="caps">OCS</span> (Office Communicator Server) called <a class="reference external" href="http://sipe.sourceforge.net/"><span class="caps">SIPE</span></a>.&nbsp; (It&#8217;s also striving
for a generic library to connect to <span class="caps">OCS</span>, but that&#8217;s not quite there&nbsp;yet.)</p>
<p>I&#8217;ve been interested in getting this to compile in the Instantbird
framework for a while now, adding a new protocol to Instantbird.&nbsp; First
of course I need the <span class="caps">SIPE</span> source, I chose to grab a release <a class="reference external" href="http://sourceforge.net/projects/sipe/files/sipe/pidgin-sipe-1.11.2/">source
bundle</a> instead of using the <a class="reference external" href="http://sourceforge.net/apps/mediawiki/sipe/index.php?title=Windows_Build">git repository</a>, just for ease moving
files around, etc.&nbsp; There&#8217;s a rather vague <a class="reference external" href="http://sourceforge.net/apps/mediawiki/sipe/index.php?title=Windows_Build">Windows build</a> page on the
wiki that I started with, says I&nbsp;need:</p>
<ul class="simple">
<li>libpurple &gt;2.4.0 (we have&nbsp;2.7.11)</li>
<li>libglib &gt;2.12.0 (we have&nbsp;2.28.6)</li>
<li>libxml2 (we have&nbsp;this)</li>
<li>gmime &gt;2.4 (not currently&nbsp;used)</li>
</ul>
<p>So great, <a class="reference external" href="https://wiki.instantbird.org/Instantbird:Third_party_code">we have most of the dependencies</a>! We just need one more.
So I go grab, <a class="reference external" href="http://developer.gnome.org/gmime/">gmime</a>from the <span class="caps">GNOME</span> website (2.5.7, which is the
newest stable, currently), again as a source bundle and put the
necessary files in purple/libraries/gmime and edit the makefile so it
will (attempt) to compile.&nbsp; But great &#8212; it requires <a class="reference external" href="http://www.gnu.org/software/libiconv/">libiconv</a>, which
apparently is very difficult to compile, especially on Windows.&nbsp; Luckily
for me there&#8217;s a Windows version (not a port, but one that uses the
native Win32 APIs with the same interface): <a class="reference external" href="http://code.google.com/p/win-iconv/">win-iconv</a>.&nbsp; This compiled
like a champ when added as&nbsp;purple/libraries/iconv.</p>
<p>Unfortunately when I went back to compiling gmime, it attempts to
access parts of glib we&#8217;re not using (gio, in particular) and thus is
not in our source code.&nbsp; I can grab the <a class="reference external" href="http://developer.gnome.org/glib/">glib</a> source (2.28.6 to match,
of course) and add the gio subfolder, but first we should check if this
part of gmime is even used by <span class="caps">SIPE</span>! (My guess is that it is <em>not</em>, but
that&#8217;s where I&#8217;m at now.&nbsp; I&#8217;ll post back when I get&nbsp;further.</p>
Compiling Instantbird2011-05-16T21:30:00-04:002011-05-16T21:30:00-04:00Patrick Cloketag:patrick.cloke.us,2011-05-16:/posts/2011/05/16/compilling-instantbird/
<p>In the past I’ve tried to compile a few different programs that use
the Mozilla toolkit to various levels of success. I’ve tried to compile
Thunderbird, Songbird and Instantbird at various points. I got
Thunderbird to compile, but it only worked sporadically (although I
think that was Firefox …</p>
<p>In the past I’ve tried to compile a few different programs that use
the Mozilla toolkit to various levels of success. I’ve tried to compile
Thunderbird, Songbird and Instantbird at various points. I got
Thunderbird to compile, but it only worked sporadically (although I
think that was Firefox moving so fast that Thunderbird couldn’t keep
up), Songbird I gave up on rather quickly and Instantbird I’ve tried a
few times.</p>
<p>Last summer I had Instantbird compiling on my old laptop (a Lenovo
T60), which is &gt;5 years old at this point and has had the heatsink / fan
replaced twice — a known issue with that model laptop. Needless to
say, that laptop didn’t like compiling something on Windows that took
approximately an hour with a large number of reads and writes to the
hard drive. This mixed with it being an old dual core + a 5400 <span class="caps">RPM</span>
meant I’d be waiting a <span class="caps">LONG</span> time for my code to compile. I got a
Thinkpad X201 this past summer, so I finally got around to setting up a
development environment on it and was able to get Instantbird to compile
fully today. I’ve outlined the steps I’ve followed: kind of to mirror
the <a class="reference external" href="https://developer.mozilla.org/En/Simple_Thunderbird_build">Simple Thunderbird Build</a> page on <span class="caps">MDC</span>.</p>
<p>I’ve done this using Microsoft Windows 7 Professional (64-bit) with
Service Pack 1. (4.00 <span class="caps">GB</span> of <span class="caps">RAM</span>, Intel Core i7 M620 2.67 GHz).
Throughout these steps, the defaults locations and options are used in
the installers.</p>
<div class="section" id="build-requirements">
<h2><a class="toc-backref" href="#id2">Build Requirements:</a></h2>
<div class="section" id="visual-studio-express">
<h3><a class="toc-backref" href="#id3">Visual Studio Express:</a></h3>
<p>We need to install Visual Studio Express, specifically <span class="caps">VC8</span> (2005) with
Service Pack 1. (Mozilla compiles with <span class="caps">VC9</span> and <span class="caps">VC10</span> to various degrees,
but it seems libpurple only compiles with <span class="caps">VC8</span>, also this is what’s on
the Instantbird buildbot, so I like having the same version.) I
couldn’t find this on Microsoft’s website but I found it on <a class="reference external" href="http://www.softpedia.com/get/Programming/Other-Programming-Files/Microsoft-Visual-C-Toolkit.shtml">Softpedia</a>
(which is a legitimate site). Anyway, download the installer and
install it (which will download the actual compiler from Microsoft),
ensure that you also install the <span class="caps">IDE</span> (which is checked by default).</p>
<p>This will only install <span class="caps">VC8</span>, the initial release. We also need to
install <a class="reference external" href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=7b0b0339-613a-46e6-ab4d-080d4d4a8c4e">Service Pack 1</a>. I personally did this using Windows Update,
but one of the installers from there should also work.</p>
</div>
<div class="section" id="microsoft-windows-sdk">
<h3><a class="toc-backref" href="#id4">Microsoft Windows <span class="caps">SDK</span>:</a></h3>
<p>Specifically we need the <a class="reference external" href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=c17ba869-9671-4330-a63e-1fd44e0e2505&amp;displaylang=en">Windows 7 <span class="caps">SDK</span></a> (for Jumplist, Aero, etc.
support). Download and install the <span class="caps">SDK</span>, this one took a while for me to
install. I ate dinner while it was installing (pasta, if you’re curious
— I already had sauce made).</p>
<p>There’s a linker error when using <span class="caps">VC8</span> and the Windows 7 <span class="caps">SDK</span>, so we’ll
need to install a <a class="reference external" href="http://support.microsoft.com/kb/949009/">hotfix</a>for that (I tried without it and I ran into
the issue). I had to download the “VS80sp1-<span class="caps">KB949009</span>-<span class="caps">IA64</span>-<span class="caps">INTL</span>.exe”
version (there’s also an X86 and an X64 version). Choose the one that works.</p>
</div>
<div class="section" id="microsoft-macro-assembler">
<h3><a class="toc-backref" href="#id5">Microsoft Macro Assembler:</a></h3>
<p>In order to properly assemble the code we need to <a class="reference external" href="http://www.microsoft.com/downloads/en/details.aspx?familyid=7A1C9DA0-0510-44A2-B042-7EF370530C64&amp;displaylang=en">install <span class="caps">MASM</span></a>
(which I think will eventually be included in MozillaBuild, but it isn’t
currently). Again, just install it with the defaults.</p>
</div>
<div class="section" id="mozillabuild">
<h3><a class="toc-backref" href="#id6">MozillaBuild:</a></h3>
<p>Almost there, I promise. In order to get a *nix type shell to run
make, etc. in we’ll use a package from Mozilla that includes <span class="caps">MSYS</span>, make,
Mercurial, etc. Download and <a class="reference external" href="http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/MozillaBuildSetup-Latest.exe">install MozillaBuild</a>, the latest should
work fine.</p>
<p>Now, an unknown step: you might require the <a class="reference external" href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=a5c84275-3b97-4ab7-a40d-3802b2af5fc2&amp;displaylang=en">Microsoft Visual C++ 2008
<span class="caps">SP1</span> Redistributable Package</a>. I don’t know if you need this or not
since I <em>already</em> had it, most likely from a previous program I’ve installed.</p>
<p>We should be ready to build now pretty much. For some more
information for this stuff you can check out the Mozilla Developer
Network pages I used to get this information: <a class="reference external" href="https://developer.mozilla.org/En/Developer_Guide/Build_Instructions">Build Instructions</a>,
<a class="reference external" href="https://developer.mozilla.org/En/Developer_Guide/Build_Instructions/Windows_Prerequisites">Windows Build Prerequisites</a> and <a class="reference external" href="https://developer.mozilla.org/cn/VC8_Build_Instructions"><span class="caps">MSVC8</span> Build Instructions</a>.</p>
</div>
</div>
<div class="section" id="checkout-the-code">
<h2><a class="toc-backref" href="#id7">Checkout the Code:</a></h2>
<p>We need to checkout the code. I originally checked out the code with
TortoiseHg (which is what I normally use), but the version of Mercurial
included is significantly greater than the one included in MozillaBuild
and this caused me issues later on. Thus, we’ll check out the code on
the command line. Start by launching the bash shell, which is at
C:\mozilla-build\start-msvc8.bat (don’t use the x64 version). There’s
a version here which corresponds to each version of <span class="caps">VS</span>.</p>
<p>Once this finishes loading you’ll be in the home directory (which is
in the root of your user’s documents and settings folder, i.e. for me:
C:\Users\clokep). You’ll want to do the following:</p>
<pre class="literal-block">
hg clone https://hg.instantbird.org/instantbird
</pre>
<p>This might take a few minutes depending on how good your internet
connection is. (The Instantbird source isn’t <span class="caps">THAT</span> big though, it
shouldn’t take too long.)</p>
<p>Then we’ll need to change into the instantbird directory that was just
created and download the Mozilla source code:</p>
<pre class="literal-block">
cd instantbird
python client.py checkout
</pre>
<p>Now this step? This one is gonna take a while. It took me like a
couple of hours. It pulls the Mozilla source code, which is large and
has many changesets. Just let it go, it’ll give you progress
occasionally (changes, manifests, files, etc.)</p>
</div>
<div class="section" id="id1">
<h2><a class="toc-backref" href="#id8">Compiling Instantbird:</a></h2>
<p>We need to set up the options we want to build with. These are
read from a .mozconfig (don’t miss the “.” in the front!). The contents
of the .mozconfig that worked for me are:</p>
<pre class="literal-block">
ac_add_options --enable-application=instantbird
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/objdir-ib-release
ac_add_options --disable-accessibility
</pre>
<p>The first option says to build Instantbird, the second gives an output
directory and the third <a class="reference external" href="https://developer.mozilla.org/en/atlbase.h">disables accessibility</a> (not really sure why
we need to do this, but we’ll get that error at that link otherwise).</p>
<p>Finally (back in the bash shell) type:</p>
<pre class="literal-block">
make -f client.mk build
</pre>
<p>Now sit back and relax. My build took about an hour to finish, maybe
a bit less — I wasn’t fully paying attention. Once it’s done you
should see something like:</p>
<pre class="literal-block">
Processed 1 file, writing output:
Output:
"c:\\Users\\clokep\\instantbird\\objdir-ib-release\\instantbird\\installer\\windows\\instgen\\helper.exe"
Install: 2 pages (128 bytes), 1 section (16416 bytes), 2579
instructions (72212 bytes), 369 strings (10198 bytes), 1 language table (230 bytes).
Uninstall: 5 pages (320 bytes),
1 section (16416 bytes), 2063 instructions (57764 bytes), 388 strings
(10828 bytes), 1 language table (314 bytes).
Datablock optimizer saved 123940 bytes (~17.6%).
Using zlib compression.
EXE header size: 63488 / 39424 bytes
Install code: 99564 / 99560 bytes
Install data: 118002 / 241950 bytes
Uninstall code+data: 398654 / 398646 bytes
CRC (0x062AF3F5): 4 / 4 bytes
Total size: 679712 / 779584 bytes (87.1%)
c:/Users/clokep/instantbird/objdir-ib-release/mozilla/config/nsinstall.exe -D ../../../mozilla/dist/bin/uninstall
cp instgen/helper.exe ../../../mozilla/dist/bin/uninstall
make[5]: Leaving directory `/c/Users/clokep/instantbird/objdir-ib-release/instantbird/installer/windows'
make[4]: Leaving directory `/c/Users/clokep/instantbird/objdir-ib-release/instantbird'
make[3]: Leaving directory `/c/Users/clokep/instantbird/objdir-ib-release'
make[2]: Leaving directory `/c/Users/clokep/instantbird/objdir-ib-release'
make[1]: Leaving directory `/c/Users/clokep/instantbird/objdir-ib-release'
</pre>
<p>Now, to test that the build actually worked we can browse to the
compiled executable and run it:</p>
<pre class="literal-block">
cd objdir-ib-release/mozilla/dist/bin/instantbird.exe -P dev -no-remote
</pre>
<p>The -P option specifies a profile name (dev), the second option
(-no-remote) allows you to run a second Instantbird instance (since I
assume you use Instantbird to <span class="caps">IM</span>…you probably want to be able to run a
second one, if you don’t use it…shame on you. Try not to close the
wrong Instantbird when you’re working on stuff).</p>
<p>Hopefully this will help someone else get started on hacking
Instantbird. There’s other good ways you can hack too if your computer
can’t handle compiling, including unpacking omni.jar.</p>
<p>One last tidbit is to possibly add the option to your .mozconfig:</p>
<pre class="literal-block">
--enable-chrome-format=flat
</pre>
<p>This will not package anything in JARs (which pretty much just get in
the way while developing). See <a class="reference external" href="https://developer.mozilla.org/en/JAR_Packaging">here</a> for more info.</p>
<p>Edit: Fixed the path to the executable thanks to Florian. And fixed a
spelling error in the title.</p>
</div>
Why rewrite the IRC protocol plugin? (Part 2)2011-04-30T13:01:00-04:002011-04-30T13:01:00-04:00Patrick Cloketag:patrick.cloke.us,2011-04-30:/posts/2011/04/30/why-rewrite-irc-protocol-plugin-part-2/<p>I <a class="reference external" href="http://patrick.cloke.us/posts/2010/12/08/why-rewrite-irc-into-javascript/">previously wrote about</a> why I&#8217;m rewriting the libpurple <span class="caps">IRC</span>
implementation into a JavaScript implementation for Instantbird.&nbsp; This
is kind of a follow up, but more focused on what I hope to accomplish
feature wise for <span class="caps">IRC</span> in Instantbird.&nbsp; A good overview to look at is the
<a class="reference external" href="https://bugzilla.instantbird.org/showdependencygraph.cgi?id=507&amp;display=web&amp;rankdir=LR">dependencies of …</a></p><p>I <a class="reference external" href="http://patrick.cloke.us/posts/2010/12/08/why-rewrite-irc-into-javascript/">previously wrote about</a> why I&#8217;m rewriting the libpurple <span class="caps">IRC</span>
implementation into a JavaScript implementation for Instantbird.&nbsp; This
is kind of a follow up, but more focused on what I hope to accomplish
feature wise for <span class="caps">IRC</span> in Instantbird.&nbsp; A good overview to look at is the
<a class="reference external" href="https://bugzilla.instantbird.org/showdependencygraph.cgi?id=507&amp;display=web&amp;rankdir=LR">dependencies of bug 507</a> (implement <span class="caps">IRC</span> in JavaScript) &#8212; you&#8217;ll want
to look to the left of bug 507, these are the bugs that depend on 507
(as opposed to blocking&nbsp;507).</p>
<p>My overall hope is to make Instantbird the easiest and simplest <span class="caps">IRC</span>
client to use.&nbsp; I&#8217;ve found that most <span class="caps">IRC</span> clients tend to depend a great
deal on commands and essentially being a very thin <span class="caps">GUI</span> layer on top of
the protocol.&nbsp; I don&#8217;t really see the reason for this, we should attempt
to hide the protocol as much as possible from the users.&nbsp; This means
fitting the <span class="caps">IRC</span> command responses into the <span class="caps">GUI</span> wherever possible and
possibly &#8220;losing&#8221; some features compared to other <span class="caps">IRC</span> clients, although
I think that&#8217;s a matter of perspective.&nbsp; (For example, there&#8217;s often an
<span class="caps">IRC</span> command to list all the channels available, I <em>do not</em> think this
should be implemented as a text command, but it should be available via
the join chat <span class="caps">GUI</span>).</p>
<p>Now some more specific&nbsp;plans:</p>
<ul class="simple">
<li>Support for <span class="caps">IRC</span> services would be pretty awesome, I&#8217;m not sure
whether this would be part of the main protocol or as an extension,
but it should be able to handle NickServ mostly autonomously
(possibly even automatically registering the nick, etc.).&nbsp; MemoServ
could be implemented as a message service once there is <span class="caps">UI</span> for that
in Instantbird.&nbsp; I&#8217;m not sure how ChanServ could be handled in the
<span class="caps">UI</span>, but I&#8217;ll think more about this.&nbsp; See <a class="reference external" href="https://bugzilla.instantbird.org/show_bug.cgi?id=720">bug 720</a> for more info.
(And yes, there are multiple versions of <span class="caps">IRC</span> services, but we can
attempt to support a subset and otherwise just leave it up to the
user.&nbsp; Ideally servers would have supported this stuff&#8230;but that&#8217;s
not how <span class="caps">IRC</span>&nbsp;works.)</li>
<li>The <span class="caps">UI</span> should be more responsive to the modes of the user and to the
channel.&nbsp; For example, if the user does not have permission to edit
the topic, it should not be editable in the <span class="caps">UI</span> (<a class="reference external" href="https://bugzilla.instantbird.org/show_bug.cgi?id=318">bug 318</a>).&nbsp; Also,
if a user is a (half-)operator, there should be <span class="caps">UI</span> to have cause
other users to be given (h)op (<a class="reference external" href="https://bugzilla.instantbird.org/show_bug.cgi?id=597">bug 597</a>).&nbsp; In terms of channel
modes, there could be <span class="caps">UI</span> to show the channel is invite only or that
it&#8217;s a hidden&nbsp;channel.</li>
</ul>
<p>There&#8217;s some not as user visible improvements I&#8217;d like to&nbsp;make:</p>
<ul class="simple">
<li>Supporting more authentication methods in <span class="caps">IRC</span> (<a class="reference external" href="https://bugzilla.instantbird.org/show_bug.cgi?id=719">bug 719</a>).</li>
</ul>
<p>There&#8217;s also a few &#8220;bugs&#8221; in the libpurple implementation that this
will&nbsp;fix:</p>
<ul class="simple">
<li>The /msg command doesn&#8217;t show outgoing messages (<a class="reference external" href="https://bugzilla.instantbird.org/show_bug.cgi?id=188">bug 188</a>).&nbsp; I
believe this is actually already&nbsp;fixed.</li>
<li><span class="caps">IRC</span> channels should automatically rejoin on reconnect (<a class="reference external" href="https://bugzilla.instantbird.org/show_bug.cgi?id=385">bug 385</a>).</li>
<li>Chats with other users should show whether they are available or not
(<a class="reference external" href="https://bugzilla.instantbird.org/show_bug.cgi?id=613">bug 613</a>).</li>
</ul>
<p>These are just some ideas and it&#8217;s a long ways off for feature parity
with libpurple even.&nbsp; (Although since Instantbird doesn&#8217;t support all
the features of Pidgin, feature-parity in this case doesn&#8217;t include
things like <span class="caps">DCC</span> transfer, etc. until Instantbird itself supports&nbsp;those.)</p>
<p>Right now, the code is mostly usable (and I&#8217;m finally catching any
exceptions that are thrown so the code shouldn&#8217;t crash anymore), and
works fine.&nbsp; The one issue I&#8217;m having is sometimes I&#8217;m unable to
reconnect when the connection is lost, but I think I&#8217;ve finally fixed
that issue and reconnection should happen&nbsp;automatically!</p>
<p>One last quick note, if you happen to have the <a class="reference external" href="https://hg.instantbird.org/experiments">repository</a> checked
out, you&#8217;ll want to update on the default branch from now on as I&#8217;ve
merged the separate branches together under&nbsp;subfolders.</p>
The so-called IRC “specifications”2011-03-08T21:20:00-05:002014-12-20T15:55:00-05:00Patrick Cloketag:patrick.cloke.us,2011-03-08:/posts/2011/03/08/so-called-irc-specifications/
<p>In a <a class="reference external" href="http://patrick.cloke.us/posts/2010/12/08/why-rewrite-irc-into-javascript/">previous post</a> I had briefly gone over the “history of <span class="caps">IRC</span>” as
I know it. I’m going to expand on this a bit as I’ve come to understand
it a bit more while reading through documentation. (Hopefully it won’t
sound too much like a rant …</p>
<p>In a <a class="reference external" href="http://patrick.cloke.us/posts/2010/12/08/why-rewrite-irc-into-javascript/">previous post</a> I had briefly gone over the “history of <span class="caps">IRC</span>” as
I know it. I’m going to expand on this a bit as I’ve come to understand
it a bit more while reading through documentation. (Hopefully it won’t
sound too much like a rant, as it is all driving me crazy!)</p>
<div class="section" id="irc-specifications">
<h2><a class="toc-backref" href="#id5"><span class="caps">IRC</span> Specifications</a></h2>
<p>So there’s the original specification (<a class="reference external" href="http://tools.ietf.org/html/rfc1459"><span class="caps">RFC</span> 1459</a>) in May 1993; this
was expanded and replaced by four different specifications (<a class="reference external" href="http://tools.ietf.org/html/rfc2810"><span class="caps">RFC</span> 2810</a>,
<a class="reference external" href="http://tools.ietf.org/html/rfc2811">2811</a>, <a class="reference external" href="http://tools.ietf.org/html/rfc2812">2812</a>, <a class="reference external" href="http://tools.ietf.org/html/rfc2813">2813</a>) in April 2000. Seems pretty straightforward, right?</p>
</div>
<div class="section" id="dcc-ctcp">
<h2><a class="toc-backref" href="#id6"><span class="caps">DCC</span>/<span class="caps">CTCP</span></a></h2>
<p>Well, kind of…there’s also the <span class="caps">DCC</span>/<span class="caps">CTCP</span> specifications, which is a
separate protocol embedded/hidden within the <span class="caps">IRC</span> protocol (e.g. they’re
sent as <span class="caps">IRC</span> messages and parsed specially by clients, the server sees
them as normal messages). <span class="caps">DCC</span>/<span class="caps">CTCP</span> is used to send files as well as
other particular messages (<span class="caps">ACTION</span> commands for roleplaying, <span class="caps">SED</span> for
encrypting conversations, <span class="caps">VERSION</span> to get client information, etc.).
Anyway, this get’s a bit more complicated — it starts with the <a class="reference external" href="http://www.irchelp.org/irchelp/rfc/dccspec.html"><span class="caps">DCC</span>
specification</a>. This was replaced/updated by the <a class="reference external" href="http://www.irchelp.org/irchelp/rfc/ctcpspec.html"><span class="caps">CTCP</span> specification</a>
(which fully includes the <span class="caps">DCC</span> specification) in 1994. An <a class="reference external" href="https://web.archive.org/web/20101129023108/http://www.invlogic.com/irc/ctcp.html">“updated”
<span class="caps">CTCP</span> specification</a> was released in February 1997. There’s also a
<a class="reference external" href="https://web.archive.org/web/20080723170128/http://www.invlogic.com/irc/ctcp2_intro.html"><span class="caps">CTCP</span>/2 specification</a> from October 1998, which was meant to
reformulate a lot of the previous three versions. And <em>finally</em>,
there’s the <span class="caps">DCC2</span> specification (two parts: <a class="reference external" href="http://tools.ietf.org/html/draft-smith-irc-dcc2-negotiation-00">connection negotiation</a> and
<a class="reference external" href="http://www.dcc2.org/files/dcc2/draft-smith-irc-dcc2-files-00.txt">file transfers</a>) from April 2004.</p>
<p>But wait! I lied…that’s not really the end of <span class="caps">DCC</span>/<span class="caps">CTCP</span>, there’s
also a bunch of extensions to it: <a class="reference external" href="http://www.visualirc.net/tech-tdcc.php">Turbo <span class="caps">DCC</span></a>, <a class="reference external" href="http://xa.bi/files/irc/xdcc.3.3.0b.irc"><span class="caps">XDCC</span> (eXtended <span class="caps">DCC</span>)</a>
in 1993, <a class="reference external" href="http://www.visualirc.net/tech-wboard.php"><span class="caps">DCC</span> Whiteboard</a>, and a few other variations of this: <span class="caps">RDCC</span>
(Reverse <span class="caps">DCC</span>), <span class="caps">SDD</span> (Secure <span class="caps">DCC</span>), <span class="caps">DCC</span> Voice, etc. Wikipedia has a <a class="reference external" href="http://en.wikipedia.org/wiki/Direct_Client-to-Client">good
summary</a>.</p>
<p>Something else to note about the whole <span class="caps">DCC</span>/<span class="caps">CTCP</span> mess…parts of it
just <em>don’t</em> have any documentation. There’s <em>none</em>at all for <span class="caps">SED</span> (at
least that I’ve found, I’d love to be proved wrong) and very little
(really just a mention) for <span class="caps">DCC</span> Voice.</p>
<p>So, we’re about halfway through now. There’s a bunch of extensions to
the <span class="caps">IRC</span> protocol specifications that add new commands to the actual protocol.</p>
</div>
<div class="section" id="authentication">
<h2><a class="toc-backref" href="#id7">Authentication</a></h2>
<p>Originally <span class="caps">IRC</span> had no authentication ability except the <span class="caps">PASS</span> command,
which very few servers seem to use, a variety of mechanisms have
replaced this, including <a class="reference external" href="https://raw.githubusercontent.com/atheme/charybdis/master/doc/sasl.txt"><span class="caps">SASL</span> authentication</a> (both <span class="caps">PLAIN</span> and <span class="caps">BLOWFISH</span>
methods, although <span class="caps">BLOWFISH</span> isn’t documented); and <span class="caps">SASL</span> itself is covered
by at least <a class="reference external" href="http://tools.ietf.org/html/rfc2222">four</a> <a class="reference external" href="http://tools.ietf.org/html/rfc4422">RFCs</a> <a class="reference external" href="http://tools.ietf.org/html/rfc2595">in this</a> <a class="reference external" href="http://tools.ietf.org/html/rfc4616">situation</a>. There also seems
to be a method called “Auth” which I haven’t been able to pin down, as
well as Ident (which is a more general protocol authentication method I
haven’t looked into yet).</p>
</div>
<div class="section" id="extension-support">
<h2><a class="toc-backref" href="#id8">Extension Support</a></h2>
<p>This includes a few that generally add a way by which servers are able
to tell their clients exactly what a server supports. The first of
these was RPL_ISUPPORT, which was defined as a <a class="reference external" href="http://tools.ietf.org/html/draft-brocklesby-irc-isupport-03">draft specification</a>
in January 2004, and <a class="reference external" href="http://tools.ietf.org/html/draft-hardy-irc-isupport-00">updated</a> in January of 2005.</p>
<p>A similar concept was defined as <a class="reference external" href="http://tools.ietf.org/html/draft-mitchell-irc-capabilities-01"><span class="caps">IRC</span> Capabilities</a> in March 2005.</p>
</div>
<div class="section" id="protocol-extensions">
<h2><a class="toc-backref" href="#id9">Protocol Extensions</a></h2>
<p><span class="caps">IRCX</span>, a Microsoft extension to <span class="caps">IRC</span> used (at one point) for some of
it’s instant messaging products <a class="reference external" href="http://tools.ietf.org/html/draft-pfenning-irc-extensions-04">exists as a draft</a> from June 1998.</p>
<p>There’s also:</p>
<ul class="simple">
<li>The <a class="reference external" href="https://github.com/atheme/charybdis/raw/master/doc/monitor.txt"><span class="caps">MONITOR</span></a> command.</li>
<li><a class="reference external" href="https://raw.githubusercontent.com/atheme/charybdis/master/doc/modeg.txt">User mode +g</a>.</li>
<li><a class="reference external" href="https://raw.githubusercontent.com/atheme/charybdis/master/doc/services.txt">Services compatibility modes</a>.</li>
<li><a class="reference external" href="https://raw.githubusercontent.com/atheme/charybdis/master/doc/account-notify.txt">Account-notify client capability</a>.</li>
<li><a class="reference external" href="https://raw.githubusercontent.com/atheme/charybdis/master/doc/tgchange.txt">Target change for messages</a>.</li>
</ul>
</div>
<div class="section" id="services">
<h2><a class="toc-backref" href="#id10">Services</a></h2>
<p>To fill in some of the missing features of <span class="caps">IRC</span>, services were created
(Wikipedia has a good <a class="reference external" href="http://en.wikipedia.org/wiki/Internet_Relay_Chat_services">summary</a> again). This commonly includes
ChanServ, NickServ, OperServ, and MemoServ. Not too hard, but different
server packages include different services (or even the same services
that behave differently), one of more common ones is <a class="reference external" href="http://www.anope.org/docgen/1.8/en_us/">Anope</a>, however
(plus they have awesome documentation, so they get a link).</p>
<p>There was an attempt to standardize how to interact with services
called <span class="caps">IRC</span>+, which included three specifications: <a class="reference external" href="http://www.irc-plus.org/specs/confctrl-draft.html">conference control
protocol</a>, <a class="reference external" href="http://www.irc-plus.org/specs/identity-draft.html">identity protocol</a> and <a class="reference external" href="http://www.irc-plus.org/specs/subscriptions-draft.html">subscriptions protocol</a>. I don’t
believe this are supported widely (if at all).</p>
</div>
<div class="section" id="irc-url-scheme">
<h2><a class="toc-backref" href="#id11"><span class="caps">IRC</span> <span class="caps">URL</span> Scheme</a></h2>
<p>Finally this brings us to the <span class="caps">IRC</span> <span class="caps">URL</span> scheme of which there are a few
versions. A draft from August 1996 defines the original <a class="reference external" href="http://tools.ietf.org/html/draft-mirashi-url-irc-01">irc: <span class="caps">URL</span>
scheme</a>. This was updated/replaced by <a class="reference external" href="http://tools.ietf.org/html/draft-butcher-irc-url-04">another draft</a> which defines
irc: and ircs: <span class="caps">URL</span> schemes.</p>
<p>As of right now that’s all that I’ve found…an awful lot. Plus it’s
not all compatible with each other (and sometimes out right contradicts
each other). Often newer specifications say not to support older
specifications, but who knows what servers/clients you’ll end up talking
to! It’s difficult to know what’s used in practice, especially since
there’s an awful lot of <a class="reference external" href="http://en.wikipedia.org/wiki/Comparison_of_IRC_daemons"><span class="caps">IRC</span> servers</a> out there. Anyway, if someone
does know of another specification, etc. that I missed please let me know!</p>
<dl class="docutils">
<dt>Updated [2014-12-20]</dt>
<dd>Fixed some dead links. Unfortunately some links now point to the <a class="reference external" href="https://archive.org/web/">Wayback
Machine</a>. There are also copies of most, if not all, of these links in my
<a class="reference external" href="https://bitbucket.org/clokep/irc-docs">irc-docs repository</a>. Thanks Ultra Rocks for the heads up!</dd>
</dl>
</div>
Status Update - February 17, 20112011-02-17T19:21:00-05:002011-02-17T19:21:00-05:00Patrick Cloketag:patrick.cloke.us,2011-02-17:/posts/2011/02/17/status-update-february-17-2011/<p>Another month has gone by so it&#8217;s time for another status update.
Unfortunately not as much got done this month as I was hoping, but
here&#8217;s a quick update of what I&#8217;ve worked&nbsp;on:</p>
<ul class="simple">
<li><a class="reference external" href="https://bugzilla.instantbird.org/show_bug.cgi?id=690">Bug 690</a> - jsProtoHelper could help registering&nbsp;commands</li>
<li><a class="reference external" href="https://bugzilla.instantbird.org/show_bug.cgi?id=661">Bug 661</a> - JavaScript accounts do not …</li></ul><p>Another month has gone by so it&#8217;s time for another status update.
Unfortunately not as much got done this month as I was hoping, but
here&#8217;s a quick update of what I&#8217;ve worked&nbsp;on:</p>
<ul class="simple">
<li><a class="reference external" href="https://bugzilla.instantbird.org/show_bug.cgi?id=690">Bug 690</a> - jsProtoHelper could help registering&nbsp;commands</li>
<li><a class="reference external" href="https://bugzilla.instantbird.org/show_bug.cgi?id=661">Bug 661</a> - JavaScript accounts do not automatically set
containsNick field on&nbsp;messages</li>
<li><a class="reference external" href="https://bugzilla.instantbird.org/show_bug.cgi?id=686">Bug 686</a> - Implement default chat name for
getChatRoomDefaultFieldValues for&nbsp;js-proto</li>
</ul>
<p>Florian also implemented a few things that are really helpful for
JavaScript&nbsp;protocols:</p>
<ul class="simple">
<li><a class="reference external" href="https://bugzilla.instantbird.org/show_bug.cgi?id=649">Bug 649</a> - purple proxies should not be in the way of JavaScript&nbsp;protocols</li>
<li><a class="reference external" href="https://bugzilla.instantbird.org/show_bug.cgi?id=118">Bug 118</a> - Extensions should be able to register&nbsp;commands.</li>
</ul>
<p>In addition, Twitter support was added to nightly builds as a
JavaScript protocol (<a class="reference external" href="https://bugzilla.instantbird.org/show_bug.cgi?id=598">bug 598</a>).</p>
<p>Hopefully next I&#8217;ll implement most of the commands for <span class="caps">IRC</span> (within the
next week) at which point I&#8217;ll release a sample extension (which will
overwrite the libpurple <span class="caps">IRC</span> implementation), allowing people to test
without needing to make a new account,&nbsp;etc.</p>
Status Update - January 18, 20112011-01-18T23:17:00-05:002011-01-18T23:17:00-05:00Patrick Cloketag:patrick.cloke.us,2011-01-18:/posts/2011/01/18/status-update-january-18-2011/<p>I haven&#8217;t had an update in a few weeks (since early December)
actually, so I thought I would post a bit about what I&#8217;ve worked on.
I&#8217;ve fixed a bunch of bugs in the backend of Instantbird that allow work
on JavaScript <span class="caps">IRC</span> protocol to&nbsp;continue:</p>
<ul class="simple">
<li><a class="reference external" href="https://bugzilla.instantbird.org/show_bug.cgi?id=519">Bug …</a></li></ul><p>I haven&#8217;t had an update in a few weeks (since early December)
actually, so I thought I would post a bit about what I&#8217;ve worked on.
I&#8217;ve fixed a bunch of bugs in the backend of Instantbird that allow work
on JavaScript <span class="caps">IRC</span> protocol to&nbsp;continue:</p>
<ul class="simple">
<li><a class="reference external" href="https://bugzilla.instantbird.org/show_bug.cgi?id=519">Bug 519</a> - Extend jsProtoHelper to implement purpleIConvChat
(<a class="reference external" href="http://hg.instantbird.org/instantbird/rev/0166084ce2ae">check-in</a>)</li>
<li><a class="reference external" href="https://bugzilla.instantbird.org/show_bug.cgi?id=495">Bug 495</a> - purpleIAccount cannot access preferences via JavaScript
protocol (<a class="reference external" href="http://hg.instantbird.org/instantbird/rev/a188a5cc3ff1">check-in</a>)</li>
<li><a class="reference external" href="https://bugzilla.instantbird.org/show_bug.cgi?id=648">Bug 648</a> -Provide a default <span class="caps">JS</span> implementation of
purpleIChatRoomField
(<a class="reference external" href="http://hg.instantbird.org/instantbird/rev/61fc80a569d3">check-in</a>)</li>
<li>[Reviewed] <a class="reference external" href="https://bugzilla.instantbird.org/show_bug.cgi?id=647">Bug 647</a> - Username split for JavaScript protocols
(<a class="reference external" href="http://hg.instantbird.org/instantbird/rev/a6c8fbf77e10">check-in</a>)</li>
<li>[Reviewed] &lt;no bug&gt; -Share the nsIClassInfo implementation between
all the objects implemented in jsProtoHelper
(<a class="reference external" href="http://hg.instantbird.org/instantbird/rev/035f7d8d7f78">check-in</a>)</li>
</ul>
<p>Also a few other random bugs I&#8217;ve worked&nbsp;on:</p>
<ul class="simple">
<li><a class="reference external" href="https://bugzilla.instantbird.org/show_bug.cgi?id=625">Bug 625</a> - Findbar broken on Windows in Conversation window
(<a class="reference external" href="http://hg.instantbird.org/instantbird/rev/2e8af77af2f2">check-in</a>)</li>
<li><a class="reference external" href="https://bugzilla.instantbird.org/show_bug.cgi?id=629">Bug 629</a> - Remove workaround for bug 503048
(<a class="reference external" href="http://hg.instantbird.org/instantbird/rev/ba4b9401791b">check-in</a>)</li>
<li><a class="reference external" href="https://bugzilla.instantbird.org/show_bug.cgi?id=473">Bug 473</a> - <span class="caps">JS</span> Logger line breaks don&#8217;t play well on Windows
<a class="reference external" href="http://hg.instantbird.org/instantbird/rev/6a600b8a32c9">(check-in</a>)</li>
<li><a class="reference external" href="https://bugzilla.instantbird.org/show_bug.cgi?id=593">Bug 593</a> - JavaScript component does not have a method named:
&#8220;onBeforeLinkTraversal&#8221;
(<a class="reference external" href="http://hg.instantbird.org/instantbird/rev/1b75f9fa4859">check-in</a>)</li>
</ul>
<p>Although none of these are really things that weren&#8217;t working a few
weeks ago, there are now real APIs for these for JavaScript protocols,
allowing other protocols to use them and to <em><span class="caps">FULLY</span></em> implement them
instead of hard coding values.&nbsp; In addition, a lot of the purplexpcom
layer is now hidden from JavaScript&nbsp;protocols.</p>
<p>There&#8217;s a few things left to do for the JavaScript protocol&nbsp;layer:</p>
<ul class="simple">
<li><a class="reference external" href="https://bugzilla.instantbird.org/show_bug.cgi?id=118">Bug 118</a> - Extensions should be able to register&nbsp;commands.</li>
<li><a class="reference external" href="https://bugzilla.instantbird.org/show_bug.cgi?id=650">Bug 650</a> - JavaScript accounts must be notified of status changes
(a sketchy patch that exists that will work, but a better patch to
core should be&nbsp;done)</li>
<li><a class="reference external" href="https://bugzilla.instantbird.org/show_bug.cgi?id=623">Bug 623</a> - Auto-Join option field is hard coded for certain
protocols (not <em>really</em> necessary, since it&#8217;s still <span class="caps">IRC</span>, but it
should be&nbsp;fixed)</li>
<li><a class="reference external" href="https://bugzilla.instantbird.org/show_bug.cgi?id=649">Bug 649</a> - Proxy should be available to JavaScript protocols
(hopefully being handled by&nbsp;Florian)</li>
</ul>
<p>A good summary of this is <a class="reference external" href="https://bugzilla.instantbird.org/showdependencygraph.cgi?id=507&amp;display=web&amp;rankdir=LR">the dependency graph of bug 507</a>
(Implement <span class="caps">IRC</span> in JavaScript).&nbsp; Note that the <span class="caps">IRC</span> JavaScript work blocks
<em>a&nbsp; lot</em> of <span class="caps">UI</span> work done for <span class="caps">IRC</span>.&nbsp; In particular Mook has been working
on implementing notifications (i.e. Invites, and perhaps a few other
commands), see <a class="reference external" href="https://bugzilla.instantbird.org/show_bug.cgi?id=628">Bug 628</a>.&nbsp; For other bugs, see the link above &#8212; and if
there&#8217;s a strange <span class="caps">UI</span> feature that you think should be added, please file
a bug and let us know about&nbsp;it!</p>
<p>I&#8217;ve also worked a bit on sending outgoing text with rich formatting
(bold, italics, underline, text size, etc.), this work is being tracked
in <a class="reference external" href="https://bugzilla.instantbird.org/show_bug.cgi?id=634">Bug 634</a>. There&#8217;s a proof on concept, but a lot of work needs to be
done for it, but it&#8217;s sort of working right&nbsp;now.</p>
<p>As I alluded to in my last blog post, the JavaScript protocols would
be used to implement Twitter. Work for this is occurring in <a class="reference external" href="https://bugzilla.instantbird.org/show_bug.cgi?id=598">Bug 598</a>,
where Florian has implemented (very) basic Twitter&nbsp;support.</p>
<p>My plans for the next&nbsp;bit:</p>
<ul class="simple">
<li>I&#8217;m hoping to finish up some of the work blocking JavaScript
protocols so <span class="caps">IRC</span> can be put into a state that needs alpha/beta
testers (if you&#8217;re interested in testing/hacking please drop me a
line here, on <span class="caps">IRC</span> or via&nbsp;email).</li>
<li>Move into my new&nbsp;apartment</li>
<li>Start my new&nbsp;job</li>
<li>Work on richtext messages a bit&nbsp;more</li>
</ul>
Blogger RSS Feeds for a Label2010-12-08T15:25:00-05:002010-12-08T15:25:00-05:00Patrick Cloketag:patrick.cloke.us,2010-12-08:/posts/2010/12/08/blogger-rss-feeds-for-label/<p>Blogger has crappy support for <span class="caps">RSS</span> apparently.&nbsp; I figured if I clicked
on a label, then found the <span class="caps">RSS</span> embedded in the page&#8230;it would give me
the <span class="caps">RSS</span> feed for that label,&nbsp;right?</p>
<p>Wrong.</p>
<p>Of course there&#8217;s an&nbsp;<a class="reference external" href="http://www.google.com/support/blogger/bin/answer.py?hl=en&amp;answer=97933"><span class="caps">FAQ</span></a> page about this, but the syntax it gives
is …</p><p>Blogger has crappy support for <span class="caps">RSS</span> apparently.&nbsp; I figured if I clicked
on a label, then found the <span class="caps">RSS</span> embedded in the page&#8230;it would give me
the <span class="caps">RSS</span> feed for that label,&nbsp;right?</p>
<p>Wrong.</p>
<p>Of course there&#8217;s an&nbsp;<a class="reference external" href="http://www.google.com/support/blogger/bin/answer.py?hl=en&amp;answer=97933"><span class="caps">FAQ</span></a> page about this, but the syntax it gives
is broken.&nbsp; For a specific label (I&#8217;m using the label&nbsp;&#8220;Instantbird&#8221;):</p>
<ul class="simple">
<li><span class="caps">RSS</span>:
<a class="reference external" href="http://clokep.blogspot.com/feeds/posts/default/-/Instantbird?alt=rss">http://clokep.blogspot.com/feeds/posts/default/-/Instantbird?alt=rss</a></li>
<li>Atom: <a class="reference external" href="http://clokep.blogspot.com/feeds/posts/default/-/Instantbird">http://clokep.blogspot.com/feeds/posts/default/-/Instantbird</a></li>
</ul>
<p>Who knows what versions of <span class="caps">RSS</span>/Atom these are.&nbsp; But the feeds do&nbsp;exist.</p>
Why Rewrite IRC into JavaScript? (vs. libpurple’s vs. ChatZilla’s)2010-12-08T14:29:00-05:002010-12-08T14:29:00-05:00Patrick Cloketag:patrick.cloke.us,2010-12-08:/posts/2010/12/08/why-rewrite-irc-into-javascript/
<p>I had a request on <span class="caps">IRC</span> (from Mic) to write an in-depth blog post
about <a class="reference external" href="https://bugzilla.instantbird.org/show_bug.cgi?id=507"><span class="caps">IRC</span> in JavaScript</a>:</p>
<blockquote>
“Maybe we could ask clokep if he’d like to write something about
js-irc? Why it is done, what the advantages are once it’s done, how
he is working on it …</blockquote>
<p>I had a request on <span class="caps">IRC</span> (from Mic) to write an in-depth blog post
about <a class="reference external" href="https://bugzilla.instantbird.org/show_bug.cgi?id=507"><span class="caps">IRC</span> in JavaScript</a>:</p>
<blockquote>
“Maybe we could ask clokep if he’d like to write something about
js-irc? Why it is done, what the advantages are once it’s done, how
he is working on it (going through the specs), putting the
jsProtocol code to test and adding missing pieces?” — <a class="reference external" href="http://log.bezut.info/instantbird/101208/#m54">Mic</a></blockquote>
<div class="section" id="wait-a-second-what-is-irc">
<h2><a class="toc-backref" href="#id3">Wait a second, what is <span class="caps">IRC</span>?</a></h2>
<p>I guess this is a good first question, I’ll steal from <a class="reference external" href="http://en.wikipedia.org/wiki/IRC">Wikipedia</a>:</p>
<blockquote>
Internet Relay Chat (<span class="caps">IRC</span>) is a form of real-time […] chat […] It
is mainly designed for group communication […] but also allows
[…for…] private message as well as chat and data transfers.</blockquote>
<p>Awesome, what’s that really mean? It’s an instant messaging protocol
with an actual specification (i.e. it’s not owned by some large, unnamed
company), with open-source libraries for clients and servers. It’s
usually used by more computer-oriented types of people and centers
around group conversation. Personally most of what I use it for is
open-source software I use (I’m almost always in <a class="reference external" href="irc://irc.mozilla.org/#instantbird">#instantbird</a>,
<a class="reference external" href="irc://irc.mozilla.org/#maildev">#maildev</a>, and <a class="reference external" href="irc://irc.mozilla.org/#songbird">#songbird</a> on <a class="reference external" href="http://irc.mozilla.org/">Mozilla’s <span class="caps">IRC</span> servers</a>.)</p>
</div>
<div class="section" id="why-it-is-done-what-advantages-are-there-once-this-is-done">
<h2><a class="toc-backref" href="#id4">Why it is done? What advantages are there once this is done?</a></h2>
<p>I touched upon this a little in my <a class="reference external" href="http://patrick.cloke.us/posts/2010/12/04/javascript-irc-in-instantbird/">last post</a>. In terms of
Instantbird: there’s an idea of switching some / all of the protocols
(eventually) to be JavaScript protocols instead of the libpurple
versions (libpurple is written mostly in C and is cross-platform, but
recent gains in speed in JavaScript allow this advantage of libpurple to
not matter as much). This would unfortunately mean we need to maintain
a lot more code, but it would allow us to integrate protocols in any way
that we see fit, instead of only using APIs / methods provided by
libpurple. Hopefully this would allow us to <a class="reference external" href="https://bugzilla.instantbird.org/showdependencytree.cgi?id=507&amp;maxdepth=2&amp;hide_resolved=1">enhance our <span class="caps">IRC</span>
implementation</a> a bit.</p>
<p>Also, Instantbird (nightlies) currently have limited support for
generating a protocol plug-in in JavaScript. A couple of “test”
protocols have be done, but nothing in “real” (in particular, none that
used a multi-user chat). This would allow us to iron out <a class="reference external" href="https://bugzilla.instantbird.org/show_bug.cgi?id=519">some</a>
<a class="reference external" href="https://bugzilla.instantbird.org/show_bug.cgi?id=118">bugs</a> in the implementation of JavaScript protocols.</p>
<p><em>[Edit: Florian suggested another question that wasn’t originally
covered, which some people more familiar with Mozilla code might be wondering.]</em></p>
</div>
<div class="section" id="why-aren-t-you-using-the-code-from-chatzilla">
<h2><a class="toc-backref" href="#id5">Why aren’t you using the code from ChatZilla?</a></h2>
<p>This was a tough one. Honestly when I first wanted a parsing
algorithm, I looked at the ChatZilla code, I used it. Then rewrote it
in a fourth as many lines (<a class="reference external" href="http://hg.mozilla.org/chatzilla/file/tip/js/lib/irc.js#l1250">93</a> vs. <a class="reference external" href="https://hg.instantbird.org/experiments/file/IRC-JavaScript/components/ircProtocol.js#l208">20</a>). Simply said, the code in
ChatZilla is <em>old</em>, it doesn’t use many of the features available only
in newer versions of JavaScript. To that point, the ChatZilla code
hasn’t been updated in over a year! The last check-in was: 2009-10-03,
below is a <a class="reference external" href="http://hg.mozilla.org/chatzilla/log/tip/js/lib/irc.js">quick summary</a> of the number of check-ins per year:</p>
<ul class="simple">
<li>2010: 0</li>
<li>2009: 5</li>
<li>2008: 15</li>
<li>2007: 11</li>
<li>2006: 18</li>
</ul>
<p>There’s been a pretty steady decline in check-ins. I could take this
code and attempt to whip it into shape and make huge sweeping changes
and commit them back to ChatZilla, but honestly it was easier to start
over for me. Regardless of ease, I’m not sure it would work any:
especially since the ChatZilla code seems overly complicated and overly
specific (since it wasn’t really built as a library as far as I can
see), especially since all the code is meant to deal only with <span class="caps">IRC</span>. The
Instantbird code needs to be protocol agnostic to a degree, while is why
it interfaces to purplexpcom.</p>
<p>A quick example of this is: ChatZilla uses a CIRCUser object, but for
Instantbird I need to create either an imIContact or a
purpleIAccountBuddy (depending on the situation). It’s possible that’s
can be abstracted and code shared — but I’m not sure it would be worth
the effort. After all this, I should probably look more into the
ChatZilla code, perhaps more of it could be used.</p>
<p>(If someone familiar with the ChatZilla code base — I don’t know
who/if there’s a maintainer — is interested in talking with me, please
get in contact here or on #instantbird. It’s possible we could align
some of what I’ve been working on, but I’m not sure how much could be
shared besides the parsing algorithm).</p>
<p><em>[End edit]</em></p>
</div>
<div class="section" id="what-are-the-specific-advantages-for-an-end-user">
<h2><a class="toc-backref" href="#id6">What are the specific advantages for an end-user?</a></h2>
<p>In terms of the <span class="caps">IRC</span> protocol itself, there shouldn’t be any, my goal
is for it to be a drop in replacement for the libpurple implementation
with automatic account migration, etc. For end-users we can hopefully
solve <a class="reference external" href="https://bugzilla.instantbird.org/showdependencytree.cgi?id=574&amp;maxdepth=1&amp;hide_resolved=1">a few annoying <span class="caps">IRC</span> <span class="caps">UI</span> issues</a>.</p>
</div>
<div class="section" id="what-about-for-developers-anything-cool-there">
<h2><a class="toc-backref" href="#id7">What about for developers? Anything cool there?</a></h2>
<p>Well, I’m hoping to be able to test this replacement via an extension
that replaces the libpurple <span class="caps">IRC</span> to dogfood it before eventual inclusion
in Instantbird. I’m not sure if that counts as “cool.” though. If
nothing else there will be an example of how to write a protocol in
JavaScript (using sockets). So hopefully other people can make some
other cool protocols off of that example. You might wonder what else we
have planned for JavaScript protocols; there are plans to make at least
a Twitter protocol.</p>
</div>
<div class="section" id="how-is-this-being-done">
<h2><a class="toc-backref" href="#id8">How is this being done?</a></h2>
<p>Well I said up above <span class="caps">IRC</span> has a specification, right? Well, yes.
There’s the <a class="reference external" href="http://tools.ietf.org/html/rfc1459">original specification</a>, this was superseded by <a class="reference external" href="http://tools.ietf.org/html/rfc2810">four</a>
<a class="reference external" href="http://tools.ietf.org/html/rfc2811">different</a> <a class="reference external" href="http://tools.ietf.org/html/rfc2812">specification</a> <a class="reference external" href="http://tools.ietf.org/html/rfc2813">documents</a>. Of which we only really
care about one: <a class="reference external" href="http://tools.ietf.org/html/rfc2812">the client protocol</a>. So we have this updated
specification (try reading it, it’s rather painful), which is good.
It’s relatively straightforward set of commands and responses/errors.
It’s a bit more confusing than that though since there are a couple of
extensions, etc. This is summarized below:</p>
<ul class="simple">
<li><span class="strike"><span class="caps">RFC</span> 1459</span><ul>
<li>Extended with <a class="reference external" href="http://www.irchelp.org/irchelp/rfc/dccspec.html"><span class="strike"><span class="caps">DCC</span> specification (“direct client-to-client”)</span></a><ul>
<li>Replaced with <a class="reference external" href="http://www.irchelp.org/irchelp/rfc/dccspec.html"><span class="strike"><span class="caps">CTCP</span> (“client-to-client protocol”)</span></a><ul>
<li><a class="reference external" href="http://www.invlogic.com/irc/ctcp.html">Draft for a formalized <span class="caps">CTCP</span></a></li>
</ul>
</li>
<li>(Apparently some people are working on a <a class="reference external" href="http://www.dcc2.org/"><span class="caps">DCC2</span></a>)</li>
</ul>
</li>
<li>Officially replaced with RFCs 2810, 2811, 2812, 2813</li>
</ul>
</li>
</ul>
<p>A lot of this is being done by reading the specifications and finding
the proper responses, etc. I’ve also used <a class="reference external" href="http://www.wireshark.org/download.html">Wireshark</a> a bit to see how
libpurple sends <span class="caps">IRC</span> commands (in particular, in what order it sends them
in). A lot of my development is happening on live <span class="caps">IRC</span> servers, which
isn’t really best practice, but I’m mostly sending commands by hand to
see the responses since a bunch of non-standard responses and extensions
have developed beyond the above. I have been using <a class="reference external" href="http://ircd.bircd.org/">beware irc</a> to run
a daemon on my own machine, however.</p>
</div>
<div class="section" id="so-how-far-along-are-you">
<h2><a class="toc-backref" href="#id9">So how far along are you?</a></h2>
<p>I’ve started implementing <span class="caps">RFC</span> 2812 and have a variety of commands done
(the login sequence occurs automatically, the server connection is kept
alive, messages can be sent to a channel and are parsed when received, a
lot of the initial server information is displayed but unparsed). But
there’s a lot more to do! As my last post outlined, I recently was able
to successfully get a chat to work in Instantbird from a silly bug I had
been having.</p>
<p>It’s rather slow going since I’ll start to implement something from
the <span class="caps">IRC</span> side, and then realize the <a class="reference external" href="http://hg.instantbird.org/instantbird/file/tip/purple/purplexpcom/src/jsProtoHelper.jsm">Instantbird layer</a> (the jsProtocol
module) is missing a component I need. One of the major parts of
working on this is extending the Instantbird layer to contain the proper
functions and objects needed to implement chats via JavaScript. This is
usually the slowest going part of my code, since it involves interfacing
with Instantbird / <a class="reference external" href="http://hg.instantbird.org/instantbird/file/tip/purple/purplexpcom/public/">purplexpcom</a>. Luckily Florian, the main developer
of Instantbird, has been a big help with this (as have other
participants of #instantbird — in particular I know Mic helped track
down a few syntax type bugs).</p>
</div>
<div class="section" id="what-s-next">
<h2><a class="toc-backref" href="#id10">What’s next?</a></h2>
<p>Now that have the basics of chat working, I need to start handling the
<span class="caps">QUIT</span>, <span class="caps">PART</span> and <span class="caps">JOIN</span> commands for when other users enter <span class="amp">&amp;</span> leave chat
rooms. Once these are complete it should be quite usable, although the
entire preference system still doesn’t exist, including notifying the <span class="caps">UI</span>
of what options are available. In addition, I need to look into doing
<span class="caps">SSL</span> sockets.</p>
<p>Once the protocol plug-in is done, we plan to abstract sections of it
that will be useful for other protocols (in particular the socket
connection aspects).</p>
</div>
<div class="section" id="where-can-i-see-this-stuff">
<h2><a class="toc-backref" href="#id11">Where can I see this stuff…?</a></h2>
<p>My work is kept in the “<a class="reference external" href="https://hg.instantbird.org/experiments/file/IRC-JavaScript/">experiments</a>” repository on Instantbird’s
<a class="reference external" href="http://mercurial.selenic.com/">Mercurial</a> repository. There’s also a variety of bugs open (they’re
listed above, I’m not going to re-list them), although not a ton is
happening in them.</p>
</div>
<div class="section" id="how-can-i-help">
<h2><a class="toc-backref" href="#id12">How can I help?!</a></h2>
<p>Well you can of course feel free to download the code and hack on it,
let me know (via <span class="caps">IRC</span> or any of the bugs most likely) if you have a patch
you’d like me to apply. Or if you just found something that doesn’t
work you can feel free to let me know, although I probably just haven’t
gotten around to fixing it yet.</p>
<p>Also, if you’ve ever found something annoying / broken in the <span class="caps">IRC</span>
implementation in Instantbird / libpurple please let us know (through
any of the above contact sources).</p>
<p>Hopefully that’s a bit of a better explanation of why we’re spending
time to rewrite the <span class="caps">IRC</span> protocol implementation into JavaScript — we
definitely think it’s worth it and can lead to a bunch of new unique
protocol plug-ins for Instantbird.</p>
</div>
JavaScript IRC in Instantbird2010-12-04T17:24:00-05:002010-12-04T17:24:00-05:00Patrick Cloketag:patrick.cloke.us,2010-12-04:/posts/2010/12/04/javascript-irc-in-instantbird/<p>I&#8217;ve been working on rewriting the <span class="caps">IRC</span> plugin for <a class="reference external" href="http://www.instantbird.com/">Instantbird</a> since
the summer (sometime in August, I can&#8217;t seem to find the exact date &#8212;
at least since Sept. 10th&nbsp;though).</p>
<p>Since <a class="reference external" href="http://developer.pidgin.im/wiki/WhatIsLibpurple">libpurple</a> (used in Pidgin, Adium, etc.) provides the <span class="caps">IRC</span>
protocol that we currently use, why do this …</p><p>I&#8217;ve been working on rewriting the <span class="caps">IRC</span> plugin for <a class="reference external" href="http://www.instantbird.com/">Instantbird</a> since
the summer (sometime in August, I can&#8217;t seem to find the exact date &#8212;
at least since Sept. 10th&nbsp;though).</p>
<p>Since <a class="reference external" href="http://developer.pidgin.im/wiki/WhatIsLibpurple">libpurple</a> (used in Pidgin, Adium, etc.) provides the <span class="caps">IRC</span>
protocol that we currently use, why do this?&nbsp; One reason is to iron out
(and find) some of the bugs left in implementing protocols in JavaScript
and part of it is so I can learn to code better.&nbsp; Unfortunately during
this semester I was not able to get as much done as I had hoped and
almost everything that had been done was finished in&nbsp;August/September</p>
<p>Some big milestones I&#8217;ve completed (with dates if I have&nbsp;them):</p>
<ol class="arabic simple">
<li>Connected to server via sockets in&nbsp;JavaScript</li>
<li>Generate a conversation that works as a raw connection to the server
(i.e. as if you had opened a telnet connection to the&nbsp;server)</li>
<li>Parsing messages and automatic ponging when the server&nbsp;pings</li>
<li>Joining a channel (2010/12/04, i.e.&nbsp;today!)</li>
</ol>
<p>There had been a bunch of small bugs I had been having in getting this
to work: one error, (which I found quickly) one of the other developers
(<a class="reference external" href="http://queze.net/">Florian</a>) was able to help me out with, was that I was not initiating
a <strong>new</strong> object.&nbsp; And after learning a bit above observers I was able
to get the <span class="caps">UI</span> to respond.&nbsp; I even threw in support for op/half-op/voice
After today&#8217;s work I was able to generate the following&nbsp;screenshot:</p>
<!-- -->
<blockquote class="center">
<a class="reference external image-reference" href="http://patrick.cloke.us/images/IRCworking2.png"><img alt="Example conversation using JavaScript IRC." class="center" src="http://patrick.cloke.us/images/IRCworking2.png" style="height: 297px;" /></a>
<p>An initial example of Instantbird communicating using JavaScript <span class="caps">IRC</span>.</p>
</blockquote>
<p>This build would be almost fully usable by those who do very little on
<span class="caps">IRC</span> (i.e. if you just want to go and chat, it&#8217;d work well), but there&#8217;s
a lot more work to be done.&nbsp; The code can be viewed in the <a class="reference external" href="https://hg.instantbird.org/experiments/file/IRC-JavaScript/">Experiments
repository</a>.&nbsp; (Check it out, there&#8217;s a 600+ line switch&nbsp;statement.)</p>
Yahoo & Thunderbird Can Finally Play Nice?2010-11-22T23:03:00-05:002010-11-22T23:03:00-05:00Patrick Cloketag:patrick.cloke.us,2010-11-22:/posts/2010/11/22/yahoo-thunderbird/<p>For years I&#8217;ve been dealing with Yahoo&#8217;s lack of support for any sort
of decent (free) <span class="caps">POP3</span>/<span class="caps">IMAP</span>/<span class="caps">SMTP</span> protocol support.&nbsp; Why do I need this?
So I can check my <a class="reference external" href="http://mail.yahoo.com/">Yahoo mail</a> in <a class="reference external" href="http://www.mozillamessaging.com/en-US/thunderbird/">Mozilla Thunderbird</a> of&nbsp;course!</p>
<p>At first I used <a class="reference external" href="http://ypopsemail.com/"><span class="caps">YPOPS</span>!</a>, a program that read the …</p><p>For years I&#8217;ve been dealing with Yahoo&#8217;s lack of support for any sort
of decent (free) <span class="caps">POP3</span>/<span class="caps">IMAP</span>/<span class="caps">SMTP</span> protocol support.&nbsp; Why do I need this?
So I can check my <a class="reference external" href="http://mail.yahoo.com/">Yahoo mail</a> in <a class="reference external" href="http://www.mozillamessaging.com/en-US/thunderbird/">Mozilla Thunderbird</a> of&nbsp;course!</p>
<p>At first I used <a class="reference external" href="http://ypopsemail.com/"><span class="caps">YPOPS</span>!</a>, a program that read the <span class="caps">HTML</span> pages provided
by the Yahoo webmail client and served the emails on a local <span class="caps">POP</span>
server.&nbsp; Cool, right?&nbsp; Except it always broke whenever Yahoo changed
their pages&nbsp;around.</p>
<p>After a bit I moved onto using the <a class="reference external" href="http://www.blogger.com/">WebMail extension</a> for
Thunderbird.&nbsp; It essentially works the same way, but runs in the
Thunderbird process as an extension instead of as a separate service.
It&#8217;s a little complicated to set up and requires two extensions.&nbsp; The
general WebMail extension and a Yahoo specific one (there&#8217;s also ones
available for Hotmail, Gmail, Libero and <span class="caps">AOL</span>).&nbsp; You might wonder why
this exists for some services that have always had <span class="caps">POP</span>/<span class="caps">IMAP</span> access
(Gmail)?&nbsp; I was too, apparently some people cannot check those ports
because of firewall issues so this essentially allows them to check it
via port 80, over an <span class="caps">HTTP</span>&nbsp;connection.</p>
<p>A few months ago I came across <a class="reference external" href="http://www.emaildiscussions.com/showthread.php?t=59575">post</a> describing how a <a class="reference external" href="http://en.wikipedia.org/w/index.php?title=Yahoo%21_Mail&amp;oldid=396914770#Free_IMAP_and_SMTPs_access">simple
(nonstandard) command</a> could allow access to the Yahoo <span class="caps">IMAP</span> server, but
it required <a class="reference external" href="http://www.crasseux.com/linux/">patching the Thunderbird source</a> &#8212; not an option for me
since I&#8217;ve been running nightlies of either Thunderbird 3.1 or 3.2/3.3
for a while now. (I mean sure, I could do it&#8230;but WebMail extension was
working fine.)&nbsp; There was <a class="reference external" href="http://groups.google.com/group/mozilla.dev.apps.thunderbird/browse_thread/thread/546356554c73f8ca">some discussion</a> about it and a <a class="reference external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=493064">bug</a> was
filed for&nbsp;Thunderbird.</p>
<p>So how did this lead to free <span class="caps">IMAP</span> support?&nbsp; I noticed in the <a class="reference external" href="https://wiki.mozilla.org/Thunderbird/StatusMeetings/2010-11-16#Web_Update">Weekly
Status Meeting Notes (2010-11-16)</a> for Thunderbird a mention of <a class="reference external" href="http://trunk.mozillamessaging.com/en-US/thunderbird/features/email_providers.html">Free
Email Providers</a> page.&nbsp; Checking it out it said &#8220;Y! Mail is a free
email service provided by Yahoo! It offers webmail supported by targeted
advertising as well as <span class="caps">IMAP</span> access.&#8221;&nbsp; Hmm&#8230;but I just said they don&#8217;t
have support this for free! A quick Bing search brought up a <a class="reference external" href="http://www.theanimail.com/imap_server_settings.html">page with
<span class="caps">IMAP</span> server settings</a>.&nbsp; I figured I&#8217;d check if they work, and sure
enough they did!&nbsp; The settings are copied&nbsp;below:</p>
<blockquote>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">User name:</th><td class="field-body"><span class="strike">user&#64;yahoo.com</span> user</td>
</tr>
<tr class="field"><th class="field-name"><span class="caps">IMAP</span> server:</th><td class="field-body"><span class="strike">imap-ssl.mail.yahoo.com</span> imap.mail.yahoo.com</td>
</tr>
<tr class="field"><th class="field-name">Port:</th><td class="field-body">993</td>
</tr>
<tr class="field"><th class="field-name">Password:</th><td class="field-body">Cleartext/Normal</td>
</tr>
<tr class="field"><th class="field-name"><span class="caps">SSL</span>:</th><td class="field-body">yes</td>
</tr>
<tr class="field"><th class="field-name"><span class="caps">SMTP</span> server:</th><td class="field-body">smtp.mail.yahoo.com</td>
</tr>
<tr class="field"><th class="field-name">Port:</th><td class="field-body">465</td>
</tr>
<tr class="field"><th class="field-name">Password:</th><td class="field-body">Cleartext/Normal</td>
</tr>
<tr class="field"><th class="field-name"><span class="caps">SSL</span>:</th><td class="field-body">yes</td>
</tr>
</tbody>
</table>
</blockquote>
<p>Awesome!&nbsp; Anyway, I replied with this info in the aforementioned bug
and <a class="reference external" href="https://bugzilla.mozilla.org/attachment.cgi?id=492550&amp;action=diff">a patch</a> was quickly added by Mozilla&#8217;s <a class="reference external" href="http://www.bucksch.org/1/projects/mozilla/">Ben Bucksch</a> to support
this in Thunderbird, hopefully it&#8217;ll make it into the next version!&nbsp; It
was also brought to my attention that imap-ssl.mail.yahoo.com provides
an <span class="caps">SSL</span> certificate that is valid for imap.mail.yahoo.com only, I&#8217;d
suggest using that&nbsp;former.</p>
<p>Note that I&#8217;m currently suffering from <a class="reference external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=610264">another bug</a> while using
Yahoo <span class="caps">IMAP</span>.&nbsp; Everything works, there&#8217;s just an annoying pop-up
occasionally about the error.&nbsp; Hopefully it will be fixed&nbsp;soon.</p>