Jabber Search for advanced user search - xmpp

I'm trying to search user by username in my xmpp server, but the result always contains no items...
for getting the form format I send:
<iq type='get' to='search.MY_SERVER' xmlns='jabber:client'>
<query xmlns='jabber:iq:search'/>
</iq>
and received:
<iq xmlns="jabber:client" type="result" id="3:sendIQ" from="search.MY_SERVER" to="ID#MY_SERVER/7acf23bb">
<query xmlns="jabber:iq:search">
<instructions>The following fields are available for searching. Wildcard (*) characters are allowed as part of the query.</instructions>
<first/><last/><nick/><email/>
<x xmlns="jabber:x:data" type="form">
<title>Advanced User Search</title>
<instructions>The following fields are available for searching. Wildcard (*) characters are allowed as part of the query.</instructions>
<field var="FORM_TYPE" type="hidden">
<value>jabber:iq:search</value>
</field>
<field var="search" type="text-single" label="Search">
<required/>
</field>
<field var="Username" type="boolean" label="Username">
<value>1</value>
</field>
<field var="Name" type="boolean" label="Name">
<value>1</value>
</field>
<field var="Email" type="boolean" label="Email">
<value>1</value>
</field>
</x>
</query>
</iq>
and then I send:
<iq type='set' to='search.MY_SERVER' xmlns='jabber:client'>
<query xmlns='jabber:iq:search'>
<x xmlns='jabber:x:data' type='submit'>
<field type='hidden' var='FORM_TYPE'>
<value>jabber:iq:search</value>
</field>
<field var='search'>
<value>*</value>
</field>
</x>
</query>
</iq>
but received no items:
<iq xmlns="jabber:client" type="result" id="4:sendIQ" from="search.MY_SERVER" to="ID#MY_SERVER/7acf23bb">
<query xmlns="jabber:iq:search">
<x xmlns="jabber:x:data" type="result">
<field var="FORM_TYPE" type="hidden"/>
<reported>
<field var="jid" type="jid-single" label="JID"/>
<field var="Username" type="text-single" label="Username"/>
<field var="Name" type="text-single" label="Name"/>
<field var="Email" type="text-single" label="Email"/>
</reported>
</x>
</query>
</iq>
Does someone know what went wrong?

I have found the answer,send following request will do the trick:
<iq type='set' to='search.MY_SERVER' xmlns='jabber:client'>
<query xmlns='jabber:iq:search'>
<x xmlns='jabber:x:data' type='submit'>
<field var='search'>
<value>SEARCH_CRITERIA</value>
</field>
<field var='Username'>
<value>1</value>
</field>
</x>
</query>
</iq>

Related

Incorrect NumInGroup count for repeating group (Field=268)

When I recieve a Market Data Snapshot Full Refresh message, my app cannot consume it.
This is how the message looks like:
8=FIX.4.4|9=160|35=W|34=1625|49=DummyBroker|56=DummyID|52=20220201-15:17:17.201806|262=43_MarketDataChange|55=USD/CHF|268=6|269=0|270=0.92282|271=400000|269=1|270=0.92293|271=400000|10=227|
Human readable format (please ignore the Invalid lines):
Error message my app is sending back to the server: Rejected: Incorrect NumInGroup count for repeating group (Field=268)
268=6 seems ok to me, so I am guessing that something is wrong with the DataDictionary.
This is how the message appears in my DataDictionary:
<message name="MarketDataSnapshotFullRefresh" msgtype="W" msgcat="app">
<field name="MDReqID" required="N"/>
<field name="Symbol" required="Y"/>
<group name="NoMDEntries" required="Y">
<field name="MDEntryType" required="Y"/>
<field name="MDEntryPx" required="Y"/>
<field name="MDEntrySize" required="Y"/>
</group>
</message>
Relevant fields:
<field number="268" name="NoMDEntries" type="NUMINGROUP"/>
<field number="269" name="MDEntryType" type="CHAR">
<value enum="0" description="BID" />
<value enum="1" description="OFFER" />
</field>
<field number="270" name="MDEntryPx" type="PRICE"/>
<field number="271" name="MDEntrySize" type="QTY"/>
In my config file ValidateFieldsHaveValues=N, ValidateFieldsOutOfOrder=N.
Anyone knows where the issue is?
As #ChristophJohn mentioned NoMDEntries should be 2 not 6, so the error is on the broker side.
It was already explained here:
what is "NoMDEntries"?
The correct message should look like this:
8=FIX.4.4|9=160|35=W|34=1625|49=DummyBroker|56=DummyID|52=20220201-15:17:17.201806|262=43_MarketDataChange|55=USD/CHF|268=2|269=0|270=0.92282|271=400000|269=1|270=0.92293|271=400000|10=227|

Fetching ejabberd MUC members list

There seem to be some threads around this and it seems very obvious an issue to be a problem, but somehow in MUCs / rooms created by my ejabberd mobile clients, the creator / owner is able to fetch the members list but when I fetch the same from the members, there is an administrative privileges required error.
Below are the request and response stanzas as well as the room options. Can someone advise please if there is something I'm overlooking here ... many thanks?
Request from member:
<iq
type="get"
to="1479313326166_what%20a%20day#conference.example.com"
id="7BB7F8C8-B47F-4C0C-9E4D-8CAC3A5287FF">
<query xmlns="http://jabber.org/protocol/muc#admin">
<item
affiliation="member">
</item>
</query>
</iq>
Response to member:
<iq xmlns="jabber:client"
from="1479313326166_what%20a%20day#conference.example.com"
to="group-member#example.com/9A36B83F-0B1B-484E-BFB2-C0F1C7148274"
id="7BB7F8C8-B47F-4C0C-9E4D-8CAC3A5287FF"
type="error">
<query xmlns="http://jabber.org/protocol/muc#admin">
<item affiliation="member"></item>
</query>
<error code="403" type="auth">
<forbidden xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"></forbidden>
<text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">
Administrator privileges required
</text>
</error>
</iq>
Room options:
> /sbin/ejabberdctl get_room_options 1479313326166_what%20a%20day conference.example.com
title
description
allow_change_subj true
allow_query_users true
allow_private_messages true
allow_private_messages_from_visitors anyone
allow_visitor_status true
allow_visitor_nickchange true
public true
public_list true
persistent true
moderated true
captcha_protected false
members_by_default true
members_only true
allow_user_invites false
allow_subscription true
password_protected false
password
anonymous true
presence_broadcast [moderator,participant,visitor]
allow_voice_requests true
voice_request_min_interval 1800
max_users 200
logging false
vcard <vCard xmlns='vcard-temp'><NICKNAME>What a day</NICKNAME><NOTE/></vCard>
captcha_whitelist {0,nil}
mam false
I tried configure a room via ConfigurationForm and ServerDefaultConfig, fortunetely never got your error and fetchMembers always works fine. There might be some very silly stuff that hard to find out. Maybe try to clear the db or restart the server to start over.
<x xmlns=\"jabber:x:data\" type=\"form\">
<title>Configuration of room 1479231695#conference.192.168.100.226</title>
<field type=\"hidden\" var=\"FORM_TYPE\">
<value>http://jabber.org/protocol/muc#roomconfig</value>
</field>
<field type=\"text-single\" label=\"Room title\" var=\"muc#roomconfig_roomname\">
<value></value>
</field>
<field type=\"text-single\" label=\"Room description\" var=\"muc#roomconfig_roomdesc\">
<value></value>
</field>
<field type=\"boolean\" label=\"Make room persistent\" var=\"muc#roomconfig_persistentroom\">
<value>1</value>
</field>
<field type=\"boolean\" label=\"Make room public searchable\" var=\"muc#roomconfig_publicroom\">
<value>0</value>
</field>
<field type=\"boolean\" label=\"Make participants list public\" var=\"public_list\">
<value>0</value>
</field>
<field type=\"boolean\" label=\"Make room password protected\" var=\"muc#roomconfig_passwordprotectedroom\">
<value>0</value>
</field>
<field type=\"text-private\" label=\"Password\" var=\"muc#roomconfig_roomsecret\">
<value></value>
</field>
<field type=\"list-single\" label=\"Maximum Number of Occupants\" var=\"muc#roomconfig_maxusers\">
<value>200</value>
<option label=\"5\">
<value>5</value>
</option>
<option label=\"10\">
<value>10</value>
</option>
<option label=\"20\">
<value>20</value>
</option>
<option label=\"30\">
<value>30</value>
</option>
<option label=\"50\">
<value>50</value>
</option>
<option label=\"100\">
<value>100</value>
</option>
<option label=\"200\">
<value>200</value>
</option>
</field>
<field type=\"list-single\" label=\"Present real Jabber IDs to\" var=\"muc#roomconfig_whois\">
<option label=\"moderators only\">
<value>moderators</value>
</option>
<option label=\"anyone\">
<value>anyone</value>
</option>
<value>anyone</value>
</field>
<field type=\"list-multi\" label=\"Roles for which Presence is Broadcasted\" var=\"muc#roomconfig_presencebroadcast\">
<value>moderator</value>
<value>participant</value>
<value>visitor</value>
<option label=\"Moderator\">
<value>moderator</value>
</option>
<option label=\"Participant\">
<value>participant</value>
</option>
<option label=\"Visitor\">
<value>visitor</value>
</option>
</field>
<field type=\"boolean\" label=\"Make room members-only\" var=\"muc#roomconfig_membersonly\">
<value>1</value>
</field>
<field type=\"boolean\" label=\"Make room moderated\" var=\"muc#roomconfig_moderatedroom\">
<value>0</value>
</field>
<field type=\"boolean\" label=\"Default users as participants\" var=\"members_by_default\">
<value>1</value>
</field>
<field type=\"boolean\" label=\"Allow users to change the subject\" var=\"muc#roomconfig_changesubject\">
<value>1</value>
</field>
<field type=\"boolean\" label=\"Allow users to send private messages\" var=\"allow_private_messages\">
<value>1</value>
</field>
<field type=\"list-single\" label=\"Allow visitors to send private messages to\" var=\"allow_private_messages_from_visitors\">
<value>anyone</value>
<option label=\"nobody\">
<value>nobody</value>
</option>
<option label=\"moderators only\">
<value>moderators</value>
</option>
<option label=\"anyone\">
<value>anyone</value>
</option>
</field>
<field type=\"boolean\" label=\"Allow users to query other users\" var=\"allow_query_users\">
<value>1</value>
</field>
<field type=\"boolean\" label=\"Allow users to send invites\" var=\"muc#roomconfig_allowinvites\">
<value>1</value>
</field>
<field type=\"boolean\" label=\"Allow visitors to send status text in presence updates\" var=\"muc#roomconfig_allowvisitorstatus\">
<value>1</value>
</field>
<field type=\"boolean\" label=\"Allow visitors to change nickname\" var=\"muc#roomconfig_allowvisitornickchange\">
<value>1</value>
</field>
<field type=\"boolean\" label=\"Allow visitors to send voice requests\" var=\"muc#roomconfig_allowvoicerequests\">
<value>1</value>
</field>
<field type=\"text-single\" label=\"Minimum interval between voice requests (in seconds)\" var=\"muc#roomconfig_voicerequestmininterval\">
<value>1800</value>
</field>
<field type=\"jid-multi\" label=\"Exclude Jabber IDs from CAPTCHA challenge\" var=\"muc#roomconfig_captcha_whitelist\"></field>
</x>
mod_muc:
## host: "conference.#HOST#"
access:
- allow
access_admin:
- allow: admin
access_create: muc_create
access_persistent: muc_create
history_size: 0
default_room_options:
allow_user_invites: true
anonymous: false
members_by_default: true
members_only: true
moderated: false
persistent: true
public: false
public_list: false

quickfix marketdatarequest parsing errors

I am using quickfix 1.14.0 on a linux machine. I am sending a MarketDataRequest. The request I am sending is
<message>
<header>
<field number="8">
<![CDATA[FIX.4.4]]>
</field>
<field number="35">
<![CDATA[V]]>
</field>
<field number="49">
<![CDATA[FixServer]]>
</field>
<field number="56">
<![CDATA[INCA]]>
</field>
</header>
<body>
<field number="146">
<![CDATA[1]]>
</field>
<field number="262">
<![CDATA[MARKETDATAID]]>
</field>
<field number="263">
<![CDATA[0]]>
</field>
<field number="264">
<![CDATA[0]]>
</field>
<field number="267">
<![CDATA[1]]>
</field>
<group>
<field number="55">
<![CDATA[LNUX]]>
</field>
</group>
<group>
<field number="269">
<![CDATA[0]]>
</field>
</group>
</body>
<trailer>
</trailer>
</message>
On the receiving end, I see the request coming in as
<message>
<header>
<field number="8">
<![CDATA[FIX.4.4]]>
</field>
<field number="9">
<![CDATA[112]]>
</field>
<field number="35">
<![CDATA[V]]>
</field>
<field number="34">
<![CDATA[93]]>
</field>
<field number="49">
<![CDATA[FixServer]]>
</field>
<field number="52">
<![CDATA[20150714-19:19:54.844]]>
</field>
<field number="56">
<![CDATA[INCA]]>
</field>
</header>
<body>
<field number="55">
<![CDATA[LNUX]]>
</field>
<field number="146">
<![CDATA[1]]>
</field>
<field number="262">
<![CDATA[MARKETDATAID]]>
</field>
<field number="263">
<![CDATA[0]]>
</field>
<field number="264">
<![CDATA[0]]>
</field>
<field number="267">
<![CDATA[1]]>
</field>
<field number="269">
<![CDATA[0]]>
</field>
</body>
<trailer>
<field number="10">
<![CDATA[151]]>
</field>
</trailer>
</message>
I am parsing the request using
FIX::MDReqID mdReqID;
FIX::SubscriptionRequestType subscriptionRequestType;
FIX::MarketDepth marketDepth;
FIX::NoRelatedSym noRelatedSym;
FIX44::MarketDataRequest::NoRelatedSym noRelatedSymGroup;
message.get( mdReqID );
message.get( subscriptionRequestType );
if ( subscriptionRequestType != FIX::SubscriptionRequestType_SNAPSHOT )
throw( FIX::IncorrectTagValue( subscriptionRequestType.getField() ) );
message.get( marketDepth );
message.get( noRelatedSym );
for ( int i = 0; i < noRelatedSym; ++i )
{
FIX::Symbol symbol;
message.getGroup( i, noRelatedSymGroup );
noRelatedSymGroup.get( symbol );
}
I get an exception when I try to get the noRelatedSymbolGroup. I see the following error message sent back to the requestor,
358=Conditionally Required Field Missing (146)
The code I am using is from the examples. I do not understand why the tag 55 appears before tag 146, even though it appears correctly from the sender side.
Any help is appreciated.
This looks like a configuration problem.
Your config should have these two lines:
UseDataDictionary=Y
DataDictionary=path/to/your/dd.xml
I bet the first line is missing.
The 55 is appearing before 146 because QF will internally rearrange the top-level fields in your message (because FIX does not care about the order of top-level fields).
55 is not top-level in MarketDataReq messages, but your bad configuration is telling QF that there are no repeating groups (because repeating groups require a DD). Thus QF is treating everything as a top-level field.

