Reputation: 1114
I am trying to figure out how to make Strophe.js work with the XEP-0055 plugin. So I guess I first have to determine what search fields are supported by the service, then I have to send the actual request:
<iq type='set'
from='[email protected]/home'
to='characters.shakespeare.lit'
id='search2'
xml:lang='en'>
<query xmlns='jabber:iq:search'>
<last>Capulet</last>
</query>
</iq>
But how do you translate it into Strophe.js query? This is my attempt:
$iq({to: 'characters.shakespeare.lit',
from: '[email protected]/home',
type: 'set',
id: 'search2'}).c('query', {xmlns: 'jabber:iq:search'}).t("last", search_query)
and what exactly do I need to send, eg
to: characters.shakespeare.lit - is is the address of the XMPP service I am using? eg. jabber.org
from: [email protected]/home - is it my ID on the server?
Upvotes: 2
Views: 962
Reputation: 6223
var iq = $iq({
type: 'set',
id: 'search2',
to: 'vjud.yourserver.org'
})
.c('query', {xmlns: 'jabber:iq:search'})
.c('x', {xmlns: 'jabber:x:data', type:'submit'})
.c('field', {var: 'first'}).c('value','Rub*').up();
conn.sendIQ(iq);
note: to: characters.shakespeare.lit
Not your server but the vcard service search.
.c('field', {var: 'first'}) if any error change var to 'var'
Upvotes: 3