[JDEV] Adding own namespace

Bernino Lind lind at hlgroup.dk
Thu Jun 12 17:29:44 CDT 2003


Dear list,

I need to add a namespace for some development I am doing.

Needed:
* store a game id with score and jid in database

Aka:

<iq type='set' to='score at my-host'>
  <query xmlns='jabber:score'>
     <gameid>1</gameid>
     <score>123</score>
   </query>
</iq>

And ofcourse a "get" method to find the score of a particular user.

I am very much in doubt of an implementation. I read about the bloodbank
example in some jep with jabber:x:data - but there is no implementation
guide so I dropped it.

I also read the test:iq:url example - ditto problem.

What I have done so far, by quessing, is:

Add dtd=2 queries to the xdb_sql.xml configuration with a xmlns of
jabber:score.
Add jabber:score to my jabber.xml configuration with xdb_sql as storage
method for all hosts for the xmlns jabber:score.

I get 404 and 502: no go.

Then I added service description and name. Still no go.

In the browse section:
        <service type="score" jid="score.192.168.0.166" name="score">
          <ns>jabber:score</ns>
        </service>


In the xdb section:
  <xdb id="xdbscore">
    <host/>
    <ns>jabber:score</ns>
    <load>
      <xdb_sql>/usr/local/lib/jabber/xdb_sql.so</xdb_sql>
    </load>
    <jabberd:include>/usr/local/etc/xdb_sql.xml</jabberd:include>
  </xdb>


Parallel to yahoo etc. gateway service sections:
  <service id="score">
    <host>score.192.168.0.166</host>
  </service>

In the xdb_sql:
    <!-- ****************** score ********************** -->
     <querydef name="score-set" dtd="2" type="set"
namespace="jabber:score">
        <text>INSERT INTO score (username,gameid,score) VALUES
('$$user$$', '$$gameid$$','$$score$$')</text>
        <user>$$user$$</user>
        <bindvar tag="gameid">$$gameid$$</bindvar>
        <bindvar tag="score">$$score$$</bindvar>
     </querydef>

     <querydef name="score-get" dtd="2" type="get"
namespace="jabber:score">
        <text>SELECT score, date FROM score WHERE username = '$$user$$'
AND gameid='$$gameid$$'</text>
        <user>$$user$$</user>
        <bindvar tag="gameid">$$gameid$$</bindvar>
        <top-result><x xmlns='score:iq:get'/></top-result>
        <bindcol tag="domain" offset="0"/>
        <bindcol tag="file" offset="1"/>
        </querydef>
    </queries>

Can anyone send an example of how to configure the server to add a
namespace in this way?

As you can see this is really the same question previously asked on this
list: how to really use the dtd=2???

best regards,
Bernino Lind




More information about the JDev mailing list