forked from GNUsocial/gnu-social
ensureWebfinger was never complete in StatusNet. Worked a bit on it.
This commit is contained in:
parent
bb1ac66d74
commit
2d0c7c2c99
@ -326,7 +326,7 @@ class OStatusPlugin extends Plugin
|
|||||||
'type' => 'mention',
|
'type' => 'mention',
|
||||||
'text' => $target,
|
'text' => $target,
|
||||||
'position' => $pos,
|
'position' => $pos,
|
||||||
'url' => $profile->profileurl);
|
'url' => $profile->getUrl());
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->log(LOG_ERR, "Webfinger check failed: " . $e->getMessage());
|
$this->log(LOG_ERR, "Webfinger check failed: " . $e->getMessage());
|
||||||
@ -353,7 +353,7 @@ class OStatusPlugin extends Plugin
|
|||||||
'type' => 'mention',
|
'type' => 'mention',
|
||||||
'text' => $target,
|
'text' => $target,
|
||||||
'position' => $pos,
|
'position' => $pos,
|
||||||
'url' => $profile->profileurl);
|
'url' => $profile->getUrl());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
@ -1959,7 +1959,9 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If we got a feed URL, try that
|
// If we got a feed URL, try that
|
||||||
|
$feedUrl = null;
|
||||||
if (array_key_exists('feedurl', $hints)) {
|
if (array_key_exists('feedurl', $hints)) {
|
||||||
|
$feedUrl = $hints['feedurl'];
|
||||||
try {
|
try {
|
||||||
common_log(LOG_INFO, "Discovery on acct:$addr with feed URL " . $hints['feedurl']);
|
common_log(LOG_INFO, "Discovery on acct:$addr with feed URL " . $hints['feedurl']);
|
||||||
$oprofile = self::ensureFeedURL($hints['feedurl'], $hints);
|
$oprofile = self::ensureFeedURL($hints['feedurl'], $hints);
|
||||||
@ -1972,7 +1974,9 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If we got a profile page, try that!
|
// If we got a profile page, try that!
|
||||||
|
$profileUrl = null;
|
||||||
if (array_key_exists('profileurl', $hints)) {
|
if (array_key_exists('profileurl', $hints)) {
|
||||||
|
$profileUrl = $hints['profileurl'];
|
||||||
try {
|
try {
|
||||||
common_log(LOG_INFO, "Discovery on acct:$addr with profile URL $profileUrl");
|
common_log(LOG_INFO, "Discovery on acct:$addr with profile URL $profileUrl");
|
||||||
$oprofile = self::ensureProfileURL($hints['profileurl'], $hints);
|
$oprofile = self::ensureProfileURL($hints['profileurl'], $hints);
|
||||||
@ -2009,7 +2013,7 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
$profile->nickname = self::nicknameFromUri($uri);
|
$profile->nickname = self::nicknameFromUri($uri);
|
||||||
$profile->created = common_sql_now();
|
$profile->created = common_sql_now();
|
||||||
|
|
||||||
if (isset($profileUrl)) {
|
if (!is_null($profileUrl)) {
|
||||||
$profile->profileurl = $profileUrl;
|
$profile->profileurl = $profileUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2028,13 +2032,14 @@ class Ostatus_profile extends Managed_DataObject
|
|||||||
$oprofile->profile_id = $profile_id;
|
$oprofile->profile_id = $profile_id;
|
||||||
$oprofile->created = common_sql_now();
|
$oprofile->created = common_sql_now();
|
||||||
|
|
||||||
if (isset($feedUrl)) {
|
if (!is_null($feedUrl)) {
|
||||||
$profile->feeduri = $feedUrl;
|
$oprofile->feeduri = $feedUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $oprofile->insert();
|
$result = $oprofile->insert();
|
||||||
|
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
|
$profile->delete();
|
||||||
common_log_db_error($oprofile, 'INSERT', __FILE__);
|
common_log_db_error($oprofile, 'INSERT', __FILE__);
|
||||||
// TRANS: Exception. %s is a webfinger address.
|
// TRANS: Exception. %s is a webfinger address.
|
||||||
throw new Exception(sprintf(_m('Could not save OStatus profile for "%s".'),$addr));
|
throw new Exception(sprintf(_m('Could not save OStatus profile for "%s".'),$addr));
|
||||||
|
Loading…
Reference in New Issue
Block a user