﻿<?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>Code and Relax</title>
	<atom:link href="http://facemain.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://facemain.com</link>
	<description>Nothing To Lose</description>
	<lastBuildDate>Thu, 24 Jun 2010 07:16:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Using Pubsub service of Ejabberd for live data</title>
		<link>http://facemain.com/2010/04/19/using-pubsub-service-of-ejabberd-for-live-data/</link>
		<comments>http://facemain.com/2010/04/19/using-pubsub-service-of-ejabberd-for-live-data/#comments</comments>
		<pubDate>Mon, 19 Apr 2010 06:51:29 +0000</pubDate>
		<dc:creator>cuongle</dc:creator>
				<category><![CDATA[ejabberd]]></category>
		<category><![CDATA[xmpp]]></category>
		<category><![CDATA[couchdb]]></category>
		<category><![CDATA[erlang]]></category>
		<category><![CDATA[mochiweb]]></category>
		<category><![CDATA[pubsub]]></category>
		<category><![CDATA[webmachine]]></category>

		<guid isPermaLink="false">http://facemain.com/?p=81</guid>
		<description><![CDATA[The concept of real-time Web became more popular. Real-time information to be shared between sites. I made some models and will introduce it soon. Primary language : Erlang Protocol : XMPP over BOSH XMPP server: Ejabberd (had Pubsub service) Server database: CouchDB or Riak Web host: Webmachine + Mochiweb behind Ngnix Beta version at : http://stocktm.com]]></description>
			<content:encoded><![CDATA[<p>The concept of real-time Web became more popular. Real-time information to be shared between sites. I made some models and will introduce it soon.</p>
<p>Primary language : Erlang<br />
Protocol : XMPP over BOSH<br />
XMPP server: Ejabberd (had Pubsub service)<br />
Server database: CouchDB or Riak<br />
Web host: Webmachine + Mochiweb behind Ngnix</p>
<p>Beta version at : http://stocktm.com</p>
]]></content:encoded>
			<wfw:commentRss>http://facemain.com/2010/04/19/using-pubsub-service-of-ejabberd-for-live-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Happy Lunar New Year 2010</title>
		<link>http://facemain.com/2010/02/16/happy-lunar-new-year-2010/</link>
		<comments>http://facemain.com/2010/02/16/happy-lunar-new-year-2010/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 04:57:23 +0000</pubDate>
		<dc:creator>cuongle</dc:creator>
				<category><![CDATA[VIETNAM MY COUNTRY]]></category>
		<category><![CDATA[lunar new year 2010]]></category>

		<guid isPermaLink="false">http://facemain.com/?p=76</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="aligncenter" src="http://wcorporate.bnpparibas.com/applis/wCorporate/wCorporate.nsf/docsByCode/IAKB-6LDE3K/$FILE/e-cardSINv2-small.jpg" alt="Happy Lunar New Year 2010" width="420" height="300" /></p>
]]></content:encoded>
			<wfw:commentRss>http://facemain.com/2010/02/16/happy-lunar-new-year-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>expand webmachine REST tookit with dynamic module loader.</title>
		<link>http://facemain.com/2010/01/01/expand-webmachine-rest-tookit-with-dynamic-module-loader/</link>
		<comments>http://facemain.com/2010/01/01/expand-webmachine-rest-tookit-with-dynamic-module-loader/#comments</comments>
		<pubDate>Fri, 01 Jan 2010 09:25:42 +0000</pubDate>
		<dc:creator>cuongle</dc:creator>
				<category><![CDATA[webmachine]]></category>
		<category><![CDATA[dynamic module]]></category>
		<category><![CDATA[erlang]]></category>
		<category><![CDATA[REST]]></category>

		<guid isPermaLink="false">http://facemain.com/?p=66</guid>
		<description><![CDATA[Just implement http://github.com/cuonglb/webmachine_-expand]]></description>
			<content:encoded><![CDATA[<p>Just implement <img src='http://facemain.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<blockquote><p><a href="http://github.com/cuonglb/webmachine_-expand">http://github.com/cuonglb/webmachine_-expand</a></p></blockquote>
<p><img src="http://facemain.com/wp-content/uploads/2010/01/1.png" alt="" /><br />
<img src="http://facemain.com/wp-content/uploads/2010/01/2.png" alt="" /></p>
]]></content:encoded>
			<wfw:commentRss>http://facemain.com/2010/01/01/expand-webmachine-rest-tookit-with-dynamic-module-loader/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Testing new XEPs added on the Ejabberd 2.1.0 final version</title>
		<link>http://facemain.com/2009/11/26/testing-new-xeps-added-on-the-ejabberd-2-1-0-final-version/</link>
		<comments>http://facemain.com/2009/11/26/testing-new-xeps-added-on-the-ejabberd-2-1-0-final-version/#comments</comments>
		<pubDate>Thu, 26 Nov 2009 03:06:29 +0000</pubDate>
		<dc:creator>cuongle</dc:creator>
				<category><![CDATA[ejabberd]]></category>
		<category><![CDATA[xmpp]]></category>
		<category><![CDATA[xep]]></category>

		<guid isPermaLink="false">http://facemain.com/?p=54</guid>
		<description><![CDATA[+ XEP Support : Added XEP-0059 Result Set Management (for listing rooms) Added XEP-0082 Date Time Added XEP-0085 Chat State Notifications Added XEP-0157 Contact Addresses for XMPP Services Added XEP-0158 CAPTCHA Forms (in MUC rooms) Added STUN server, for XEP-0176: Jingle ICE-UDP Transport Method (skipped this XEP because my system to bad ) Added XEP-0199 [...]]]></description>
			<content:encoded><![CDATA[<p>+ XEP Support :</p>
<ul>
<li><span style="background-color: #ffffff;">Added <a href="http://xmpp.org/extensions/xep-0059.html">XEP-0059</a> Result Set Management (for listing rooms)</span></li>
<li><span style="background-color: #ffffff;">Added <a href="http://xmpp.org/extensions/xep-0082.html">XEP-0082</a> Date Time</span></li>
<li><span style="background-color: #ffffff;">Added <a href="http://xmpp.org/extensions/xep-0085.html">XEP-0085</a> Chat State Notifications</span></li>
<li><span style="background-color: #ffffff;">Added <a href="http://xmpp.org/extensions/xep-0157.html">XEP-0157</a> Contact Addresses for XMPP Services</span></li>
<li><span style="background-color: #ffffff;">Added <a href="http://xmpp.org/extensions/xep-0158.html">XEP-0158</a> CAPTCHA Forms (in MUC rooms)</span></li>
<li><span style="background-color: #ffffff;">Added STUN server, for <a href="http://xmpp.org/extensions/xep-0176.html">XEP-0176</a>: Jingle ICE-UDP Transport Method (skipped this XEP because my system to bad <img src='http://facemain.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> )</span></li>
<li><span style="background-color: #ffffff;">Added <a href="http://xmpp.org/extensions/xep-0158.html">XEP-0199</a> XMPP Ping</span></li>
<li><span style="background-color: #ffffff;">Added <a href="http://xmpp.org/extensions/xep-0202.html">XEP-0202</a> Entity Time</span></li>
<li><span style="background-color: #ffffff;">Added <a href="http://xmpp.org/extensions/xep-0203.html">XEP-0203</a> Delayed Delivery</span></li>
<li><span style="background-color: #ffffff;">Added <a href="http://xmpp.org/extensions/xep-0227.html">XEP-0227</a> Portable Import/Export Format for XMPP-IM Servers</span></li>
<li><span style="background-color: #ffffff;">Added <a href="http://xmpp.org/extensions/xep-0237.html">XEP-0237</a> Roster Versioning</span></li>
</ul>
<p>+ Test enviroment :</p>
<ul>
<li><span style="background-color: #ffffff;">Server : CPU E2200 @ 2.20GHz x86_64bit 4GB Ram</span></li>
<li><span style="background-color: #ffffff;">OS : Ubuntu server distro with Linux kernel : 2.6.28-13-generic with GNOME desktop env.</span></li>
<li><span style="background-color: #ffffff;">Erlang R13B (erts-5.7.1) async-thread:1 kernel-poll:true</span></li>
<li><span style="background-color: #ffffff;">Ejabberd 2.1.0 final version (virtual host : cuonglb-desktop with one node : ejabberd@localhost)</span></li>
<li><span style="background-color: #ffffff;">Create two users for this test : user_a@cuonglb-desktop and user_b@cuonglb-desktop</span></li>
<li><span style="background-color: #ffffff;">PSI 0.12 with XML Console</span></li>
<li><span style="background-color: #ffffff;">Python 2.5.4 r254:67916 [GCC 4.3.3]</span></li>
<li><span style="background-color: #ffffff;">Twisted 8.2.0</span></li>
</ul>
<p>We are starting with <strong>XEP-0199 XMPP Ping</strong>:<br />
Open config file of ejabberd at ./conf/ejabberd.cfg and add mod_ping in modules terms (no options):</p>

<div class="wp_syntax_wrapper"><span class="wp_syntax_lang">Erlang</span><div class="wp_syntax"><div class="code"><pre class="erlang" style="color: #FFF; font-family:&quot;Consolas&quot;,monospace,&quot;Courier New&quot;">    <span style="color: #CCC;">&#123;</span>modules<span style="color: #CCC;">,</span>
     <span style="color: #CCC;">&#91;</span>
      <span style="color: #CCC;">&#123;</span>mod_adhoc<span style="color: #CCC;">,</span>    <span style="color: #CCC;">&#91;</span><span style="color: #CCC;">&#93;</span><span style="color: #CCC;">&#125;</span><span style="color: #CCC;">,</span>
      <span style="color: #CCC;">...</span>
      <span style="color: #CCC;">&#123;</span>mod_ping<span style="color: #CCC;">,</span>    <span style="color: #CCC;">&#91;</span><span style="color: #CCC;">&#93;</span><span style="color: #CCC;">&#125;</span><span style="color: #CCC;">,</span>
      <span style="color: #CCC;">...</span>
    <span style="color: #CCC;">&#93;</span>
    <span style="color: #CCC;">&#125;</span></pre></div></div></div>

<p>Ok, now restart ejabberd server : ./bin/ejabberdctrl restart<br />
Start PSI -&gt; General -&gt; Account setup -&gt; Add account of user a : user_a@cuonglb-desktop and set status is online.<br />
Start PSI:XML Console -&gt; right click on the account user_a@cuonglb-desktop from accounts list and click XML Console.<br />
In XML Console dialog click Enable and click XML Input &#8230; button and input xml iq stanza bellow :</p>
<p>Client-to-Server ping</p>

<div class="wp_syntax_wrapper"><span class="wp_syntax_lang">XML</span><div class="wp_syntax"><div class="code"><pre class="xml" style="color: #FFF; font-family:&quot;Consolas&quot;,monospace,&quot;Courier New&quot;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;iq</span> <span style="color: #7AB9BE;">from</span>=<span style="color: #7ACC00;">&quot;cuonglb@cuonglb-desktop/cuonglb-desktop&quot;</span> <span style="color: #7AB9BE;">type</span>=<span style="color: #7ACC00;">&quot;get&quot;</span> <span style="color: #7AB9BE;">to</span>=<span style="color: #7ACC00;">&quot;cuonglb-desktop&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ping</span> <span style="color: #7AB9BE;">xmlns</span>=<span style="color: #7ACC00;">'urn:xmpp:ping'</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/iq<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div></div>

<p>See on XML Console :<br />
<img class="aligncenter" title="ok pong" src="http://facemain.com/wp-content/uploads/2009/11/ok_pong1.png" alt=""  /></p>
<p><strong>XEP-0157: Contact Addresses for XMPP Services</strong></p>
<p>Queries server with iq stanza :</p>

<div class="wp_syntax_wrapper"><span class="wp_syntax_lang">XML</span><div class="wp_syntax"><div class="code"><pre class="xml" style="color: #FFF; font-family:&quot;Consolas&quot;,monospace,&quot;Courier New&quot;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;iq</span> <span style="color: #7AB9BE;">from</span>=<span style="color: #7ACC00;">'cuonglb@jabber.org/cuongle-lappy'</span></span>
<span style="color: #009900;">    <span style="color: #7AB9BE;">to</span>=<span style="color: #7ACC00;">'jabber.org'</span></span>
<span style="color: #009900;">    <span style="color: #7AB9BE;">id</span>=<span style="color: #7ACC00;">'disco1'</span></span>
<span style="color: #009900;">    <span style="color: #7AB9BE;">type</span>=<span style="color: #7ACC00;">'get'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;query</span> <span style="color: #7AB9BE;">xmlns</span>=<span style="color: #7ACC00;">'http://jabber.org/protocol/disco#info'</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/iq<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div></div>

<p> My server communicates info</p>

<div class="wp_syntax_wrapper"><span class="wp_syntax_lang">XML</span><div class="wp_syntax"><div class="code"><pre class="xml" style="color: #FFF; font-family:&quot;Consolas&quot;,monospace,&quot;Courier New&quot;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;iq</span> <span style="color: #7AB9BE;">from</span>=<span style="color: #7ACC00;">&quot;jabber.org&quot;</span> <span style="color: #7AB9BE;">type</span>=<span style="color: #7ACC00;">&quot;result&quot;</span> <span style="color: #7AB9BE;">to</span>=<span style="color: #7ACC00;">&quot;cuonglb@jabber.org/cuongle-lappy&quot;</span> <span style="color: #7AB9BE;">id</span>=<span style="color: #7ACC00;">&quot;disco1&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;query</span> <span style="color: #7AB9BE;">xmlns</span>=<span style="color: #7ACC00;">&quot;http://jabber.org/protocol/disco#info&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;identity</span> <span style="color: #7AB9BE;">category</span>=<span style="color: #7ACC00;">&quot;server&quot;</span> <span style="color: #7AB9BE;">type</span>=<span style="color: #7ACC00;">&quot;im&quot;</span> <span style="color: #7AB9BE;">name</span>=<span style="color: #7ACC00;">&quot;ejabberd&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;feature</span> <span style="color: #7AB9BE;">var</span>=<span style="color: #7ACC00;">&quot;http://ejabberd.jabberstudio.org/protocol/configure&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;feature</span> <span style="color: #7AB9BE;">var</span>=<span style="color: #7ACC00;">&quot;http://jabber.org/protocol/commands&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;feature</span> <span style="color: #7AB9BE;">var</span>=<span style="color: #7ACC00;">&quot;http://jabber.org/protocol/disco#info&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;feature</span> <span style="color: #7AB9BE;">var</span>=<span style="color: #7ACC00;">&quot;http://jabber.org/protocol/disco#items&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;feature</span> <span style="color: #7AB9BE;">var</span>=<span style="color: #7ACC00;">&quot;http://jabber.org/protocol/disco#publish&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;feature</span> <span style="color: #7AB9BE;">var</span>=<span style="color: #7ACC00;">&quot;iq&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;feature</span> <span style="color: #7AB9BE;">var</span>=<span style="color: #7ACC00;">&quot;jabber:iq:last&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;feature</span> <span style="color: #7AB9BE;">var</span>=<span style="color: #7ACC00;">&quot;jabber:iq:register&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;feature</span> <span style="color: #7AB9BE;">var</span>=<span style="color: #7ACC00;">&quot;jabber:iq:time&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;feature</span> <span style="color: #7AB9BE;">var</span>=<span style="color: #7ACC00;">&quot;jabber:iq:version&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;feature</span> <span style="color: #7AB9BE;">var</span>=<span style="color: #7ACC00;">&quot;presence&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;feature</span> <span style="color: #7AB9BE;">var</span>=<span style="color: #7ACC00;">&quot;presence-invisible&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;feature</span> <span style="color: #7AB9BE;">var</span>=<span style="color: #7ACC00;">&quot;vcard-temp&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;feature</span> <span style="color: #7AB9BE;">var</span>=<span style="color: #7ACC00;">&quot;http://jabber.org/protocol/commands&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/query<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/iq<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div></div>

]]></content:encoded>
			<wfw:commentRss>http://facemain.com/2009/11/26/testing-new-xeps-added-on-the-ejabberd-2-1-0-final-version/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A look at NOSQL and NOSQL Patterns</title>
		<link>http://facemain.com/2009/11/25/a-look-at-nosql-and-nosql-patterns/</link>
		<comments>http://facemain.com/2009/11/25/a-look-at-nosql-and-nosql-patterns/#comments</comments>
		<pubDate>Wed, 25 Nov 2009 07:03:17 +0000</pubDate>
		<dc:creator>cuongle</dc:creator>
				<category><![CDATA[NOSQL]]></category>
		<category><![CDATA[Ricky Ho]]></category>

		<guid isPermaLink="false">http://facemain.com/?p=52</guid>
		<description><![CDATA[Ricky Ho has done a great job of providing a thorough overview of the characteristics and patterns of what are being terms NOSQL products. This includes looking at products purporting to be NOSQL products, API’s ,data partitioning, data replication, client consistency, vector clock, and more. A very good read.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.blogger.com/profile/03793674536997651667">Ricky Ho</a> has done a great job of providing a thorough overview of the characteristics and patterns of what are being terms <a href="http://paulstamatiou.com/nosql-east-conference-nonrelational-database">NOSQL</a> products. This includes looking at products purporting to be NOSQL products, API’s ,data partitioning, data replication, client consistency, vector clock, and more. A very good <a href="http://horicky.blogspot.com/2009/11/nosql-patterns.html">read</a>.<br />
<img alt="" src="http://2.bp.blogspot.com/_j6mB7TMmJJY/SwmX6waHqPI/AAAAAAAAAVk/48TsSr21pUU/s400/P2.png" title="Update" class="aligncenter" width="400" height="375" /></p>
]]></content:encoded>
			<wfw:commentRss>http://facemain.com/2009/11/25/a-look-at-nosql-and-nosql-patterns/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>try to develop a sample service using  ejabberd router</title>
		<link>http://facemain.com/2009/11/24/try-to-develop-a-sample-service-using-ejabberd-router/</link>
		<comments>http://facemain.com/2009/11/24/try-to-develop-a-sample-service-using-ejabberd-router/#comments</comments>
		<pubDate>Tue, 24 Nov 2009 03:16:48 +0000</pubDate>
		<dc:creator>cuongle</dc:creator>
				<category><![CDATA[ejabberd]]></category>
		<category><![CDATA[xmpp]]></category>
		<category><![CDATA[ejabberd module]]></category>
		<category><![CDATA[ejabberd service]]></category>

		<guid isPermaLink="false">http://facemain.com/?p=38</guid>
		<description><![CDATA[Today free, try to develop a sample service using ejabberd router. + Requirements: Erlang/OTP, XMPP/Jabber protocol and Module development for Ejabberd skills (of course). Jabber clients for testing this service : PSI, Pidgin, Tkabber &#8230; I use all Mastery of two modules: gen_mod and gen_server behaviour Emacs with Erlang mode (optional, but recommended). + Using [...]]]></description>
			<content:encoded><![CDATA[<p>Today free, try to develop a sample service using  ejabberd router.<br />
+ Requirements:</p>
<ul>
<li><span style="background-color: #ffffff;">Erlang/OTP, XMPP/Jabber protocol and Module development for Ejabberd skills (of course).</span></li>
<li><span style="background-color: #ffffff;">Jabber clients for testing this service : PSI, Pidgin, Tkabber &#8230; I use all <img src='http://facemain.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </span></li>
<li><span style="background-color: #ffffff;">Mastery of two modules: gen_mod and gen_server behaviour</span></li>
<li><span style="background-color: #ffffff;">Emacs with Erlang mode (optional, but recommended). <img src='http://facemain.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </span></li>
</ul>
<p>+ Using Emacs to creat a file with file name is : mod_sample.erl<br />
+ OK, now we are using emacs/mode to code generation gen_server&#8217;s skeleton <img src='http://facemain.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  -&gt; Erlang/Skeletons/gen_server</p>
<p>+ Service name : Sample (sample.example.com) with example.com is virtual host.<br />
+ Scope : I do not think but it could be an ejabberd service pattern <img src='http://facemain.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>

<div class="wp_syntax_wrapper"><span class="wp_syntax_lang">Erlang</span><div class="wp_syntax"><div class="code"><pre class="erlang" style="color: #FFF; font-family:&quot;Consolas&quot;,monospace,&quot;Courier New&quot;"><span style="color: #999;">%%%-------------------------------------------------------------------</span>
<span style="color: #999;">%%% File    : mod_sample.erl</span>
<span style="color: #999;">%%% Author  : Cuong Le &lt;&gt;</span>
<span style="color: #999;">%%% Description : ejabberd service using ejabberd_router</span>
<span style="color: #999;">%%%</span>
<span style="color: #999;">%%% Created : 24 Nov 2009 by Cuong Le &lt;&gt;</span>
<span style="color: #999;">%%%-------------------------------------------------------------------</span>
<span style="color: #CCC;">-</span><span style="color: #5400b3;">module</span><span style="color: #CCC;">&#40;</span>mod_sample<span style="color: #CCC;">&#41;</span><span style="color: #CCC;">.</span>
&nbsp;
<span style="color: #CCC;">-</span><span style="color: #5400b3;">behaviour</span><span style="color: #CCC;">&#40;</span>gen_server<span style="color: #CCC;">&#41;</span><span style="color: #CCC;">.</span>
<span style="color: #CCC;">-</span><span style="color: #5400b3;">behaviour</span><span style="color: #CCC;">&#40;</span>gen_mod<span style="color: #CCC;">&#41;</span><span style="color: #CCC;">.</span>
&nbsp;
<span style="color: #999;">%% API</span>
<span style="color: #CCC;">-</span><span style="color: #5400b3;">export</span><span style="color: #CCC;">&#40;</span><span style="color: #CCC;">&#91;</span>start_link<span style="color: #CCC;">/</span><span style="color: #FFCC00;">2</span><span style="color: #CCC;">&#93;</span><span style="color: #CCC;">&#41;</span><span style="color: #CCC;">.</span>
&nbsp;
<span style="color: #999;">%% gen_server callbacks</span>
<span style="color: #CCC;">-</span><span style="color: #5400b3;">export</span><span style="color: #CCC;">&#40;</span><span style="color: #CCC;">&#91;</span>init<span style="color: #CCC;">/</span><span style="color: #FFCC00;">1</span><span style="color: #CCC;">,</span> handle_call<span style="color: #CCC;">/</span><span style="color: #FFCC00;">3</span><span style="color: #CCC;">,</span> handle_cast<span style="color: #CCC;">/</span><span style="color: #FFCC00;">2</span><span style="color: #CCC;">,</span> handle_info<span style="color: #CCC;">/</span><span style="color: #FFCC00;">2</span><span style="color: #CCC;">,</span>
   terminate<span style="color: #CCC;">/</span><span style="color: #FFCC00;">2</span><span style="color: #CCC;">,</span> code_change<span style="color: #CCC;">/</span><span style="color: #FFCC00;">3</span><span style="color: #CCC;">&#93;</span><span style="color: #CCC;">&#41;</span><span style="color: #CCC;">.</span>
&nbsp;
<span style="color: #999;">%% gen_mod callbacks</span>
<span style="color: #CCC;">-</span><span style="color: #5400b3;">export</span><span style="color: #CCC;">&#40;</span><span style="color: #CCC;">&#91;</span>start<span style="color: #CCC;">/</span><span style="color: #FFCC00;">2</span><span style="color: #CCC;">,</span>stop<span style="color: #CCC;">/</span><span style="color: #FFCC00;">1</span><span style="color: #CCC;">&#93;</span><span style="color: #CCC;">&#41;</span><span style="color: #CCC;">.</span>
&nbsp;
<span style="color: #CCC;">-</span><span style="color: #5400b3;">define</span><span style="color: #CCC;">&#40;</span><span style="color: #7AB9BE;">PROCNAME</span><span style="color: #CCC;">,</span> ejabberd_mod_sample<span style="color: #CCC;">&#41;</span><span style="color: #CCC;">.</span>
&nbsp;
<span style="color: #CCC;">-</span><span style="color: #5400b3;">record</span><span style="color: #CCC;">&#40;</span><span style="color: #d400ed;">state</span><span style="color: #CCC;">,</span> <span style="color: #CCC;">&#123;</span>
host
<span style="color: #CCC;">&#125;</span><span style="color: #CCC;">&#41;</span><span style="color: #CCC;">.</span>
&nbsp;
<span style="color: #CCC;">-</span><span style="color: #5400b3;">include</span><span style="color: #CCC;">&#40;</span><span style="color: #7ACC00;">&quot;ejabberd.hrl&quot;</span><span style="color: #CCC;">&#41;</span><span style="color: #CCC;">.</span>
<span style="color: #CCC;">-</span><span style="color: #5400b3;">include</span><span style="color: #CCC;">&#40;</span><span style="color: #7ACC00;">&quot;jlib.hrl&quot;</span><span style="color: #CCC;">&#41;</span><span style="color: #CCC;">.</span>
&nbsp;
<span style="color: #999;">%%====================================================================</span>
<span style="color: #999;">%% API</span>
<span style="color: #999;">%%====================================================================</span>
&nbsp;
<span style="color: #999;">%%--------------------------------------------------------------------</span>
<span style="color: #999;">%% Function: start_link() -&gt; {ok,Pid} | ignore | {error,Error}</span>
<span style="color: #999;">%% Description: Starts the server</span>
<span style="color: #999;">%%--------------------------------------------------------------------</span>
&nbsp;
<span style="color: #ff3c00;">start_link</span><span style="color: #CCC;">&#40;</span><span style="color: #45b3e6;">Host</span><span style="color: #CCC;">,</span> <span style="color: #45b3e6;">Opts</span><span style="color: #CCC;">&#41;</span> <span style="color: #CCC;">-&gt;</span>
<span style="color: #45b3e6;">Proc</span> <span style="color: #CCC;">=</span> gen_mod:<span style="color: #ff3c00;">get_module_proc</span><span style="color: #CCC;">&#40;</span><span style="color: #45b3e6;">Host</span><span style="color: #CCC;">,</span> ?<span style="color: #6941fd;">PROCNAME</span><span style="color: #CCC;">&#41;</span><span style="color: #CCC;">,</span>
<span style="color: #ff4e18;">gen_server</span>:<span style="color: #ff3c00;">start_link</span><span style="color: #CCC;">&#40;</span><span style="color: #CCC;">&#123;</span>local<span style="color: #CCC;">,</span> <span style="color: #45b3e6;">Proc</span><span style="color: #CCC;">&#125;</span><span style="color: #CCC;">,</span> ?<span style="color: #6941fd;">MODULE</span><span style="color: #CCC;">,</span> <span style="color: #CCC;">&#91;</span><span style="color: #45b3e6;">Host</span><span style="color: #CCC;">,</span> <span style="color: #45b3e6;">Opts</span><span style="color: #CCC;">&#93;</span><span style="color: #CCC;">,</span> <span style="color: #CCC;">&#91;</span><span style="color: #CCC;">&#93;</span><span style="color: #CCC;">&#41;</span><span style="color: #CCC;">.</span>
&nbsp;
<span style="color: #999;">%%====================================================================</span>
<span style="color: #999;">%% gen_mod callbacks</span>
<span style="color: #999;">%%====================================================================</span>
<span style="color: #ff3c00;">start</span><span style="color: #CCC;">&#40;</span><span style="color: #45b3e6;">Host</span><span style="color: #CCC;">,</span> <span style="color: #45b3e6;">Opts</span><span style="color: #CCC;">&#41;</span> <span style="color: #CCC;">-&gt;</span>
<span style="color: #45b3e6;">Proc</span> <span style="color: #CCC;">=</span> gen_mod:<span style="color: #ff3c00;">get_module_proc</span><span style="color: #CCC;">&#40;</span><span style="color: #45b3e6;">Host</span><span style="color: #CCC;">,</span> ?<span style="color: #6941fd;">PROCNAME</span><span style="color: #CCC;">&#41;</span><span style="color: #CCC;">,</span>
<span style="color: #45b3e6;">ChildSpec</span> <span style="color: #CCC;">=</span> <span style="color: #CCC;">&#123;</span><span style="color: #45b3e6;">Proc</span><span style="color: #CCC;">,</span> <span style="color: #CCC;">&#123;</span>?<span style="color: #6941fd;">MODULE</span><span style="color: #CCC;">,</span> start_link<span style="color: #CCC;">,</span> <span style="color: #CCC;">&#91;</span><span style="color: #45b3e6;">Host</span><span style="color: #CCC;">,</span> <span style="color: #45b3e6;">Opts</span><span style="color: #CCC;">&#93;</span><span style="color: #CCC;">&#125;</span><span style="color: #CCC;">,</span> permanent<span style="color: #CCC;">,</span> <span style="color: #FFCC00;">1000</span><span style="color: #CCC;">,</span> worker<span style="color: #CCC;">,</span> <span style="color: #CCC;">&#91;</span>?<span style="color: #6941fd;">MODULE</span><span style="color: #CCC;">&#93;</span><span style="color: #CCC;">&#125;</span><span style="color: #CCC;">,</span>
<span style="color: #ff4e18;">supervisor</span>:<span style="color: #ff3c00;">start_child</span><span style="color: #CCC;">&#40;</span>ejabberd_sup<span style="color: #CCC;">,</span> <span style="color: #45b3e6;">ChildSpec</span><span style="color: #CCC;">&#41;</span><span style="color: #CCC;">.</span>
&nbsp;
<span style="color: #ff3c00;">stop</span><span style="color: #CCC;">&#40;</span><span style="color: #45b3e6;">Host</span><span style="color: #CCC;">&#41;</span><span style="color: #CCC;">-&gt;</span>
    <span style="color: #45b3e6;">Proc</span> <span style="color: #CCC;">=</span> gen_mod:<span style="color: #ff3c00;">get_module_proc</span><span style="color: #CCC;">&#40;</span><span style="color: #45b3e6;">Host</span><span style="color: #CCC;">,</span> ?<span style="color: #6941fd;">PROCNAME</span><span style="color: #CCC;">&#41;</span><span style="color: #CCC;">,</span>
    <span style="color: #ff4e18;">supervisor</span>:<span style="color: #ff3c00;">terminate_child</span><span style="color: #CCC;">&#40;</span>ejabberd_sup<span style="color: #CCC;">,</span> <span style="color: #45b3e6;">Proc</span><span style="color: #CCC;">&#41;</span><span style="color: #CCC;">,</span>
    <span style="color: #ff4e18;">supervisor</span>:<span style="color: #ff3c00;">delete_child</span><span style="color: #CCC;">&#40;</span>ejabberd_sup<span style="color: #CCC;">,</span> <span style="color: #45b3e6;">Proc</span><span style="color: #CCC;">&#41;</span><span style="color: #CCC;">.</span>
<span style="color: #999;">%%====================================================================</span>
<span style="color: #999;">%% gen_server callbacks</span>
<span style="color: #999;">%%====================================================================</span>
<span style="color: #999;">%%--------------------------------------------------------------------</span>
<span style="color: #999;">%% Function: init(Args) -&gt; {ok, State} |</span>
<span style="color: #999;">%%                         {ok, State, Timeout} |</span>
<span style="color: #999;">%%                         ignore               |</span>
<span style="color: #999;">%%                         {stop, Reason}</span>
<span style="color: #999;">%% Description: Initiates the server</span>
<span style="color: #999;">%%--------------------------------------------------------------------</span>
&nbsp;
<span style="color: #ff3c00;">init</span><span style="color: #CCC;">&#40;</span><span style="color: #CCC;">&#91;</span><span style="color: #45b3e6;">Host</span><span style="color: #CCC;">,</span> <span style="color: #45b3e6;">Opts</span><span style="color: #CCC;">&#93;</span><span style="color: #CCC;">&#41;</span> <span style="color: #CCC;">-&gt;</span>
&nbsp;
<span style="color: #45b3e6;">MyHost</span> <span style="color: #CCC;">=</span> gen_mod:<span style="color: #ff3c00;">get_opt_host</span><span style="color: #CCC;">&#40;</span><span style="color: #45b3e6;">Host</span><span style="color: #CCC;">,</span> <span style="color: #45b3e6;">Opts</span><span style="color: #CCC;">,</span> <span style="color: #7ACC00;">&quot;sample.@HOST@&quot;</span><span style="color: #CCC;">&#41;</span><span style="color: #CCC;">,</span>
&nbsp;
ejabberd_router:<span style="color: #ff3c00;">register_route</span><span style="color: #CCC;">&#40;</span><span style="color: #45b3e6;">MyHost</span><span style="color: #CCC;">&#41;</span><span style="color: #CCC;">,</span>
&nbsp;
<span style="color: #CCC;">&#123;</span>ok<span style="color: #CCC;">,</span> #<span style="color: #d400ed;">state</span><span style="color: #CCC;">&#123;</span>
host <span style="color: #CCC;">=</span> <span style="color: #45b3e6;">MyHost</span>
<span style="color: #CCC;">&#125;</span><span style="color: #CCC;">&#125;</span><span style="color: #CCC;">.</span>
&nbsp;
<span style="color: #999;">%%--------------------------------------------------------------------</span>
<span style="color: #999;">%% Function: %% handle_call(Request, From, State) -&gt; {reply, Reply, State} |</span>
<span style="color: #999;">%%                                      {reply, Reply, State, Timeout} |</span>
<span style="color: #999;">%%                                      {noreply, State} |</span>
<span style="color: #999;">%%                                      {noreply, State, Timeout} |</span>
<span style="color: #999;">%%                                      {stop, Reason, Reply, State} |</span>
<span style="color: #999;">%%                                      {stop, Reason, State}</span>
<span style="color: #999;">%% Description: Handling call messages</span>
<span style="color: #999;">%%--------------------------------------------------------------------</span>
&nbsp;
<span style="color: #ff3c00;">handle_call</span><span style="color: #CCC;">&#40;</span><span style="color: #45b3e6;">_Request</span><span style="color: #CCC;">,</span> <span style="color: #45b3e6;">_From</span><span style="color: #CCC;">,</span> <span style="color: #45b3e6;">State</span><span style="color: #CCC;">&#41;</span> <span style="color: #CCC;">-&gt;</span>
<span style="color: #45b3e6;">Reply</span> <span style="color: #CCC;">=</span> ok<span style="color: #CCC;">,</span>
<span style="color: #CCC;">&#123;</span>reply<span style="color: #CCC;">,</span> <span style="color: #45b3e6;">Reply</span><span style="color: #CCC;">,</span> <span style="color: #45b3e6;">State</span><span style="color: #CCC;">&#125;</span><span style="color: #CCC;">.</span>
&nbsp;
<span style="color: #999;">%%--------------------------------------------------------------------</span>
<span style="color: #999;">%% Function: handle_cast(Msg, State) -&gt; {noreply, State} |</span>
<span style="color: #999;">%%                                      {noreply, State, Timeout} |</span>
<span style="color: #999;">%%                                      {stop, Reason, State}</span>
<span style="color: #999;">%% Description: Handling cast messages</span>
<span style="color: #999;">%%--------------------------------------------------------------------</span>
&nbsp;
<span style="color: #ff3c00;">handle_cast</span><span style="color: #CCC;">&#40;</span><span style="color: #45b3e6;">_Msg</span><span style="color: #CCC;">,</span> <span style="color: #45b3e6;">State</span><span style="color: #CCC;">&#41;</span> <span style="color: #CCC;">-&gt;</span>
<span style="color: #CCC;">&#123;</span>noreply<span style="color: #CCC;">,</span> <span style="color: #45b3e6;">State</span><span style="color: #CCC;">&#125;</span><span style="color: #CCC;">.</span>
&nbsp;
<span style="color: #999;">%%--------------------------------------------------------------------</span>
<span style="color: #999;">%% Function: handle_info(Info, State) -&gt; {noreply, State} |</span>
<span style="color: #999;">%%                                       {noreply, State, Timeout} |</span>
<span style="color: #999;">%%                                       {stop, Reason, State}</span>
<span style="color: #999;">%% Description: Handling all non call/cast messages</span>
<span style="color: #999;">%%--------------------------------------------------------------------</span>
&nbsp;
<span style="color: #ff3c00;">handle_info</span><span style="color: #CCC;">&#40;</span><span style="color: #CCC;">&#123;</span>route<span style="color: #CCC;">,</span> <span style="color: #45b3e6;">From</span><span style="color: #CCC;">,</span> <span style="color: #45b3e6;">To</span><span style="color: #CCC;">,</span> <span style="color: #45b3e6;">Packet</span><span style="color: #CCC;">&#125;</span><span style="color: #CCC;">,</span> #<span style="color: #d400ed;">state</span><span style="color: #CCC;">&#123;</span>host <span style="color: #CCC;">=</span> <span style="color: #45b3e6;">Host</span><span style="color: #CCC;">&#125;</span> <span style="color: #CCC;">=</span> <span style="color: #45b3e6;">State</span><span style="color: #CCC;">&#41;</span> <span style="color: #CCC;">-&gt;</span>
    <span style="color: #3D9EDD;">case</span> <span style="color: #3D9EDD;">catch</span> <span style="color: #ff3c00;">do_route</span><span style="color: #CCC;">&#40;</span><span style="color: #45b3e6;">From</span><span style="color: #CCC;">,</span> <span style="color: #45b3e6;">To</span><span style="color: #CCC;">,</span> <span style="color: #45b3e6;">Packet</span><span style="color: #CCC;">,</span> <span style="color: #45b3e6;">Host</span><span style="color: #CCC;">&#41;</span> <span style="color: #3D9EDD;">of</span>
  <span style="color: #CCC;">&#123;</span><span style="">'EXIT'</span><span style="color: #CCC;">,</span> <span style="color: #45b3e6;">Reason</span><span style="color: #CCC;">&#125;</span><span style="color: #CCC;">-&gt;</span>
      ?<span style="color: #6941fd;">ERROR_MSG</span><span style="color: #CCC;">&#40;</span><span style="color: #7ACC00;">&quot;~p&quot;</span><span style="color: #CCC;">,</span><span style="color: #CCC;">&#91;</span><span style="color: #45b3e6;">Reason</span><span style="color: #CCC;">&#93;</span><span style="color: #CCC;">&#41;</span><span style="color: #CCC;">;</span>
  <span style="color: #45b3e6;">_</span> <span style="color: #CCC;">-&gt;</span>
      <span style="color: #FFF;">ok</span>
    <span style="color: #3D9EDD;">end</span><span style="color: #CCC;">,</span>
<span style="color: #CCC;">&#123;</span>noreply<span style="color: #CCC;">,</span> <span style="color: #45b3e6;">State</span><span style="color: #CCC;">&#125;</span><span style="color: #CCC;">;</span>
<span style="color: #ff3c00;">handle_info</span><span style="color: #CCC;">&#40;</span><span style="color: #45b3e6;">_Info</span><span style="color: #CCC;">,</span> <span style="color: #45b3e6;">State</span><span style="color: #CCC;">&#41;</span> <span style="color: #CCC;">-&gt;</span>
<span style="color: #CCC;">&#123;</span>noreply<span style="color: #CCC;">,</span> <span style="color: #45b3e6;">State</span><span style="color: #CCC;">&#125;</span><span style="color: #CCC;">.</span>
&nbsp;
<span style="color: #999;">%%--------------------------------------------------------------------</span>
<span style="color: #999;">%% Function: terminate(Reason, State) -&gt; void()</span>
<span style="color: #999;">%% Description: This function is called by a gen_server when it is about to</span>
<span style="color: #999;">%% terminate. It should be the opposite of Module:init/1 and do any necessary</span>
<span style="color: #999;">%% cleaning up. When it returns, the gen_server terminates with Reason.</span>
<span style="color: #999;">%% The return value is ignored.</span>
<span style="color: #999;">%%--------------------------------------------------------------------</span>
&nbsp;
<span style="color: #ff3c00;">terminate</span><span style="color: #CCC;">&#40;</span><span style="color: #45b3e6;">_Reason</span><span style="color: #CCC;">,</span> <span style="color: #45b3e6;">State</span><span style="color: #CCC;">&#41;</span> <span style="color: #CCC;">-&gt;</span>
<span style="color: #FFF;">ejabberd_router</span>:<span style="color: #ff3c00;">unregister_route</span><span style="color: #CCC;">&#40;</span><span style="color: #45b3e6;">State</span><span style="color: #ff9600;">#</span><span style="color: #d400ed;">state</span><span style="color: #CCC;">.</span>host<span style="color: #CCC;">&#41;</span><span style="color: #CCC;">,</span>
ok<span style="color: #CCC;">.</span>
&nbsp;
<span style="color: #999;">%%--------------------------------------------------------------------</span>
<span style="color: #999;">%% Func: code_change(OldVsn, State, Extra) -&gt; {ok, NewState}</span>
<span style="color: #999;">%% Description: Convert process state when code is changed</span>
<span style="color: #999;">%%--------------------------------------------------------------------</span>
&nbsp;
<span style="color: #ff3c00;">code_change</span><span style="color: #CCC;">&#40;</span><span style="color: #45b3e6;">_OldVsn</span><span style="color: #CCC;">,</span> <span style="color: #45b3e6;">State</span><span style="color: #CCC;">,</span> <span style="color: #45b3e6;">_Extra</span><span style="color: #CCC;">&#41;</span> <span style="color: #CCC;">-&gt;</span>
<span style="color: #CCC;">&#123;</span>ok<span style="color: #CCC;">,</span> <span style="color: #45b3e6;">State</span><span style="color: #CCC;">&#125;</span><span style="color: #CCC;">.</span>
&nbsp;
<span style="color: #999;">%%--------------------------------------------------------------------</span>
<span style="color: #999;">%%% Internal functions</span>
<span style="color: #999;">%%--------------------------------------------------------------------</span>
&nbsp;
<span style="color: #ff3c00;">do_route</span><span style="color: #CCC;">&#40;</span><span style="color: #45b3e6;">From</span><span style="color: #CCC;">,</span> <span style="color: #45b3e6;">To</span><span style="color: #CCC;">,</span> <span style="color: #45b3e6;">Packet</span><span style="color: #CCC;">,</span> <span style="color: #45b3e6;">Host</span><span style="color: #CCC;">&#41;</span><span style="color: #CCC;">-&gt;</span>
    <span style="color: #CCC;">&#123;</span>xmlelement<span style="color: #CCC;">,</span> <span style="color: #45b3e6;">Name</span><span style="color: #CCC;">,</span> <span style="color: #45b3e6;">Attrs</span><span style="color: #CCC;">,</span> <span style="color: #45b3e6;">_Els</span><span style="color: #CCC;">&#125;</span> <span style="color: #CCC;">=</span> <span style="color: #45b3e6;">Packet</span><span style="color: #CCC;">,</span>
    <span style="color: #3D9EDD;">case</span> <span style="color: #45b3e6;">To</span> <span style="color: #3D9EDD;">of</span> 
  #<span style="color: #d400ed;">jid</span><span style="color: #CCC;">&#123;</span>luser <span style="color: #CCC;">=</span> <span style="color: #7ACC00;">&quot;&quot;</span><span style="color: #CCC;">,</span> lresource <span style="color: #CCC;">=</span> <span style="color: #7ACC00;">&quot;&quot;</span><span style="color: #CCC;">&#125;</span> <span style="color: #CCC;">-&gt;</span>
      <span style="color: #3D9EDD;">case</span> <span style="color: #45b3e6;">Name</span> <span style="color: #3D9EDD;">of</span>
    <span style="color: #7ACC00;">&quot;iq&quot;</span> <span style="color: #CCC;">-&gt;</span>        
        <span style="color: #3D9EDD;">case</span> j<span style="color: #ff4e18;">lib</span>:<span style="color: #ff3c00;">iq_query_info</span><span style="color: #CCC;">&#40;</span><span style="color: #45b3e6;">Packet</span><span style="color: #CCC;">&#41;</span> <span style="color: #3D9EDD;">of</span>
      #<span style="color: #d400ed;">iq</span><span style="color: #CCC;">&#123;</span>type<span style="color: #CCC;">=</span>get<span style="color: #CCC;">,</span> xmlns <span style="color: #CCC;">=</span> ?<span style="color: #6941fd;">NS_DISCO_INFO</span><span style="color: #CCC;">,</span> sub_el <span style="color: #CCC;">=</span> <span style="color: #45b3e6;">SubEl</span><span style="color: #CCC;">,</span> lang <span style="color: #CCC;">=</span> <span style="color: #45b3e6;">Lang</span><span style="color: #CCC;">&#125;</span> <span style="color: #CCC;">=</span> <span style="color: #45b3e6;">IQ</span> <span style="color: #CCC;">-&gt;</span>
          <span style="color: #CCC;">&#123;</span>xmlelement<span style="color: #CCC;">,</span> <span style="color: #45b3e6;">_</span><span style="color: #CCC;">,</span> <span style="color: #45b3e6;">QAttrs</span><span style="color: #CCC;">,</span> <span style="color: #45b3e6;">_</span><span style="color: #CCC;">&#125;</span> <span style="color: #CCC;">=</span> <span style="color: #45b3e6;">SubEl</span><span style="color: #CCC;">,</span>
          <span style="color: #45b3e6;">Node</span> <span style="color: #CCC;">=</span> xml:<span style="color: #ff3c00;">get_attr_s</span><span style="color: #CCC;">&#40;</span><span style="color: #7ACC00;">&quot;node&quot;</span><span style="color: #CCC;">,</span> <span style="color: #45b3e6;">QAttrs</span><span style="color: #CCC;">&#41;</span><span style="color: #CCC;">,</span>
          <span style="color: #45b3e6;">Res</span> <span style="color: #CCC;">=</span> <span style="color: #3D9EDD;">case</span> <span style="color: #ff3c00;">iq_disco_info</span><span style="color: #CCC;">&#40;</span><span style="color: #45b3e6;">Host</span><span style="color: #CCC;">,</span> <span style="color: #45b3e6;">Node</span><span style="color: #CCC;">,</span> <span style="color: #45b3e6;">From</span><span style="color: #CCC;">,</span> <span style="color: #45b3e6;">Lang</span><span style="color: #CCC;">&#41;</span> <span style="color: #3D9EDD;">of</span>
              <span style="color: #CCC;">&#123;</span>result<span style="color: #CCC;">,</span> <span style="color: #45b3e6;">IQRes</span><span style="color: #CCC;">&#125;</span> <span style="color: #CCC;">-&gt;</span>
            <span style="color: #FFF;">j</span><span style="color: #ff4e18;">lib</span>:<span style="color: #ff3c00;">iq_to_xml</span><span style="color: #CCC;">&#40;</span>
              <span style="color: #45b3e6;">IQ</span><span style="color: #ff9600;">#</span><span style="color: #d400ed;">iq</span><span style="color: #CCC;">&#123;</span>type <span style="color: #CCC;">=</span> result<span style="color: #CCC;">,</span>
              sub_el <span style="color: #CCC;">=</span> <span style="color: #CCC;">&#91;</span><span style="color: #CCC;">&#123;</span>xmlelement<span style="color: #CCC;">,</span> <span style="color: #7ACC00;">&quot;query&quot;</span><span style="color: #CCC;">,</span>
                   <span style="color: #45b3e6;">QAttrs</span><span style="color: #CCC;">,</span> <span style="color: #45b3e6;">IQRes</span><span style="color: #CCC;">&#125;</span><span style="color: #CCC;">&#93;</span><span style="color: #CCC;">&#125;</span><span style="color: #CCC;">&#41;</span><span style="color: #CCC;">;</span>
              <span style="color: #CCC;">&#123;</span>error<span style="color: #CCC;">,</span> <span style="color: #45b3e6;">Error</span><span style="color: #CCC;">&#125;</span> <span style="color: #CCC;">-&gt;</span>
            <span style="color: #FFF;">j</span><span style="color: #ff4e18;">lib</span>:<span style="color: #ff3c00;">make_error_reply</span><span style="color: #CCC;">&#40;</span><span style="color: #45b3e6;">Packet</span><span style="color: #CCC;">,</span> <span style="color: #45b3e6;">Error</span><span style="color: #CCC;">&#41;</span>
          <span style="color: #3D9EDD;">end</span><span style="color: #CCC;">,</span>
          ejabberd_router:<span style="color: #ff3c00;">route</span><span style="color: #CCC;">&#40;</span><span style="color: #45b3e6;">To</span><span style="color: #CCC;">,</span> <span style="color: #45b3e6;">From</span><span style="color: #CCC;">,</span> <span style="color: #45b3e6;">Res</span><span style="color: #CCC;">&#41;</span><span style="color: #CCC;">;</span>            
      #<span style="color: #d400ed;">iq</span><span style="color: #CCC;">&#123;</span><span style="color: #CCC;">&#125;</span> <span style="color: #CCC;">-&gt;</span>
          <span style="color: #45b3e6;">Err</span> <span style="color: #CCC;">=</span> j<span style="color: #ff4e18;">lib</span>:<span style="color: #ff3c00;">make_error_reply</span><span style="color: #CCC;">&#40;</span>
            <span style="color: #45b3e6;">Packet</span><span style="color: #CCC;">,</span>
            ?<span style="color: #6941fd;">ERR_FEATURE_NOT_IMPLEMENTED</span><span style="color: #CCC;">&#41;</span><span style="color: #CCC;">,</span>
          ejabberd_router:<span style="color: #ff3c00;">route</span><span style="color: #CCC;">&#40;</span><span style="color: #45b3e6;">To</span><span style="color: #CCC;">,</span> <span style="color: #45b3e6;">From</span><span style="color: #CCC;">,</span> <span style="color: #45b3e6;">Err</span><span style="color: #CCC;">&#41;</span><span style="color: #CCC;">;</span>          
      <span style="color: #45b3e6;">_</span> <span style="color: #CCC;">-&gt;</span>            
          <span style="color: #FFF;">ok</span>
        <span style="color: #3D9EDD;">end</span><span style="color: #CCC;">;</span>       
    <span style="color: #45b3e6;">_</span> <span style="color: #CCC;">-&gt;</span>
        <span style="color: #FFF;">ok</span>
      <span style="color: #3D9EDD;">end</span><span style="color: #CCC;">;</span>
  <span style="color: #45b3e6;">_</span> <span style="color: #CCC;">-&gt;</span>
      <span style="color: #FFF;">ok</span>
    <span style="color: #3D9EDD;">end</span><span style="color: #CCC;">.</span>
&nbsp;
<span style="color: #ff3c00;">string_to_node</span><span style="color: #CCC;">&#40;</span><span style="color: #45b3e6;">SNode</span><span style="color: #CCC;">&#41;</span> <span style="color: #CCC;">-&gt;</span>
    <span style="color: #ff4e18;">string</span>:<span style="color: #ff3c00;">tokens</span><span style="color: #CCC;">&#40;</span><span style="color: #45b3e6;">SNode</span><span style="color: #CCC;">,</span> <span style="color: #7ACC00;">&quot;/&quot;</span><span style="color: #CCC;">&#41;</span><span style="color: #CCC;">.</span>
&nbsp;
<span style="color: #ff3c00;">iq_disco_info</span><span style="color: #CCC;">&#40;</span><span style="color: #45b3e6;">Host</span><span style="color: #CCC;">,</span> <span style="color: #45b3e6;">SNode</span><span style="color: #CCC;">,</span> <span style="color: #45b3e6;">From</span><span style="color: #CCC;">,</span> <span style="color: #45b3e6;">_Lang</span><span style="color: #CCC;">&#41;</span> <span style="color: #CCC;">-&gt;</span>
    <span style="color: #45b3e6;">Node</span> <span style="color: #CCC;">=</span> <span style="color: #ff3c00;">string_to_node</span><span style="color: #CCC;">&#40;</span><span style="color: #45b3e6;">SNode</span><span style="color: #CCC;">&#41;</span><span style="color: #CCC;">,</span>
    <span style="color: #3D9EDD;">case</span> <span style="color: #45b3e6;">Node</span> <span style="color: #3D9EDD;">of</span>
  <span style="color: #CCC;">&#91;</span><span style="color: #CCC;">&#93;</span> <span style="color: #CCC;">-&gt;</span>
      <span style="color: #CCC;">&#123;</span>result<span style="color: #CCC;">,</span>
       <span style="color: #CCC;">&#91;</span><span style="color: #CCC;">&#123;</span>xmlelement<span style="color: #CCC;">,</span> <span style="color: #7ACC00;">&quot;identity&quot;</span><span style="color: #CCC;">,</span>
         <span style="color: #CCC;">&#91;</span><span style="color: #CCC;">&#123;</span><span style="color: #7ACC00;">&quot;category&quot;</span><span style="color: #CCC;">,</span> <span style="color: #7ACC00;">&quot;test&quot;</span><span style="color: #CCC;">&#125;</span><span style="color: #CCC;">,</span>
    <span style="color: #CCC;">&#123;</span><span style="color: #7ACC00;">&quot;type&quot;</span><span style="color: #CCC;">,</span> <span style="color: #7ACC00;">&quot;service&quot;</span><span style="color: #CCC;">&#125;</span><span style="color: #CCC;">,</span>
    <span style="color: #CCC;">&#123;</span><span style="color: #7ACC00;">&quot;name&quot;</span><span style="color: #CCC;">,</span> <span style="color: #7ACC00;">&quot;sample&quot;</span><span style="color: #CCC;">&#125;</span><span style="color: #CCC;">&#93;</span><span style="color: #CCC;">,</span> <span style="color: #CCC;">&#91;</span><span style="color: #CCC;">&#93;</span><span style="color: #CCC;">&#125;</span><span style="color: #CCC;">&#93;</span>
      <span style="color: #CCC;">&#125;</span><span style="color: #CCC;">;</span>
  <span style="color: #45b3e6;">_</span> <span style="color: #CCC;">-&gt;</span>
      <span style="color: #FFF;">ok</span>  
    <span style="color: #3D9EDD;">end</span><span style="color: #CCC;">.</span></pre></div></div></div>

<p>To be continue &#8230; <img src='http://facemain.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://facemain.com/2009/11/24/try-to-develop-a-sample-service-using-ejabberd-router/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Implement prettyPrintXML javascript function wrap on rawInput/rawOutput StropheJS API</title>
		<link>http://facemain.com/2009/10/23/implement-prettyprintxml-javascript-function-wrap-on-rawinputrawoutput-strophejs-api/</link>
		<comments>http://facemain.com/2009/10/23/implement-prettyprintxml-javascript-function-wrap-on-rawinputrawoutput-strophejs-api/#comments</comments>
		<pubDate>Fri, 23 Oct 2009 06:57:06 +0000</pubDate>
		<dc:creator>cuongle</dc:creator>
				<category><![CDATA[xmpp]]></category>
		<category><![CDATA[jabber/xmpp]]></category>
		<category><![CDATA[strophe]]></category>

		<guid isPermaLink="false">http://facemain.com/?p=34</guid>
		<description><![CDATA[Before : After using : Code : JavaScriptprettyPrintXML = function&#40;data&#41;&#123; var formatted = ''; var reg = /(&#62;)(&#60;)(\/*)/g; data = data.replace&#40;reg, '$1\r\n$2$3'&#41;; var pad = 0; jQuery.each&#40;data.split&#40;'\r\n'&#41;, function&#40;index, node&#41; &#123; var indent = 0; try &#123; if &#40;node.match&#40;/^&#60;BINVAL&#62;/&#41;&#41; &#123; node = '&#60;BINVAL&#62;{binary data}&#60;/BINVAL&#62;'; indent = 0; &#125; else if &#40;node.match&#40;/^&#60;password&#62;/&#41;&#41; &#123; node = '&#60;password&#62;{hidden}&#60;/password&#62;'; indent [...]]]></description>
			<content:encoded><![CDATA[<p>Before :<br />
<img src="http://facemain.com/wp-content/uploads/2009/10/01.png" alt="Before" title="Before" width="670" height="143" class="alignleft size-full wp-image-32" /></p>
<p>After using :<br />
<img src="http://facemain.com/wp-content/uploads/2009/10/02.png" alt="After" title="After" width="670" height="143" class="alignleft size-full wp-image-33" /></p>
<p>Code :</p>

<div class="wp_syntax_wrapper"><span class="wp_syntax_lang">JavaScript</span><div class="wp_syntax"><div class="code"><pre class="javascript" style="color: #FFF; font-family:&quot;Consolas&quot;,monospace,&quot;Courier New&quot;">prettyPrintXML <span style="color: #CCC;">=</span> <span style="color: #996600;">function</span><span style="color: #CCC;">&#40;</span>data<span style="color: #CCC;">&#41;</span><span style="color: #CCC;">&#123;</span>
    <span style="color: #996600;">var</span> formatted <span style="color: #CCC;">=</span> <span style="color: #7ACC00;">''</span><span style="color: #CCC;">;</span>
    <span style="color: #996600;">var</span> reg <span style="color: #CCC;">=</span> <span style="color: #33CC66;">/(&gt;)(&lt;)(\/*)/g</span><span style="color: #CCC;">;</span>
    data <span style="color: #CCC;">=</span> data.<span style="color: #FFF;">replace</span><span style="color: #CCC;">&#40;</span>reg<span style="color: #CCC;">,</span> <span style="color: #7ACC00;">'$1<span style="color: #99FF00;">\r</span><span style="color: #99FF00;">\n</span>$2$3'</span><span style="color: #CCC;">&#41;</span><span style="color: #CCC;">;</span>
    <span style="color: #996600;">var</span> pad <span style="color: #CCC;">=</span> <span style="color: #FFCC00;">0</span><span style="color: #CCC;">;</span>
    jQuery.<span style="color: #FFF;">each</span><span style="color: #CCC;">&#40;</span>data.<span style="color: #FFF;">split</span><span style="color: #CCC;">&#40;</span><span style="color: #7ACC00;">'<span style="color: #99FF00;">\r</span><span style="color: #99FF00;">\n</span>'</span><span style="color: #CCC;">&#41;</span><span style="color: #CCC;">,</span> <span style="color: #996600;">function</span><span style="color: #CCC;">&#40;</span>index<span style="color: #CCC;">,</span> node<span style="color: #CCC;">&#41;</span> <span style="color: #CCC;">&#123;</span>
      <span style="color: #996600;">var</span> indent <span style="color: #CCC;">=</span> <span style="color: #FFCC00;">0</span><span style="color: #CCC;">;</span>
      <span style="color: #3D9EDD;">try</span> <span style="color: #CCC;">&#123;</span>
        <span style="color: #3D9EDD;">if</span> <span style="color: #CCC;">&#40;</span>node.<span style="color: #FFF;">match</span><span style="color: #CCC;">&#40;</span><span style="color: #33CC66;">/^&lt;BINVAL&gt;/</span><span style="color: #CCC;">&#41;</span><span style="color: #CCC;">&#41;</span> <span style="color: #CCC;">&#123;</span>
          node <span style="color: #CCC;">=</span> <span style="color: #7ACC00;">'&lt;BINVAL&gt;{binary data}&lt;/BINVAL&gt;'</span><span style="color: #CCC;">;</span>
          indent <span style="color: #CCC;">=</span> <span style="color: #FFCC00;">0</span><span style="color: #CCC;">;</span>
        <span style="color: #CCC;">&#125;</span> <span style="color: #3D9EDD;">else</span> <span style="color: #3D9EDD;">if</span> <span style="color: #CCC;">&#40;</span>node.<span style="color: #FFF;">match</span><span style="color: #CCC;">&#40;</span><span style="color: #33CC66;">/^&lt;password&gt;/</span><span style="color: #CCC;">&#41;</span><span style="color: #CCC;">&#41;</span> <span style="color: #CCC;">&#123;</span>
          node <span style="color: #CCC;">=</span> <span style="color: #7ACC00;">'&lt;password&gt;{hidden}&lt;/password&gt;'</span><span style="color: #CCC;">;</span>
          indent <span style="color: #CCC;">=</span> <span style="color: #FFCC00;">0</span><span style="color: #CCC;">;</span>
        <span style="color: #CCC;">&#125;</span> <span style="color: #3D9EDD;">else</span> <span style="color: #3D9EDD;">if</span> <span style="color: #CCC;">&#40;</span>node.<span style="color: #FFF;">match</span><span style="color: #CCC;">&#40;</span> <span style="color: #33CC66;">/.+&lt;\/\w[^&gt;]*&gt;$/</span> <span style="color: #CCC;">&#41;</span> <span style="color: #CCC;">||</span> node.<span style="color: #FFF;">match</span><span style="color: #CCC;">&#40;</span><span style="color: #33CC66;">/^&lt;\w[^&gt;].+\/&gt;/</span><span style="color: #CCC;">&#41;</span><span style="color: #CCC;">&#41;</span> <span style="color: #CCC;">&#123;</span>
          indent <span style="color: #CCC;">=</span> <span style="color: #FFCC00;">0</span><span style="color: #CCC;">;</span>
        <span style="color: #CCC;">&#125;</span> <span style="color: #3D9EDD;">else</span> <span style="color: #3D9EDD;">if</span> <span style="color: #CCC;">&#40;</span>node.<span style="color: #FFF;">match</span><span style="color: #CCC;">&#40;</span> <span style="color: #33CC66;">/^&lt;\/\w/</span> <span style="color: #CCC;">&#41;</span><span style="color: #CCC;">&#41;</span> <span style="color: #CCC;">&#123;</span>
          <span style="color: #3D9EDD;">if</span> <span style="color: #CCC;">&#40;</span>pad <span style="color: #CCC;">!=</span> <span style="color: #FFCC00;">0</span><span style="color: #CCC;">&#41;</span> <span style="color: #CCC;">&#123;</span>
            pad <span style="color: #CCC;">-=</span> <span style="color: #FFCC00;">1</span><span style="color: #CCC;">;</span>
          <span style="color: #CCC;">&#125;</span>
        <span style="color: #CCC;">&#125;</span> <span style="color: #3D9EDD;">else</span> <span style="color: #3D9EDD;">if</span> <span style="color: #CCC;">&#40;</span>node.<span style="color: #FFF;">match</span><span style="color: #CCC;">&#40;</span> <span style="color: #33CC66;">/^&lt;\w[^&gt;]*[^\/]&gt;.*$/</span> <span style="color: #CCC;">&#41;</span> <span style="color: #CCC;">||</span> node.<span style="color: #FFF;">match</span><span style="color: #CCC;">&#40;</span><span style="color: #33CC66;">/^&lt;\w[^&gt;]*&gt;/</span><span style="color: #CCC;">&#41;</span><span style="color: #CCC;">&#41;</span> <span style="color: #CCC;">&#123;</span>
          indent <span style="color: #CCC;">=</span> <span style="color: #FFCC00;">1</span><span style="color: #CCC;">;</span>
        <span style="color: #CCC;">&#125;</span> <span style="color: #3D9EDD;">else</span> <span style="color: #CCC;">&#123;</span>
          indent <span style="color: #CCC;">=</span> <span style="color: #FFCC00;">0</span><span style="color: #CCC;">;</span>
        <span style="color: #CCC;">&#125;</span>
&nbsp;
        <span style="color: #996600;">var</span> padding <span style="color: #CCC;">=</span> <span style="color: #7ACC00;">''</span><span style="color: #CCC;">;</span>
        <span style="color: #3D9EDD;">for</span> <span style="color: #CCC;">&#40;</span><span style="color: #996600;">var</span> i <span style="color: #CCC;">=</span> <span style="color: #FFCC00;">0</span><span style="color: #CCC;">;</span> i <span style="color: #CCC;">&lt;</span> pad<span style="color: #CCC;">;</span> i<span style="color: #CCC;">++</span><span style="color: #CCC;">&#41;</span> <span style="color: #CCC;">&#123;</span>
          padding <span style="color: #CCC;">+=</span> <span style="color: #7ACC00;">'<span style="color: #99FF00;">\t</span>'</span><span style="color: #CCC;">;</span>
        <span style="color: #CCC;">&#125;</span>
&nbsp;
        formatted <span style="color: #CCC;">+=</span> padding <span style="color: #CCC;">+</span> node <span style="color: #CCC;">+</span> <span style="color: #7ACC00;">'<span style="color: #99FF00;">\r</span><span style="color: #99FF00;">\n</span>'</span><span style="color: #CCC;">;</span>
        pad <span style="color: #CCC;">+=</span> indent<span style="color: #CCC;">;</span>
      <span style="color: #CCC;">&#125;</span> <span style="color: #3D9EDD;">catch</span><span style="color: #CCC;">&#40;</span>e<span style="color: #CCC;">&#41;</span> <span style="color: #CCC;">&#123;</span>
        <span style="color: #3D9EDD;">return</span> data<span style="color: #CCC;">;</span>
      <span style="color: #CCC;">&#125;</span>
      <span style="color: #3D9EDD;">return</span> <span style="color: #996600;">true</span><span style="color: #CCC;">;</span>
    <span style="color: #CCC;">&#125;</span><span style="color: #CCC;">&#41;</span><span style="color: #CCC;">;</span>
    <span style="color: #3D9EDD;">return</span> formatted<span style="color: #CCC;">;</span>    
<span style="color: #CCC;">&#125;</span><span style="color: #CCC;">;</span></pre></div></div></div>

]]></content:encoded>
			<wfw:commentRss>http://facemain.com/2009/10/23/implement-prettyprintxml-javascript-function-wrap-on-rawinputrawoutput-strophejs-api/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XMPP 101</title>
		<link>http://facemain.com/2009/10/20/xmpp-101/</link>
		<comments>http://facemain.com/2009/10/20/xmpp-101/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 05:04:07 +0000</pubDate>
		<dc:creator>cuongle</dc:creator>
				<category><![CDATA[xmpp]]></category>

		<guid isPermaLink="false">http://facemain.com/?p=28</guid>
		<description><![CDATA[XMPP 101 View more presentations from Remko Tronçon.]]></description>
			<content:encoded><![CDATA[<div style="width:425px;text-align:left" id="__ss_1097174"><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" href="http://www.slideshare.net/remko.troncon/xmpp-101" title="XMPP 101">XMPP 101</a><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=xmpp101-key-090303164623-phpapp01&#038;rel=0&#038;stripped_title=xmpp-101" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=xmpp101-key-090303164623-phpapp01&#038;rel=0&#038;stripped_title=xmpp-101" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;">View more <a style="text-decoration:underline;" href="http://www.slideshare.net/">presentations</a> from <a style="text-decoration:underline;" href="http://www.slideshare.net/remko.troncon">Remko Tronçon</a>.</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://facemain.com/2009/10/20/xmpp-101/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Instant Messaging with Jabber/XMPP</title>
		<link>http://facemain.com/2009/10/20/27/</link>
		<comments>http://facemain.com/2009/10/20/27/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 21:59:50 +0000</pubDate>
		<dc:creator>cuongle</dc:creator>
				<category><![CDATA[xmpp]]></category>

		<guid isPermaLink="false">http://facemain.com/2009/10/20/27/</guid>
		<description><![CDATA[Instant Messaging with Jabber/XMPP View more documents from johnx.]]></description>
			<content:encoded><![CDATA[<p><img style="visibility:hidden;width:0px;height:0px;" border=0 width=0 height=0 src="http://counters.gigya.com/wildfire/IMP/CXNID=2000002.0NXC/bHQ9MTI1NjAxNDc1MDgyMyZwdD*xMjU2MDE*Nzg2MzgyJnA9MTAxOTEmZD1zc19lbWJlZCZuPXdvcmRwcmVzcyZnPTImbz*zOTIxOTY5ZDg3Zjg*ZTkwODEwZjA3Y2Q2ODQzMmQ1OCZvZj*w.gif" />
<div style="width:425px;text-align:left" id="__ss_288612"><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" href="http://www.slideshare.net/johnx/instant-messaging-with-jabberxmpp" title="Instant Messaging with Jabber/XMPP">Instant Messaging with Jabber/XMPP</a><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=instant-messaging-with-jabberxmpp-1204426819811745-3&#038;stripped_title=instant-messaging-with-jabberxmpp" /><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=instant-messaging-with-jabberxmpp-1204426819811745-3&#038;stripped_title=instant-messaging-with-jabberxmpp" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;">View more <a style="text-decoration:underline;" href="http://www.slideshare.net/">documents</a> from <a style="text-decoration:underline;" href="http://www.slideshare.net/johnx">johnx</a>.</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://facemain.com/2009/10/20/27/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Requesting Jingle Info Server Addresses of Google Talk</title>
		<link>http://facemain.com/2009/10/16/requesting-jingle-info-server-addresses-from-google-talk/</link>
		<comments>http://facemain.com/2009/10/16/requesting-jingle-info-server-addresses-from-google-talk/#comments</comments>
		<pubDate>Fri, 16 Oct 2009 10:14:40 +0000</pubDate>
		<dc:creator>cuongle</dc:creator>
				<category><![CDATA[jingle/xmpp]]></category>
		<category><![CDATA[jingle info]]></category>

		<guid isPermaLink="false">http://facemain.com/?p=8</guid>
		<description><![CDATA[I&#8217;m using PSI (XMPP application client) with XML console and sends an IQ get containing a &#60;query/&#62; element qualified by the &#8216;google:jingleinfo&#8217; namespace : XML&#60;iq type='get' from='cuonglb@gmail.com/psi' to='cuonglb@gmail.com' id='ji-request-1'&#62; &#60;query xmlns='google:jingleinfo'/&#62; &#60;/iq&#62; and result : XML&#60;iq from=&#34;cuonglb@gmail.com&#34; type=&#34;result&#34; to=&#34;cuonglb@gmail.com/cuonglb-de8CF233B1&#34; id=&#34;ji-request-1&#34; &#62; &#60;query xmlns=&#34;google:jingleinfo&#34;&#62; &#60;stun&#62; &#60;server host=&#34;stun.l.google.com&#34; udp=&#34;19302&#34; /&#62; &#60;server host=&#34;stun4.l.google.com&#34; udp=&#34;19302&#34; /&#62; &#60;server host=&#34;stun1.l.google.com&#34; udp=&#34;19302&#34; [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m using PSI (XMPP application client) with XML console and sends an IQ get containing             a <code>&lt;query/&gt;</code> element qualified by the &#8216;google:jingleinfo&#8217;             namespace :</p>

<div class="wp_syntax_wrapper"><span class="wp_syntax_lang">XML</span><div class="wp_syntax"><div class="code"><pre class="xml" style="color: #FFF; font-family:&quot;Consolas&quot;,monospace,&quot;Courier New&quot;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;iq</span> <span style="color: #7AB9BE;">type</span>=<span style="color: #7ACC00;">'get'</span></span>
<span style="color: #009900;"><span style="color: #7AB9BE;">from</span>=<span style="color: #7ACC00;">'cuonglb@gmail.com/psi'</span></span>
<span style="color: #009900;"><span style="color: #7AB9BE;">to</span>=<span style="color: #7ACC00;">'cuonglb@gmail.com'</span></span>
<span style="color: #009900;"><span style="color: #7AB9BE;">id</span>=<span style="color: #7ACC00;">'ji-request-1'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;query</span> <span style="color: #7AB9BE;">xmlns</span>=<span style="color: #7ACC00;">'google:jingleinfo'</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/iq<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div></div>

<p>and result :</p>

<div class="wp_syntax_wrapper"><span class="wp_syntax_lang">XML</span><div class="wp_syntax"><div class="code"><pre class="xml" style="color: #FFF; font-family:&quot;Consolas&quot;,monospace,&quot;Courier New&quot;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;iq</span> <span style="color: #7AB9BE;">from</span>=<span style="color: #7ACC00;">&quot;cuonglb@gmail.com&quot;</span> <span style="color: #7AB9BE;">type</span>=<span style="color: #7ACC00;">&quot;result&quot;</span> <span style="color: #7AB9BE;">to</span>=<span style="color: #7ACC00;">&quot;cuonglb@gmail.com/cuonglb-de8CF233B1&quot;</span> <span style="color: #7AB9BE;">id</span>=<span style="color: #7ACC00;">&quot;ji-request-1&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;query</span> <span style="color: #7AB9BE;">xmlns</span>=<span style="color: #7ACC00;">&quot;google:jingleinfo&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;stun<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;server</span> <span style="color: #7AB9BE;">host</span>=<span style="color: #7ACC00;">&quot;stun.l.google.com&quot;</span> <span style="color: #7AB9BE;">udp</span>=<span style="color: #7ACC00;">&quot;19302&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;server</span> <span style="color: #7AB9BE;">host</span>=<span style="color: #7ACC00;">&quot;stun4.l.google.com&quot;</span> <span style="color: #7AB9BE;">udp</span>=<span style="color: #7ACC00;">&quot;19302&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;server</span> <span style="color: #7AB9BE;">host</span>=<span style="color: #7ACC00;">&quot;stun1.l.google.com&quot;</span> <span style="color: #7AB9BE;">udp</span>=<span style="color: #7ACC00;">&quot;19302&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;server</span> <span style="color: #7AB9BE;">host</span>=<span style="color: #7ACC00;">&quot;stun3.l.google.com&quot;</span> <span style="color: #7AB9BE;">udp</span>=<span style="color: #7ACC00;">&quot;19302&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;server</span> <span style="color: #7AB9BE;">host</span>=<span style="color: #7ACC00;">&quot;stun2.l.google.com&quot;</span> <span style="color: #7AB9BE;">udp</span>=<span style="color: #7ACC00;">&quot;19302&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/stun<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;relay<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;token<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>CAESGgoRY3VvbmdsYkBnbWFpbC5jb20QtPHA9MUkGhCxyfdjVL3w0j0Ref2K6iVC<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/token<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;server</span> <span style="color: #7AB9BE;">host</span>=<span style="color: #7ACC00;">&quot;relay.google.com&quot;</span> <span style="color: #7AB9BE;">udp</span>=<span style="color: #7ACC00;">&quot;19295&quot;</span> <span style="color: #7AB9BE;">tcp</span>=<span style="color: #7ACC00;">&quot;19294&quot;</span> <span style="color: #7AB9BE;">tcpssl</span>=<span style="color: #7ACC00;">&quot;443&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/relay<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/query<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/iq<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div></div>

<p><img class="alignnone size-full wp-image-10" title="psi_01" src="http://facemain.com/wp-content/uploads/2009/10/psi_01.png" alt="psi_01" width="656" height="486" /></p>
]]></content:encoded>
			<wfw:commentRss>http://facemain.com/2009/10/16/requesting-jingle-info-server-addresses-from-google-talk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
