git.gnu.io has moved to IP address 209.51.188.249 -- please double check where you are logging in.

Commit 255943d7 authored by mmn's avatar mmn

User agents and generators changed to GNU social

parent ca66860a
......@@ -165,7 +165,7 @@ class ActivityStreamJSONDocument extends JSONActivityCollection
*/
function asString()
{
$this->doc['generator'] = 'StatusNet ' . STATUSNET_VERSION; // extension
$this->doc['generator'] = 'GNU social ' . GNUSOCIAL_VERSION; // extension
$this->doc['title'] = $this->title;
$this->doc['url'] = $this->url;
$this->doc['totalItems'] = $this->count;
......
......@@ -158,7 +158,7 @@ class HTTPClient extends HTTP_Request2
}
parent::__construct($url, $method, $config);
$this->setHeader('User-Agent', $this->userAgent());
$this->setHeader('User-Agent', self::userAgent());
}
/**
......@@ -247,9 +247,10 @@ class HTTPClient extends HTTP_Request2
*
* @return string
*/
function userAgent()
static public function userAgent()
{
return "GNU Social/".GNUSOCIAL_VERSION." (".GNUSOCIAL_CODENAME.")";
return GNUSOCIAL_ENGINE . '/' . GNUSOCIAL_VERSION
. ' (' . GNUSOCIAL_CODENAME . ')';
}
/**
......
......@@ -90,11 +90,11 @@ function ping_broadcast_notice($notice) {
if ($type === 'get') {
$result = $fetcher->get($notify_url . '?' . http_build_query($args),
array('User-Agent: StatusNet/'.STATUSNET_VERSION));
array('User-Agent: ' . HTTPClient::userAgent()));
} else {
$result = $fetcher->post($notify_url,
http_build_query($args),
array('User-Agent: StatusNet/'.STATUSNET_VERSION));
array('User-Agent: ' . HTTPClient::userAgent()));
}
if ($result->status != '200') {
common_log(LOG_WARNING,
......
......@@ -158,12 +158,22 @@ class Plugin
$this->log(LOG_DEBUG, $msg);
}
function name()
public function name()
{
$cls = get_class($this);
return mb_substr($cls, 0, -6);
}
public function version()
{
return GNUSOCIAL_VERSION;
}
protected function userAgent() {
return HTTPClient::userAgent()
. ' (' . get_class($this) . ' v' . $this->version() . ')';
}
function onPluginVersion(&$versions)
{
$name = $this->name();
......
......@@ -143,9 +143,9 @@ class BlogspamNetPlugin extends Plugin
return '127.0.0.1';
}
function userAgent()
function version()
{
return 'BlogspamNetPlugin/'.BLOGSPAMNETPLUGIN_VERSION . ' StatusNet/' . STATUSNET_VERSION;
return BLOGSPAMNETPLUGIN_VERSION;
}
function onPluginVersion(&$versions)
......
......@@ -227,10 +227,9 @@ class LinkbackPlugin extends Plugin
}
}
function userAgent()
public function version()
{
return 'LinkbackPlugin/'.LINKBACKPLUGIN_VERSION .
' StatusNet/' . STATUSNET_VERSION;
return LINKBACKPLUGIN_VERSION;
}
function onPluginVersion(&$versions)
......
......@@ -67,12 +67,6 @@ class SpotifyPlugin extends Plugin
return true;
}
function userAgent()
{
return 'SpotifyPlugin/'.SPOTIFYPLUGIN_VERSION .
' StatusNet/' . STATUSNET_VERSION;
}
function onPluginVersion(&$versions)
{
$versions[] = array('name' => 'Spotify',
......
......@@ -129,7 +129,7 @@ abstract class JsonStreamReader
$lines = array(
"GET $path HTTP/1.1",
"Host: $host",
"User-Agent: StatusNet/" . STATUSNET_VERSION . " (TwitterBridgePlugin)",
'User-Agent: ' . HTTPClient::userAgent() . ' (TwitterBridgePlugin)',
"Connection: close",
"",
""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment