fbsync: prevent falsely added copntacts

pull/203/head
Michael Vogel 2014-06-25 09:11:09 +02:00
parent 0a6d1f9e49
commit 97fe8aef5c
1 changed files with 13 additions and 4 deletions

View File

@ -278,10 +278,19 @@ function fbsync_createpost($a, $uid, $self, $contacts, $applications, $post, $cr
}
if ($contact_id <= 0) {
// To-Do:
// $contacts[$post->source_id] seems to be wrong by repeated posts
// must be changed in future
$contact_id = fbsync_fetch_contact($uid, $contacts[$post->source_id], $create_user);
if ($post->actor_id != $post->source_id) {
// Testing if we know the source or the actor
$contact_id = fbsync_fetch_contact($uid, $contacts[$post->source_id], false);
if (($contact_id == 0) and array_key_exists($post->actor_id, $contacts))
$contact_id = fbsync_fetch_contact($uid, $contacts[$post->actor_id], false);
// If we don't know anyone, we guess we should know the source. Could be the wrong decision
if ($contact_id == 0)
$contact_id = fbsync_fetch_contact($uid, $contacts[$post->source_id], $create_user);
} else
$contact_id = fbsync_fetch_contact($uid, $contacts[$post->source_id], $create_user);
if ($contact_id == -1) {
logger('fbsync_createpost: Contact is blocked. Post not imported '.print_r($post, true), LOGGER_DEBUG);