<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>chris moos&#039;s blog &#187; oscar</title>
	<atom:link href="http://chrismoos.com/tag/oscar/feed/" rel="self" type="application/rss+xml" />
	<link>http://chrismoos.com</link>
	<description>developer by day, developer by night</description>
	<lastBuildDate>Wed, 11 Aug 2010 15:41:00 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Haskell AIM Client &#8211; a cool proof of&#160;concept</title>
		<link>http://chrismoos.com/2009/05/26/haskell-aim-client-a-cool-proof-of-concept/</link>
		<comments>http://chrismoos.com/2009/05/26/haskell-aim-client-a-cool-proof-of-concept/#comments</comments>
		<pubDate>Tue, 26 May 2009 18:29:21 +0000</pubDate>
		<dc:creator>Chris Moos</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[aim]]></category>
		<category><![CDATA[haskell]]></category>
		<category><![CDATA[oscar]]></category>

		<guid isPermaLink="false">http://chrismoos.com/?p=374</guid>
		<description><![CDATA[Haskell has been my favorite programming language in the past month, and for good reason. Its (purely) functional and has strong, static typing. 
The language feels more graceful to me, where design and function are key. It is a joy to program in and I would love to keep exploring it.

On my path to learning [...]]]></description>
			<content:encoded><![CDATA[<p>Haskell has been my favorite programming language in the past month, and for good reason. Its (purely) functional and has strong, static typing. </p>
<p>The language feels more graceful to me, where design and function are key. It is a joy to program in and I would love to keep exploring it.</p>
<p><img src="http://www.moostrax.com/cmoos/RunningMan_AIM.gif" style="width: 300px;padding:10px;float:right;" /></p>
<p>On my path to learning a new language, I usually try to implement something to get some real-world experience. In this instance, I have chosen to implement an Open AIM client. AIM operates on the legacy TOC(text based) protocol, or the feature full <a href="http://dev.aol.com/aim/oscar/">OSCAR protocol</a>, which is what most AIM clients use. I decided that OSCAR would be more fun to do, especially with the <a href="http://dev.aol.com/aim/oscar/#SIGNON">three step login process</a>.</p>
<p>The client that I wrote is very simple &#8212; handles login to AIM and just sits there. It can get IM&#8217;s though. The bulk of the AIM client that I enjoyed writing was the protocol handlers, and implementing the login process.</p>
<p>It would be very easy to extend this client to be a bot, if you are looking for a practical use for it. For me, the learning experience is enough.</p>
<p><span id="more-374"></span></p>
<p>The main function is listed below.</p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;">start<span style="color: #339933; font-weight: bold;">_</span>aim <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">do</span>
	<span style="font-weight: bold;">putStrLn</span> <span style="background-color: #3cb371;">&quot;Haskell AIM Client - OSCAR Protocol&quot;</span>
	appKey <span style="color: #339933; font-weight: bold;">&lt;-</span> getAppKey
	screenName <span style="color: #339933; font-weight: bold;">&lt;-</span> getScreenName
	password <span style="color: #339933; font-weight: bold;">&lt;-</span> getPassword
	<span style="color: #06c; font-weight: bold;">let</span> clientInfo <span style="color: #339933; font-weight: bold;">=</span> AIMClientInfo <span style="color: red;">1</span> <span style="background-color: #3cb371;">&quot;HaskellClient&quot;</span> appKey
	result <span style="color: #339933; font-weight: bold;">&lt;-</span> aim<span style="color: #339933; font-weight: bold;">_</span>open<span style="color: #339933; font-weight: bold;">_</span>auth clientInfo screenName password
	<span style="color: #06c; font-weight: bold;">case</span> result <span style="color: #06c; font-weight: bold;">of</span>
		Just info <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="color: #06c; font-weight: bold;">do</span>
			boss<span style="color: #339933; font-weight: bold;">_</span>result <span style="color: #339933; font-weight: bold;">&lt;-</span> aim<span style="color: #339933; font-weight: bold;">_</span>boss<span style="color: #339933; font-weight: bold;">_</span>session clientInfo info
			<span style="color: #06c; font-weight: bold;">case</span> boss<span style="color: #339933; font-weight: bold;">_</span>result <span style="color: #06c; font-weight: bold;">of</span>
				Just si <span style="color: #339933; font-weight: bold;">-&gt;</span> aim<span style="color: #339933; font-weight: bold;">_</span>oscar<span style="color: #339933; font-weight: bold;">_</span>login si
				Nothing <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="font-weight: bold;">putStrLn</span> <span style="background-color: #3cb371;">&quot;Unable to authenticate with BOSS server.&quot;</span>
		Nothing <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="font-weight: bold;">return</span> <span style="color: green;">&#40;</span><span style="color: green;">&#41;</span></pre></div></div>

<p>If you want to try out this AIM client, you must have an <a href="http://developer.aim.com/manageKeys.jsp">Open AIM Developer key</a>.</p>
<p>The first step is to <a href="http://www.moostrax.com/cmoos/haim.tar.gz">download the source</a> and use cabal to configure, build, and install it.</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;"># wget http://www.moostrax.com/cmoos/haim.tar.gz
# tar -xzf haim.tar.gz
# cd haim
# cabal configure &amp;&amp; cabal build &amp;&amp; cabal install</pre></div></div>

<p>And then run it.</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;"># ~/.cabal/bin/haim</pre></div></div>

<p>The output will look something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">Haskell AIM Client - OSCAR Protocol
An Open AIM Developer key is required: http://developer.aim.com/manageKeys.jsp
Open AIM Key&gt; 
AIM Screen Name&gt; 
AIM Password&gt; 
Connected to AIM server.
Entered OSCAR client loop.
Login accepted by OSCAR server. Setting up rights.
Max Watchers: 2000
Max Buddies: 1000
Max Temp Buddies: 160
Max Denies: 1000</pre></div></div>

<p>Like I said, the client is very simple, and just sits and waits. When you login you will see some information about your buddy list, and other AIM login data.</p>
]]></content:encoded>
			<wfw:commentRss>http://chrismoos.com/2009/05/26/haskell-aim-client-a-cool-proof-of-concept/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
	</channel>
</rss>
