Projects tigase _server server-core Issues #1389
Automatically accept the invitations (#1389)
Open
Unknown opened 4 years ago

Hi,

I am wondering if there is a way to make system automatically accept invitation from other users. That could be useful when you integrate the chat with your existing system that already provides authentication layer and proper relations between users based on which system can decide whether invitation should be accepted.

Eventually can 'auto accept' for a user that is not online? Or to accept the invitation the user has to be logged in?

Unknown commented 4 years ago

There is an option auto-authorize that allows you to automatically authorise requests, see https://docs.tigase.net/tigase-server/master-snapshot/Administration_Guide/html/#autoSub (if this link doesn't work yet use this one and scroll a bit down.

However, if you manage roster externally then using Dynamic Rosters seems like a better idea.

Unknown commented 4 years ago

Hmm I updated the configuration accordingly, but still I am getting a rooster with type="subscribe" in the Tigase UI client I am receiving the popup with question to accept the contact invitation.

Unknown commented 4 years ago

This is because... there was an error in the documentation :-)

A while back we decided to split presence plugin into two for efficiency: one responsible for handling subscriptions (presence-subscription) and state (sharing presence information depending on the state: presence-state). Old presence plugin is still there but it's not enabled by default and if you used configuration from the documentation then 'auto-authorize' = 'true' would not be enabled for correct, active plugin. You should use:

'sess-man' () {
    'jabber:iq:roster' {
        'auto-authorize' = 'true'
    }
    'presence-subscription' () {
        'auto-authorize' = 'true'
    }
}

I just check it and it works as expected:

U1 sends:

<presence type='subscribe' to='tigase2@atlantiscity'/>

U1 recives:

<iq type="set" to="tigase1@atlantiscity/Psi+/2" id="rsttig5">
    <query xmlns="jabber:iq:roster" ver="15a2ec55b9eed0485d6da92f487d547a">
        <item subscription="both" name="tigase2" jid="tigase2@atlantiscity"/>
    </query>
</iq>

<presence from="tigase2@atlantiscity/Psi+" to="tigase1@atlantiscity">
    <priority>55</priority>
    <c xmlns="http://jabber.org/protocol/caps" node="http://psi-dev.googlecode.com/caps" ver="0.16" ext="cs e-time ep-notify-2 last-act mr sxe whiteboard"/>
</presence>

U2 recives:

<iq type="set" to="tigase2@atlantiscity/Psi+" id="rsttig4">
    <query xmlns="jabber:iq:roster" ver="2c801cc687581d9263dea90e5b873cfd">
        <item subscription="both" name="tigase1" jid="tigase1@atlantiscity"/>
    </query>
</iq>


<presence from="tigase1@atlantiscity/Psi+/2" to="tigase2@atlantiscity">
    <priority>64</priority>
    <c xmlns="http://jabber.org/protocol/caps" node="http://psi-dev.googlecode.com/caps" ver="0.16" ext="cs e-time ep-notify-2 last-act mr sxe whiteboard"/>
</presence>
Unknown commented 4 years ago

Hah :) thanks it worked. Should I raise a request to update documentation or that defect is enough ?

Unknown commented 4 years ago
Unknown commented 4 years ago

Hi again :)

It works fine when I am sending a stanza like you shown. However We decided to move the connecting the users to Server to be invoked at given scenarios.

In our BE we are trying to send the HTTP request with proper stanza: So I am sending a request to: POST /rest/stream/?api-key=our-api-key with body:

<presence type="subscribe" xmlns="jabber:client" from="fromUser@ourhost.com" to="toUser@ourhost.com" />

I am receiving 200, and the following happens:

toUser receives rooster with subscription like in your above message, but just after that he receives also rooster but subscription is set to from instead both:

<iq type="set" to="toUser@ourhost.com" id="rsttig4">
    <query xmlns="jabber:iq:roster">
        <item subscription="from" name="fromUser" jid="fromUser@ourhost.com"/>
    </query>
</iq>

About the fromUser he receives subscription="none"...

It looks like a stanza I sent through REST is interpreted differently the one I send in the UI client. Should I know anything more about the REST call?

Unknown commented 4 years ago

REST requests are not processed by fromUser but are injected on the server-side as if they were received, ie. from the remote server, so fromUser's roster is not aware of <presence/> stanza sent by you using REST request and that stanza was delivered only to toUser.

Due to thatfromUser in roster has subscription set to none and toUser has in roster subsription set to from.

Unknown commented 4 years ago

Hmm so how can I manage it? Can I send second stanza setting to="fromUser" ? Do you have any hints?

Unknown commented 4 years ago

Well, I think that sending presence stanzas to both users (so that both users would be aware of that) could be possible, but it is possible that it may not be possible if some presence sent from the account owner to the server would be required.

However, if both users accounts are on your own server you could check user-roster-management and user-roster-management-ext ad-hoc commands as they were designed for manipulation of users roster by the server on the user's behalf.

Unknown commented 4 years ago

I checked these commands and although the response returns information that operation was successful there is no change in roster list... Fortunately if I run roster-fixer command it seems to work. I will confirm that

issue 1 of 1
Issue Votes (0)
Watchers (0)
Reference
tigase/_server/server-core#1389
Please wait...
Page is in error, reload to recover