Not logged in. · Lost password · Register
Forum: MatriX and XmppDotNet RSS
Avatar
choquito #1
Member since Mar 2013 · 21 posts · Location: Spain
Group memberships: Members
Show profile · Link to this post
Subject: Matrix.Ui How to changing muc properties
Hi Alex,

What's the correct way to change the properties from xdata using Matrix.Ui?

  1.  
  2. private void PresenceCallback(object sender, PresenceEventArgs e)
  3. {
  4.         var mucX = e.Presence.MucUser;
  5.          if (mucX.HasStatus(201))  // 201 =  room is awaiting configuration.
  6.          {
  7.              mm.RequestRoomConfiguration(_roomJid, InstantRoomResult);
  8.          }
  9.     ....
  10.     ....
  11. }
  12.  
  13.  
  14. private void InstantRoomResult(object sender, IqEventArgs args)
  15. {
  16.      if (args.Iq.Type == Matrix.Xmpp.IqType.result)
  17.         {
  18.              var query = args.Iq.Element<Matrix.Xmpp.Muc.Owner.OwnerQuery>();
  19.              if (query != null)
  20.              {
  21.                  var xdata = query.XData;
  22.                  Matrix.Ui.XData.XDataControl xdc = new Matrix.Ui.XData.XDataControl();
  23.                  xdc.CreateForm(xdata);
  24.              
  25.    
  26.               // here. Exists any Method for changing the muc properties?
  27.                  xdc. ???????????
  28.  
  29.  
  30.                  var xdataresponse = xdc.CreateResponse();
  31.                  mm.SubmitRoomConfiguration(_roomJid, xdataresponse);
  32.  
  33.  
  34.  
  35.               }
  36.         }
  37.  }


Thanks.
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
I have attached a XDataUI sample project. Let me know if this helps.

Alex
The author has attached one file to this post:
XDataUI.zip 399.2 kBytes
You have no permission to open this file.
Avatar
choquito #3
Member since Mar 2013 · 21 posts · Location: Spain
Group memberships: Members
Show profile · Link to this post
Hi Alex,

The attached project has been very useful for my.

This works for change the muc options in xml response before send it to server:

  1.  private void InstantRoomResult(object sender, IqEventArgs args)
  2.         {
  3.             if (args.Iq.Type == Matrix.Xmpp.IqType.result)
  4.             {
  5.                 var query = args.Iq.Element<Matrix.Xmpp.Muc.Owner.OwnerQuery>();
  6.                 if (query != null)
  7.                 {
  8.                     var xdata = query.XData;
  9.                     Matrix.Ui.XData.XDataControl xdc = new Matrix.Ui.XData.XDataControl();
  10.                     xdc.CreateForm(xdata);
  11.                     var xdataresponse = xdc.CreateResponse();
  12.                     // Make room persistent
  13.                     xdataresponse.GetField("muc#roomconfig_persistentroom").SetValue("1");
  14.                     mm.SubmitRoomConfiguration(_roomJid, xdataresponse);
  15.                 }
  16.             }
  17.         }

Thanks.
This post was edited on 2013-03-16, 07:16 by choquito.
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: