-
Notifications
You must be signed in to change notification settings - Fork 333
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
Improved direction and protocol detection #9766
Conversation
src/Protocol/DFRN.php
Outdated
@@ -2628,6 +2633,11 @@ public static function import($xml, $importer, $sort_by_date = false, $protocol | |||
$header["wall"] = 0; | |||
$header["origin"] = 0; | |||
$header["contact-id"] = $importer["id"]; | |||
$header["direction"] = $direction; | |||
|
|||
if ($direction == Conversation::RELAY) { |
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.
Please use ===
when checking against a constant value.
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.
Why? Is it in some way faster?
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.
BTW: done
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.
Since you're comparing constant values with constant values, you can be sure types won't be different. It's marginally faster but it's most importantly safer.
This PR funnily touches many files - but doesn't really do much - except some statistics :-) In an effort to better understand how messages arrive at Friendica we detect not only the transport protocol but also the direction (means if a posted had been pushed to our server or if we fetched it). This had been done before, but only partially and not for all protocols.
This is now done.
Also some unnecessary code and parameters concerning DFRN had been removed.