Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support XEP-0100 jabber:iq:gateway protocol #592

Closed
singpolyma opened this issue Jan 27, 2018 · 3 comments
Closed

Support XEP-0100 jabber:iq:gateway protocol #592

singpolyma opened this issue Jan 27, 2018 · 3 comments

Comments

@singpolyma
Copy link
Contributor

This is #367 again because #378 had some bugs and was reverted.

The main goal is to implement UI for https://xmpp.org/extensions/xep-0100.html#addressing and especially for 6.3 jabber:iq:gateway

The flow is like this: when clicking "add a new contact" we check to see if there are any gateways in the user's roster (by checking category == gateyway or features contains jabber:iq:gateway in caps). If there are none, the we just show exactly the dialog Movim has today, and everything works as normal.

If any gateways are found in the roster, then we add a drop-down to the top of the dialog. This drop down will default to "Enter the JID for your contact" and the rest of the form works as normal. We send off

<iq type='get' to='example.gateway' from='user@movim.eu/movim' id='1'>
  <query xmlns='jabber:iq:gateway'/>
</iq>

to each gateway and get back

<iq type='result' from='example.gateway' to='user@movim.eu/movim id='1'>
  <query xmlns='jabber:iq:gateway'>
    <desc>
      Please enter the gateway username you want to contact
    </desc>
    <prompt>Gateway Username</prompt>
  </query>
</iq>

Or else an error iq indicating that the gateway just uses basic jid escaping and not the full protocol.

When the user picks a gateway from the dropdown, we can show a field that is labelled with the label text we got from the protocol above, so that the user knows what kind/format of username they should enter. (In the case of an error response above, a generic "contact id: " or similar prompt is used)

When the form is submitted, we then send off:

<iq type='set' to='example.gateway' from='user@movim.eu/movim' id='2'>
  <query xmlns='jabber:iq:gateway'>
      <prompt>My Contact</prompt>
  </query>
</iq>

and get back:

<iq type='result' from='example.gateway' to='contact@movim.eu' id='2'>
  <query xmlns='jabber:iq:gateway'>
    <jid>my-contact@example.gateway</jid>
  </query>
</iq>

Or an error response. With the above response, we are done and add the given JID to the roster as though it had been entered manually by the user. With an error response, we show the error on the form to let the user know they have entered an invalid contact identifier and what the error is so they can try again.

If a gateway does not support the protocol (detected by error response in the first step, noted above) then we do not try to use it in this step, and instead use JIDescape(<entered-text>)@gateway.example as the JID to add to the roster.

@edhelas edhelas self-assigned this Jan 27, 2018
@edhelas edhelas removed their assignment Jun 20, 2018
@edhelas
Copy link
Member

edhelas commented Jun 20, 2018

Is it sill something planned?

@singpolyma
Copy link
Contributor Author

Yeah, it's on my list of things to do, just haven't got back to Movim-related code recently

@edhelas
Copy link
Member

edhelas commented Jan 16, 2019

Closing this ticket as nothing has been done since then :)
I made some improvements regarding gateway handling but not that feature especially.
If you have something to propose, please mention this ticket in your PR and we'll see if we can reopen it.

@edhelas edhelas closed this as completed Jan 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants