Not logged in. · Lost password · Register
Forum: MatriX RSS
Avatar
Eric380 #1
Member since Jun 2012 · 10 posts
Group memberships: Members, Premium
Show profile · Link to this post
Subject: MucManager change room properties
I see how to create a chat room using the server default properties in the MiniClient sample.  You use EnterRoom then RequestInstantRoom. 

I would like to show a dialog after the call EnterRoom so the user can change the defaults (public, persistent, require password, etc) before creating the room with RequestInstantRoom.  Is this possible?  If not I would like to change the defaults after creating the room with RequestInstantRoom.  How do I do this?  

I see MucManger.RequestRoomConfiguration will return a form.  How do I use this?
Avatar
Alex #2
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
yes this is possible. Don't call RequestInstantRoom and request the room configuration form with RequestRoomConfiguration.

RequestRoomConfiguration returns a xdata form with all the properties your server allows to configure. You have to parse this form either to a UI and present it to your user, or process it automatically in code. In both ways you get a result which you have to send back to the server. When this succeeds you room is configured and ready to use.

On our download server here:
http://www.ag-software.net/download-directory/
when you browse to /MatriX/Full/ there is archive MatriX.Ui.zip. This is a project which creates a user interface from xdata forms, and also creates the response you have to submit from the user input. When you need a UI for the xdata from then this code will help you a lot.

The following code build the packet to submit the room configuration:

  1. var iq = new OwnerIq {Type = IqType.set, To = jidRoom, OwnerQuery = {XData = xdataResult}};

I have added a new function SubmitRoomConfiguration to the MucManager which will be in the next build.
Avatar
Eric380 #3
Member since Jun 2012 · 10 posts
Group memberships: Members, Premium
Show profile · Link to this post
Thanks.

What is the best way to get the xdata from the Query?

When will the next build happen?
Avatar
Alex #4
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by Eric380:
What is the best way to get the xdata from the Query?

Define a callback for the room configuration. The Iq Stanza is in the callback event args.
The following code gets the xdata form.

  1. if (iq != null)
  2. {
  3.     var query = iq.Element<Matrix.Xmpp.Muc.Owner.OwnerQuery>();
  4.     if (query != null)
  5.     {
  6.         var xdata = query.XData;
  7.     }
  8. }

Quote by Eric380:
When will the next build happen?
in 5 minutes from now ;-)

Alex
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:
Forum: MatriX RSS