Not logged in. · Lost password · Register
Forum: MatriX RSS
Avatar
amerts #1
Member for 2 months · 3 posts
Group memberships: Members
Show profile · Link to this post
Subject: MUC subscription
Hi everyone! I'm trying to get the list of all rooms that I'm subscribed to, but can't find a proper Subscriptions element or API to implement it.

I checked if my service supports this feature

Request:
  1. <iq from={user-jid}
  2.    to='conference.localhost'
  3.    type='get'
  4.  <query xmlns='http://jabber.org/protocol/disco#info'/>
  5. </iq>

Response:
  1. <query xmlns="http://jabber.org/protocol/disco#info">    
  2.         <identity name="Chatrooms" type="text" category="conference" />    
  3.         <feature var="http://jabber.org/protocol/disco#info" />    
  4.         <feature var="http://jabber.org/protocol/disco#items" />    
  5.         <feature var="http://jabber.org/protocol/muc" />    
  6.         <feature var="vcard-temp" />    
  7.         <feature var="urn:xmpp:mucsub:0" />    
  8.         <feature var="http://jabber.org/protocol/muc#unique" />    
  9.         <feature var="jabber:iq:register" />    
  10.         <feature var="http://jabber.org/protocol/rsm" />    
  11.         <x type="result" xmlns="jabber:x:data">      
  12.             <field var="FORM_TYPE" type="hidden">        
  13.                 <value>http://jabber.org/network/serverinfo</value>      
  14.             </field>    
  15.         </x>  
  16.     </query>

After that I want to send send the following request to get the list of subscriptions:
 
  1. <iq from={user-jid}
  2. to={room-jid}
  3.    type='get'
  4.    id='E6E10350-76CF-40C6-B91B-1EA08C332FC7'>
  5.  <subscriptions xmlns='urn:xmpp:mucsub:0' />
  6. </iq>

And subscribe on a room
  1. <iq from={user-jid}
  2. to={room-jid}
  3.    type='set'
  4.    id='E6E10350-76CF-40C6-B91B-1EA08C332FC7'>
  5.  <subscribe xmlns='urn:xmpp:mucsub:0' nick='mynick'>
  6.     <event node='urn:xmpp:mucsub:nodes:presence' />
  7.     <event node='urn:xmpp:mucsub:nodes:messages' />
  8.     <event node='urn:xmpp:mucsub:nodes:affiliations' />
  9.     <event node='urn:xmpp:mucsub:nodes:subscribers' />
  10.     <event node='urn:xmpp:mucsub:nodes:subject' />
  11.     <event node='urn:xmpp:mucsub:nodes:config' />
  12.     <event node='urn:xmpp:mucsub:nodes:system' />
  13.  </subscribe>
  14. </iq>

Please, can you help me to find a proper API  ?
This post was edited 5 times, last on 2019-10-14, 13:27 by Alex.
Avatar
Alex #2
Member since Feb 2003 · 4308 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello amerts,

are you using ejabberds custom extension MucSub?
Did you read the documentation here?
https://docs.ejabberd.im/developer/xmpp-clients-bots/exten…

Alex
This post was edited on 2019-10-08, 14:02 by Alex.
Avatar
amerts #3
Member for 2 months · 3 posts
Group memberships: Members
Show profile · Link to this post
Hey Alex. Yes, you are right. So do you have any ideas how can I adapt my code to use it on the client side ?
Avatar
Alex #4
Member since Feb 2003 · 4308 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
I think what you are looking for is described here in the docs:
https://docs.ejabberd.im/developer/xmpp-clients-bots/exten…

Example: User asks for subscriptions list

  1. <iq from='hag66@shakespeare.example'
  2.    to='muc.shakespeare.example'
  3.    type='get'
  4.    id='E6E10350-76CF-40C6-B91B-1EA08C332FC7'>
  5.  <subscriptions xmlns='urn:xmpp:mucsub:0' />
  6. </iq>

so you just have to send this iq to the server.
I would suggest to build a custom class in MatriX for the <subscription/> tag. Because this custom extension is not supported out of the box in MatriX.

see also:
https://www.ag-software.net/matrix-xmpp-sdk/matrix-develop…

let me know if this helps.

Alex
This post was edited on 2019-10-14, 13:29 by Alex.
Avatar
amerts #5
Member for 2 months · 3 posts
Group memberships: Members
Show profile · Link to this post
thanks, Alex. I'll try to do it over the next weeks, but I think extending existing API will work for me, so let's stay in touch.
This post was edited on 2019-10-14, 13:28 by 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