<?xml version="1.0" encoding="utf-8" ?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">

    <title type="text">ProcessOne Discussion Forums</title>
    <link rel="alternate" type="text/html" href="http://www.process-one.net/en/forum/" />
    <link rel="self" type="application/atom+xml" href="http://www.process-one.net/en/forum/atom/" />
    <updated></updated>
    <rights>Copyright (c) 2011</rights>
    <generator uri="http://expressionengine.com/" version="1.7.0">ExpressionEngine</generator>
    <id>tag:process-one.net,2011:07:09</id>


    <entry>
      <title>what type of parameter exmpp_xml:set_attributes/2 accept&#63; atom or binary&#63;</title>
      <link rel="alternate" type="text/html" href="http://www.process-one.net/en/forum/viewthread/610/" />      
      <id>tag:process-one.net,2011:en/forum/viewthread/.610</id>
      <published>2011-07-01T09:35:56Z</published>
      <updated></updated>
      <author><name>dinosaurkfb</name></author>
      <content type="html">
      <![CDATA[
        <p>Hi,<br />
The specification in the devdoc of exmpp defines exmpp_xml:set_attributes/2 as below:<br />
<span style="color:brown;"><span style="font-size:14px;">set_attributes(XML_Element, Rest::Attrs_Spec) -&gt; New_XML_Element<br />
&nbsp;   XML_Element = xmlel() | xmlel_old()<br />
&nbsp;   Attrs_Spec = [&#123;Name, Value&#125; | &#123;NS, Name, Value&#125; | xmlattr_old() | xmlattr()]<br />
&nbsp;   NS = atom() | string()<br />
&nbsp;   Name = binary()<br />
&nbsp;   Value = binary() | string() | atom() | integer()<br />
&nbsp;   New_XML_Element = xmlel() | xmlel_old()</span></span></p>

<p>we can see that Name should be binary(), but the code in exmpp_xmpp.hrl use atoms:
</p><div class="codeblock"><code><span style="color: #000000">
<span style="color: #007700">-</span><span style="color: #0000BB">define</span><span style="color: #007700">(</span><span style="color: #0000BB">IQ</span><span style="color: #007700">(</span><span style="color: #0000BB">Type</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">To</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">Id</span><span style="color: #007700">),&nbsp;(<br />&nbsp;&nbsp;</span><span style="color: #0000BB">exmpp_xml</span><span style="color: #007700">:</span><span style="color: #0000BB">set_attributes</span><span style="color: #007700">(<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">#xmlel&#123;ns&nbsp;=&nbsp;?NS_JABBER_CLIENT,&nbsp;name&nbsp;=&nbsp;'iq'&#125;,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#91;&#123;</span><span style="color: #DD0000">'type'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">Type&#125;</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#123;</span><span style="color: #DD0000">'to'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">To&#125;</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#123;</span><span style="color: #DD0000">'id'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">Id&#125;&#93;</span><span style="color: #007700">)<br />)).&nbsp;</span>
</span>
</code></div>

<p>which would cause an error, I test it like this:<br />
<span style="color:green;">15&gt;&nbsp; exmpp_xml:set_attributes(&#123;xmlel, &#8216;jabber:client&#8217;, [], iq, [], []&#125;,[&#123;&#8216;type&#8217;, get&#125;, &#123;&#8216;to&#8217;, &#8220;localhost&#8221;&#125;, &#123;&#8216;id&#8217;, 1234&#125;]).<br />
** exception error: no function clause matching exmpp_xml:set_attribute(&#123;xmlel,&#8216;jabber:client&#8217;,[],iq,[],[]&#125;,type,get)<br />
&nbsp;  &nbsp; in function  exmpp_xml:set_attributes/2</span><br />
and when I use binary instead of atom,&nbsp; it&#8217;s ok:<br />
<span style="color:green;">18&gt;&nbsp; exmpp_xml:set_attributes(&#123;xmlel, &#8216;jabber:client&#8217;, [], iq, [], []&#125;,[&#123;&lt;&lt;&#8220;type&#8221;&gt;&gt;, get&#125;, &#123;&lt;&lt;&#8220;to&#8221;&gt;&gt;, &#8220;localhost&#8221;&#125;, &#123;&lt;&lt;&#8220;id&#8221;&gt;&gt;, 1234&#125;]).<br />
&#123;xmlel,&#8216;jabber:client&#8217;,[],iq,<br />
&nbsp;  &nbsp;   [&#123;xmlattr,undefined,&lt;&lt;&#8220;type&#8221;&gt;&gt;,&lt;&lt;&#8220;get&#8221;&gt;&gt;&#125;,<br />
&nbsp;  &nbsp;  &nbsp; &#123;xmlattr,undefined,&lt;&lt;&#8220;to&#8221;&gt;&gt;,&lt;&lt;&#8220;localhost&#8221;&gt;&gt;&#125;,<br />
&nbsp;  &nbsp;  &nbsp; &#123;xmlattr,undefined,&lt;&lt;&#8220;id&#8221;&gt;&gt;,&lt;&lt;&#8220;1234&#8221;&gt;&gt;&#125;],<br />
&nbsp;  &nbsp;   []&#125;</span></p>

<p>So, anybody can explain this? Is this a bug or something else?</p>

<p>Best regards.
</p>
      ]]>
      </content>
    </entry>

    <entry>
      <title>EXMPP not connecting to M&#45;Link XMPP Server &#45; Solved</title>
      <link rel="alternate" type="text/html" href="http://www.process-one.net/en/forum/viewthread/579/" />      
      <id>tag:process-one.net,2011:en/forum/viewthread/.579</id>
      <published>2011-04-14T20:41:33Z</published>
      <updated>2011-04-14T21:13:45Z</updated>
      <author><name>Thiago Camargo</name></author>
      <content type="html">
      <![CDATA[
        <p>When trying to connect to M-Link XMPP Server</p>

<p>=ERROR REPORT==== 2011-04-14 21:34:30 ===<br />
Error in process &lt;0.107.0&gt; on node &#8216;JingleNodes@ds0039&#8217; with exit value: &#123;&#123;nocatch,&#123;xml_parser,parsing,parsing_failed,&#123;27,&#8220;unbound prefix&#8221;&#125;&#125;&#125;,[&#123;exmpp_xmlstream,parse,2&#125;,&#123;exmpp_socket,receiver_loop,3&#125;]&#125;</p>

<p><br />
=INFO REPORT==== 2011-04-14 21:34:30 ===<br />
&nbsp;   application: app_jn_component<br />
&nbsp;   exited: &#123;shutdown,&#123;app_jn_component,start,[normal,[]]&#125;&#125;<br />
&nbsp;   type: temporary</p>

<p>&#8212;&#8212;-<br />
After:<br />
dbg:tracer().<br />
dbg:p(all,c).<br />
dbg:tpl(exmpp_xmlstream, parse, []).<br />
dbg:tpl(exmpp_internals, gen_send, []).</p>

<p>(&lt;0.140.0&gt;) call exmpp_xmlstream:parse(&#123;xml_stream,&#123;gen_fsm,&lt;0.139.0&gt;&#125;,<br />
&nbsp;  &nbsp;  &nbsp;  &nbsp; &#123;xml_parser,[&#123;max_size,infinity&#125;,<br />
&nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &#123;root_depth,1&#125;,<br />
&nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &#123;names_as_atom,true&#125;,<br />
&nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &#123;emit_endtag,true&#125;,<br />
&nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &#123;check_nss,xmpp&#125;,<br />
&nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &#123;check_elems,xmpp&#125;,<br />
&nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &#123;check_attrs,xmpp&#125;],<br />
&nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; #Port&lt;0.4184&gt;&#125;,<br />
&nbsp;  &nbsp;  &nbsp;  &nbsp; new,false,undefined&#125;,&lt;&lt;&#8221;&lt;stream:error&gt;&lt;host-gone &gt;&lt;/stream:error&gt;&lt;/stream:stream&gt;&lt;?xml version=&#8216;1.0&#8217;?&gt;&lt;stream:stream &gt;&#8221;&gt;&gt;)</p>

<p>That was a simple type in the component Name.
</p>
      ]]>
      </content>
    </entry>

    <entry>
      <title>presence processing branch is missed in stream_opened</title>
      <link rel="alternate" type="text/html" href="http://www.process-one.net/en/forum/viewthread/530/" />      
      <id>tag:process-one.net,2011:en/forum/viewthread/.530</id>
      <published>2011-01-24T23:29:36Z</published>
      <updated></updated>
      <author><name>Boris Okner</name></author>
      <content type="html">
      <![CDATA[
        <p>Hi,</p>

<p>Below is the code from exmpp_session.erl (on github.com):</p>

<p><br />
%% Process incoming<br />
%% Dispatch incoming messages<br />
stream_opened(?message, State = #state&#123;client_pid = From&#125;) -&gt;<br />
&nbsp;   process_message(From, Attrs, MessageElement),<br />
&nbsp;   &#123;next_state, stream_opened, State&#125;;<br />
%% Dispach IQs from server<br />
stream_opened(?iq, State) -&gt;<br />
&nbsp;   process_iq(State#state.client_pid, Attrs, IQElement),<br />
&nbsp;   &#123;next_state, stream_opened, State&#125;;</p>

<p>The branch for ?presence is missed. Is there any specific reason for it? In my case I have stream_opened state after I login, so handling incoming presences should be fine, right?<br />
The fact that presence doesn&#8217;t get handled creates received_packet record with most of the fields missed (as presence becomes &#8220;other&#8221; packet, which is handled by yet another stream_opened branch).</p>

<p>Please advise,</p>

<p>Regards,<br />
Boris
</p>
      ]]>
      </content>
    </entry>

    <entry>
      <title>exmpp no_engine_registered Issue on Debian</title>
      <link rel="alternate" type="text/html" href="http://www.process-one.net/en/forum/viewthread/295/" />      
      <id>tag:process-one.net,2009:en/forum/viewthread/.295</id>
      <published>2009-12-03T21:13:21Z</published>
      <updated></updated>
      <author><name>Thiago Camargo</name></author>
      <content type="html">
      <![CDATA[
        <p>When using exmpp in an old Debian Server I&#8217;m getting the following message:</p>

<p>=ERROR REPORT==== 3-Dec-2009::21:10:07 ===<br />
Error in process &lt;0.35.0&gt; with exit value: &#123;&#123;nocatch,&#123;xml_parser,options,no_engine_registered,undefined&#125;&#125;,[&#123;exmpp_component,connect,3&#125;,&#123;jn_component,init,6&#125;]&#125;</p>

<p>Using latest Erlang OTP Distribution, also using the tar version of exmpp.</p>

<p>Any clues?
</p>
      ]]>
      </content>
    </entry>

    <entry>
      <title>exmpp: PEP support in component bots</title>
      <link rel="alternate" type="text/html" href="http://www.process-one.net/en/forum/viewthread/336/" />      
      <id>tag:process-one.net,2010:en/forum/viewthread/.336</id>
      <published>2010-03-24T00:04:56Z</published>
      <updated></updated>
      <author><name>Vince</name></author>
      <content type="html">
      <![CDATA[
        <p>Hi everyone,</p>

<p>I believe it would be great to handle PEP updates by users subscribed to component bots.</p>

<p>Does the auto-subscribe feature of the personal eventing protocol work also with component bots?<br />
Can the component bot use Entity Capabilities to specify which event types wants to receive?</p>

<p>Or is it necessary to explicitly subscribe to peers&#8217; <a href="http://www.process-one.net/en?URL=http%3A%2F%2Fjabber.org%2Fprotocol%2Ftune">http://jabber.org/protocol/tune</a> node?</p>

<p>I would be really glad if you could please share any clues on the right way to implement PEP handling at the component side.</p>

<p>Thanks a lot!</p>

<p>Cheers,<br />
Vince
</p>
      ]]>
      </content>
    </entry>

    <entry>
      <title>exmpp: presence subscription from a component bot</title>
      <link rel="alternate" type="text/html" href="http://www.process-one.net/en/forum/viewthread/334/" />      
      <id>tag:process-one.net,2010:en/forum/viewthread/.334</id>
      <published>2010-03-21T18:57:58Z</published>
      <updated></updated>
      <author><name>Vince</name></author>
      <content type="html">
      <![CDATA[
        <p>Hi All,</p>

<p>Thanks a lot for developing exmpp library in open source!</p>

<p>I was giving it a first try by following the tutorial at <a href="http://www.process-one.net/en?URL=http%3A%2F%2Fwww.process-one.net%2Fen%2Fblogs%2Farticle%2Fscalable_xmpp_bots_with_erlang_and_exmpp_part_iii">http://www.process-one.net/en/blogs/article/scalable_xmpp_bots_with_erlang_and_exmpp_part_iii</a> and running the article source code. Sweet!</p>

<p>I&#8217;ve experienced only one problem so far and I&#8217;d like to ask for your help&#8230; Sorry, I still haven&#8217;t figure out what I&#8217;m overlooking here.</p>

<p>Right after a successful registration, the web_status_component sends a request to subscribe the user&#8217;s presence informations:</p>

<p>&lt;nick &gt;Web Presence Bot&lt;/nick&gt;&lt;/presence&gt;</p>

<p>or </p>

<p>&#123;xmlel,&#8216;jabber:component:accept&#8217;,[],presence,<br />
&nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  [&#123;xmlattr,undefined,type,&lt;&lt;&#8220;subscribe&#8221;&gt;&gt;&#125;,<br />
&nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;   &#123;xmlattr,undefined,from,&lt;&lt;&#8220;buddy@example.tld&#8221;&gt;&gt;&#125;,<br />
&nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;   &#123;xmlattr,undefined,to,&lt;&lt;&#8220;romeo@example.tld&#8221;&gt;&gt;&#125;],<br />
&nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  [&#123;xmlel,&#8216;http://jabber.org/protocol/nick&#8217;,[],nick,[],<br />
&nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; [&#123;xmlcdata,&lt;&lt;&#8220;Web Presence Bot&#8221;&gt;&gt;&#125;]&#125;]&#125;</p>

<p><br />
The server replies back with, stopping the client from exchanging any presence message with the component:</p>

<p>&lt;nick &gt;Web Presence Bot&lt;/nick&gt;&lt;error code=&#8220;400&#8221; type=&#8220;modify&#8221;&gt;&lt;bad-request &gt;&lt;/error&gt;&lt;/presence&gt;</p>

<p><br />
Similarly, at component startup presence notifications don&#8217;t go through.</p>

<p>Can you please help me in fixing presence subscription handling from a component?</p>

<p>I&#8217;m using ejabberd 2.1.x branch with exmpp 0.9.3 and I&#8217;d love starting to build a component bot with exmpp :-)</p>

<p>Many thanks!</p>

<p>Best,<br />
Vince
</p>
      ]]>
      </content>
    </entry>

    <entry>
      <title>exmpp improvements</title>
      <link rel="alternate" type="text/html" href="http://www.process-one.net/en/forum/viewthread/231/" />      
      <id>tag:process-one.net,2009:en/forum/viewthread/.231</id>
      <published>2009-06-05T12:55:53Z</published>
      <updated>2009-06-05T13:14:25Z</updated>
      <author><name>Eric Cestari</name></author>
      <content type="html">
      <![CDATA[
        <p>As exmpp is still work in progress, I guess such a thread is necessary ;)</p>

<p>First thing :<br />
I&#8217;m writing some code to connect to a MUC. </p>

<p>The #received_packet&#123;&#125; record is great, but it could be a bit better!</p>

<p>Case in point : the from field. It just holds a string. I&#8217;d pretty much rather it to return the jlib:jid_to_lower term :<br />
&#123;Node, Server, Resource&#125;, because ... pattern matching :)</p>

<p>If I am to write a MUC client, I&#8217;d like to pattern match on &#123;&#8220;room&#8221;, &#8220;conference.localhost&#8221;, Sender&#125; in my receive loop.</p>

<p>That would imply implementing the exmpp_jid:make(&#123;Node, Server, Resource&#125;) and the exmpp_jid:to_lower(JID)</p>

<p>This JID representation is so useful in ejabberd (see mod_muc, mod_pubsub) I&#8217;d love to have here too.</p>

<p>And while I am at it, I&#8217;d like to have several client_pids subscribing to events by pattern matching this same #received_packet&#123;&#125; on sender or query_ns. Of course, I might end up doing it myself, but that would be very nice to have as an option.
</p>
      ]]>
      </content>
    </entry>

    <entry>
      <title>Thank you for exmpp</title>
      <link rel="alternate" type="text/html" href="http://www.process-one.net/en/forum/viewthread/230/" />      
      <id>tag:process-one.net,2009:en/forum/viewthread/.230</id>
      <published>2009-06-04T16:58:37Z</published>
      <updated></updated>
      <author><name>luc</name></author>
      <content type="html">
      <![CDATA[
        <p>You guys made my day yesterday with the release of exmpp. I&#8217;m already a happy user.</p>

<p>The code is nice, clean and well documented. The one thing it lacks is a couple of how-to/tutorials to get people started. I&#8217;m planning to write a blog post in the future to help folks get started. I&#8217;m sure once the library starts getting used more, there will be more of these to guide new users.</p>

<p>One question: do I have to be running ejabberd for my clients to work? I was able to get a client login on my localhost with ejabberd running but when I run the same code with a gmail JID, I am not able to get it to work.</p>

<p>Thanks,
</p>
      ]]>
      </content>
    </entry>

    <entry>
      <title>Problem with building exmpp</title>
      <link rel="alternate" type="text/html" href="http://www.process-one.net/en/forum/viewthread/253/" />      
      <id>tag:process-one.net,2009:en/forum/viewthread/.253</id>
      <published>2009-08-18T00:21:26Z</published>
      <updated>2009-08-18T04:46:58Z</updated>
      <author><name>Boris Okner</name></author>
      <content type="html">
      <![CDATA[
        <p>Hello,</p>

<p>I&#8217;m trying to build exmpp on Debian, and for some reason configure script doesn&#8217;t see neither Expat nor LibXml2, although both of them are installed.</p>

<p>The configuration output shows:</p>

<p>&nbsp;   XML parsers:<br />
&nbsp;  &nbsp;  . Expat:&nbsp;  &nbsp;  &nbsp;   no<br />
&nbsp;  &nbsp;  . LibXML2:&nbsp;  &nbsp;  &nbsp; no<br />
Consequently, exmpp_xml:start_parser() throws<br />
&#123;xml_parser,options,no_engine_registered,undefined&#125;<br />
exception.</p>

<p>What am I missing?</p>

<p>Thank you,</p>

<p>Boris
</p>
      ]]>
      </content>
    </entry>

    <entry>
      <title>Crash when receiving unexpected Packet</title>
      <link rel="alternate" type="text/html" href="http://www.process-one.net/en/forum/viewthread/280/" />      
      <id>tag:process-one.net,2009:en/forum/viewthread/.280</id>
      <published>2009-11-19T17:33:05Z</published>
      <updated></updated>
      <author><name>Thiago Camargo</name></author>
      <content type="html">
      <![CDATA[
        <p>Not sure if it is my Erlang, or exmpp crashing here:</p>

<p>22&gt; jn_component:start(&#8220;jn.localhost&#8221;,&#8220;secret&#8221;,&#8220;localhost&#8221;, 8888, &#8220;127.0.0.1&#8221;).<br />
&lt;0.333.0&gt;<br />
&#123;received_packet,iq,&#8220;get&#8221;,<br />
&nbsp;   &#123;&lt;&lt;&#8220;user2&#8221;&gt;&gt;,&lt;&lt;&#8220;localhost&#8221;&gt;&gt;,&lt;&lt;&#8220;Thiago-Camargos-MacBook-Pro&#8221;&gt;&gt;&#125;,<br />
&nbsp;   &#8220;aacaa&#8221;,undefined,<br />
&nbsp;   &#123;xmlel,&#8216;jabber:component:accept&#8217;,[],iq,<br />
&nbsp;  &nbsp;  &nbsp; [&#123;xmlattr,undefined,from,<br />
&nbsp;  &nbsp;  &nbsp;  &nbsp;   &lt;&lt;&#8220;user2@localhost/Thiago-Camargos-MacBook-Pro&#8221;&gt;&gt;&#125;,<br />
&nbsp;  &nbsp;  &nbsp;  &#123;xmlattr,undefined,to,&lt;&lt;&#8220;jn.localhost&#8221;&gt;&gt;&#125;,<br />
&nbsp;  &nbsp;  &nbsp;  &#123;xmlattr,&#8216;http://www.w3.org/XML/1998/namespace&#8217;,&#8220;lang&#8221;,&lt;&lt;&#8220;en&#8221;&gt;&gt;&#125;,<br />
&nbsp;  &nbsp;  &nbsp;  &#123;xmlattr,undefined,type,&lt;&lt;&#8220;get&#8221;&gt;&gt;&#125;,<br />
&nbsp;  &nbsp;  &nbsp;  &#123;xmlattr,undefined,id,&lt;&lt;&#8220;aacaa&#8221;&gt;&gt;&#125;],<br />
&nbsp;  &nbsp;  &nbsp; [&#123;xmlcdata,&lt;&lt;&#8221;\n&#8221;&gt;&gt;&#125;,<br />
&nbsp;  &nbsp;  &nbsp;  &#123;xmlel,&#8216;http://jabber.org/protocol/disco#info&#8217;,<br />
&nbsp;  &nbsp;  &nbsp;  &nbsp;   [&#123;&#8216;http://jabber.org/protocol/disco#info&#8217;,none&#125;],<br />
&nbsp;  &nbsp;  &nbsp;  &nbsp;   &#8216;query&#8217;,[],[]&#125;,<br />
&nbsp;  &nbsp;  &nbsp;  &#123;xmlcdata,&lt;&lt;&#8221;\n&#8221;&gt;&gt;&#125;]&#125;&#125;<br />
23&gt; <br />
=ERROR REPORT==== 19-Nov-2009::17:29:56 ===<br />
Error in process &lt;0.333.0&gt; with exit value: &#123;function_clause,[&#123;jn_component,process_iq,[&lt;0.334.0&gt;,&#123;xmlel,&#8216;jabber:component:accept&#8217;,[],iq,[&#123;xmlattr,undefined,from,&lt;&lt;43 bytes&gt;&gt;&#125;,&#123;xmlattr,undefined,to,&lt;&lt;12 bytes&gt;&gt;&#125;,&#123;xmlattr,&#8216;http://www.w3.org/XML/1998/namespace&#8217;,&#8220;lang&#8221;,&lt;&lt;2 bytes&gt;&gt;&#125;,&#123;xmlattr,undefined&#8230; </p>

<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
The code portion is:
</p><div class="codeblock"><code><span style="color: #000000">
<span style="color: #0000BB">loop</span><span style="color: #007700">(</span><span style="color: #0000BB">XmppCom</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">JID</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">PubIP</span><span style="color: #007700">)&nbsp;-&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">receive<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;stop&nbsp;</span><span style="color: #007700">-&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">exmpp_component</span><span style="color: #007700">:</span><span style="color: #0000BB">stop</span><span style="color: #007700">(</span><span style="color: #0000BB">XmppCom</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;%%&nbsp;If&nbsp;</span><span style="color: #0000BB">we&nbsp;receive&nbsp;a&nbsp;message</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">we&nbsp;reply&nbsp;with&nbsp;the&nbsp;same&nbsp;message<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Record&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #FF8000">#received_packet&#123;packet_type=message,&nbsp;raw_packet=Packet&#125;&nbsp;-&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">io</span><span style="color: #007700">:</span><span style="color: #0000BB">format</span><span style="color: #007700">(</span><span style="color: #DD0000">"~p~n"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#91;Record&#93;</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">process_message</span><span style="color: #007700">(</span><span style="color: #0000BB">XmppCom</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">Packet</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">JID</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">loop</span><span style="color: #007700">(</span><span style="color: #0000BB">XmppCom</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">JID</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">PubIP</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">Record&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #FF8000">#received_packet&#123;packet_type=iq,&nbsp;type_attr=Type,&nbsp;raw_packet=IQ&#125;&nbsp;-&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">io</span><span style="color: #007700">:</span><span style="color: #0000BB">format</span><span style="color: #007700">(</span><span style="color: #DD0000">"~p~n"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#91;Record&#93;</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">process_iq</span><span style="color: #007700">(</span><span style="color: #0000BB">XmppCom</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">IQ</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">Type</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">PubIP</span><span style="color: #007700">,</span><span style="color: #0000BB">exmpp_xml</span><span style="color: #007700">:</span><span style="color: #0000BB">get_ns_as_atom</span><span style="color: #007700">(</span><span style="color: #0000BB">exmpp_iq</span><span style="color: #007700">:</span><span style="color: #0000BB">get_payload</span><span style="color: #007700">(</span><span style="color: #0000BB">IQ</span><span style="color: #007700">))),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">loop</span><span style="color: #007700">(</span><span style="color: #0000BB">XmppCom</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">JID</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">PubIP</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">Record&nbsp;</span><span style="color: #007700">-&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">io</span><span style="color: #007700">:</span><span style="color: #0000BB">format</span><span style="color: #007700">(</span><span style="color: #DD0000">"~p~n"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#91;Record&#93;</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">loop</span><span style="color: #007700">(</span><span style="color: #0000BB">XmppCom</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">JID</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">PubIP</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">end</span><span style="color: #007700">.<br /><br />%%&nbsp;</span><span style="color: #0000BB">Create&nbsp;Channel&nbsp;</span><span style="color: #007700">and&nbsp;return&nbsp;</span><span style="color: #0000BB">details<br />process_iq</span><span style="color: #007700">(</span><span style="color: #0000BB">XmppCom</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"get"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">IQ</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">PubIP</span><span style="color: #007700">,&nbsp;?</span><span style="color: #0000BB">NS_CHANNEL</span><span style="color: #007700">)&nbsp;-&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;case&nbsp;</span><span style="color: #0000BB">allocate_relay</span><span style="color: #007700">()&nbsp;</span><span style="color: #0000BB">of<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#123;A</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">B&#125;&nbsp;</span><span style="color: #007700">-&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">Result&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">exmpp_iq</span><span style="color: #007700">:</span><span style="color: #0000BB">result</span><span style="color: #007700">(</span><span style="color: #0000BB">IQ</span><span style="color: #007700">,</span><span style="color: #0000BB">get_candidate_elem</span><span style="color: #007700">(</span><span style="color: #0000BB">PubIP</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">A</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">B</span><span style="color: #007700">)),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">exmpp_component</span><span style="color: #007700">:</span><span style="color: #0000BB">send_packet</span><span style="color: #007700">(</span><span style="color: #0000BB">XmppCom</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">Result</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">_&nbsp;</span><span style="color: #007700">-&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">Error&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">exmpp_iq</span><span style="color: #007700">:</span><span style="color: #0000BB">error</span><span style="color: #007700">(</span><span style="color: #0000BB">IQ</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">exmpp_component</span><span style="color: #007700">:</span><span style="color: #0000BB">send_packet</span><span style="color: #007700">(</span><span style="color: #0000BB">XmppCom</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">Error</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">end</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">process_iq</span><span style="color: #007700">(</span><span style="color: #0000BB">XmppCom</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"get"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">IQ</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">_</span><span style="color: #007700">,&nbsp;?</span><span style="color: #0000BB">NS_DISCO_INFO</span><span style="color: #007700">)&nbsp;-&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">Identity&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">exmpp_xml</span><span style="color: #007700">:</span><span style="color: #0000BB">element</span><span style="color: #007700">(?</span><span style="color: #0000BB">NS_DISCO_INFO</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'identity'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#91;exmpp_xml</span><span style="color: #007700">:</span><span style="color: #0000BB">attribute</span><span style="color: #007700">(</span><span style="color: #DD0000">"category"</span><span style="color: #007700">,&nbsp;&lt;&lt;</span><span style="color: #DD0000">"proxy"</span><span style="color: #007700">&gt;&gt;),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">exmpp_xml</span><span style="color: #007700">:</span><span style="color: #0000BB">attribute</span><span style="color: #007700">(</span><span style="color: #DD0000">"type"</span><span style="color: #007700">,&nbsp;&lt;&lt;</span><span style="color: #DD0000">"relay"</span><span style="color: #007700">&gt;&gt;),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">exmpp_xml</span><span style="color: #007700">:</span><span style="color: #0000BB">attribute</span><span style="color: #007700">(</span><span style="color: #DD0000">"name"</span><span style="color: #007700">,&nbsp;&lt;&lt;</span><span style="color: #DD0000">"Jingle&nbsp;Nodes&nbsp;Relay"</span><span style="color: #007700">&gt;&gt;)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#93;</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#91;&#93;</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">IQRegisterFeature1&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">exmpp_xml</span><span style="color: #007700">:</span><span style="color: #0000BB">element</span><span style="color: #007700">(?</span><span style="color: #0000BB">NS_DISCO_INFO</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'feature'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#91;exmpp_xml</span><span style="color: #007700">:</span><span style="color: #0000BB">attribute</span><span style="color: #007700">(</span><span style="color: #DD0000">'var'</span><span style="color: #007700">,&nbsp;?</span><span style="color: #0000BB">NS_JINGLE_NODES_s</span><span style="color: #007700">)</span><span style="color: #0000BB">&#93;</span><span style="color: #007700">,</span><span style="color: #0000BB">&#91;&#93;</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">IQRegisterFeature2&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">exmpp_xml</span><span style="color: #007700">:</span><span style="color: #0000BB">element</span><span style="color: #007700">(?</span><span style="color: #0000BB">NS_DISCO_INFO</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'feature'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#91;exmpp_xml</span><span style="color: #007700">:</span><span style="color: #0000BB">attribute</span><span style="color: #007700">(</span><span style="color: #DD0000">'var'</span><span style="color: #007700">,&nbsp;?</span><span style="color: #0000BB">NS_CHANNEL_s</span><span style="color: #007700">)</span><span style="color: #0000BB">&#93;</span><span style="color: #007700">,</span><span style="color: #0000BB">&#91;&#93;</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">Result&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">exmpp_iq</span><span style="color: #007700">:</span><span style="color: #0000BB">result</span><span style="color: #007700">(</span><span style="color: #0000BB">IQ</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">exmpp_xml</span><span style="color: #007700">:</span><span style="color: #0000BB">element</span><span style="color: #007700">(?</span><span style="color: #0000BB">NS_DISCO_INFO</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'query'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#91;&#93;</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#91;Identity</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">IQRegisterFeature1</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">IQRegisterFeature2&#93;</span><span style="color: #007700">)),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">exmpp_component</span><span style="color: #007700">:</span><span style="color: #0000BB">send_packet</span><span style="color: #007700">(</span><span style="color: #0000BB">XmppCom</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">Result</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">process_iq</span><span style="color: #007700">(</span><span style="color: #0000BB">XmppCom</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"set"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">IQ</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">_</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">_</span><span style="color: #007700">)&nbsp;-&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">Error&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">exmpp_iq</span><span style="color: #007700">:</span><span style="color: #0000BB">error</span><span style="color: #007700">(</span><span style="color: #0000BB">IQ</span><span style="color: #007700">,</span><span style="color: #DD0000">'feature-not-implemented'</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">exmpp_component</span><span style="color: #007700">:</span><span style="color: #0000BB">send_packet</span><span style="color: #007700">(</span><span style="color: #0000BB">XmppCom</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">Error</span><span style="color: #007700">).&nbsp;</span>
</span>
</code></div>
      ]]>
      </content>
    </entry>


</feed>