xmpp/ejabberd user search commend returning empty fields

this is my query to ejabberd server running on localhost using window telnet to search whether user exists or not
local server host name is durgesh-laptop
<iq type="set" id="searchByUserName" to="vjud.durgesh-laptop"from="durgesh#durgeshlaptop">
<query xmlns="jabber:iq:search">
<x xmlns="jabber:x:data" type="submit">
<field type="hidden" var="FROM_TYPE">
<value>jabber:iq:search</value>
</field>
<field var="user">
<value>anand</value>
</field></x></query></iq>
server response is:-
<iq from='vjud.durgesh-laptop' to='durgesh#durgesh-laptop/Telnet Client' id='searchByUserName' type='result'>
<query xmlns='jabber:iq:search'>
<x xmlns='jabber:x:data' type='result'>
<title>Search Results for vjud.durgesh-laptop</title>
<reported><field type='text-single' label='Jabber ID' var='jid'/>
<field type='text-single' label='Full Name' var='fn'/>
<field type='text-single' label='Name' var='first'/>
<field type='text-single' label='Middle Name' var='middle'/>
<field type='text-single' label='Family Name' var='last'/>
<field type='text-single' label='Nickname' var='nick'/>
<field type='text-single' label='Birthday' var='bday'/>
<field type='text-single' label='Country' var='ctry'/>
<field type='text-single' label='City' var='locality'/>
<field type='text-single' label='Email' var='email'/>
<field type='text-single' label='Organization Name' var='orgname'/>
<field type='text-single' label='Organization Unit' var='orgunit'/></reported></x>
</query></iq>
it contain empty fields. No matter whether user exists or not it always response with empty field values
please tell me where i am doing wrong.

get offline messages of publisher

I have implemented XEP-0060 pubsub using openfire , i am able to publish messages over an existing node and i have other subscribers who can get those published messages.
now the issue is , i am not be able to receiver the old messages i mean if the subscribers are offline and when they come back online then how can i get the old messages which were being published by the publisher long time back.
My node on which publishers are publishing is configured as follows
<iq from="pubsub.example.com" type="result" id="meta1" to="lime#example.com/localhost">
<query xmlns="http://jabber.org/protocol/disco#info" node="mynode/loc">
<identity category="pubsub" type="leaf"/>
<feature var="http://jabber.org/protocol/pubsub"/>
<feature var="http://jabber.org/protocol/disco#info"/>
<x xmlns="jabber:x:data" type="result">
<field type="hidden" var="FORM_TYPE">
<value>http://jabber.org/protocol/pubsub#meta-data</value>
</field>
<field type="text-single" label="Short name for the node" var="pubsub#title">
<value/>
</field>
<field type="text-single" label="Description of the node" var="pubsub#description">
<value/>
</field>
<field type="boolean" label="Allow subscriptions to node" var="pubsub#subscribe">
<value>1</value>
</field>
<field type="boolean" label="New subscriptions require configuration" var="pubsub#subscription_required">
<value>0</value>
</field>
<field type="boolean" label="Deliver payloads with event notifications" var="pubsub#deliver_payloads">
<value>1</value>
</field>
<field type="boolean" label="Notify subscribers when the node configuration changes" var="pubsub#notify_config">
<value>1</value>
</field>
<field type="boolean" label="Notify subscribers when the node is deleted" var="pubsub#notify_delete">
<value>1</value>
</field>
<field type="boolean" label="Notify subscribers when items are removed from the node" var="pubsub#notify_retract">
<value>1</value>
</field>
<field type="boolean" label="Only deliver notifications to available users" var="pubsub#presence_based_delivery">
<value>0</value>
</field>
<field type="text-single" label="Type of payload data to be provided at this node" var="pubsub#type">
<value/>
</field>
<field type="text-single" label="Message body XSLT" var="pubsub#body_xslt">
<value/>
</field>
<field type="text-single" label="Payload XSLT" var="pubsub#dataform_xslt">
<value/>
</field>
<field type="list-single" label="Specify who may subscribe and retrieve items" var="pubsub#access_model">
<option>
<value>authorize</value>
</option>
<option>
<value>open</value>
</option>
<option>
<value>presence</value>
</option>
<option>
<value>roster</value>
</option>
<option>
<value>whitelist</value>
</option>
<value>open</value>
</field>
<field type="list-single" label="Publisher model" var="pubsub#publish_model">
<option>
<value>publishers</value>
</option>
<option>
<value>subscribers</value>
</option>
<option>
<value>open</value>
</option>
<value>open</value>
</field>
<field type="list-multi" label="Roster groups allowed to subscribe" var="pubsub#roster_groups_allowed"/>
<field type="jid-multi" label="People to contact with questions" var="pubsub#contact"/>
<field type="text-single" label="Default language" var="pubsub#language">
<value>English</value>
</field>
<field type="jid-multi" label="Node owners" var="pubsub#owner">
<value>mypublisher#example.com</value>
</field>
<field type="jid-multi" label="Node publishers" var="pubsub#publisher"/>
<field type="list-single" label="Select entity that should receive replies to items" var="pubsub#itemreply">
<value>owner</value>
</field>
<field type="jid-multi" label="Multi-user chat room to which replies should be sent" var="pubsub#replyroom"/>
<field type="jid-multi" label="Users to which replies should be sent" var="pubsub#replyto"/>
<field type="boolean" label="Send items to new subscribers" var="pubsub#send_item_subscribe">
<value>1</value>
</field>
<field type="boolean" label="Persist items to storage" var="pubsub#persist_items">
<value>1</value>
</field>
<field type="text-single" label="Max number of items to persist" var="pubsub#max_items">
<value>5</value>
</field>
<field type="text-single" label="Max payload size in bytes" var="pubsub#max_payload_size">
<value>5120</value>
</field>
</x>
</query>
</iq>
yeah i got it , when the subscriber gets online using following stanza he/she can retrive the old published items
subid is must in this case
<iq type='get'
from='subscriber#example.com'
to='pubsub.example.com'
id='items1'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<items node='mynode'
subid="8839399494949"/>
</pubsub>
</iq>