Not logged in. · Lost password · Register
Forum: MatriX and XmppDotNet RSS
Avatar
Govardhan N #1
Member since Mar 2018 · 10 posts
Group memberships: Members
Show profile · Link to this post
Subject: MatriX vNext MUC functions
Hello Alex,

We are using Matrix vNext for our XMPP client on Xamarin .net core platform.
We have communicated in the past as well via mails, and thanks for your support!
Have a couple of queries regarding MUC interface
1) In Matrix vNext - how do we retrieve all members of a room
2) How do we retrieve all rooms of a member?

Do you have any examples? or samples that I can try?
Thanks once again for your support!

I remember that this functionality was available in Matrix SDK, but in vNext cannot find any documentation.
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
here is an example for 1:

  1. var adminIq= new AdminIq {To = "room1@muc.myserver.com", Type = IqType.Get};
  2. adminIq.AdminQuery.AddItem(new Matrix.Xmpp.Muc.Admin.Item(Affiliation.Member));
  3.  
  4. var ret = await xmppClient.SendIqAsync(adminIq);

all those helpers of the previous MatriX version are coming to vNext as well in an Extensions package over time.

Not sure what you want to achieve in 2. What were you doing here in your existing code? There is nothing in XMPP which tells you on which rooms I am a member.
Avatar
Govardhan N #3
Member since Mar 2018 · 10 posts
Group memberships: Members
Show profile · Link to this post
Thanks for the reply Alex,

I tried with the same code specified in your reply.

  1. var adminIq= new AdminIq {To = "room1@muc.myserver.com", Type = IqType.Get};
  2. adminIq.AdminQuery.AddItem(new Matrix.Xmpp.Muc.Admin.Item(Affiliation.Member));
  3.  
  4. var ret = await xmppClient.SendIqAsync(adminIq);

I ran it as a owner of the room and also as member, I got the below result without any members list:

  1. <iq xml:lang="en" to="admin@muc.myserver.com/MatriX" from="room1@muc.myserver.com" type="result" id="rLmeKLPDTEq6/gTA9458qQ" xmlns="jabber:client">
  2.  <query xmlns="http://jabber.org/protocol/muc#admin" />
  3. </iq>

2) How do we retrieve all rooms of a member?
We need to retrieve room details because, when the user is logged off or app is killed or crashed, we need to fetch the room he belongs to join again. We are maintaining a database, where we are storing room details. But we need XMPP based solution for this.
This post was edited 2 times, last on 2018-03-15, 12:17 by Alex.
Edit reason: added code formatting
Avatar
Alex #4
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
1)
The server replies with no members. So there are no regsitered members for this room.
Is it possible that you mix up participants with members?

See also:
https://xmpp.org/extensions/xep-0045.html#modifymember

2)
you have to build this list yourself in your application.
You should know when your apps jpins and leaves rooms, and build build this list locally in your application code.
Avatar
Govardhan N #5
Member since Mar 2018 · 10 posts
Group memberships: Members
Show profile · Link to this post
Thanks for the reply,

1. You are right, we were joining room as a participant. Now we changed the affiliation to member and we are able to get the list.

2. Right now we are storing the room details in database and joining to the room. We will continue to use the same.

3. Another query, is it possible to join subscribed room automatically when user logged in?
Currently we are entering the room by providing room jid  when user signs in.

Thank you for your prompt response and support.
Avatar
Alex #6
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
3) Most clients use XEP-0048: Bookmarks for this.
You can request your bookmarks after login and join the rooms where autojoin is set automatically.
When you do not need to synchronize this over miultiple different devices or clients then you can store it also in your local DB.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters: