XMPP: How to query specific rosters presence - strophe

Whats is XAMP stanza for get specific(single or multiple) roster presence instead of all ?
I'm using Strophe.js for XAMPP(openfire) communication. As per Openfire didn't provide support for message status(read, received and read) at server side so, I have implemented some extra logic for make it work.
I'm retrieving my rosters by ajax call through querying Openfire db one self and returning rosters, also roster search functionality here. Problem is when I search and get roster through API so I can't get presence of roster. I want presence only for search result rosters instead all users through Strophe.js(XAMP stanza).

I found a partial solution, it's only working when the roster is online. we can take default user status offline and we can update online presence response.
<presence to="JID" type="probe" xmlns="jabber:client"/>

Related

MAM XEP-0313 - Query conversation list for a particular user

I am developing a mobile messaging app (ios) and I support the logout feature. I want to keep the latest conversation list when the users logs in back again. Because the local storage of the app gets cleaned once logout.
I am using MAM XEP-0313 sucessfully but I have not found an IQ to query the conversation list of a particular user.
For example:
chat
user_a -> user_b
user_c
user_d
user_f
user_a has had conversations with 4 users and he wants to logout of the app, when he comes back in he needs to get those last 4 conversation threads on his list.
What I do when a user messages another user is that I add them to my roster and have the logic of automatic subscription. So I was thinking to use the roster history logic to query this collection but I was also expecting the MAM module to have a more direct way..
I am using MongooseIM server
I understand your problem, the solution you have is probably the best one you can have with standard XEPs and their implementations.
The conversation list is actually sth missing in MAM spec or in general in XMPP. There are some works to define an extension to get you all the conversations where you have some unread messages (so called "unread sync"). Will this be enough for you or you would rather want to get some kind of "inbox". By "inbox" I mean a list of all recent conversations with unread messages count where there are some unread messages.

How to integrate with OpenFire XMPP server to receive roster info for users?

I need to create small auxiliary server that is part/integrates with OpenFire server in order to get roster for a given user.
I was looking for some plugin/api call that given the user JID to return his contacts and their online status.
All-in-all I may end up changing OpenFire's code but I was hoping that there is a easier solution
All though the links provided by Manasi would work for you. However those links refers to user service plugin which has been depricated by openfire.
They recommend to use REST API plugin.
You'll see list of all plugins here.
You should read about retrieving user roster and their presence .
You could try using the user service plugin of openfire that returns a host of information of the user as well as its rosters.
for documentation click here.
You can get the roster information by this url.

Server managed roster in Tigase

Generally in messenger services, user adds or deletes contacts and let knows server about it. Server then takes necessary actions.
However, our requirement is "server decides contacts list, makes roster changes accordingly and clients receives updates about the same". How can we achieve this in Tigase?
There is a dedicated API in the Tigase just for that. It is called a DynamicRoster. Maybe the name is the most accurate. Dynamic because it is managed by the server and it can change any time user requests the roster.
Anyway, there are code examples in the Tigase main code repository. You can have multiple dynamic rosters active at the same time and they can retrieve contacts from different locations.
There is also a roster protocol extension which allows you to keep extra information for the contacts in the dynamic roster such as phone numbers, etc... More info about this o the Tigase.org website in the devel guide section.
Hope this helps.

Is there a way to determine which Mulit User Conferences (MUC) a user has joined?

I wonder if there is a way to query the XMPP server (passing user JID?) to find out what chat room(s) this user is currently in? If not, can we query jabber server to get a list of all active chat rooms?
BTW we're running ejabber enabled for multiuser chat. A solution using a java library (smack?) would be ideal.
As mentioned by Joe Hildebrand, there is no such a standard feature as it is a privacy violation to allow that over XMPP, so you cannot expect to do that from Smack. Maybe with admin privilege you could have a custom protocol extension that does that but that seems risky.
However, at the server level, you should be able to write a custom module for ejabberd that will query or index all rooms users are in. This is not standard and there is plugin development involved.
There are two (maybe three) XMPP entities that have that information:
the XMPP MUC component which provides the MUC room
the users XMPP client (or better the XMPP library used by the user)
maybe the XMPP server(s) (but let's ignore that)
At the time of writing this, there is no standardized way (in terms of XMPP XEPs) to query that information. As Joe Hildebrand pointed out, this would result in a information leak which is not what we want in most cases.
But you can either extend the MUC component to provide that information (remember XMPP is easily extendable) or the XMPP client library. The usual approach would be via an iq get query. For example:
<iq type='get' from='juliet#capulet.lit/balcony' to='capulet.lit' id='q1'>
<query xmlns='http://jabber.org/protocol/muc#joinedrooms'/>
</iq>
The entities which support that query would then report back the joined rooms of the requested entity. Also they would may announce the http://jabber.org/protocol/muc#joinedrooms feature in their service discovery information.
Note that this is a fictional protocol extension meant as example. I have never seen it in real use
If the MUC component provides this feature then it's not controllable by the client if this information is exposed. But if the client provides this feature then of course he can control who can retrieve this information. You may decide what's the better approach in your case.
Getting all chat rooms is no problem, just use this query.
There seems to be already a question on how to retrieve rooms with smack. Look here.

What is the "Roster" in XMPP?

I'm learning XMPP and I repeatedly see the word "Roster" but I have no idea what it is.
contact list (in XMPP this is called a "roster")
Source: XMPP-IM - RFC 6121 ยง 1.3: Requirements
In XMPP, one's contact list is called a roster, which consists of any number of specific roster items, each roster item being identified by a unique JID (usually of the form contact#domain). A user's roster is stored by the user's server on the user's behalf so that the user may access roster information from any resource.
Note: There are important interactions between rosters and subscriptions; these are defined under Integration of Roster Items and Presence Subscriptions, and the reader must refer to that section for a complete understanding of roster management.
See http://xmpp.org/rfcs/rfc6121.html#intro-requirements
Let me know if anybody have any queries regarding xmpp/chat app in Android.
Roster is the name given to the list of contacts which appears in one's chat client
http://www.adarshr.com/fun-with-xmpp-and-google-talk-part-2