Not logged in. · Lost password · Register
Forum: agsXMPP RSS
tasknet #1
Member since Dec 2019 · 4 posts
Group memberships: Members
Show profile · Link to this post
Subject: How do I confirm my subscriptions correctly?
Hi everybody, I use agsXmpp library, I get many ask subscribe:

  1. <iq xmlns="jabber:client" from="testz2@mx.testserverz.info" to="testz2@mx.testserverz.info/agsXMPP" type="result" id="agsXMPP_5" xml:lang="en">
  2.    <query xmlns="jabber:iq:roster">
  3.       <item jid="testy@mx.testserverz.info" ask="subscribe" />
  4.       <item ask="subscribe" name="testz2@mx.testserverz.info" jid="testz2@mx.testserverz.info"><group>Friends</group></item>
  5.       <item jid="testconfaconference.mx.testserverz.info" ask="subscribe" />
  6.       <item jid="testconfa@conference.mx.testserverz.info" ask="subscribe" />
  7.       <item jid="testconfa223122019164645@conference.mx.testserverz.info" ask="subscribe" />
  8.       <item jid="testconfa223122019165017@conference.mx.testserverz.info" ask="subscribe" />
  9.       <item jid="testconfa223122019172125@conference.mx.testserverz.info" ask="subscribe" />
  10.       <item jid="testconfa22312201917364@conference.mx.testserverz.info" ask="subscribe" />
  11.    </query>
  12. </iq>

and I try to confirm all of that (see code under),
but it doesn't work, I get subscribe many times.
How do I confirm my subscriptions correctly?

  1. xmpp.OnRosterItem += new XmppClientConnection.RosterHandler(xmpp_OnRosterItem);
  2. ...
  3. private void xmpp_OnRosterItem(object sender, RosterItem item)
  4. {
  5.     if (item == null) return;
  6.     if (item.Ask == AskType.subscribe)
  7.     {
  8.         PubSub_anySubscribe(item.Jid);
  9.     }
  10.     ...
  11. }
  12.        
  13. private void PubSub_anySubscribe(Jid jid)
  14. {
  15.     try
  16.     {
  17.         if (jid == null) return;
  18.         var pm = new PresenceManager(xmpp);
  19.         pm.Subcribe(jid);
  20.         xmpp.Send(new Message(jid,xmpp.MyJID, "Hi everybody..."));
  21.     }
  22.     catch (Exception exp)
  23.     {
  24.         var s = exp.Message;
  25.     }
  26. }
This post was edited on 2019-12-29, 23:15 by Alex.
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
looks like you sent subscription requests to your contacts, but they have not received or approved them yet.
see here how to approve subscription requests:
https://github.com/agnauck/agsXMPP/blob/c7f70a7d89a1dd587a…

Alex
This post was edited on 2019-12-30, 00:18 by Alex.
tasknet #3
Member since Dec 2019 · 4 posts
Group memberships: Members
Show profile · Link to this post
No.
The userOwner (testz2@mx.testserverz.info) created these conferences (XEP-0045: Multi-User Chat - XMPP):

  1. jid="testconfa@conference.mx.testserverz.info" ask="subscribe" /><item jid="testconfa223122019164645@conference.mx.testserverz.info" ask="subscribe" /><item jid="testconfa223122019165017@conference.mx.testserverz.info" ask="subscribe" /><item jid="testconfa223122019172125@conference.mx.testserverz.info" ask="subscribe" /><item jid="testconfa22312201917364@conference.mx.testserverz.info" ask="subscribe" />


testz2@mx.testserverz.info try to invite this testz2@mx.testserverz.info  to the conference.
It was impossible to invite other users, because of the mistake that first you need to become a participant in the conference ... and this was strange, because the testz2@mx.testserverz.info  created the conference ...
therefore, after creating the conference, the command was executed :


  1. internal XmppClientConnection _con = null;
  2.  
  3.  
  4. ..
  5. MucManager muc = new MucManager(_con);
  6.  
  7. muc.CreateReservedRoom(roomJid);
  8. muc.GrantOwnershipPrivileges(roomJid, mainJid);
  9.  
  10. muc.JoinRoom(roomJid, groupChatSettings.nickname);
  11.  
  12. initMucConfig(); //
  13. ..
  14. muc.Invite(mainJid, _roomJid);
  15.  
  16.  
  17.  
  18. private void initMucConfig()
  19. {
  20.     // ReceiveFormConfiguration - request default config and after send user config
  21.     // _con.IqGrabber.SendIq(oIq, ...);
  22.     muc.RequestConfigurationForm(roomJid, new IqCB(ReceiveFormConfiguration));  
  23.  
  24. }
Avatar
Alex #4
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
you are mixing up contacts and chatrooms somehow.
The rooms which you are joining don't need to be on your roster (aka contact list). And you don't need to send subscription requests to the rooms.
When you want to store you favorite rooms you can use the bookmark feature for this.

Alex
tasknet #5
Member since Dec 2019 · 4 posts
Group memberships: Members
Show profile · Link to this post
thanks!
but the problem is that I (testz2@mx.testserverz.info) created a room and tried to invite another user into it. In response, I received that only those who are subscribed to it can invite to the room, that is, the creator of the room is not signed up for it, so I tried to invite myself (testz2@mx.testserverz.info).

how to make the creator of a room subscribe to it?
Avatar
Alex #6
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Please include your XML logs which show the error messages from the server.
tasknet #7
Member since Dec 2019 · 4 posts
Group memberships: Members
Show profile · Link to this post
Sorry, I made a mistake.

1. I (testz2@mx.testserverz.info) sent invite to another user, but he did not receive it.
2. I (testz2@mx.testserverz.info) tried to send a message to the room and in response received a message:

  1. <message xmlns="jabber:client" from="testconfa@conference.mx.testserverz.info" to="testz2@mx.testserverz.info/agsXMPP" type="error" xml:lang="en">
  2.    <error type="modify" code="406">
  3.       <not-acceptable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
  4.       <text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" xml:lang="en">Only occupants are allowed to send messages to the conference</text>
  5.    </error>
  6.    <body>Hi everybody...</body>
  7. </message>



how to make the creator of the room subscribe to the room that he created?

This is a topical issue..
This post was edited on 2019-12-31, 11:11 by tasknet.
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: agsXMPP RSS