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

Improved direction and protocol detection #9766

Merged
merged 4 commits into from
Jan 10, 2021

Conversation

annando
Copy link
Collaborator

@annando annando commented Jan 9, 2021

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.

@@ -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) {
Copy link
Collaborator

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.

Copy link
Collaborator Author

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?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW: done

Copy link
Collaborator

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.

@annando annando mentioned this pull request Jan 10, 2021
@MrPetovan MrPetovan merged commit ca8e406 into friendica:develop Jan 10, 2021
@annando annando deleted the conversation-direction branch January 11, 2021 05:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants