Not logged in. · Lost password · Register
Forum: MatriX and XmppDotNet RSS
How to handle Group Chat invite
Avatar
suresh #1
Member since Jan 2015 · 2 posts · Location: India
Group memberships: Members
Show profile · Link to this post
Subject: Handle Group Chat invite
hi ,

1. how to handle group chat invite .i got invite in OnMessage event like below .how to handle this and parse the xml .

Invite

  1. <message from="groupName@conference.serverid.com" to="suresh@serverid.com" type="normal" xmlns="jabber:client">
  2.  <x xmlns="http://jabber.org/protocol/muc#user">
  3.     <invite from="sender@serverid.com/12138876311421839794675292">
  4.       <reason>Join the group!!!</reason>
  5.     </invite>
  6.  </x>
  7.  <x xmlns="jabber:x:conference" jid="groupName@conference.serverid.com">Join the group!!!</x>
  8.  <body>sender@serverid.com/12138876311421839794675292 invites you to the room groupName@conference.serverid.com (Join the group!!!) </body>
  9. </message>


Direct Invite

  1. <message from="sender@serverid.com/QXmpp" to="suresh@serverid.com" type="normal" xmlns="jabber:client">
  2.  <x xmlns="jabber:x:conference" jid="groupName@conference.serverid.com" reason="join room" />
  3. </message>

2. how to get the group members list.
This post was edited on 2015-01-22, 09:50 by Alex.
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by suresh:
1. how to handle group chat invite .i got invite in OnMessage event like below .how to handle this and parse the xml .

Invite

  1. <message from="groupName@conference.serverid.com" to="suresh@serverid.com" type="normal" xmlns="jabber:client">
  2.  <x xmlns="http://jabber.org/protocol/muc#user">
  3.     <invite from="sender@serverid.com/12138876311421839794675292">
  4.       <reason>Join the group!!!</reason>
  5.     </invite>
  6.  </x>
  7.  <x xmlns="jabber:x:conference" jid="groupName@conference.serverid.com">Join the group!!!</x>
  8.  <body>sender@serverid.com/12138876311421839794675292 invites you to the room groupName@conference.serverid.com (Join the group!!!) </body>
  9. </message>

msg.XMucUser gives you the <x xmlns="http://jabber.org/protocol/muc#user"/> tag.
So you could check if this is not null. If its not null then its an invite.

The X object then has properties to access all the children, eg. GetInvites(9 which gives you an enumeration of the invites n this object. There could be multiple, but in most cases there is only 1.

msg.From is the room you get invited to.

Quote by suresh:
Direct Invite

  1. <message from="sender@serverid.com/QXmpp" to="suresh@serverid.com" type="normal" xmlns="jabber:client">
  2.  <x xmlns="jabber:x:conference" jid="groupName@conference.serverid.com" reason="join room" />
  3. </message>

you get the conference tag with the following code:
  1. msg.Element<Matrix.Xmpp.Muc.Conference>();
then just use the properties of the object

Quote by suresh:
2. how to get the group members list.
you nust be in the room, then you can use mucManager.RequestMemberList which retrieves it.
see also: XEP-0045: Multi-User Chat

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: