Not logged in. · Lost password · Register
Forum: MatriX and XmppDotNet RSS
Avatar
Stei #1
Member since Oct 2016 · 31 posts
Group memberships: Members
Show profile · Link to this post
Subject: Sending MUC room invitation to offline user
After creating and unlocking a MUC room I invite users to the room using MucManager.Invite(). If the users are online, then they receive the invitation message. However, users that are offline never receive the invitation message when they log in. Is this the way XMPP is designed? Or does it seem like I am doing something wrong?
Avatar
Alex #2
Member since Feb 2003 · 4447 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Are you sending your invites to full or bare Jids?

Invites to Bare Jids should be stored as offline messages and then delivered by the server as soon as the user comes online.
But this depends also on the server software you are using and its configuration.

Alex
Avatar
Stei #3
Member since Oct 2016 · 31 posts
Group memberships: Members
Show profile · Link to this post
They are being sent to the bare Jids. When I send a normal chat message to an offline user, it is delivered to the user when they log in, as expected. It is only the invitation messages that are not being delivered by the server when the user logs in
Avatar
Alex #4
Member since Feb 2003 · 4447 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
I would check with your server vendor then.

Can you post a Xml dump here on an invite which gets delivered to an online user?

When your server does not support it then you can also try to use XEP-0249: Direct MUC Invitations.

This problem came up here before with the Openfire server:
http://forum.ag-software.net/thread/916-Sending-MUC-invite…
Avatar
Stei #5
Member since Oct 2016 · 31 posts
Group memberships: Members
Show profile · Link to this post
I know that the server supports delivering the message to offline users, because we have an iPhone version (not using Matrix XMPP though) and any MUC invites from the iPhone version are received when a user comes online. I noticed in my XML log I get this message though, after inviting a user (I invite the user immediately after the room is created and unlocked):

  1. <iq to="aaaaaa@domain.net/MatriX-WinRT" id="MX_7" xmlns="jabber:client" type="error" from="aaaaaa-1479960227000@muc.domain.net">
  2.  <query xmlns="http://jabber.org/protocol/muc#admin">
  3.     <item role="participant" nick="bbb@domain.net" />
  4.  </query>
  5.  <error code="500" type="wait">
  6.     <internal-server-error xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
  7.  </error>
  8. </iq>

I can't find any information on this error code though.


And here is when an invite successfully arrives to the other user:
  1. <message from="aaaaaa-1479957450000@muc.domain.net" xmlns="jabber:client" to="bbb@domain.net">
  2.  <x xmlns="http://jabber.org/protocol/muc#user">
  3.     <invite from="aaaaaa@domain.net/MatriX-for-WinRT">
  4.       <reason>gggggghhhhh</reason>
  5.     </invite>
  6.  </x>
  7. </message>
This post was edited 2 times, last on 2016-11-24, 09:33 by Alex.
Avatar
Alex #6
Member since Feb 2003 · 4447 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by Stei:
I know that the server supports delivering the message to offline users, because we have an iPhone version (not using Matrix XMPP though) and any MUC invites from the iPhone version are received when a user comes online. I noticed in my XML log I get this message though, after inviting a user (I invite the user immediately after the room is created and unlocked):

As I said before, there are multiple different ways to invite. Please send xml samples of invite messages on the sender and receiver. or better a complete flow of creating a room and sending the invite.

Quote by Stei:
  1. <iq to="aaaaaa@domain.net/MatriX-WinRT" id="MX_7" xmlns="jabber:client" type="error" from="aaaaaa-1479960227000@muc.domain.net">
  2.  <query xmlns="http://jabber.org/protocol/muc#admin">
  3.     <item role="participant" nick="bbb@domain.net" />
  4.  </query>
  5.  <error code="500" type="wait">
  6.     <internal-server-error xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
  7.  </error>
  8. </iq>

I can't find any information on this error code though.

Internal server error can have many reasons. Without seeing the outgoing packet and the complete flow of joining the room its hard to find out.

Alex
Avatar
Stei #7
Member since Oct 2016 · 31 posts
Group memberships: Members
Show profile · Link to this post
Here is the output from every time XMPPClient's OnSendXml/OnReceiveXml events are fired during the muc creation process. (The user who created the room is AAAAAA@my-domain.net, and they invited BBBBBB@my-domain.net to join the room):

  1. OnSendXml:
  2. <presence to="AAAAAA-1480038274000@muc.my-domain.net/AAAAAA" xmlns="jabber:client">
  3.  <x xmlns="http://jabber.org/protocol/muc" />
  4. </presence>
  5.  
  6. OnReceiveXml:
  7. <presence to="AAAAAA@my-domain.net/MatriX-WinRT" from="AAAAAA-1480038274000@muc.my-domain.net/AAAAAA" xmlns="jabber:client">
  8.  <x xmlns="http://jabber.org/protocol/muc#user">
  9.     <item role="moderator" jid="AAAAAA@my-domain.net/MatriX-WinRT" affiliation="owner" nick="AAAAAA" />
  10.     <status code="110" />
  11.     <status code="201" />
  12.  </x>
  13. </presence>
  14.  
  15. OnSendXml:
  16. <iq id="MX_4" type="get" to="AAAAAA-1480038274000@muc.my-domain.net" xmlns="jabber:client">
  17.  <query xmlns="http://jabber.org/protocol/muc#owner" />
  18. </iq>
  19.  
  20. OnReceiveXml:
  21. <message to="AAAAAA@my-domain.net/MatriX-WinRT" xmlns="jabber:client" type="groupchat" from="AAAAAA-1480038274000@muc.my-domain.net">
  22.  <body>Room is locked. Please configure.</body>
  23. </message>
  24.  
  25. OnReceiveXml:
  26. <message to="AAAAAA@my-domain.net/MatriX-WinRT" xmlns="jabber:client" type="groupchat" from="AAAAAA-1480038274000@muc.my-domain.net">
  27.  <body>Welcome! You created new Multi User Chat Room. Room is locked now. Configure it please!</body>
  28. </message>
  29.  
  30. OnReceiveXml:
  31. <iq to="AAAAAA@my-domain.net/MatriX-WinRT" id="MX_4" xmlns="jabber:client" type="result" from="AAAAAA-1480038274000@muc.my-domain.net">
  32.  <query xmlns="http://jabber.org/protocol/muc#owner">
  33.     <x xmlns="jabber:x:data" type="form">
  34.       <field var="muc#roomconfig_roomname" type="text-single" label="Natural-Language Room Name">
  35.         <value />
  36.       </field>
  37.       <field var="muc#roomconfig_roomdesc" type="text-single" label="Short Description of Room">
  38.         <value />
  39.       </field>
  40.       <field var="muc#roomconfig_persistentroom" type="boolean" label="Make Room Persistent?">
  41.         <value>0</value>
  42.       </field>
  43.       <field var="muc#roomconfig_publicroom" type="boolean" label="Make Room Publicly Searchable?">
  44.         <value>1</value>
  45.       </field>
  46.       <field var="muc#roomconfig_moderatedroom" type="boolean" label="Make Room Moderated?">
  47.         <value>0</value>
  48.       </field>
  49.       <field var="muc#roomconfig_membersonly" type="boolean" label="Make Room Members Only?">
  50.         <value>0</value>
  51.       </field>
  52.       <field var="muc#roomconfig_passwordprotectedroom" type="boolean" label="Password Required to Enter?">
  53.         <value>0</value>
  54.       </field>
  55.       <field var="muc#roomconfig_roomsecret" type="text-single" label="Password">
  56.         <value />
  57.       </field>
  58.       <field var="muc#roomconfig_anonymity" type="list-single" label="Room anonymity level:">
  59.         <value>semianonymous</value>
  60.         <option label="Non-Anonymous Room">
  61.           <value>nonanonymous</value>
  62.         </option>
  63.         <option label="Semi-Anonymous Room">
  64.           <value>semianonymous</value>
  65.         </option>
  66.         <option label="Fully-Anonymous Room">
  67.           <value>fullanonymous</value>
  68.         </option>
  69.       </field>
  70.       <field var="muc#roomconfig_changesubject" type="boolean" label="Allow Occupants to Change Subject?">
  71.         <value>0</value>
  72.       </field>
  73.       <field var="muc#roomconfig_enablelogging" type="boolean" label="Enable Public Logging?">
  74.         <value>0</value>
  75.       </field>
  76.       <field var="logging_format" type="list-single" label="Logging format:">
  77.         <value>html</value>
  78.         <option label="HTML">
  79.           <value>html</value>
  80.         </option>
  81.         <option label="Plain text">
  82.           <value>plain</value>
  83.         </option>
  84.       </field>
  85.       <field var="muc#maxhistoryfetch" type="text-single" label="Maximum Number of History Messages Returned by Room">
  86.         <value>50</value>
  87.       </field>
  88.       <field var="tigase#presence_delivery_logic" type="list-single" label="Presence delivery logic">
  89.         <value>PREFERE_PRIORITY</value>
  90.         <option label="PREFERE_LAST">
  91.           <value>PREFERE_LAST</value>
  92.         </option>
  93.         <option label="PREFERE_PRIORITY">
  94.           <value>PREFERE_PRIORITY</value>
  95.         </option>
  96.       </field>
  97.       <field var="tigase#presence_filtering" type="boolean" label="Enable filtering of presence (broadcasting presence only between selected groups">
  98.         <value>0</value>
  99.       </field>
  100.       <field var="tigase#presence_filtered_affiliations" type="list-multi" label="Affiliations for which presence should be delivered">
  101.         <option label="admin">
  102.           <value>admin</value>
  103.         </option>
  104.         <option label="member">
  105.           <value>member</value>
  106.         </option>
  107.         <option label="none">
  108.           <value>none</value>
  109.         </option>
  110.         <option label="outcast">
  111.           <value>outcast</value>
  112.         </option>
  113.         <option label="owner">
  114.           <value>owner</value>
  115.         </option>
  116.       </field>
  117.     </x>
  118.  </query>
  119. </iq>
  120.  
  121. OnSendXml:
  122. <iq id="MX_5" type="set" to="AAAAAA-1480038274000@muc.my-domain.net" xmlns="jabber:client">
  123.  <query xmlns="http://jabber.org/protocol/muc#owner">
  124.     <x type="submit" xmlns="jabber:x:data">
  125.       <field var="muc#roomconfig_roomname" type="text-single">
  126.         <value>Tttttttttttt</value>
  127.       </field>
  128.       <field var="muc#roomconfig_roomdesc" type="text-single">
  129.         <value></value>
  130.       </field>
  131.       <field var="muc#roomconfig_persistentroom" type="boolean">
  132.         <value>1</value>
  133.       </field>
  134.       <field var="muc#roomconfig_publicroom" type="boolean">
  135.         <value>1</value>
  136.       </field>
  137.       <field var="muc#roomconfig_moderatedroom" type="boolean">
  138.         <value>0</value>
  139.       </field>
  140.       <field var="muc#roomconfig_membersonly" type="boolean">
  141.         <value>0</value>
  142.       </field>
  143.       <field var="muc#roomconfig_passwordprotectedroom" type="boolean">
  144.         <value>0</value>
  145.       </field>
  146.       <field var="muc#roomconfig_roomsecret" type="text-single">
  147.         <value></value>
  148.       </field>
  149.       <field var="muc#roomconfig_anonymity" type="list-single">
  150.         <value>semianonymous</value>
  151.       </field>
  152.       <field var="muc#roomconfig_changesubject" type="boolean">
  153.         <value>1</value>
  154.       </field>
  155.       <field var="muc#roomconfig_enablelogging" type="boolean">
  156.         <value>0</value>
  157.       </field>
  158.       <field var="logging_format" type="list-single">
  159.         <value>html</value>
  160.       </field>
  161.       <field var="muc#maxhistoryfetch" type="text-single">
  162.         <value>15</value>
  163.       </field>
  164.       <field var="tigase#presence_delivery_logic" type="list-single">
  165.         <value>PREFERE_PRIORITY</value>
  166.       </field>
  167.       <field var="tigase#presence_filtering" type="boolean">
  168.         <value>0</value>
  169.       </field>
  170.       <field var="tigase#presence_filtered_affiliations" type="list-multi" />
  171.     </x>
  172.  </query>
  173. </iq>
  174.  
  175. OnReceiveXml:
  176. <iq to="AAAAAA@my-domain.net/MatriX-WinRT" id="MX_5" xmlns="jabber:client" type="result" from="AAAAAA-1480038274000@muc.my-domain.net" />
  177.  
  178. CreateGroupViewModel - Inviting users...
  179.  
  180. OnSendXml:
  181. <iq id="MX_6" to="AAAAAA-1480038274000@muc.my-domain.net" type="set" xmlns="jabber:client">
  182.  <query xmlns="http://jabber.org/protocol/muc#admin">
  183.     <item affiliation="member" jid="BBBBBB@my-domain.net">
  184.       <reason>Tttttttttttt</reason>
  185.     </item>
  186.  </query>
  187. </iq>
  188.  
  189. OnSendXml:
  190. <iq id="MX_7" to="AAAAAA-1480038274000@muc.my-domain.net" type="set" xmlns="jabber:client">
  191.  <query xmlns="http://jabber.org/protocol/muc#admin">
  192.     <item role="participant" nick="BBBBBB@my-domain.net" />
  193.  </query>
  194. </iq>
  195.  
  196. OnSendXml:
  197. <message to="AAAAAA-1480038274000@muc.my-domain.net" xmlns="jabber:client">
  198.  <x xmlns="http://jabber.org/protocol/muc#user">
  199.     <invite to="BBBBBB@my-domain.net">
  200.       <reason>Tttttttttttt</reason>
  201.     </invite>
  202.  </x>
  203. </message>
  204.  
  205. OnReceiveXml:
  206. <message to="AAAAAA@my-domain.net/MatriX-WinRT" xmlns="jabber:client" type="groupchat" from="AAAAAA-1480038274000@muc.my-domain.net">
  207.  <body>Room is now unlocked</body>
  208. </message>
  209.  
  210. OnReceiveXml:
  211. <message to="AAAAAA@my-domain.net/MatriX-WinRT" xmlns="jabber:client" type="groupchat" from="AAAAAA-1480038274000@muc.my-domain.net">
  212.  <x xmlns="http://jabber.org/protocol/muc#user">
  213.     <status code="104" />
  214.  </x>
  215. </message>
  216.  
  217. OnReceiveXml:
  218. <iq to="AAAAAA@my-domain.net/MatriX-WinRT" id="MX_6" xmlns="jabber:client" type="result" from="AAAAAA-1480038274000@muc.my-domain.net" />
  219.  
  220. OnReceiveXml:
  221. <iq to="AAAAAA@my-domain.net/MatriX-WinRT" id="MX_7" xmlns="jabber:client" type="error" from="AAAAAA-1480038274000@muc.my-domain.net">
  222.  <query xmlns="http://jabber.org/protocol/muc#admin">
  223.     <item role="participant" nick="BBBBBB@my-domain.net" />
  224.  </query>
  225.  <error code="500" type="wait">
  226.     <internal-server-error xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
  227.  </error>
  228. </iq>
