Not logged in. · Lost password · Register
Forum: MatriX RSS
Avatar
assistit #1
Member since Apr 2014 · 4 posts
Group memberships: Members
Show profile · Link to this post
Subject: Problems creating rooms
Hi,

Please help, I am using Matrix 1.5.3.6 and now seem unable to create a new rooms.
(using pidgin with the same server and user this works, and I thought this code worked at some stage!).

Please see my code and xml response below.

Thanks


The code being used:

  1. _muc = new MucManager(_xmppClient);
  2. _newRoomJid = string.Format("{0}@conference.{1}", dlg.inputText, _xmppClient.XmppDomain);
  3. _muc.EnterRoom(_newRoomJid, _nickName);
  4. _muc.RequestInstantRoom(_newRoomJid, OnRequestInstantRoom);
  5.  
  6.  
  7. public void OnRequestInstantRoom(object sender, IqEventArgs args)
  8. {
  9.     if (args.Iq.Type == Matrix.Xmpp.IqType.result)
  10.     {
  11.         _muc.RequestRoomConfiguration(args.Iq.From, OnRequestRoomConfiguration);
  12.     }
  13. }
  14.  
  15.  
  16. public void OnRequestRoomConfiguration(object sender, IqEventArgs args)
  17. {
  18.     if (args.Iq.Type == Matrix.Xmpp.IqType.result)
  19.     {
  20.         var query = args.Iq.Element<Matrix.Xmpp.Muc.Owner.OwnerQuery>();
  21.         if (query != null)
  22.         {
  23.             var xdata = query.XData;
  24.             Matrix.Xmpp.XData.Field f_persistent = xdata.GetField("muc#roomconfig_persistentroom");
  25.  
  26.             //Field f_persistent = new Field(FieldType.Boolean);
  27.             //f_persistent.Var = "muc#roomconfig_persistentroom";
  28.  
  29.             // Read the room configuration and make it persistent
  30.             Matrix.Xmpp.XData.Field[] fields = xdata.GetFields().ToArray();
  31.             for (int i = fields.Length - 1; i >= 0; i--)
  32.             {
  33.                 string valStr = "";
  34.                 if (fields[i].HasTag("value"))
  35.                     valStr = fields[i].GetValue();
  36.                 Debug.WriteLine(string.Format("Field {0} = {1}", fields[i].Var, valStr ));
  37.                 if (fields[i].Var == "muc#roomconfig_persistentroom")
  38.                 {
  39.                     Debug.WriteLine("making persistent");
  40.                     fields[i].SetValueBool(true);
  41.                     Debug.WriteLine(string.Format("Field {0} = {1}", fields[i].Var, fields[i].GetValue()));
  42.                 }
  43.             }
  44.  
  45.             Matrix.Xmpp.XData.Data xForm = new Matrix.Xmpp.XData.Data();
  46.             xForm.Type = Matrix.Xmpp.XData.FormType.submit;
  47.             xForm.Add(fields);
  48.             _muc.SubmitRoomConfiguration(_newRoomJid, xForm, OnRoomConfigResult);
  49.         }
  50.     }
  51. }
  52.  
  53.  
  54. private void OnRoomConfigResult(object sender, IqEventArgs args)
  55. {
  56.     if (args.Iq.Type == IqType.result)
  57.     {
  58.         // success 
  59.         Debug.WriteLine("New room has been configured");
  60.         MessageBox.Show(string.Format("New room '{0}' has been created.", _newRoomJid.User), "Add room", MessageBoxButtons.OK);
  61.     }
  62.     else if (args.Iq.Type == IqType.error)
  63.     {
  64.         // error
  65.         Debug.WriteLine("Error configuring room");
  66.         MessageBox.Show(string.Format("Error adding room!\n{0}", args.Iq.Error), "Add room", MessageBoxButtons.OK, MessageBoxIcon.Error);
  67.     }
  68.     this.Close();
  69. }

XML capture:


  1.  
  2. <presence to="devtest1@conference.assist.gtl.biz/nigel" xmlns="jabber:client">
  3.  <x xmlns="http://jabber.org/protocol/muc">
  4.     <history maxchars="0" />
  5.  </x>
  6. </presence>
  7. <iq id="MX_10" type="set" to="devtest1@conference.assist.gtl.biz" xmlns="jabber:client">
  8.  <query xmlns="http://jabber.org/protocol/muc#owner">
  9.     <x type="submit" xmlns="jabber:x:data" />
  10.  </query>
  11. </iq>
  12.  
  13. <presence from="devtest1@conference.assist.gtl.biz/nigel" to="nigel@assist.gtl.biz/AssistITClient" type="error" xmlns="jabber:client">
  14.  <x xmlns="http://jabber.org/protocol/muc">
  15.     <history maxchars="0" />
  16.  </x>
  17.  <error code="503" type="cancel">
  18.     <service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
  19.  </error>
  20. </presence>
This post was edited on 2014-04-03, 16:47 by Alex.
Avatar
Alex #2
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
to me it looks like you send the packets to fast, or there is a problem on your server itself.

Can you try to wait until the room got created when you send the EnterRoom. When the room is created you get back presences from it. Now after that try to call RequestInstantRoom.

Alex
Avatar
assistit #3
Member since Apr 2014 · 4 posts
Group memberships: Members
Show profile · Link to this post
If I only issue the "enterRoom()" and skip the "RequestInstantRomm()" it still fails.

If I use pidgin using same account the room gets created.

Thanks.
Avatar
Alex #4
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Please post the logs, an also one of Pidgin so we can compare them.

Alex
Avatar
assistit #5
Member since Apr 2014 · 4 posts
Group memberships: Members
Show profile · Link to this post
My App

  1. <presence to="newroom1@conference.assist.gtl.biz/nigel" xmlns="jabber:client">
  2.  <x xmlns="http://jabber.org/protocol/muc" />
  3. </presence>
  4. <presence from="newroom1@conference.assist.gtl.biz/nigel" to="nigel@assist.gtl.biz/AssistITClient" type="error" xmlns="jabber:client">
  5.  <x xmlns="http://jabber.org/protocol/muc" />
  6.  <error code="503" type="cancel">
  7.     <service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
  8.  </error>
  9. </presence>

Pidgin


  1. <presence to='devtest@conference.assist.gtl.biz/nigel'>
  2.     <priority>1</priority>
  3.     <c xmlns='http://jabber.org/protocol/caps' node='http://pidgin.im/' hash='sha-1' ver='71LAP/wlWGfun7j+Q4FCSSuAhQw='/>
  4.     <x xmlns='http://jabber.org/protocol/muc'/>
  5. </presence>
  6. <presence from='devtest@conference.assist.gtl.biz/nigel' to='nigel@assist.gtl.biz/32550081961396455553509002'>
  7.     <priority>1</priority>
  8.     <c xmlns='http://jabber.org/protocol/caps' node='http://pidgin.im/' hash='sha-1' ver='71LAP/wlWGfun7j+Q4FCSSuAhQw='/>
  9.     <x xmlns='http://jabber.org/protocol/muc#user'>
  10.         <item jid='nigel@assist.gtl.biz/32550081961396455553509002' affiliation='owner' role='moderator'/>
  11.         <status code='201'/>
  12.     </x>
  13. </presence>
This post was edited on 2014-04-03, 17:44 by Alex.
Avatar
Alex #6
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
The Xml you send is correct.
Is it possible that you send the Enter roon to early? Before your XMPP session is completely ready?

Alex
This post was edited on 2014-04-03, 17:48 by Alex.
Avatar
assistit #7
Member since Apr 2014 · 4 posts
Group memberships: Members
Show profile · Link to this post
The xmppClient component has been running a while as I have already tabulated a list of all rooms and users before the user can create a room via the UI.

We are using ejabberd (v2.1.8) In the logs at the server I see some entries...


I(<0.29284.8>:mod_muc_room:126) : Created MUC room...
I(<0.29284.8>:mod_muc_room:968) : Destroyed MUC room... because it's temporary and empty
I(<0.29284.8>:mod_muc_room:705) : Stopping MUC room ....

Thanks
?
Avatar
Alex #8
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
The logs on ejabberd look OK.

When a room is not configured to be a persistent room then it gets destroyed automatically when the last participant leaves the room.
I guess this is what you see in your logs.

// create room
I(<0.29284.8>:mod_muc_room:126) : Created MUC room...

// last person left => empty => gets destroyed automatically
I(<0.29284.8>:mod_muc_room:968) : Destroyed MUC room... because it's temporary and empty

// I guess the log message that the room was destroyed now
I(<0.29284.8>:mod_muc_room:705) : Stopping MUC room ....

As I said before your XML logs logs look fine. MatriX sends the same as Pidgin, only Pidgin has some extended caps data which does not matter at all here.
It can help when you post the complete Xml logs from the beginning of the complete session.

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