}
function linkback_get_source($source, $target) {
+ // Check if we are pinging ourselves and ignore
+ $localprefix = common_config('site', 'server') . '/' . common_config('site', 'path');
+ if(linkback_lenient_target_match($source, $localprefix)) {
+ common_debug('Ignoring self ping from ' . $source . ' to ' . $target);
+ return NULL;
+ }
+
$request = HTTPClient::start();
try {
// We found a match, return it immediately
if(isset($item['properties']['url']) && in_array($url, $item['properties']['url'])) {
return $item['properties'];
-
- // Let's keep all the hcards for later, to return one of them at least
- $hcards[] = $item['properties'];
}
+
+ // Let's keep all the hcards for later, to return one of them at least
+ $hcards[] = $item['properties'];
}
// No match immediately for the url we expected, but there were h-cards found
$options = array('is_local' => Notice::REMOTE,
'url' => $entry['url'][0],
- 'uri' => $source,
+ 'uri' => $entry['url'][0],
'rendered' => $rendered,
'replies' => array(),
'groups' => array(),
try { $dupe->saveKnownUrls($options['urls']); } catch (ServerException $ex) {}
if($options['reply_to']) { $dupe->reply_to = $options['reply_to']; }
- if($options['repost_of']) { $dupe->repost_of = $options['repost_of']; }
+ if($options['repeat_of']) { $dupe->repeat_of = $options['repeat_of']; }
+ if($dupe->reply_to != $orig->reply_to || $dupe->repeat_of != $orig->repeat_of) {
+ $parent = Notice::getKV('id', $dupe->repost_of ? $dupe->repost_of : $dupe->reply_to);
+ if($parent instanceof Notice) {
+ // If we changed the reply_to or repeat_of we might live in a new conversation now
+ $dupe->conversation = $parent->conversation;
+ }
+ }
if($dupe->update($orig)) { $saved = $dupe; }
+ if($dupe->conversation != $orig->conversation && Conversation::noticeCount($orig->conversation) < 1) {
+ // Delete empty conversation
+ $emptyConversation = Conversation::getKV('id', $orig->conversation);
+ $emptyConversation->delete();
+ }
} catch (Exception $e) {
common_log(LOG_ERR, "Linkback update of remote message $source failed: " . $e->getMessage());
return false;
// notice's nickname and %3$s is the content of the favorited notice.)
$act->content = sprintf(_('%1$s favorited something by %2$s: %3$s'),
$profile->getNickname(), $notice_or_user->getProfile()->getNickname(),
- $notice_or_user->rendered ?: $notice_or_user->content);
+ $notice_or_user->getRendered());
if($entry['rsvp']) {
$act->content = $options['rendered'];
}