Avatar
Stei #8
Member since Oct 2016 · 31 posts
Group memberships: Members
Show profile · Link to this post
I notice that if I use the MucManager's invite method, I do not receive the invite message when I log in. But if I "manually" construct the invite message, then I receive the message when I log in. However, despite setting the invite message's From property to the room Jid, when I log in, it says the message is from the person who sent it, not from the room Jid. Here is the code I'm using:

  1. Message message = new Message();
  2.  
  3. message.From = (Jid)room;
  4. message.To = participant.BareJid;
  5. message.XMucUser = new Matrix.Xmpp.Muc.User.X();
  6. message.XMucUser.AddInvite(new Matrix.Xmpp.Muc.User.Invite(participant.BareJid, reason));
  7. message.Body = "i";
  8.  
  9. _xmppClient.Send(message);

When the other user receives this invite, I expect the Message's From property to be the room jid, but instead it is the sender's full jid.
Avatar
Stei #9
Member since Oct 2016 · 31 posts
Group memberships: Members
Show profile · Link to this post
I just realized, the invite is being sent to the room Jid (message's to property); is that the reason the other user never receives it?

  1. <message to="AAAAAA-1480038274000@muc.my-domain.net" xmlns="jabber:client">
  2.  <x xmlns="http://jabber.org/protocol/muc#user">
  3.     <invite to="BBBBBB@my-domain.net">
  4.       <reason>Tttttttttttt</reason>
  5.     </invite>
  6.  </x>
  7. </message>

Here is the code I'm using:

  1. _mucManager.Invite(participant.BareJid, roomJid, reason);

Is the invite message suppose to go to the room, and not to the user?

Edit: After reading this http://xmpp.org/extensions/xep-0045.html#invite, I realize that this is normal behavior, and that the room itself should then send the invitation to the user. For some reason its not though, I will look into it more.
This post was edited on 2016-11-25, 10:19 by Stei.
Avatar
Alex #10
Member since Feb 2003 · 4447 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
As I said before, there are different ways to invite a user.


mediated invite gets sent to the room. and then forwarded by the MUC component.

In your log above you seem to send the invites before the room got unlocked. This can also be the problem.

Alex
Avatar
Stei #11
Member since Oct 2016 · 31 posts
Group memberships: Members
Show profile · Link to this post
I was never able to invite an offline user to a group chat using the MucManager's Invite() method. I.E.,

  1. _mucManager.Invite(toJidBare, roomJid);

The user would never receive the invite when they logged in. However I managed to get it to work using the following method:

  1. Message message = new Message();
  2. message.To = roomJid;
  3. message.XMucUser = new Matrix.Xmpp.Muc.User.X();
  4. Invite invite = new Invite();
  5. invite.To = toJidBare;
  6. invite.Reason = reason;
  7. message.XMucUser.AddInvite(invite);
  8. _xmppClient.Send(message);

The above code will send the invite to the user if they are online, and if they are offline, they will receive the message when they log in
Avatar
Alex #12
Member since Feb 2003 · 4447 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
MucManager uses pretty much the same code internal.
I don't understand why it does not work.
Do you see any difference?

  1. using UserX = Matrix.Xmpp.Muc.User.X;
  2.  
  3.  /// <summary>
  4. /// Invites the specified jids.
  5. /// </summary>
  6. /// <param name="jids">The jids.</param>
  7. /// <param name="room">The room.</param>
  8. /// <param name="reason">The reason for this invite.</param>
  9. /// <param name="thread">The thread.</param>
  10. public void Invite(Jid[] jids, Jid room, string reason, string thread)
  11. {
  12.     var msg = new Message { To = room };
  13.  
  14.     var user = new UserX();
  15.    
  16.     foreach (Jid jid in jids)
  17.     {
  18.         var invite = new Invite(jid);
  19.        
  20.         if (!String.IsNullOrEmpty(reason))
  21.             invite.Reason = reason;
  22.  
  23.         if(!String.IsNullOrEmpty(thread))
  24.             invite.Continue = new Continue(thread);
  25.  
  26.         user.AddInvite(invite);
  27.     }
  28.  
  29.     msg.Add(user);
  30.  
  31.     Send(msg);
  32. }
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: