0

Is there a way via the API to re-invite a user to a room who has previously been outcast?

  • Created a room
POST /create_room_with_opts
{
    "name": "testroompersistent", 
    "service": "foo", 
    "host": "bar" ,
    "options": {
                "title": "Super important meeting",
                "description": "This meeting is super important",
                "persistent": "true",
                "allow_user_invites": "true"
    }
}
  • Invited a user
POST /send_direct_invitation
{
  "name": "testroompersistent",
  "service": "foo",
  "password": "",
  "reason": "Check this out!",
  "users": "user@companyDomain.co.uk"
}
  • User joins room
  • Admin sets user affiliation to "outcast"
POST /set_room_affiliation
{
   "name": "testroompersistent",
    "service": "foo",
    "jid": "userJid",
    "affiliation": "outcast"
}
  • Invited a user again
POST /send_direct_invitation
{
  "name": "testroompersistent",
  "service": "foo",
  "password": "",
  "reason": "Check this out!",
  "users": "user@companyDomain.co.uk"
}
  • Set affiliation to "member"
POST /set_room_affiliation
{
   "name": "testroompersistent",
    "service": "foo",
    "jid": "userJid",
    "affiliation": "member"
}

I've tried to set the affiliation before and after the invite but to no avail.

FullStack
  • 437
  • 5
  • 15
  • 1
    It works for me when using XMPP clients to set the affiliations. You should update your problem description and indicate exactly what commands you issue for each step, and what arguments. – Badlop Oct 19 '20 at 16:29
  • question updated with code – FullStack Oct 21 '20 at 08:50
  • 1
    I tried with your examples, and set "users" and "jid" fields with the same user JID. The first invitation gets correct. The second invitation, as the user is banned, does not allow the user to join. Then, once the user affiliation is "member" again, the third invitation (that you didn't show) works correctly, and he can join the room again. I tested with ejabberd 20.07 – Badlop Oct 27 '20 at 17:04
  • Thanks @Badlop I looked back at my code an I was using the jid I got back from /get_room_occupants to set the affiliation this jid had "/[numbers]" after it and I assume it wasn't setting the affiliation correctly. I was getting 0=success back but it must not have been working correctly. Thanks – FullStack Oct 28 '20 at 09:13

1 Answers1

0

I was using the jid I got back from /get_room_occupants to set the affiliation this jid had "/[numbers]" after it and I assume it wasn't setting the affiliation correctly. I was getting 0=success back but it must not have been working correctly.

I have changed the jid to exclude the random numbers I got back from /get_room_occupants. Thanks @badlop for taking the time to respond.

FullStack
  • 437
  • 5
  • 15