Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
sreedevi1984 #1
Member since Oct 2006 · 38 posts
Group memberships: Members
Show profile · Link to this post
Subject: Banning a user from conference
Hi,

    I have a doubt regarding banning a user from the conference. According to JEP-0045, I did, but I am getting the xml as follows.. What is wrong in this..? Please help me...

  1. SEND:
  2.  <iq xmlns="jabber:client" id="agsXMPP_12" to="test@conference.localhost/viji" type="set">
  3. <query xmlns="http://jabber.org/protocol/muc#admin">
  4. <item affiliation="outcast" jid="test@conference.localhost/sree"><reason>You are banned !</reason></item>
  5. </query>
  6. </iq>
  7. RECV:
  8. <iq xmlns="jabber:client" from="test@conference.localhost/viji" id="agsXMPP_12" to="viji@localhost/MiniClient" type="set">
  9. <query xmlns="http://jabber.org/protocol/muc#admin">
  10. <item affiliation="outcast" jid="test@conference.localhost/sree"><reason>You are banned !</reason>
  11. </item>
  12. </query>
  13. </iq>
This post was edited on 2017-05-02, 12:34 by Alex.
Avatar
Alex #2
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello,

you send the packet to a wrong Jid. You have to send it to the room directly which is a bare Jid. Instead of this you send it to a user directly.
Did you look at the MucManager class? You can ban a user in one line of code with the MucManager.

Alex
Avatar
sreedevi1984 #3
Member since Oct 2006 · 38 posts
Group memberships: Members
Show profile · Link to this post
Hi Alex,
          Thanks for your quick response. I changed to bare jid by using the following code...

  1. MucManager mucManager = new MucManager(_connection);
  2. mucManager.BanUser(new Jid(room_Jid.Bare),new Jid ("praveen@localhost"),"You are banned !");

and now I am getting 403 forbidden error...
This post was edited on 2017-05-02, 12:34 by Alex.
Avatar
Alex #4
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
it looks like you are not allowed to ban a/this user.

  • Do you have enough permissions to ban this user (you have to be a room admin or owner)?
  • Is the user you ban a normal user or a admin/owner?

Alex
Avatar
sreedevi1984 #5
Member since Oct 2006 · 38 posts
Group memberships: Members
Show profile · Link to this post
How can I check whether I have the rights to ban or kick..? Is there any way to get any information about the current user's rights...?
Avatar
sreedevi1984 #6
Member since Oct 2006 · 38 posts
Group memberships: Members
Show profile · Link to this post
In reply to post #4
How can I check whether I have the rights to ban or kick.. i.e affiliation and role? Is there any way to get any information about the current user's rights...?
Avatar
Alex #7
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
yes there is,
you get the Roles and affiliations with the presence packets.
You can't can a user with a higher affiliation.
In the XEP are some good tables which show the permissions of different role and affiliations.

Alex
Avatar
sreedevi1984 #8
Member since Oct 2006 · 38 posts
Group memberships: Members
Show profile · Link to this post
thank you for all your quick responses.. Now it's working welll...

Sreedevi
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