-
-
Notifications
You must be signed in to change notification settings - Fork 248
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 #1176
base: master
Are you sure you want to change the base?
Conversation
Thanks for the PR ! I'll try to review it in the upcoming days and give you feedback :) |
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.
Is there a way for me to properly test it ?
@@ -32,8 +32,7 @@ public function roster() | |||
|
|||
public function capability() | |||
{ | |||
return $this->hasOne('App\Info', 'node', 'node') | |||
->whereNull('server'); |
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.
This is risky, I'll have to double check if it doesn't bring some side issues
} | ||
|
||
public function foundJid($prompt, $jid) { | ||
$session = \Movim\Session::start(); |
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.
Not a big fan of using memory session for that, I'd prefer to have just parameters passed around.
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.
We need to store state somewhere, since this data comes in asynchronously from XMPP and there can be more than one. The search results are rendered using draw
and expect the entire list of results to be available for that. Additionally, we do probably want to cache this for a short time since it's a remote lookup.
I'm not saying memory session is definitely right for it, but I'm curious what you would suggest as an alternative here in order to have prepareSearch
know about all the items that have come in asynchronously?
->request(); | ||
} else if ($contact->presence->capability->getGatewayTypeAttribute()) { | ||
if ($contact->presence->capability->hasFeature("jid\\20escaping")) { | ||
$this->foundJid($key, Utils::escapeJidLocalpart($key).'@'.$contact->presence->jid); |
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.
Rebuilding the JID this way seems risky
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.
It's not "rebuilding" but rather building a new JID out of the query and the gateway, having already determined in the line before that this escaping format is supported by the gateway.
We could put the operation in a method somewhere, but it's always going to do fundamentally what this line does.
Uses jabber:iq:gateway where supported (such as slidge and cheogram) and otherwise falls back to jid escaping where supported, or finally traditional % escaping. When searching for contacts, automatically search all gateways that are added to contacts as well, and show any relevant results. Note: if the gateway returns an error because the format is bad, this doesn't show the error since that doesn't really fit the search paradigm, and instead it simply does not show a result for that gateway.
@edhelas: Have you seen @singpolyma changes? |
Uses jabber:iq:gateway where supported (such as slidge and cheogram) and
otherwise falls back to jid escaping where supported, or finally traditional %
escaping. When searching for contacts, automatically search all gateways that
are added to contacts as well, and show any relevant results.
Note: if the gateway returns an error because the format is bad, this doesn't
show the error since that doesn't really fit the search paradigm, and instead it
simply does not show a result for that gateway.
Also contains a patch to show sms contacts with the "mobile" icon and gateways themselves with the "bot" icon.