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
Nice UI for adding a contact through a Gateway #378
Conversation
44567f9
to
3309c03
Compare
e9b25fe
to
f45ade8
Compare
If there are any. Same as the old UI when there are no gateways.
f45ade8
to
f0d1e4d
Compare
@edhelas this one is ready for initial review now, and is fully functional in my tests :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great :)
app/widgets/Roster/Roster.php
Outdated
$this->rpc( | ||
'Roster.addGatewayPrompt', | ||
$packet->from, | ||
''.$packet->content->prompt, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you're casting to string please use (string)$variable and not ''. ;)
app/widgets/Roster/Roster.php
Outdated
|
||
function onIqGatewaySet($packet) | ||
{ | ||
$form = json_decode($packet->content->extra); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need of this extra step if it's an array, what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was getting an error about not serializing SimpleXML without this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after other changes, this no longer happens, it seems. So I've removed the json encoding again
a9da059
to
566ef34
Compare
If the Gateway doesn't actually support jabber:iq:gateway, use a reasonable fallback.
Otherwise we sometimes get errors about not being allowed to serialize SimpleXML stuff.
566ef34
to
fae151a
Compare
If we got a prompt back earlier, then we know that the gateway supports jabber:iq:gateway. So we send off the user input, and then re-run our form handler on whatever comes back. Don't dismiss the dialog right away in JavaScript, but wait for the server to be really done first.
The gateway may perform some validation on the user input, and we need to show any errors to the user so they can correct their mistakes.
fae151a
to
859ff1a
Compare
@edhelas I believe I have made all your suggested changes :) |
Implements https://xmpp.org/extensions/xep-0100.html#addressing as well as a final fallback to the old %-encoding hack that some gateways still use for historical reasons.
Closes #367
Depends on https://github.com/movim/moxl/pull/17