[ejabberd] How to implement Friend Search function on IM client?

wei tsingmei at gmail.com
Tue Oct 6 21:32:27 MSD 2009


yes... i checked xep-0004 and send following stanza to ejabberd server, can
get result now. Is following stanza correct? or still needs optimization?
Bunch of thanks.


[009:406] SEND >>>>>>>>>>>>>>>>>>>>>>>>> : Wed Oct 07 01:27:40 2009
[009:422]    <iq type="set" from="alex at abc/call" to="jud.abc.com" id="12">
[009:422]      <query xmlns="jabber:iq:search">
[009:422]        <x xmlns="jabber:x:data" type="submit">
[009:422]          <field xmlns="" type="text-single" var="user">
[009:422]            <value>
[009:422]              alex
[009:422]            </value>
[009:422]          </field>
[009:422]        </x>
[009:438]      </query>
[009:438]    </iq>
[009:485] RECV <<<<<<<<<<<<<<<<<<<<<<<<< : Wed Oct 07 01:27:40 2009
[009:485]    <iq from='jud.abc.com' to='alex at abc.com/call' id='12'
type='result'>
[009:485]      <query xmlns='jabber:iq:search'>
[009:485]        <x xmlns='jabber:x:data' type='result'>
[009:485]          <title>
[009:485]            搜索结果属于关键�jud.91youbao.com
[009:485]          </title>
[009:485]          <reported>
[009:500]            <field type='text-single' label='Jabber ID' var='jid'/>
[009:500]            <field type='text-single' label='全名' var='fn'/>
[009:500]            <field type='text-single' label='名称' var='first'/>
[009:500]            <field type='text-single' label='中间� var='middle'/>
[009:500]            <field type='text-single' label='姓氏' var='last'/>
[009:500]            <field type='text-single' label='昵称' var='nick'/>
[009:500]            <field type='text-single' label='出生日期' var='bday'/>

[009:500]            <field type='text-single' label='国家' var='ctry'/>
[009:516]            <field type='text-single' label='城市' var='locality'/>
[009:516]            <field type='text-single' label='电子邮件' var='email'/
>
[009:516]            <field type='text-single' label='组织名称' var='orgname
'/>
[009:516]            <field type='text-single' label='组织单位' var='orgunit
'/>
[009:516]          </reported>
[009:516]          <item>
[009:516]            <field var='jid'>
[009:516]              <value>
[009:531]                alex at abc.com
[009:531]              </value>
[009:531]            </field>
[009:531]            <field var='fn'>
[009:531]              <value>
[009:531]                alexfullname
[009:531]              </value>
[009:531]            </field>
[009:531]            <field var='last'>
[009:531]              <value>
[009:547]              </value>
[009:547]            </field>
[009:547]            <field var='first'>
[009:547]              <value>
[009:547]              </value>
[009:547]            </field>
[009:547]            <field var='middle'>
[009:547]              <value>
[009:547]              </value>
[009:547]            </field>
[009:547]            <field var='nick'>
[009:563]              <value>
[009:563]                alexnickname
[009:563]              </value>
[009:563]            </field>
[009:563]            <field var='bday'>
[009:563]              <value>
[009:563]              </value>
[009:563]            </field>
[009:563]            <field var='ctry'>
[009:563]              <value>
[009:578]              </value>
[009:578]            </field>
[009:578]            <field var='locality'>
[009:578]              <value>
[009:578]              </value>
[009:578]            </field>
[009:578]            <field var='email'>
[009:578]              <value>
[009:578]              </value>
[009:578]            </field>
[009:578]            <field var='orgname'>
[009:594]              <value>
[009:594]              </value>
[009:594]            </field>
[009:594]            <field var='orgunit'>
[009:594]              <value>
[009:594]              </value>
[009:594]            </field>
[009:594]          </item>
[009:594]        </x>
[009:594]      </query>
[009:594]    </iq>


On Wed, Oct 7, 2009 at 12:12 AM, Pablo Polvorin <
pablo.polvorin at process-one.net> wrote:

> You are doing the wrong requests, as ejabberd uses data forms* for
> user search. See the search form ejabberd gives you, you should see
> something like:
>
> <iq ..>
> <query xmlns="jabber:iq:search">
> <instructions>You need an x:data capable client to search</instructions>
> <x xmlns="jabber:x:data" type="form" >
>   [...]
> </x>
> </query>
> </iq>
>
>
> *http://xmpp.org/extensions/xep-0004.html
>
>
> 2009/10/6 wei <tsingmei at gmail.com>:
> > Thank you for your quick response. But I send the request stanza to the
> JUD
> > component, but get error 400 from the server... I checked the help and
> > internet, can't find any answer...
> > [032:563]    <iq type="set" from="alex at abc.com/call"
> > to="jud.abc.com" id="12">
> > [032:563]      <query xmlns="jabber:iq:search">
> > [032:563]        <fn>
> > [032:563]          alexfull
> > [032:563]        </fn>
> > [032:563]      </query>
> > [032:563]    </iq>
> > [032:594] RECV <<<<<<<<<<<<<<<<<<<<<<<<< : Tue Oct 06 22:34:45 2009
> > [032:594]    <iq from='jud.abc.com' to='alex at abc.com/call' type='error '
> > xml:lang='*' id='12'>
> > [032:594]      <query xmlns='jabber:iq:search'>
> > [032:594]        <fn>
> > [032:594]          alexfull
> > [032:594]        </fn>
> > [032:594]      </query>
> > [032:594]      <error code='400' type='modify'>
> > [032:594]        <bad-request
> xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
> > [032:594]      </error>
> > [032:594]    </iq>
> > On Tue, Oct 6, 2009 at 9:41 PM, Pablo Polvorin
> > <pablo.polvorin at process-one.net> wrote:
> >>
> >> Hi,
> >> you need to send it to the appropiate vcard user search (vjud)
> >> component in your ejabberd server.
> >> that is probably called "vjud.%YOURDOMAIN%" (you can change it in
> >> ejabberd.cfg)
> >>
> >> 2009/10/6 wei <tsingmei at gmail.com>:
> >> > Hi all,
> >> > I send following stanza to get Friend Search Support info from
> ejabberd,
> >> > but
> >> > return error:
> >> >            <iq type='get' id='search1'>
> >> >                 <query xmlns='jabber:iq:search'/>
> >> >            </iq>
> >> > error is:
> >> > [017:797]    <iq from='alex' to='alex' type='error' xml:lang='*'
> >> > id='12'>
> >> > [017:797]      <query xmlns='jabber:iq:search'/>
> >> > [017:797]      <error code='503' type='cancel'>
> >> > [017:797]        <service-unavailable
> >> > xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
> >> > [017:813]      </error>
> >> > [017:813]    </iq>
> >> > so, how to write the stanza to support user search?
> >> > Thanks a million.
> >> > alex
> >> > _______________________________________________
> >> > ejabberd mailing list
> >> > ejabberd at jabber.ru
> >> > http://lists.jabber.ru/mailman/listinfo/ejabberd
> >> >
> >> >
> >>
> >>
> >>
> >> --
> >> Pablo Polvorin
> >> ProcessOne
> >> _______________________________________________
> >> ejabberd mailing list
> >> ejabberd at jabber.ru
> >> http://lists.jabber.ru/mailman/listinfo/ejabberd
> >
> >
> > _______________________________________________
> > ejabberd mailing list
> > ejabberd at jabber.ru
> > http://lists.jabber.ru/mailman/listinfo/ejabberd
> >
> >
>
>
>
> --
> Pablo Polvorin
> ProcessOne
> _______________________________________________
> ejabberd mailing list
> ejabberd at jabber.ru
> http://lists.jabber.ru/mailman/listinfo/ejabberd
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.jabber.ru/pipermail/ejabberd/attachments/20091007/ca6e9ceb/attachment-0001.html>


More information about the ejabberd mailing list